소스 검색

Merge branch 'master' of https://git.yishihui.com/iOS/BFFramework

* 'master' of https://git.yishihui.com/iOS/BFFramework:
  1.fix bugs
  1.解决imageFilter崩溃问题
  1.update framework
  1.update framework
harry 3 년 전
부모
커밋
6cfc3cc20d

+ 2 - 3
BFFramework.podspec

@@ -57,8 +57,7 @@ TODO: Add long description of the pod here.
     s.dependency 'AliyunOSSiOS','2.10.10' # 阿里云组件
     s.dependency 'WechatOpenSDK-Swift','1.8.7.1' # 微信组件
     s.dependency 'MJRefresh','3.7.2' # 刷新组件
-    s.dependency 'LMJHorizontalScrollText' ,'2.0.2'
-    s.dependency 'TXLiteAVSDK_Player','9.1.10564' # 腾讯播放器组件
+    s.dependency 'LMJHorizontalScrollText','2.0.2'
+    s.dependency 'TXLiteAVSDK_Player','9.2.10637' # 腾讯播放器组件
     s.dependency 'Bugly','2.5.90' #crash log 收集
-
 end

+ 43 - 59
BFFramework/Classes/PQGPUImage/akfilters/PQImageFilter.swift

@@ -20,46 +20,39 @@ open class PQImageFilter: PQBaseFilter {
     deinit {
         BFLog(1, message: "image filter deinit 析构掉~")
         newImage = nil
-        
+
         if imageTexture != 0 {
             glDeleteTextures(1, &imageTexture)
             imageTexture = 0
         }
-        if(imageVertexBuffer != 0){
+        if imageVertexBuffer != 0 {
             PQGPUImageTools.deleteVBO(imageVertexBuffer)
             imageVertexBuffer = 0
         }
-   
-        
     }
-    
+
     init(sticker: PQEditVisionTrackMaterialsModel, isExport: Bool = true, showUISize: CGSize = .zero) {
         super.init(fragmentShader: PassthroughFragmentShader, numberOfInputs: 1)
-        
+
         mSticker = sticker
         stickerInfo = sticker
-        
         if mSticker!.locationPath.count == 0 {
             BFLog(2, message: "图片数据为空,创建失败")
             return
         }
-        //        print("mSticker path : \(String(describing: mSticker!.locationPath))")
-        
         newImage = UIImage(contentsOfFile: documensDirectory + sticker.locationPath)
-        //try find image file frome in BFFramework bundle
-        if(newImage == nil){
-            newImage = UIImage.moduleImage(named: sticker.locationPath, moduleName: "BFFramework",isAssets: false)
+        // try find image file frome in BFFramework bundle
+        if newImage == nil {
+            newImage = UIImage.moduleImage(named: sticker.locationPath, moduleName: "BFFramework", isAssets: false)
         }
-        
         // 如果是预览时 对原图进行缩放处理
         if !isExport {
             let maxLength = max(showUISize.width, showUISize.height)
             newImage = newImage?.nx_scaleWithMaxLength(maxLength: CGFloat(maxLength * UIScreen.main.scale))
-            
+
             BFLog(message: "newImage is \(newImage?.size.width ?? 0) \(newImage?.size.height ?? 0)")
-            
         }
-        
+
         autoreleasepool {
             if newImage == nil {
                 let filePath = documensDirectory + (mSticker?.locationPath ?? "")
@@ -72,27 +65,23 @@ open class PQImageFilter: PQBaseFilter {
                 } else { BFLog(2, message: "文件不存在") }
             }
         }
-        
+
         if newImage?.cgImage != nil {
             BFLog(message: "提前加载图片。。。。timelineIn : \(String(describing: mSticker?.timelineIn)) timelineOut :\(String(describing: mSticker?.timelineOut)) \(String(describing: mSticker?.locationPath))")
-            
+
             //            imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
-            
+
         } else { BFLog(2, message: "image filter init error image data is nil!") }
-        
-        
+
         // 保证是16的公倍数
-        let aptImageSize =  NXAVUtil.aptSize(newImage!.size)
-        if (!__CGSizeEqualToSize(aptImageSize, newImage!.size))
-        {
+        let aptImageSize = NXAVUtil.aptSize(newImage?.size ?? CGSize.zero)
+        if !__CGSizeEqualToSize(aptImageSize, newImage?.size ?? CGSize.zero) {
             BFLog(2, message: "原图大小宽度不是16的倍数 \(newImage!.size)")
             //            newImage = newImage?.nx_scaleToSize(size: aptImageSize)
             BFLog(2, message: "归16后大小 \(newImage!.size)")
-            
         }
-        
     }
-    
+
     //    override public func newFramebufferAvailable(_ framebuffer: Framebuffer, fromSourceIndex: UInt) {
     //        super.newFramebufferAvailable(framebuffer, fromSourceIndex: fromSourceIndex)
     //
@@ -104,49 +93,48 @@ open class PQImageFilter: PQBaseFilter {
     ////            } else { BFLog(message: "image filter init error image data is nil!") }
     ////        }
     //    }
-    
-    open override func renderFrame() {
+
+    override open func renderFrame() {
         let inputFramebuffer: Framebuffer = inputFramebuffers[0]!
         let inputSize = inputFramebuffer.sizeForTargetOrientation(.portrait)
-        
+
         //        print("renderFrame timestamp is \(inputFramebuffer.timingStyle)")
-        
+
         let currTime = CMTimeGetSeconds(CMTime(value: inputFramebuffer.timingStyle.timestamp!.value, timescale: inputFramebuffer.timingStyle.timestamp!.timescale))
-        
+
         renderFramebuffer = sharedImageProcessingContext.framebufferCache.requestFramebufferWithProperties(orientation: .portrait, size: inputSize, stencil: false)
-        
+
         // 画布
         let textureProperties = InputTextureProperties(textureCoordinates: inputFramebuffer.orientation.rotationNeededForOrientation(.portrait).textureCoordinates(), texture: inputFramebuffer.texture)
-        
+
         renderFramebuffer.activateFramebufferForRendering()
         clearFramebufferWithColor(Color.white)
         renderQuadWithShader(shader, uniformSettings: uniformSettings,
                              vertexBufferObject: sharedImageProcessingContext.standardImageVBO, inputTextures: [textureProperties])
         releaseIncomingFramebuffers()
-        
+
         if newImage == nil {
             BFLog(2, message: "图片数据有错误!!!! 检查数据\(mSticker!.locationPath)")
             return
         }
-        
+
         BFLog(2, message: " image filter 当前时间: \(currTime) \(newImage!.size)")
-        
+
         if currTime >= mSticker!.timelineIn && currTime <= mSticker!.timelineOut {
             BFLog(2, message: " 显示图片当前时间: \(currTime) 开始时间:\(mSticker!.timelineIn) 结束时间:\(mSticker!.timelineOut)  \(String(describing: newImage?.size))")
             // 取纹理坐标
             var textureCoordinates = PQGPUImageTools.getTextureCoordinates(sticker: mSticker!, textureSize: newImage!.size, cannvasSize: inputSize)
-            
-            BFLog(2, message: "textureCoordinates is \(textureCoordinates) image size :\(newImage!.size ) cannvasSize:\(inputSize)  files path is \(mSticker?.locationPath)")
-            
+
+            BFLog(2, message: "textureCoordinates is \(textureCoordinates) image size :\(newImage!.size) cannvasSize:\(inputSize)  files path is \(mSticker?.locationPath)")
+
             // imageTexture 有可能被析构导致黑屏
             if imageTexture == 0 && newImage?.cgImage != nil {
                 BFLog(2, message: "imageTexture is error !!!!!重新创建")
                 imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
             }
-            
-            
-            //如果设置过大小位置,使用设置值,比如水印
-            if(stickerInfo?.materialPosition?.width != 0){
+
+            // 如果设置过大小位置,使用设置值,比如水印
+            if stickerInfo?.materialPosition?.width != 0 {
                 textureCoordinates = [
                     0.0, 0.0, // 1 bottom left
                     1.0, 0.0, // 2 bottom right
@@ -154,36 +142,32 @@ open class PQImageFilter: PQBaseFilter {
                     1.0, 1.0, // 4 top right
                 ]
             }
-            
+
             let texturePropertiesimagetwo = InputTextureProperties(textureCoordinates: textureCoordinates, texture: imageTexture)
-            
+
             var verticesPoint: [GLfloat] = PQGPUImageTools.getVerticesPoint(sticker: mSticker!, textureSize: newImage!.size, cannvasSize: inputSize)
-            
-            //如果设置过大小位置,使用设置值,比如水印
-            if(stickerInfo?.materialPosition?.width != 0){
-                verticesPoint = PQGPUImageTools.computeVertices(viewSize: CGSize.init(width: CGFloat(inputSize.width), height: CGFloat(inputSize.height)), _bounds: CGRect.init(x: stickerInfo?.materialPosition?.x ?? 0, y:  stickerInfo?.materialPosition?.y ?? 0, width: stickerInfo?.materialPosition?.width ?? 0, height: stickerInfo?.materialPosition?.height ?? 0))
+
+            // 如果设置过大小位置,使用设置值,比如水印
+            if stickerInfo?.materialPosition?.width != 0 {
+                verticesPoint = PQGPUImageTools.computeVertices(viewSize: CGSize(width: CGFloat(inputSize.width), height: CGFloat(inputSize.height)), _bounds: CGRect(x: stickerInfo?.materialPosition?.x ?? 0, y: stickerInfo?.materialPosition?.y ?? 0, width: stickerInfo?.materialPosition?.width ?? 0, height: stickerInfo?.materialPosition?.height ?? 0))
             }
-            
+
             // 设置融合模式支持 alpha
             glEnable(GLenum(GL_DEPTH_TEST))
             glEnable(GLenum(GL_BLEND))
             glBlendFunc(GLenum(GL_SRC_ALPHA), GLenum(GL_ONE_MINUS_SRC_ALPHA))
-            
+
             imageVertexBuffer = PQGPUImageTools.NXGenerateVBO(for: verticesPoint)
-            
+
             renderQuadWithShader(shader,
                                  uniformSettings: uniformSettings,
                                  vertexBufferObject: imageVertexBuffer, inputTextures: [texturePropertiesimagetwo])
             releaseIncomingFramebuffers()
-            
-            if(imageVertexBuffer != 0){
+
+            if imageVertexBuffer != 0 {
                 PQGPUImageTools.deleteVBO(imageVertexBuffer)
                 imageVertexBuffer = 0
             }
-            
-        
         }
-        
-        
     }
 }

+ 3 - 0
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointMaterialController.swift

@@ -311,7 +311,10 @@ public class PQStuckPointMaterialController: PQBaseViewController {
     }
 
     deinit {
+        photoMaterialVc.assetCollection = nil
+        photoMaterialVc.allPhotos = nil
         PQNotification.removeObserver(self)
+        BFLog(message: "\(self) 已销毁")
     }
 
     /// 图库选择的回调

+ 3 - 3
Example/Podfile

@@ -5,8 +5,8 @@ platform :ios, '10.0'
 target 'BFFramework_Example' do
   source 'https://git.yishihui.com/iOS/BFSpecs.git'
   source 'https://github.com/CocoaPods/Specs.git'
-  pod 'BFCommonKit', :path => '/Users/sanw/Desktop/BytesFlow/Person/Projects/BFCommonKit/'
-  pod 'BFNetRequestKit', :path => '/Users/sanw/Desktop/BytesFlow/Person/Projects/BFNetRequestKit/'
-  pod 'BFMaterialKit', :path => '/Users/sanw/Desktop/BytesFlow/Person/Projects/BFMaterialKit/'
+#  pod 'BFCommonKit', :path => '/Users/sanw/Desktop/BytesFlow/Person/Projects/BFCommonKit/'
+#  pod 'BFNetRequestKit', :path => '/Users/sanw/Desktop/BytesFlow/Person/Projects/BFNetRequestKit/'
+#  pod 'BFMaterialKit', :path => '/Users/sanw/Desktop/BytesFlow/Person/Projects/BFMaterialKit/'
   pod 'BFFramework', :path => '../'
 end

+ 19 - 24
Example/Podfile.lock

@@ -31,16 +31,16 @@ PODS:
     - KingfisherWebP (= 1.3.0)
     - Toast-Swift (= 5.0.1)
   - BFFramework (1.0.7):
-    - AliyunOSSiOS (= 2.10.10)
+    - AliyunOSSiOS
     - BFCommonKit
     - BFMaterialKit
     - BFNetRequestKit
-    - Bugly (= 2.5.90)
-    - LMJHorizontalScrollText (= 2.0.2)
-    - MJRefresh (= 3.7.2)
-    - ObjectMapper (= 4.2.0)
-    - TXLiteAVSDK_Player (= 9.1.10564)
-    - WechatOpenSDK-Swift (= 1.8.7.1)
+    - Bugly
+    - LMJHorizontalScrollText
+    - MJRefresh
+    - ObjectMapper
+    - TXLiteAVSDK_Player
+    - WechatOpenSDK-Swift
   - BFMaterialKit (0.1.6):
     - BFCommonKit
   - BFNetRequestKit (0.2.3):
@@ -71,16 +71,17 @@ PODS:
     - Realm (= 10.7.6)
   - SnapKit (5.0.1)
   - Toast-Swift (5.0.1)
-  - TXLiteAVSDK_Player (9.1.10564)
+  - TXLiteAVSDK_Player (9.2.10637)
   - WechatOpenSDK-Swift (1.8.7.1)
 
 DEPENDENCIES:
-  - BFCommonKit (from `/Users/sanw/Desktop/BytesFlow/Person/Projects/BFCommonKit/`)
   - BFFramework (from `../`)
-  - BFMaterialKit (from `/Users/sanw/Desktop/BytesFlow/Person/Projects/BFMaterialKit/`)
-  - BFNetRequestKit (from `/Users/sanw/Desktop/BytesFlow/Person/Projects/BFNetRequestKit/`)
 
 SPEC REPOS:
+  https://git.yishihui.com/iOS/BFSpecs.git:
+    - BFCommonKit
+    - BFMaterialKit
+    - BFNetRequestKit
   https://github.com/CocoaPods/Specs.git:
     - Alamofire
     - AliyunOSSiOS
@@ -101,22 +102,16 @@ SPEC REPOS:
     - WechatOpenSDK-Swift
 
 EXTERNAL SOURCES:
-  BFCommonKit:
-    :path: "/Users/sanw/Desktop/BytesFlow/Person/Projects/BFCommonKit/"
   BFFramework:
     :path: "../"
-  BFMaterialKit:
-    :path: "/Users/sanw/Desktop/BytesFlow/Person/Projects/BFMaterialKit/"
-  BFNetRequestKit:
-    :path: "/Users/sanw/Desktop/BytesFlow/Person/Projects/BFNetRequestKit/"
 
 SPEC CHECKSUMS:
   Alamofire: e447a2774a40c996748296fa2c55112fdbbc42f9
   AliyunOSSiOS: b8f1dfc229cd9abf68c8ee0cb245c2d66e00dd96
-  BFCommonKit: 61380c2c5d74333d4a60fe52a3321c937b2a1f06
-  BFFramework: 8f1f60ab704eeb51a4da6828588f8da24ab85faa
-  BFMaterialKit: 920e502d41b995c9959199e513b64ae780f52ae5
-  BFNetRequestKit: 5743bcafb3f70502137780461b53d71c05b1d01e
+  BFCommonKit: ae9792ba766f4fad177cd826554a4f6feab5f9cd
+  BFFramework: c821f4a61057287a3c60ea3ce7498ccf57542de1
+  BFMaterialKit: ee4db6e76fdb94af810bc2d098a58ec15e18b2bf
+  BFNetRequestKit: 2af2279251e5304f34ca02771f74328f62fa7b6f
   Bugly: 88bc32c0acc6fef7b74d610f0319ee7560d6b9fe
   FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
   KeychainAccess: c0c4f7f38f6fc7bbe58f5702e25f7bd2f65abf51
@@ -130,9 +125,9 @@ SPEC CHECKSUMS:
   RealmSwift: e31c4ddbcc42ac879313d656b86f9ca539f6f4f4
   SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb
   Toast-Swift: 9b6a70f28b3bf0b96c40d46c0c4b9d6639846711
-  TXLiteAVSDK_Player: b4e91267f601a9cadf265ed4a903816e995ba57a
+  TXLiteAVSDK_Player: 300e6fc7262ae095ee13b18d7d821c5fae0996f9
   WechatOpenSDK-Swift: 18a8f7b12e745c30acc013f72a9f8a25aad6e216
 
-PODFILE CHECKSUM: 0566a3fccd1ba8303834811529466910b942b3bf
+PODFILE CHECKSUM: a70d2c425de0713c3557fd13b3dec4e634e32f2a
 
-COCOAPODS: 1.10.2
+COCOAPODS: 1.11.2