Sfoglia il codice sorgente

[*] swift重写完善

yanxuyao 1 mese fa
parent
commit
2870bd9e9f

+ 3 - 2
QGVAPlayer.podspec

@@ -18,7 +18,7 @@ Pod::Spec.new do |spec|
   spec.name         = "QGVAPlayer"
   spec.version      = "1.0.20"
   spec.summary      = "video animation player."
-  spec.platform     = :ios, "8.0"
+  spec.platform     = :ios, "12.0"
 
   # This description is used to generate tags and improve search results.
   #   * Think: What does it do? Why did you write it? What is the focus?
@@ -96,7 +96,8 @@ Pod::Spec.new do |spec|
   #  Not including the public_header_files will make all headers public.
   #
 
-  spec.source_files = 'QGVAPlayer/QGVAPlayer/**/*.{h,m}', 'QGVAPlayer/QGVAPlayer/Shaders/QGHWDShaders.metal'
+  spec.source_files = 'QGVAPlayer/QGVAPlayer/LNSwift/**/*.swift', 'QGVAPlayer/QGVAPlayer/Shaders/QGHWDShaders.metal'
+  spec.swift_version = '5.0'
 
   # spec.subspec 'Shaders' do |ss|
   #   ss.source_files = 'iOS/QGVAPlayer/QGVAPlayer/Shaders/**/*.{h,m}'

+ 0 - 158
QGVAPlayer/QGVAPlayer.xcodeproj/project.pbxproj

@@ -9,88 +9,9 @@
 /* Begin PBXBuildFile section */
 		0DCDE3A29A303DDAC7B34A68 /* LNModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85972E2BAAEE4BC57BC70D7D /* LNModels.swift */; };
 		424CEEC3D60F73A1EE8EBE0A /* LNVAPPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCFCF18C219ED666D3D894D2 /* LNVAPPlayerView.swift */; };
-		43BAD32225F2153500D17934 /* QGVAPWrapView.h in Headers */ = {isa = PBXBuildFile; fileRef = 43BAD32025F2153500D17934 /* QGVAPWrapView.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		43BAD32325F2153500D17934 /* QGVAPWrapView.m in Sources */ = {isa = PBXBuildFile; fileRef = 43BAD32125F2153500D17934 /* QGVAPWrapView.m */; };
 		630723B122F0409200B15629 /* QGVAPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 630723A722F0409200B15629 /* QGVAPlayer.framework */; };
 		630723B622F0409200B15629 /* QGVAPlayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723B522F0409200B15629 /* QGVAPlayerTests.m */; };
-		630723B822F0409200B15629 /* QGVAPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723AA22F0409200B15629 /* QGVAPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307240722F0410600B15629 /* QGMP4Box.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723C322F0410600B15629 /* QGMP4Box.m */; };
-		6307240822F0410600B15629 /* QGMP4Parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723C422F0410600B15629 /* QGMP4Parser.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307240922F0410600B15629 /* QGMP4Parser.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723C522F0410600B15629 /* QGMP4Parser.m */; };
-		6307240A22F0410600B15629 /* QGMP4Box.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723C622F0410600B15629 /* QGMP4Box.h */; };
-		6307240B22F0410600B15629 /* UIView+VAP.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723C722F0410600B15629 /* UIView+VAP.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307240C22F0410600B15629 /* QGVAPWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723C922F0410600B15629 /* QGVAPWeakProxy.m */; };
-		6307240D22F0410600B15629 /* QGVAPLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723CB22F0410600B15629 /* QGVAPLogger.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307240E22F0410600B15629 /* QGVAPLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723CC22F0410600B15629 /* QGVAPLogger.m */; };
-		6307240F22F0410600B15629 /* QGVAPSafeMutableDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723CD22F0410600B15629 /* QGVAPSafeMutableDictionary.h */; };
-		6307241022F0410600B15629 /* QGVAPSafeMutableArray.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723CE22F0410600B15629 /* QGVAPSafeMutableArray.h */; };
-		6307241122F0410600B15629 /* QGVAPSafeMutableArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723CF22F0410600B15629 /* QGVAPSafeMutableArray.m */; };
-		6307241222F0410600B15629 /* QGVAPSafeMutableDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723D022F0410600B15629 /* QGVAPSafeMutableDictionary.m */; };
-		6307241322F0410600B15629 /* QGVAPWeakProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723D122F0410600B15629 /* QGVAPWeakProxy.h */; };
-		6307241422F0410600B15629 /* UIColor+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723D322F0410600B15629 /* UIColor+VAPUtil.m */; };
-		6307241522F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723D422F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.h */; };
-		6307241622F0410600B15629 /* UIColor+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723D522F0410600B15629 /* UIColor+VAPUtil.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307241722F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723D622F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.m */; };
-		6307241822F0410600B15629 /* QGMP4AnimatedImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723D822F0410600B15629 /* QGMP4AnimatedImageFrame.m */; };
-		6307241922F0410600B15629 /* QGBaseDFileInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723D922F0410600B15629 /* QGBaseDFileInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307241A22F0410600B15629 /* QGBaseAnimatedImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723DA22F0410600B15629 /* QGBaseAnimatedImageFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307241B22F0410600B15629 /* QGMP4HWDFileInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723DB22F0410600B15629 /* QGMP4HWDFileInfo.m */; };
-		6307241C22F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723DC22F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.h */; };
-		6307241D22F0410600B15629 /* QGBaseDFileInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723DD22F0410600B15629 /* QGBaseDFileInfo.m */; };
-		6307241E22F0410600B15629 /* QGMP4AnimatedImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723DE22F0410600B15629 /* QGMP4AnimatedImageFrame.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307241F22F0410600B15629 /* QGMP4HWDFileInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723DF22F0410600B15629 /* QGMP4HWDFileInfo.h */; };
-		6307242022F0410600B15629 /* QGBaseAnimatedImageFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723E022F0410600B15629 /* QGBaseAnimatedImageFrame.m */; };
-		6307242322F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723E422F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.m */; };
-		6307242422F0410600B15629 /* QGAnimatedImageDecodeConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723E622F0410600B15629 /* QGAnimatedImageDecodeConfig.m */; };
-		6307242522F0410600B15629 /* QGAnimatedImageDecodeThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723E722F0410600B15629 /* QGAnimatedImageDecodeThread.h */; };
-		6307242622F0410600B15629 /* QGAnimatedImageDecodeThreadPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723E822F0410600B15629 /* QGAnimatedImageDecodeThreadPool.h */; };
-		6307242722F0410600B15629 /* QGAnimatedImageBufferManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723E922F0410600B15629 /* QGAnimatedImageBufferManager.h */; };
-		6307242822F0410600B15629 /* QGAnimatedImageDecodeManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723EA22F0410600B15629 /* QGAnimatedImageDecodeManager.h */; };
-		6307242922F0410600B15629 /* QGAnimatedImageDecodeConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723EB22F0410600B15629 /* QGAnimatedImageDecodeConfig.h */; };
-		6307242A22F0410600B15629 /* QGAnimatedImageDecodeThreadPool.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723EC22F0410600B15629 /* QGAnimatedImageDecodeThreadPool.m */; };
-		6307242B22F0410600B15629 /* QGBaseDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723EE22F0410600B15629 /* QGBaseDecoder.m */; };
-		6307242C22F0410600B15629 /* QGMP4FrameHWDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723EF22F0410600B15629 /* QGMP4FrameHWDecoder.m */; };
-		6307242D22F0410600B15629 /* QGBaseDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723F022F0410600B15629 /* QGBaseDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307242E22F0410600B15629 /* QGMP4FrameHWDecoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723F122F0410600B15629 /* QGMP4FrameHWDecoder.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307242F22F0410600B15629 /* QGAnimatedImageDecodeThread.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F222F0410600B15629 /* QGAnimatedImageDecodeThread.m */; };
-		6307243022F0410600B15629 /* QGAnimatedImageBufferManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F322F0410600B15629 /* QGAnimatedImageBufferManager.m */; };
-		6307243122F0410600B15629 /* QGAnimatedImageDecodeManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F422F0410600B15629 /* QGAnimatedImageDecodeManager.m */; };
-		6307243222F0410600B15629 /* UIView+VAP.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F522F0410600B15629 /* UIView+VAP.m */; };
-		6307243322F0410600B15629 /* QGHWDMetalView.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723F822F0410600B15629 /* QGHWDMetalView.m */; };
-		6307243522F0410600B15629 /* QGHWDShaderTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723FA22F0410600B15629 /* QGHWDShaderTypes.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		6307243622F0410600B15629 /* QGHWDMetalRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 630723FB22F0410600B15629 /* QGHWDMetalRenderer.m */; };
-		6307243822F0410600B15629 /* QGHWDMetalView.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723FD22F0410600B15629 /* QGHWDMetalView.h */; };
-		6307243922F0410600B15629 /* QGHWDMetalRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 630723FE22F0410600B15629 /* QGHWDMetalRenderer.h */; };
-		6307243A22F0410600B15629 /* QGHWDMP4OpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 6307240022F0410600B15629 /* QGHWDMP4OpenGLView.m */; };
-		6307243B22F0410600B15629 /* QGHWDMP4OpenGLView.h in Headers */ = {isa = PBXBuildFile; fileRef = 6307240122F0410600B15629 /* QGHWDMP4OpenGLView.h */; };
-		6307243C22F0410600B15629 /* VAPMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 6307240222F0410600B15629 /* VAPMacros.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		6307243F22F0410600B15629 /* QGHWDShaders.metal in Sources */ = {isa = PBXBuildFile; fileRef = 6307240622F0410600B15629 /* QGHWDShaders.metal */; };
-		632942D9231BED7D00B511BB /* QGVAPMetalUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 632942D7231BED7D00B511BB /* QGVAPMetalUtil.h */; };
-		632942DA231BED7D00B511BB /* QGVAPMetalUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 632942D8231BED7D00B511BB /* QGVAPMetalUtil.m */; };
-		636FE34823604B570001565D /* UIView+MP4HWDecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 636FE34623604B570001565D /* UIView+MP4HWDecode.h */; };
-		636FE34923604B570001565D /* UIView+MP4HWDecode.m in Sources */ = {isa = PBXBuildFile; fileRef = 636FE34723604B570001565D /* UIView+MP4HWDecode.m */; };
-		639CA47C2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 639CA47A2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.h */; };
-		639CA47D2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 639CA47B2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.m */; };
-		63AEB398231671260069CEBB /* QGVAPConfigManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB396231671250069CEBB /* QGVAPConfigManager.h */; };
-		63AEB399231671260069CEBB /* QGVAPConfigManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB397231671250069CEBB /* QGVAPConfigManager.m */; };
-		63AEB39C23167A030069CEBB /* QGVAPConfigModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB39A23167A030069CEBB /* QGVAPConfigModel.h */; };
-		63AEB39D23167A030069CEBB /* QGVAPConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB39B23167A030069CEBB /* QGVAPConfigModel.m */; };
-		63AEB3A02316AF8A0069CEBB /* NSDictionary+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB39E2316AF8A0069CEBB /* NSDictionary+VAPUtil.h */; };
-		63AEB3A12316AF8A0069CEBB /* NSDictionary+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB39F2316AF8A0069CEBB /* NSDictionary+VAPUtil.m */; };
-		63AEB3A52317CD940069CEBB /* NSArray+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB3A32317CD940069CEBB /* NSArray+VAPUtil.h */; };
-		63AEB3A62317CD940069CEBB /* NSArray+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB3A42317CD940069CEBB /* NSArray+VAPUtil.m */; };
-		63AEB3EE231952DD0069CEBB /* QGVAPTextureLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB3EC231952DD0069CEBB /* QGVAPTextureLoader.h */; };
-		63AEB3EF231952DD0069CEBB /* QGVAPTextureLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB3ED231952DD0069CEBB /* QGVAPTextureLoader.m */; };
-		63AEB3F4231959D60069CEBB /* QGVAPMetalView.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB3F2231959D60069CEBB /* QGVAPMetalView.h */; };
-		63AEB3F5231959D60069CEBB /* QGVAPMetalView.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB3F3231959D60069CEBB /* QGVAPMetalView.m */; };
-		63AEB3F923195BF80069CEBB /* QGVAPMetalRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AEB3F723195BF80069CEBB /* QGVAPMetalRenderer.h */; };
-		63AEB3FA23195BF80069CEBB /* QGVAPMetalRenderer.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AEB3F823195BF80069CEBB /* QGVAPMetalRenderer.m */; };
-		63AFC6B7231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 63AFC6B5231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.h */; };
-		63AFC6B8231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 63AFC6B6231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.m */; };
-		63BAD37822F0966300EAD4C4 /* UIDevice+VAPUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 63BAD37622F0966300EAD4C4 /* UIDevice+VAPUtil.h */; };
-		63BAD37922F0966300EAD4C4 /* UIDevice+VAPUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 63BAD37722F0966300EAD4C4 /* UIDevice+VAPUtil.m */; };
-		649EF40D24122B4D00164950 /* QGVAPMaskInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 649EF40B24122B4C00164950 /* QGVAPMaskInfo.h */; };
-		649EF40E24122B4D00164950 /* QGVAPMaskInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 649EF40C24122B4C00164950 /* QGVAPMaskInfo.m */; };
 		69DCB6EF3D76FAEFFD1929CC /* LNLegacyMappings.swift in Sources */ = {isa = PBXBuildFile; fileRef = ADF46D8C8C93AA38D15B3345 /* LNLegacyMappings.swift */; };
 		6A449A4C2102FA07B1E481A1 /* LNMP4Parser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0DFC2669FA8BE22005CBC78B /* LNMP4Parser.swift */; };
 		7644770111F618C09AAFB77A /* LNControllers.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC2DF61A816CBDC209E81671 /* LNControllers.swift */; };
@@ -538,47 +459,6 @@
 			isa = PBXHeadersBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				43BAD32225F2153500D17934 /* QGVAPWrapView.h in Headers */,
-				6307240B22F0410600B15629 /* UIView+VAP.h in Headers */,
-				630723B822F0409200B15629 /* QGVAPlayer.h in Headers */,
-				63AEB3A02316AF8A0069CEBB /* NSDictionary+VAPUtil.h in Headers */,
-				63AEB3A52317CD940069CEBB /* NSArray+VAPUtil.h in Headers */,
-				649EF40D24122B4D00164950 /* QGVAPMaskInfo.h in Headers */,
-				636FE34823604B570001565D /* UIView+MP4HWDecode.h in Headers */,
-				6307243C22F0410600B15629 /* VAPMacros.h in Headers */,
-				6307242D22F0410600B15629 /* QGBaseDecoder.h in Headers */,
-				6307242E22F0410600B15629 /* QGMP4FrameHWDecoder.h in Headers */,
-				63AEB398231671260069CEBB /* QGVAPConfigManager.h in Headers */,
-				6307243522F0410600B15629 /* QGHWDShaderTypes.h in Headers */,
-				6307241622F0410600B15629 /* UIColor+VAPUtil.h in Headers */,
-				6307241A22F0410600B15629 /* QGBaseAnimatedImageFrame.h in Headers */,
-				6307241E22F0410600B15629 /* QGMP4AnimatedImageFrame.h in Headers */,
-				6307241922F0410600B15629 /* QGBaseDFileInfo.h in Headers */,
-				6307240D22F0410600B15629 /* QGVAPLogger.h in Headers */,
-				63AFC6B7231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.h in Headers */,
-				6307240822F0410600B15629 /* QGMP4Parser.h in Headers */,
-				63AEB39C23167A030069CEBB /* QGVAPConfigModel.h in Headers */,
-				6307242522F0410600B15629 /* QGAnimatedImageDecodeThread.h in Headers */,
-				6307243822F0410600B15629 /* QGHWDMetalView.h in Headers */,
-				6307242722F0410600B15629 /* QGAnimatedImageBufferManager.h in Headers */,
-				63AEB3F923195BF80069CEBB /* QGVAPMetalRenderer.h in Headers */,
-				6307240A22F0410600B15629 /* QGMP4Box.h in Headers */,
-				6307240F22F0410600B15629 /* QGVAPSafeMutableDictionary.h in Headers */,
-				63AEB3EE231952DD0069CEBB /* QGVAPTextureLoader.h in Headers */,
-				6307242822F0410600B15629 /* QGAnimatedImageDecodeManager.h in Headers */,
-				6307241522F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.h in Headers */,
-				6307241322F0410600B15629 /* QGVAPWeakProxy.h in Headers */,
-				6307241022F0410600B15629 /* QGVAPSafeMutableArray.h in Headers */,
-				6307241F22F0410600B15629 /* QGMP4HWDFileInfo.h in Headers */,
-				6307243B22F0410600B15629 /* QGHWDMP4OpenGLView.h in Headers */,
-				6307242622F0410600B15629 /* QGAnimatedImageDecodeThreadPool.h in Headers */,
-				6307243922F0410600B15629 /* QGHWDMetalRenderer.h in Headers */,
-				6307241C22F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.h in Headers */,
-				63BAD37822F0966300EAD4C4 /* UIDevice+VAPUtil.h in Headers */,
-				6307242922F0410600B15629 /* QGAnimatedImageDecodeConfig.h in Headers */,
-				632942D9231BED7D00B511BB /* QGVAPMetalUtil.h in Headers */,
-				639CA47C2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.h in Headers */,
-				63AEB3F4231959D60069CEBB /* QGVAPMetalView.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -679,44 +559,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				6307243F22F0410600B15629 /* QGHWDShaders.metal in Sources */,
-				6307242A22F0410600B15629 /* QGAnimatedImageDecodeThreadPool.m in Sources */,
-				63AFC6B8231E3D4A00E127F9 /* QGVAPMetalShaderFunctionLoader.m in Sources */,
-				6307243A22F0410600B15629 /* QGHWDMP4OpenGLView.m in Sources */,
-				6307243322F0410600B15629 /* QGHWDMetalView.m in Sources */,
-				43BAD32325F2153500D17934 /* QGVAPWrapView.m in Sources */,
-				63AEB3A62317CD940069CEBB /* NSArray+VAPUtil.m in Sources */,
-				6307240C22F0410600B15629 /* QGVAPWeakProxy.m in Sources */,
-				6307240922F0410600B15629 /* QGMP4Parser.m in Sources */,
-				639CA47D2366D22800C0D301 /* UIGestureRecognizer+VAPUtil.m in Sources */,
-				63AEB39D23167A030069CEBB /* QGVAPConfigModel.m in Sources */,
-				63AEB3EF231952DD0069CEBB /* QGVAPTextureLoader.m in Sources */,
-				6307242C22F0410600B15629 /* QGMP4FrameHWDecoder.m in Sources */,
-				636FE34923604B570001565D /* UIView+MP4HWDecode.m in Sources */,
-				6307243022F0410600B15629 /* QGAnimatedImageBufferManager.m in Sources */,
-				6307240722F0410600B15629 /* QGMP4Box.m in Sources */,
-				6307243122F0410600B15629 /* QGAnimatedImageDecodeManager.m in Sources */,
-				6307242B22F0410600B15629 /* QGBaseDecoder.m in Sources */,
-				6307241B22F0410600B15629 /* QGMP4HWDFileInfo.m in Sources */,
-				6307242F22F0410600B15629 /* QGAnimatedImageDecodeThread.m in Sources */,
-				6307241D22F0410600B15629 /* QGBaseDFileInfo.m in Sources */,
-				6307243222F0410600B15629 /* UIView+VAP.m in Sources */,
-				6307242422F0410600B15629 /* QGAnimatedImageDecodeConfig.m in Sources */,
-				6307241222F0410600B15629 /* QGVAPSafeMutableDictionary.m in Sources */,
-				63AEB399231671260069CEBB /* QGVAPConfigManager.m in Sources */,
-				63AEB3A12316AF8A0069CEBB /* NSDictionary+VAPUtil.m in Sources */,
-				63BAD37922F0966300EAD4C4 /* UIDevice+VAPUtil.m in Sources */,
-				6307240E22F0410600B15629 /* QGVAPLogger.m in Sources */,
-				6307241822F0410600B15629 /* QGMP4AnimatedImageFrame.m in Sources */,
-				6307241722F0410600B15629 /* NSNotificationCenter+VAPThreadSafe.m in Sources */,
-				6307242022F0410600B15629 /* QGBaseAnimatedImageFrame.m in Sources */,
-				63AEB3F5231959D60069CEBB /* QGVAPMetalView.m in Sources */,
-				6307241422F0410600B15629 /* UIColor+VAPUtil.m in Sources */,
-				6307243622F0410600B15629 /* QGHWDMetalRenderer.m in Sources */,
-				649EF40E24122B4D00164950 /* QGVAPMaskInfo.m in Sources */,
-				63AEB3FA23195BF80069CEBB /* QGVAPMetalRenderer.m in Sources */,
-				6307242322F0410600B15629 /* QGBaseAnimatedImageFrame+Displaying.m in Sources */,
-				632942DA231BED7D00B511BB /* QGVAPMetalUtil.m in Sources */,
-				6307241122F0410600B15629 /* QGVAPSafeMutableArray.m in Sources */,
 				E1C9B98D15BDFC35B8FED6E9 /* LNPlaybackTypes.swift in Sources */,
 				7769C2ADCDBE6BA6706FA10F /* LNVAPFacade.swift in Sources */,
 				7644770111F618C09AAFB77A /* LNControllers.swift in Sources */,

+ 14 - 0
QGVAPlayer/QGVAPlayer/LNSwift/Core/LNPlaybackTypes.swift

@@ -4,6 +4,20 @@ import UIKit
 public typealias LNVAPImageCompletion = (_ image: UIImage?, _ error: NSError?, _ imageURL: String) -> Void
 public typealias LNVAPGestureEventBlock = (_ gestureRecognizer: UIGestureRecognizer, _ insideSource: Bool, _ source: LNVAPSourceDisplayItem?) -> Void
 
+public let kQGHWDMP4DefaultFPS = 25
+public let kQGHWDMP4MinFPS = 1
+public let QGHWDMP4MaxFPS = 60
+public let VapMaxCompatibleVersion = 2
+
+@objc public enum LNTextureBlendMode: Int {
+    case alphaLeft = 0
+    case alphaRight = 1
+    case alphaTop = 2
+    case alphaBottom = 3
+}
+
+public typealias QGHWDTextureBlendMode = LNTextureBlendMode
+
 @objc public enum LNEnterBackgroundOperation: Int {
     case stop
     case pauseAndResume

+ 7 - 4
QGVAPlayer/QGVAPlayer/LNSwift/Render/LNRenderers.swift

@@ -97,10 +97,13 @@ private final class LNHWDMetalCoreRenderer {
 
     init?(metalLayer: CAMetalLayer, blendMode: QGHWDTextureBlendMode) {
         guard let device = MTLCreateSystemDefaultDevice(),
-              let queue = device.makeCommandQueue(),
-              let library = device.makeDefaultLibrary(),
-              let vertexFunc = library.makeFunction(name: Self.kVertexFunctionName),
-              let fragmentFunc = library.makeFunction(name: Self.kFragmentFunctionName) else {
+              let queue = device.makeCommandQueue() else {
+            return nil
+        }
+
+        let shaderLoader = LNVAPMetalShaderFunctionLoader(device: device)
+        guard let vertexFunc = shaderLoader.loadFunction(withName: Self.kVertexFunctionName),
+              let fragmentFunc = shaderLoader.loadFunction(withName: Self.kFragmentFunctionName) else {
             return nil
         }
 

+ 154 - 2
QGVAPlayer/QGVAPlayer/LNSwift/Utils/LNUtilities.swift

@@ -258,6 +258,7 @@ public final class LNVAPWeakProxy: NSObject {
 public final class LNVAPMetalShaderFunctionLoader: NSObject {
     private let device: MTLDevice
     private var defaultLibrary: MTLLibrary?
+    private var fallbackLibrary: MTLLibrary?
 
     @objc(initWithDevice:)
     public init(device: MTLDevice) {
@@ -275,8 +276,159 @@ public final class LNVAPMetalShaderFunctionLoader: NSObject {
                 defaultLibrary = device.makeDefaultLibrary()
             }
         }
-        return defaultLibrary?.makeFunction(name: functionName)
+        if let function = defaultLibrary?.makeFunction(name: functionName) {
+            return function
+        }
+        if fallbackLibrary == nil {
+            fallbackLibrary = try? device.makeLibrary(source: Self.fallbackShaderSource, options: nil)
+        }
+        return fallbackLibrary?.makeFunction(name: functionName)
+    }
+
+    private static let fallbackShaderSource = """
+    #include <metal_stdlib>
+    #import <simd/simd.h>
+    using namespace metal;
+
+    typedef struct {
+        packed_float4 position;
+        packed_float2 textureColorCoordinate;
+        packed_float2 textureAlphaCoordinate;
+    } QGHWDVertex;
+
+    typedef struct {
+        packed_float4 position;
+        packed_float2 textureColorCoordinate;
+        packed_float2 textureAlphaCoordinate;
+        packed_float2 textureMaskCoordinate;
+    } QGVAPVertex;
+
+    struct ColorParameters {
+        matrix_float3x3 matrix;
+        packed_float2 offset;
+    };
+
+    struct MaskParameters {
+        matrix_float3x3 weightMatrix;
+        int coreSize;
+        float texelOffset;
+    };
+
+    typedef struct {
+        int needOriginRGB;
+        packed_float4 fillColor;
+    } VapAttachmentFragmentParameter;
+
+    typedef struct {
+        packed_float4 position;
+        packed_float2 sourceTextureCoordinate;
+        packed_float2 maskTextureCoordinate;
+    } QGHWDAttachmentVertex;
+
+    typedef struct {
+        float4 clipSpacePostion [[ position ]];
+        float2 textureColorCoordinate;
+        float2 textureAlphaCoordinate;
+    } HWDRasterizerData;
+
+    typedef struct {
+        float4 clipSpacePostion [[ position ]];
+        float2 textureColorCoordinate;
+        float2 textureAlphaCoordinate;
+        float2 textureMaskCoordinate;
+    } VAPRasterizerData;
+
+    typedef struct {
+        float4 position [[ position ]];
+        float2 sourceTextureCoordinate;
+        float2 maskTextureCoordinate;
+    } VAPAttachmentRasterizerData;
+
+    float3 RGBColorFromYuvTextures(sampler textureSampler, float2 coordinate, texture2d<float> texture_luma, texture2d<float> texture_chroma, matrix_float3x3 rotationMatrix, float2 offset) {
+        float3 color;
+        color.x = texture_luma.sample(textureSampler, coordinate).r;
+        color.yz = texture_chroma.sample(textureSampler, coordinate).rg - offset;
+        return float3(rotationMatrix * color);
+    }
+
+    float4 RGBAColor(sampler textureSampler, float2 colorCoordinate, float2 alphaCoordinate, texture2d<float> lumaTexture, texture2d<float> chromaTexture, constant ColorParameters *colorParameters) {
+        matrix_float3x3 rotationMatrix = colorParameters[0].matrix;
+        float2 offset = colorParameters[0].offset;
+        float3 color = RGBColorFromYuvTextures(textureSampler, colorCoordinate, lumaTexture, chromaTexture, rotationMatrix, offset);
+        float3 alpha = RGBColorFromYuvTextures(textureSampler, alphaCoordinate, lumaTexture, chromaTexture, rotationMatrix, offset);
+        return float4(color, alpha.r);
+    }
+
+    vertex HWDRasterizerData hwd_vertexShader(uint vertexID [[ vertex_id ]], constant QGHWDVertex *vertexArray [[ buffer(0) ]]) {
+        HWDRasterizerData out;
+        out.clipSpacePostion = vertexArray[vertexID].position;
+        out.textureColorCoordinate = vertexArray[vertexID].textureColorCoordinate;
+        out.textureAlphaCoordinate = vertexArray[vertexID].textureAlphaCoordinate;
+        return out;
+    }
+
+    fragment float4 hwd_yuvFragmentShader(HWDRasterizerData input [[ stage_in ]], texture2d<float> lumaTexture [[ texture(0) ]], texture2d<float> chromaTexture [[ texture(1) ]], constant ColorParameters *colorParameters [[ buffer(0) ]]) {
+        constexpr sampler textureSampler(mag_filter::linear, min_filter::linear);
+        return RGBAColor(textureSampler, input.textureColorCoordinate, input.textureAlphaCoordinate, lumaTexture, chromaTexture, colorParameters);
+    }
+
+    vertex VAPRasterizerData vap_vertexShader(uint vertexID [[ vertex_id ]], constant QGVAPVertex *vertexArray [[ buffer(0) ]]) {
+        VAPRasterizerData out;
+        out.clipSpacePostion = vertexArray[vertexID].position;
+        out.textureColorCoordinate = vertexArray[vertexID].textureColorCoordinate;
+        out.textureAlphaCoordinate = vertexArray[vertexID].textureAlphaCoordinate;
+        out.textureMaskCoordinate = vertexArray[vertexID].textureMaskCoordinate;
+        return out;
+    }
+
+    fragment float4 vap_yuvFragmentShader(VAPRasterizerData input [[ stage_in ]], texture2d<float> lumaTexture [[ texture(0) ]], texture2d<float> chromaTexture [[ texture(1) ]], constant ColorParameters *colorParameters [[ buffer(0) ]]) {
+        constexpr sampler textureSampler(mag_filter::linear, min_filter::linear);
+        return RGBAColor(textureSampler, input.textureColorCoordinate, input.textureAlphaCoordinate, lumaTexture, chromaTexture, colorParameters);
+    }
+
+    fragment float4 vap_maskFragmentShader(VAPRasterizerData input [[ stage_in ]], texture2d<float> lumaTexture [[ texture(0) ]], texture2d<float> chromaTexture [[ texture(1) ]], texture2d<float> maskTexture [[ texture(2) ]], constant ColorParameters *colorParameters [[ buffer(0) ]]) {
+        constexpr sampler textureSampler(mag_filter::linear, min_filter::linear);
+        float4 originColor = RGBAColor(textureSampler, input.textureColorCoordinate, input.textureAlphaCoordinate, lumaTexture, chromaTexture, colorParameters);
+        float4 maskColor = maskTexture.sample(textureSampler, input.textureMaskCoordinate);
+        float needMask = maskColor.r * 255;
+        return float4(originColor.rgb, (1 - needMask) * originColor.a);
+    }
+
+    fragment float4 vap_maskBlurFragmentShader(VAPRasterizerData input [[ stage_in ]], texture2d<float> lumaTexture [[ texture(0) ]], texture2d<float> chromaTexture [[ texture(1) ]], texture2d<float> maskTexture [[ texture(2) ]], constant ColorParameters *colorParameters [[ buffer(0) ]], constant MaskParameters *maskParameters [[ buffer(1) ]]) {
+        constexpr sampler textureSampler(mag_filter::linear, min_filter::linear);
+        float4 originColor = RGBAColor(textureSampler, input.textureColorCoordinate, input.textureAlphaCoordinate, lumaTexture, chromaTexture, colorParameters);
+        int uniform = 255;
+        float3x3 weightMatrix = maskParameters[0].weightMatrix;
+        int coreSize = maskParameters[0].coreSize;
+        float texelOffset = maskParameters[0].texelOffset;
+        float alphaResult = 0;
+        for (int y = 0; y < coreSize; y++) {
+            for (int x = 0; x < coreSize; x++) {
+                float2 nearMaskColor = float2(input.textureMaskCoordinate.x + (-1.0 + float(x)) * texelOffset, input.textureMaskCoordinate.y + (-1.0 + float(y)) * texelOffset);
+                alphaResult += maskTexture.sample(textureSampler, nearMaskColor).r * uniform * weightMatrix[x][y];
+            }
+        }
+        int needOrigin = step(alphaResult, 0.01) + step(originColor.a, 0.01);
+        return float4(originColor.rgb, needOrigin * originColor.a + (1 - needOrigin) * (1 - alphaResult));
+    }
+
+    vertex VAPAttachmentRasterizerData vapAttachment_vertexShader(uint vertexID [[ vertex_id ]], constant QGHWDAttachmentVertex *vertexArray [[ buffer(0) ]]) {
+        VAPAttachmentRasterizerData out;
+        out.position = vertexArray[vertexID].position;
+        out.sourceTextureCoordinate = vertexArray[vertexID].sourceTextureCoordinate;
+        out.maskTextureCoordinate = vertexArray[vertexID].maskTextureCoordinate;
+        return out;
+    }
+
+    fragment float4 vapAttachment_FragmentShader(VAPAttachmentRasterizerData input [[ stage_in ]], texture2d<float> lumaTexture [[ texture(0) ]], texture2d<float> chromaTexture [[ texture(1) ]], texture2d<float> sourceTexture [[ texture(2) ]], constant ColorParameters *colorParameters [[ buffer(0) ]], constant VapAttachmentFragmentParameter *fillParams [[ buffer(1) ]]) {
+        constexpr sampler textureSampler(mag_filter::linear, min_filter::linear);
+        matrix_float3x3 rotationMatrix = colorParameters[0].matrix;
+        float2 offset = colorParameters[0].offset;
+        float3 mask = RGBColorFromYuvTextures(textureSampler, input.maskTextureCoordinate, lumaTexture, chromaTexture, rotationMatrix, offset);
+        float4 source = sourceTexture.sample(textureSampler, input.sourceTextureCoordinate);
+        return float4(source.rgb, source.a * mask.r);
     }
+    """
 }
 
 @objcMembers
@@ -424,7 +576,7 @@ public final class LNVAPMetalUtil: NSObject {
 
 public extension UIView {
     @objc func lnStopVAPIfNeeded() {
-        stopHWDMP4()
+        (self as? LNVAPPlayerView)?.lnStop()
     }
 }
 

+ 2 - 2
QGVAPlayer/QGVAPlayer/LNSwift/View/LNVAPPlayerView.swift

@@ -407,12 +407,12 @@ private final class LNPlayerCore: NSObject {
         notifyFail(message: "not allowed in simulator", code: LNMP4HWDErrorCode.invalidMP4File.rawValue)
         stopInternal(triggerDelegate: true)
         return
-#endif
-
+#else
         setupRenderViewIfNeed()
 
         decodeManager = LNAnimatedImageDecodeManager(fileInfo: info, config: decodeConfig, delegate: self)
         configManager.loadConfigResources()
+#endif
     }
 
     private func setupRenderViewIfNeed() {

+ 36 - 2
QGVAPlayer/QGVAPlayer/Shaders/QGHWDShaders.metal

@@ -14,13 +14,48 @@
 // limitations under the License.
 
 #include <metal_stdlib>
-#import "QGHWDShaderTypes.h"
+#import <simd/simd.h>
 
 /*
  请注意:更新本文件后请同步到QGHWDMetalShaderSourceDefine.h
  */
 using namespace metal;
 
+typedef struct {
+    packed_float4 position;
+    packed_float2 textureColorCoordinate;
+    packed_float2 textureAlphaCoordinate;
+} QGHWDVertex;
+
+typedef struct {
+    packed_float4 position;
+    packed_float2 textureColorCoordinate;
+    packed_float2 textureAlphaCoordinate;
+    packed_float2 textureMaskCoordinate;
+} QGVAPVertex;
+
+struct ColorParameters {
+    matrix_float3x3 matrix;
+    packed_float2 offset;
+};
+
+struct MaskParameters {
+    matrix_float3x3 weightMatrix;
+    int coreSize;
+    float texelOffset;
+};
+
+struct VapAttachmentFragmentParameter {
+    int needOriginRGB;
+    packed_float4 fillColor;
+};
+
+typedef struct {
+    packed_float4 position;
+    packed_float2 sourceTextureCoordinate;
+    packed_float2 maskTextureCoordinate;
+} QGHWDAttachmentVertex;
+
 typedef struct {
     
     float4 clipSpacePostion [[ position ]];
@@ -160,4 +195,3 @@ fragment float4 vapAttachment_FragmentShader(VAPAttachmentRasterizerData input [
     float4 source = sourceTexture.sample(textureSampler, input.sourceTextureCoordinate);
     return float4(source.rgb, source.a * mask.r);
 }
-

+ 1 - 1
QGVAPlayerDemo/QGVAPlayerDemo/ViewController.m

@@ -2,7 +2,7 @@
 // Tencent is pleased to support the open source community by making vap available.
 
 #import "ViewController.h"
-#import <QGVAPlayer/QGVAPlayer.h>
+#import <QGVAPlayer.h>
 #import <QGVAPlayer/QGVAPlayer-Swift.h>
 #import <AVFoundation/AVFoundation.h>