Quellcode durchsuchen

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

wenweiwei vor 3 Jahren
Ursprung
Commit
5cf484ac76

+ 21 - 21
BFFramework/Classes/PQGPUImage/akfilters/PQGPUImageTools.swift

@@ -48,9 +48,9 @@ open class PQGPUImageTools: NSObject {
         glDeleteBuffers(1, &deletedVBO)
     }
 
-    // 图片转纹理集数据 XXXXX 使用方法后 返回的 imageTexture 要清空纹理,注意不清空显存会暴增     glDeleteTextures(1,&imageTexture)
+    // FilterLog XXXXX 使用方法后 返回的 imageTexture 要清空纹理,注意不清空显存会暴增     glDeleteTextures(1,&imageTexture)
     class func setupTexture(image: CGImage) -> GLuint {
-        BFLog(2, message: "图片转纹理集数据 =====width :\(image.width) height: \(image.height)")
+        FilterLog(2, message: "FilterLog =====width :\(image.width) height: \(image.height)")
 
         let widthOfImage = GLint(image.width)
         let heightOfImage = GLint(image.height)
@@ -119,7 +119,7 @@ open class PQGPUImageTools: NSObject {
                     }
                 }
             }
-            BFLog(2, message: "图片转纹理集数据2222 =====")
+            FilterLog(2, message: "FilterLog2222 =====")
 
             //        sharedImageProcessingContext.runOperationSynchronously{
             //    CFAbsoluteTime elapsedTime, startTime = CFAbsoluteTimeGetCurrent();
@@ -142,10 +142,10 @@ open class PQGPUImageTools: NSObject {
                 dataFromImageDataProvider = data
                 imageData = UnsafeMutablePointer<GLubyte>(mutating: CFDataGetBytePtr(dataFromImageDataProvider))
             }
-            BFLog(2, message: "图片转纹理集数据333333 =====")
+            FilterLog(2, message: "FilterLog333333 =====")
 
             glEnable(GLenum(GL_TEXTURE_2D))
-            BFLog(2, message: "图片转纹理集数据44444 =====")
+            FilterLog(2, message: "FilterLog44444 =====")
 
             /**
              *  GL_TEXTURE_2D表示操作2D纹理
@@ -154,10 +154,10 @@ open class PQGPUImageTools: NSObject {
              */
 
             glGenTextures(1, &textureID)
-            BFLog(2, message: "图片转纹理集数据5555 =====\(textureID)")
+            FilterLog(2, message: "FilterLog5555 =====\(textureID)")
 
             glBindTexture(GLenum(GL_TEXTURE_2D), textureID)
-            BFLog(2, message: "图片转纹理集数据6666 =====\(textureID)")
+            FilterLog(2, message: "FilterLog6666 =====\(textureID)")
 
             /**
              *  纹理过滤函数
@@ -187,29 +187,29 @@ open class PQGPUImageTools: NSObject {
              * 参数8:type
              * 参数9:纹理数据
              */
-            BFLog(2, message: "载入纹理 =====")
-            BFLog(2, message: "GL_TEXTURE_2D =====\(GL_TEXTURE_2D)")
-            BFLog(2, message: "GL_RGBA =====\(GL_RGBA)")
-            BFLog(2, message: "widthOfImage =====\(widthOfImage)")
-            BFLog(2, message: "heightOfImage =====\(heightOfImage)")
-            BFLog(2, message: "GL_UNSIGNED_BYTE =====\(GL_UNSIGNED_BYTE)")
-            BFLog(2, message: "imageData =====\(String(describing: imageData))")
-            BFLog(2, message: "GLenum(GL_TEXTURE_2D) =====\(GLenum(GL_TEXTURE_2D))")
-            BFLog(2, message: "GLenum(format) =====\(GLenum(format))")
-            BFLog(2, message: "GLenum(GL_UNSIGNED_BYTE) =====\(GLenum(GL_UNSIGNED_BYTE))")
+            FilterLog(2, message: "载入纹理 =====")
+            FilterLog(2, message: "GL_TEXTURE_2D =====\(GL_TEXTURE_2D)")
+            FilterLog(2, message: "GL_RGBA =====\(GL_RGBA)")
+            FilterLog(2, message: "widthOfImage =====\(widthOfImage)")
+            FilterLog(2, message: "heightOfImage =====\(heightOfImage)")
+            FilterLog(2, message: "GL_UNSIGNED_BYTE =====\(GL_UNSIGNED_BYTE)")
+            FilterLog(2, message: "imageData =====\(String(describing: imageData))")
+            FilterLog(2, message: "GLenum(GL_TEXTURE_2D) =====\(GLenum(GL_TEXTURE_2D))")
+            FilterLog(2, message: "GLenum(format) =====\(GLenum(format))")
+            FilterLog(2, message: "GLenum(GL_UNSIGNED_BYTE) =====\(GLenum(GL_UNSIGNED_BYTE))")
 
             glTexImage2D(GLenum(GL_TEXTURE_2D), 0, GL_RGBA, widthToUseForTexture, heightToUseForTexture, 0, GLenum(format), GLenum(GL_UNSIGNED_BYTE), imageData)
 
             // 结束后要做清理
-            BFLog(2, message: "结束后要做清理 =====")
-            BFLog(2, message: "GLenum(GL_TEXTURE_2D) =====\(GLenum(GL_TEXTURE_2D))")
+            FilterLog(2, message: "结束后要做清理 =====")
+            FilterLog(2, message: "GLenum(GL_TEXTURE_2D) =====\(GLenum(GL_TEXTURE_2D))")
 
             glBindTexture(GLenum(GL_TEXTURE_2D), 0) // 解绑
 
-            BFLog(2, message: "结束后要做清理1111111 =====")
+            FilterLog(2, message: "结束后要做清理1111111 =====")
             imageData.deallocate()
 
-            BFLog(2, message: "textureID =====\(textureID)")
+            FilterLog(2, message: "textureID =====\(textureID)")
         }
 
         return textureID

+ 12 - 12
BFFramework/Classes/PQGPUImage/akfilters/PQGifFilter.swift

@@ -33,7 +33,7 @@ open class PQGifFilter: PQBaseFilter {
         super.init(fragmentShader: PassthroughFragmentShader, numberOfInputs: 1)
         mSticker = sticker
 
-        BFLog(2, message: "gif file path \(mSticker?.locationPath ?? "")")
+        FilterLog(2, message: "gif file path \(mSticker?.locationPath ?? "")")
         var gifData: Data!
         autoreleasepool {
             do {
@@ -45,7 +45,7 @@ open class PQGifFilter: PQBaseFilter {
                     if (!gifFilePath.contains("var/mobile/Media")) {
                         gifFilePath = documensDirectory + gifFilePath
                     }
-                    BFLog(message: "gifFilePath is \(gifFilePath)")
+                    FilterLog(message: "gifFilePath is \(gifFilePath)")
                     gifData = try Data(contentsOf: URL(fileURLWithPath: gifFilePath))
                 }
                
@@ -56,14 +56,14 @@ open class PQGifFilter: PQBaseFilter {
         }
 
         if gifData == nil {
-            BFLog(message: "gif数据有问题!")
+            FilterLog(message: "gif数据有问题!")
             return
         }
         PQPHAssetVideoParaseUtil.parasGIFImage(data: gifData) { [weak self] _, images, duration in
 
             self?.mGifImages = images ?? []
             self?.mDuration = duration ?? 0
-            BFLog(2, message: "gif 原始时长 \(String(describing: duration)) 逻辑时长: \(String(describing: self?.mSticker?.aptDuration)) 帧数:\(String(describing: images?.count))")
+            FilterLog(2, message: "gif 原始时长 \(String(describing: duration)) 逻辑时长: \(String(describing: self?.mSticker?.aptDuration)) 帧数:\(String(describing: images?.count))")
 
             if images!.count > 0 {
                 self?.gifSize = images!.first!.size
@@ -75,7 +75,7 @@ open class PQGifFilter: PQBaseFilter {
 
             if self?.mSticker?.materialDurationFit?.fitType == adapterMode.loopAuto.rawValue || self?.mSticker?.materialDurationFit?.fitType == adapterMode.staticFrame.rawValue {
                 self?.delayTime = (self?.mDuration ?? 1) / Double(self?.mGifImages.count ?? 1)
-                BFLog(message: "正常速度每一帧的时间:\(String(describing: self?.delayTime))")
+                FilterLog(message: "正常速度每一帧的时间:\(String(describing: self?.delayTime))")
             }
             sharedImageProcessingContext.runOperationSynchronously {
                 // ( 提前渲染一帧
@@ -91,23 +91,23 @@ open class PQGifFilter: PQBaseFilter {
     func updateImages(_ currTime: Float64) {
         autoreleasepool {
             if mGifImages.count == 0 {
-                BFLog(2, message: "gif 文件有问题 一帧都没有")
+                FilterLog(2, message: "gif 文件有问题 一帧都没有")
                 return
             }
             if delayTime <= 0 {
-                BFLog(2, message: "gif 时间计算出错")
+                FilterLog(2, message: "gif 时间计算出错")
                 return
             }
             // 判断显示哪一帧
             var gifIndex = delayTime <= 0 ? 0 : Int(((currTime >= beginTime) ? currTime - beginTime : currTime) / delayTime)
             if mSticker?.materialDurationFit?.fitType == adapterMode.staticFrame.rawValue && gifIndex >= mGifImages.count { // 定帧
-                BFLog(2, message: "定帧效果 \(gifIndex)")
+                FilterLog(2, message: "定帧效果 \(gifIndex)")
                 imageTexture = PQGPUImageTools.setupTexture(image: (mGifImages.last?.cgImage)!)
                 return
             }
 
             if gifIndex >= mGifImages.count && mSticker?.materialDurationFit?.fitType == adapterMode.loopAuto.rawValue { // 自动循环重新计算开始时间 达到循环效果
-                BFLog(2, message: "自动循环效果")
+                FilterLog(2, message: "自动循环效果")
                 gifIndex = gifIndex % mGifImages.count
             }
 
@@ -143,7 +143,7 @@ open class PQGifFilter: PQBaseFilter {
             let inputSize = inputFramebuffer.sizeForTargetOrientation(.portrait)
 
             let currTime = CMTimeGetSeconds(CMTime(value: inputFramebuffer.timingStyle.timestamp!.value, timescale: inputFramebuffer.timingStyle.timestamp!.timescale))
-            BFLog(2, message: "gif filter 当前时间: \(currTime) ")
+            FilterLog(2, message: "gif filter 当前时间: \(currTime) ")
 
             // 原有画布
             renderFramebuffer = sharedImageProcessingContext.framebufferCache.requestFramebufferWithProperties(orientation: .portrait, size: inputSize, stencil: false)
@@ -157,7 +157,7 @@ open class PQGifFilter: PQBaseFilter {
             releaseIncomingFramebuffers()
 
             if currTime >= mSticker!.timelineIn, currTime <= mSticker!.timelineOut {
-                BFLog(2, message: " 显示gif当前时间: \(currTime) 开始时间:\(mSticker!.timelineIn) 结束时间:\(mSticker!.timelineOut)  ")
+                FilterLog(2, message: " 显示gif当前时间: \(currTime) 开始时间:\(mSticker!.timelineIn) 结束时间:\(mSticker!.timelineOut)  ")
 
                 // 绘制 image
                 let textureCoordinates = PQGPUImageTools.getTextureCoordinates(sticker: mSticker!, textureSize: gifSize, cannvasSize: inputSize)
@@ -179,7 +179,7 @@ open class PQGifFilter: PQBaseFilter {
                 // XXXXXXX 清空纹理,注意不清空显存会暴增
                 glDeleteTextures(1, &imageTexture)
             } else {
-                BFLog(2, message: " 不显示gif时: \(currTime) 开始时间:\(mSticker!.timelineIn) 结束时间:\(mSticker!.timelineOut)")
+                FilterLog(2, message: " 不显示gif时: \(currTime) 开始时间:\(mSticker!.timelineIn) 结束时间:\(mSticker!.timelineOut)")
             }
         }
     }

+ 16 - 16
BFFramework/Classes/PQGPUImage/akfilters/PQImageFilter.swift

@@ -18,7 +18,7 @@ open class PQImageFilter: PQBaseFilter {
     var mSticker: PQEditVisionTrackMaterialsModel?
     var newImage: UIImage?
     deinit {
-        BFLog(1, message: "image filter deinit 析构掉~")
+        FilterLog(1, message: "image filter deinit 析构掉~")
         newImage = nil
 
         if imageTexture != 0 {
@@ -42,7 +42,7 @@ open class PQImageFilter: PQBaseFilter {
             newImage = UIImage.init(data: sticker.originalData!)
         }else{
             if mSticker!.locationPath.count == 0 {
-                BFLog(2, message: "图片数据为空,创建失败")
+                FilterLog(2, message: "图片数据为空,创建失败")
                 return
             }
             
@@ -50,7 +50,7 @@ open class PQImageFilter: PQBaseFilter {
             if (!imageFilePath.contains("var/mobile/Media")) {
                 imageFilePath = documensDirectory + imageFilePath
             }
-            BFLog(message: "imageFilePath is \(imageFilePath)")
+            FilterLog(message: "imageFilePath is \(imageFilePath)")
             newImage = UIImage(contentsOfFile:imageFilePath)
         }
 
@@ -63,7 +63,7 @@ open class PQImageFilter: PQBaseFilter {
             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)")
+            FilterLog(message: "newImage is \(newImage?.size.width ?? 0) \(newImage?.size.height ?? 0)")
         }
 
         autoreleasepool {
@@ -73,30 +73,30 @@ open class PQImageFilter: PQBaseFilter {
                 if (!imageFilePath.contains("var/mobile/Media")) {
                     imageFilePath = documensDirectory + imageFilePath
                 }
-                BFLog(message: "imageFilePath is \(imageFilePath)")
+                FilterLog(message: "imageFilePath is \(imageFilePath)")
                 if FileManager.default.fileExists(atPath: imageFilePath) {
                     // 有可能是 WEBP
                     let fileData: Data = try! Data(contentsOf: URL(fileURLWithPath: imageFilePath))
                     if fileData.count != 0, fileData.isWebPFormat {
                         newImage = WebPProcessor.default.process(item: ImageProcessItem.data(fileData), options: KingfisherParsedOptionsInfo([.onlyLoadFirstFrame, .scaleFactor(1)]))
                     }
-                } else { BFLog(2, message: "文件不存在") }
+                } else { FilterLog(2, message: "文件不存在") }
             }
         }
 
         if newImage?.cgImage != nil {
-            BFLog(message: "提前加载图片。。。。timelineIn : \(String(describing: mSticker?.timelineIn)) timelineOut :\(String(describing: mSticker?.timelineOut)) \(String(describing: mSticker?.locationPath))")
+            FilterLog(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!") }
+        } else { FilterLog(2, message: "image filter init error image data is nil!") }
 
         // 保证是16的公倍数
         let aptImageSize = NXAVUtil.aptSize(newImage?.size ?? CGSize.zero)
         if !__CGSizeEqualToSize(aptImageSize, newImage?.size ?? CGSize.zero) {
-            BFLog(2, message: "原图大小宽度不是16的倍数 \(newImage!.size)")
+            FilterLog(2, message: "原图大小宽度不是16的倍数 \(newImage!.size)")
             //            newImage = newImage?.nx_scaleToSize(size: aptImageSize)
-            BFLog(2, message: "归16后大小 \(newImage!.size)")
+            FilterLog(2, message: "归16后大小 \(newImage!.size)")
         }
     }
 
@@ -108,7 +108,7 @@ open class PQImageFilter: PQBaseFilter {
     ////        if mSticker!.timelineIn != 0, currTime >= mSticker!.timelineIn, currTime <= mSticker!.timelineOut, imageTexture == 0 {
     ////            if newImage != nil {
     //////                imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
-    ////            } else { BFLog(message: "image filter init error image data is nil!") }
+    ////            } else { FilterLog(message: "image filter init error image data is nil!") }
     ////        }
     //    }
 
@@ -132,22 +132,22 @@ open class PQImageFilter: PQBaseFilter {
         releaseIncomingFramebuffers()
 
         if newImage == nil {
-            BFLog(2, message: "图片数据有错误!!!! 检查数据\(mSticker!.locationPath)")
+            FilterLog(2, message: "图片数据有错误!!!! 检查数据\(mSticker!.locationPath)")
             return
         }
 
-        BFLog(2, message: " image filter 当前时间: \(currTime) \(newImage!.size)")
+        FilterLog(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))")
+            FilterLog(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)")
+            FilterLog(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 !!!!!重新创建")
+                FilterLog(2, message: "imageTexture is error !!!!!重新创建")
                 imageTexture = PQGPUImageTools.setupTexture(image: newImage!.cgImage!)
             }
 

+ 41 - 28
BFFramework/Classes/PQGPUImage/akfilters/PQMovieFilter.swift

@@ -111,9 +111,11 @@ class PQMovieFilter: PQBaseFilter {
     
     // 当前帧 id
     var framebufferIndex:Int = 0
+    
+    var imageVertexBuffer: GLuint = 0
 
     deinit {
-        BFLog(1, message: "movie filter release")
+        FilterLog(1, message: "movie filter release")
         clearData()
     }
 
@@ -122,6 +124,11 @@ class PQMovieFilter: PQBaseFilter {
         if assetReader != nil {
             assetReader?.cancelReading()
         }
+        
+        if(imageVertexBuffer != 0){
+            PQGPUImageTools.deleteVBO(imageVertexBuffer)
+            imageVertexBuffer = 0
+        }
     }
 
     public init(url: URL) {
@@ -139,7 +146,7 @@ class PQMovieFilter: PQBaseFilter {
         super.init(fragmentShader: PassthroughFragmentShader, numberOfInputs: 1)
         moveSticker = movieSticker
         stickerInfo = movieSticker
-        BFLog(2, message: "资源裁剪的 开始时间\(moveSticker!.model_in)  结束时间: \(moveSticker!.out)")
+        FilterLog(2, message: "资源裁剪的 开始时间\(moveSticker!.model_in)  结束时间: \(moveSticker!.out)")
         if moveSticker!.videoIsCrop() {
             requestedStartTime = CMTimeMake(value: Int64(moveSticker!.model_in) * Int64(BASE_FILTER_TIMESCALE), timescale: BASE_FILTER_TIMESCALE)
         }
@@ -154,14 +161,14 @@ class PQMovieFilter: PQBaseFilter {
             if (!videoFilePath.contains("var/mobile/Media")) && (!videoFilePath.contains("BFFramework_Resources.bundle")) {
                 videoFilePath = documensDirectory + videoFilePath
             }
-            BFLog(2, message: "视频地址 \(String(describing: videoFilePath))")
+            FilterLog(2, message: "视频地址 \(String(describing: videoFilePath))")
             try loadAsset(url: URL(fileURLWithPath: videoFilePath), videoComposition: nil)
 
         } catch {
             NXLog(message: "load asset  with error: \(error)")
         }
 
-        BFLog(2, message: " move FILTER 初始化 开始显示时间:\(movieSticker.timelineIn) 结束显示时间:\(movieSticker.timelineOut)  裁剪开始时间:\(movieSticker.model_in)  裁剪结束时间:\(movieSticker.out)  路径:\(String(describing: movieSticker.locationPath)) 时长 \(CMTimeGetSeconds(asset?.duration ?? .zero))")
+        FilterLog(2, message: " move FILTER 初始化 开始显示时间:\(movieSticker.timelineIn) 结束显示时间:\(movieSticker.timelineOut)  裁剪开始时间:\(movieSticker.model_in)  裁剪结束时间:\(movieSticker.out)  路径:\(String(describing: movieSticker.locationPath)) 时长 \(CMTimeGetSeconds(asset?.duration ?? .zero))")
 
         startReading()
 //
@@ -186,7 +193,7 @@ class PQMovieFilter: PQBaseFilter {
         inputSize = inputFramebuffer.sizeForTargetOrientation(.portrait)
 
         currentTime = CMTime(value: inputFramebuffer.timingStyle.timestamp!.value, timescale: inputFramebuffer.timingStyle.timestamp!.timescale)
-        BFLog(2, message: "wwwwwwwww duration is currentSampleTime is \(CMTimeGetSeconds(currentTime))")
+        FilterLog(2, message: "wwwwwwwww duration is currentSampleTime is \(CMTimeGetSeconds(currentTime))")
 
         renderFramebuffer = sharedImageProcessingContext.framebufferCache.requestFramebufferWithProperties(orientation: mImageOrientation, size: inputSize, stencil: false)
 
@@ -198,10 +205,10 @@ class PQMovieFilter: PQBaseFilter {
                              vertexBufferObject: sharedImageProcessingContext.standardImageVBO, inputTextures: [textureProperties])
         releaseIncomingFramebuffers()
 
-        BFLog(2, message: "开始显示 movefilter 了 开始\(String(describing: moveSticker?.timelineIn)) 结束 :\(String(describing: moveSticker?.timelineOut)) currentTime \(CMTimeGetSeconds(currentTime)) 裁剪开始时间:\(String(describing: moveSticker?.model_in)) ")
+        FilterLog(2, message: "开始显示 movefilter 了 开始\(String(describing: moveSticker?.timelineIn)) 结束 :\(String(describing: moveSticker?.timelineOut)) currentTime \(CMTimeGetSeconds(currentTime)) 裁剪开始时间:\(String(describing: moveSticker?.model_in)) ")
 
         if enableSeek {
-            BFLog(2, message: "seek 到 \(CMTimeGetSeconds(currentTime))  ")
+            FilterLog(2, message: "seek 到 \(CMTimeGetSeconds(currentTime))  ")
             resetRangeTime(startTime: currentTime)
             enableSeek = false
         }
@@ -225,7 +232,7 @@ class PQMovieFilter: PQBaseFilter {
         var showtimeStamp = CMTime(value:targetTime, timescale: BASE_FILTER_TIMESCALE)
         showtimeStamp = CMTimeAdd(showtimeStamp, stickerModelIn)
 
-        BFLog(message: "showtimeStamp is \(CMTimeGetSeconds(showtimeStamp))")
+        FilterLog(message: "showtimeStamp is \(CMTimeGetSeconds(showtimeStamp))")
         readNextVideoFrame(showTimeStamp: showtimeStamp)
     
         framebufferIndex = framebufferIndex + 1
@@ -236,7 +243,7 @@ class PQMovieFilter: PQBaseFilter {
     // 原视频角度类型
     func moveAssetRotation() -> NXGPUImageRotationMode {
         let Angle: Int = PQPHAssetVideoParaseUtil.videoRotationAngle(assert: asset!)
-//        BFLog(2, message: "原视频素材Angle is \(Angle)")
+//        FilterLog(2, message: "原视频素材Angle is \(Angle)")
         // see https://my.oschina.net/NycoWang/blog/904105
         switch Angle {
         case -90, 270:
@@ -261,14 +268,14 @@ class PQMovieFilter: PQBaseFilter {
             stickerFPS = asset!.tracks(withMediaType: .video).first?.nominalFrameRate ?? 0.0
             let bitRate = asset!.tracks(withMediaType: .video).first?.estimatedDataRate
 
-            BFLog(2, message: "move filter asset  fps is \(String(describing: stickerFPS))  bit rate is \(bitRate ?? 0)")
+            FilterLog(2, message: "move filter asset  fps is \(String(describing: stickerFPS))  bit rate is \(bitRate ?? 0)")
 
             self.videoComposition = videoComposition
             self.playAtActualSpeed = playAtActualSpeed
 
             yuvConversionShader = crashOnShaderCompileFailure("MovieInput") { try sharedImageProcessingContext.programForVertexShader(defaultVertexShaderForInputs(2), fragmentShader: YUVConversionFullRangeFragmentShader) }
             self.audioSettings = audioSettings
-        } else { BFLog(2, message: "asset is nil") }
+        } else { FilterLog(2, message: "asset is nil") }
     }
 
     // MARK: -
@@ -285,7 +292,7 @@ class PQMovieFilter: PQBaseFilter {
             let videoTrack: AVAssetTrack = asset!.tracks(withMediaType: .video).first!
 
             videoSize = videoTrack.naturalSize
-            BFLog(2, message: "视频大小为 : \(videoSize)")
+            FilterLog(2, message: "视频大小为 : \(videoSize)")
 
             if videoComposition == nil {
                 let readerVideoTrackOutput = AVAssetReaderTrackOutput(track: asset!.tracks(withMediaType: .video).first!, outputSettings: outputSettings)
@@ -299,7 +306,7 @@ class PQMovieFilter: PQBaseFilter {
             }
             assetReader!.timeRange = CMTimeRange(start: CMTime(value: Int64((moveSticker?.model_in ?? 0) * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE), duration: CMTimeMake(value: Int64(((moveSticker?.out ?? 0) - (moveSticker?.model_in ?? 0)) * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE))
 
-            BFLog(2, message: "set   assetReader!.timeRange is \(assetReader!.timeRange)")
+            FilterLog(2, message: "set   assetReader!.timeRange is \(assetReader!.timeRange)")
 
             return assetReader
         } catch {
@@ -309,7 +316,7 @@ class PQMovieFilter: PQBaseFilter {
     }
 
     open func startReading() {
-        BFLog(2, message: "开始初始化")
+        FilterLog(2, message: "开始初始化")
         mach_timebase_info(&timebaseInfo)
 
         assetReader?.cancelReading()
@@ -336,7 +343,7 @@ class PQMovieFilter: PQBaseFilter {
 
     // 设置解码开始时间
     func resetRangeTime(startTime: CMTime = .zero) {
-        BFLog(2, message: "\(String(describing: moveSticker?.locationPath)) 取帧的时间 \(CMTimeGetSeconds(requestedStartTime ?? .zero))")
+        FilterLog(2, message: "\(String(describing: moveSticker?.locationPath)) 取帧的时间 \(CMTimeGetSeconds(requestedStartTime ?? .zero))")
         requestedStartTime = startTime
         startReading()
     }
@@ -352,12 +359,12 @@ class PQMovieFilter: PQBaseFilter {
 
         // 最后一帧的PTS > 要显示的目标时间 就不从解码器要数据,直接返回 view 不刷新 只有慢速时会调用
 //        if CMTimeGetSeconds(targetTimeStamp) >= CMTimeGetSeconds(showTimeStamp) + (stickerInfo?.model_in ?? 0) && CMTimeGetSeconds(targetTimeStamp) != 0 {
-            BFLog(2, message: "28797speedRate  目标显示时间 \(String(format: "%.6f", (CMTimeGetSeconds(showTimeStamp)))) 最后显示的时间 \(String(format: "%.6f", CMTimeGetSeconds(targetTimeStamp))) 裁剪开始时间:\(String(describing: moveSticker?.model_in)) speedRate is \(stickerInfo!.speedRate)")
+            FilterLog(2, message: "28797speedRate  目标显示时间 \(String(format: "%.6f", (CMTimeGetSeconds(showTimeStamp)))) 最后显示的时间 \(String(format: "%.6f", CMTimeGetSeconds(targetTimeStamp))) 裁剪开始时间:\(String(describing: moveSticker?.model_in)) speedRate is \(stickerInfo!.speedRate)")
             return
         }
 
         if assetReader == nil {
-            BFLog(2, message: "assetReader is error 出现严重错误!!!!!!!!!!!!!!")
+            FilterLog(2, message: "assetReader is error 出现严重错误!!!!!!!!!!!!!!")
             return
         }
 
@@ -378,7 +385,7 @@ class PQMovieFilter: PQBaseFilter {
             count = count + 1
             sampleBuffer = videoTrackOutput!.copyNextSampleBuffer()
             if sampleBuffer == nil {
-                BFLog(2, message: " copyNextSampleBuffer is nil error!!!")
+                FilterLog(2, message: " copyNextSampleBuffer is nil error!!!")
                 return
             }
             targetTimeStamp = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer!)
@@ -387,12 +394,12 @@ class PQMovieFilter: PQBaseFilter {
             if sampleBuffer != nil && CMTimeGetSeconds(targetTimeStamp) >= CMTimeGetSeconds(showTimeStamp) {
                 let endDecoderTime: TimeInterval = Date().timeIntervalSince1970
                 
-                BFLog(2, message: " 28797speedRate is \(stickerInfo!.speedRate) 当前主线时间为:\(String(format: "%.6f", CMTimeGetSeconds(currentTime))) 查找的帧时间为:\(String(format: "%.6f", CMTimeGetSeconds(showTimeStamp).truncatingRemainder(dividingBy: moveSticker!.out))) 要命中时间:\(CMTimeGetSeconds(showTimeStamp)) 命中时间为: \(String(format: "%.6f", CMTimeGetSeconds(targetTimeStamp))) 差值\(CMTimeGetSeconds(targetTimeStamp) - (stickerInfo?.model_in ?? 0)) 查找耗时为:\(String(format: "%.6f", TimeInterval(endDecoderTime - beginDecoderTime))) 查找次数\(count)  进场时间: \(String(describing: moveSticker?.timelineIn))  裁剪开始时间:\(String(describing: moveSticker?.model_in)) 裁剪结束时间:\(String(describing: moveSticker?.out)) 原视频时长: \(CMTimeGetSeconds(asset?.duration ?? .zero))")
+                FilterLog(2, message: " 28797speedRate is \(stickerInfo!.speedRate) 当前主线时间为:\(String(format: "%.6f", CMTimeGetSeconds(currentTime))) 查找的帧时间为:\(String(format: "%.6f", CMTimeGetSeconds(showTimeStamp).truncatingRemainder(dividingBy: moveSticker!.out))) 要命中时间:\(CMTimeGetSeconds(showTimeStamp)) 命中时间为: \(String(format: "%.6f", CMTimeGetSeconds(targetTimeStamp))) 差值\(CMTimeGetSeconds(targetTimeStamp) - (stickerInfo?.model_in ?? 0)) 查找耗时为:\(String(format: "%.6f", TimeInterval(endDecoderTime - beginDecoderTime))) 查找次数\(count)  进场时间: \(String(describing: moveSticker?.timelineIn))  裁剪开始时间:\(String(describing: moveSticker?.model_in)) 裁剪结束时间:\(String(describing: moveSticker?.out)) 原视频时长: \(CMTimeGetSeconds(asset?.duration ?? .zero))")
                 break
 
             }
 //            else {
-//                BFLog(2, message: "不丢帧显示  查找的帧时间为:\(String(format: "%.6f", CMTimeGetSeconds(showTimeStamp).truncatingRemainder(dividingBy: moveSticker!.out)))  命中时间为: \(String(format: "%.6f", CMTimeGetSeconds(targetTimeStamp)))")
+//                FilterLog(2, message: "不丢帧显示  查找的帧时间为:\(String(format: "%.6f", CMTimeGetSeconds(showTimeStamp).truncatingRemainder(dividingBy: moveSticker!.out)))  命中时间为: \(String(format: "%.6f", CMTimeGetSeconds(targetTimeStamp)))")
 ////                usleep(2)
 ////                sharedImageProcessingContext.runOperationSynchronously {
 ////                    self.renderPixelBuffler(movieFrame: CMSampleBufferGetImageBuffer(sampleBuffer!)!, withSampleTime: currentTime)
@@ -411,23 +418,23 @@ class PQMovieFilter: PQBaseFilter {
             }
             return
         } else {
-            BFLog(2, message: "sampleBuffer is  nil data is error self.assetReader?.status is \(String(describing: assetReader?.status))")
+            FilterLog(2, message: "sampleBuffer is  nil data is error self.assetReader?.status is \(String(describing: assetReader?.status))")
         }
         // 二, 已经播放完一次
         if assetReader?.status == .completed {
-            BFLog(message: "已经播放完一次")
+            FilterLog(message: "已经播放完一次")
             // 1 自动循环模式 重头开始循环
             if moveSticker?.materialDurationFit?.fitType == adapterMode.loopAuto.rawValue {
-                BFLog(2, message: "自动循环模式 重头开始循环 \(CMTimeGetSeconds(currentTime))")
+                FilterLog(2, message: "自动循环模式 重头开始循环 \(CMTimeGetSeconds(currentTime))")
 
                 startReading()
 
             } else if moveSticker?.materialDurationFit?.fitType == adapterMode.staticFrame.rawValue {
                 // 2),定帧处理
                 if lastImageBuffer != nil {
-                    BFLog(2, message: "处理显示定帧")
+                    FilterLog(2, message: "处理显示定帧")
                     let currTime = CMTimeGetSeconds(currentTime)
-                    BFLog(2, message: "process time is \(currTime)")
+                    FilterLog(2, message: "process time is \(currTime)")
                     sharedImageProcessingContext.runOperationSynchronously { [weak self] in
                         if let imgBuffer = self?.lastImageBuffer {
                             renderPixelBuffler(movieFrame: imgBuffer, withSampleTime: currentTime)
@@ -444,7 +451,7 @@ class PQMovieFilter: PQBaseFilter {
     ///   - withSampleTime: 渲染时间戳,不是帧的 PTS 是渲染的时间
     func renderPixelBuffler(movieFrame: CVPixelBuffer, withSampleTime: CMTime) {
         // NV12 会返回 2,Y分量和UV 分量, 如果buffer 是BGRA 则返回0
-        BFLog(2, message: "CVPixelBufferGetPlaneCount is \(CVPixelBufferGetPlaneCount(movieFrame))")
+        FilterLog(2, message: "CVPixelBufferGetPlaneCount is \(CVPixelBufferGetPlaneCount(movieFrame))")
 
         let bufferHeight = CVPixelBufferGetHeight(movieFrame)
         let bufferWidth = CVPixelBufferGetWidth(movieFrame)
@@ -515,7 +522,7 @@ class PQMovieFilter: PQBaseFilter {
         convertYUVToRGBAK(shader: yuvConversionShader!, luminanceFramebuffer: luminanceFramebuffer, chrominanceFramebuffer: chrominanceFramebuffer, resultFramebuffer: movieFramebuffer, colorConversionMatrix: conversionMatrix)
         CVPixelBufferUnlockBaseAddress(movieFrame, CVPixelBufferLockFlags(rawValue: CVOptionFlags(0)))
 
-        BFLog(2, message: "mp4 render process time is \(CMTimeGetSeconds(withSampleTime))")
+        FilterLog(2, message: "mp4 render process time is \(CMTimeGetSeconds(withSampleTime))")
         movieFramebuffer.timingStyle = .videoFrame(timestamp: Timestamp(withSampleTime))
 
         movieFramebuffer.userInfo = framebufferUserInfo
@@ -545,11 +552,17 @@ class PQMovieFilter: PQBaseFilter {
 
         let verticesPoint: [GLfloat] = PQGPUImageTools.getVerticesPoint(sticker: moveSticker!, textureSize: (moveAssetRotation() == .rotateLeftTextureCoordinates || moveAssetRotation() == .rotateRightTextureCoordinates) ? CGSize(width: videoSize.height, height: videoSize.width) : videoSize, cannvasSize: inputSize)
 
+        imageVertexBuffer = PQGPUImageTools.NXGenerateVBO(for: verticesPoint)
         renderQuadWithShader(shader,
                              uniformSettings: uniformSettings,
-                             vertexBufferObject: PQGPUImageTools.NXGenerateVBO(for: verticesPoint),
+                             vertexBufferObject: imageVertexBuffer,
                              inputTextures: cropTextureProperties)
         releaseIncomingFramebuffers()
+        
+        if(imageVertexBuffer != 0){
+            PQGPUImageTools.deleteVBO(imageVertexBuffer)
+            imageVertexBuffer = 0
+        }
 
         luminanceFramebuffer.unlock()
         chrominanceFramebuffer.unlock()

+ 48 - 48
BFFramework/Classes/PQGPUImage/akfilters/PQMovieInput.swift

@@ -141,7 +141,7 @@ public class PQMovieInput: ImageSource {
      // 画布的大小 注意要是偶数 要不在 IOS 13上会有绿边 自动放大到偶数
     public var mShowVidoSize: CGSize = cVideoCannvasSizeOneToOne {
         didSet {
-            BFLog(2, message: "mShowVidoSize is move input  \(mShowVidoSize)")
+            FilterLog(2, message: "mShowVidoSize is move input  \(mShowVidoSize)")
             do {
                 displayLink?.isPaused = true
                 imageFramebuffer = try Framebuffer(context: sharedImageProcessingContext, orientation: .portrait, size: GLSize(width: GLint(mShowVidoSize.width), height: GLint(mShowVidoSize.height)), textureOnly: true)
@@ -155,7 +155,7 @@ public class PQMovieInput: ImageSource {
     // 初始化方法
     public init(asset: AVAsset, videoComposition: AVVideoComposition?, audioMix: AVAudioMix?, playAtActualSpeed: Bool = false, loop: Bool = false, audioSettings: [String: Any]? = nil) throws {
         self.asset = asset
-        BFLog(2, message: "asset 资源的总时长\(asset.duration.seconds) \(asset.duration)")
+        FilterLog(2, message: "asset 资源的总时长\(asset.duration.seconds) \(asset.duration)")
         self.audioMix = audioMix
         self.audioSettings = audioSettings
         self.videoComposition = videoComposition
@@ -163,7 +163,7 @@ public class PQMovieInput: ImageSource {
         self.loop = loop
         yuvConversionShader = crashOnShaderCompileFailure("MovieInput") { try sharedImageProcessingContext.programForVertexShader(defaultVertexShaderForInputs(2), fragmentShader: YUVConversionFullRangeFragmentShader) }
         if asset.duration.seconds <= 0 {
-            BFLog(2, message: "asset 资源的总时长为0,返回")
+            FilterLog(2, message: "asset 资源的总时长为0,返回")
             return
         }
   
@@ -200,7 +200,7 @@ public class PQMovieInput: ImageSource {
         self.audioInputStatusObserver?.invalidate()
         self.avPlayerTimeObserver?.invalidate()
 
-        BFLog(1, message: "movieinput release")
+        FilterLog(1, message: "movieinput release")
     }
 
     // MARK: -
@@ -212,7 +212,7 @@ public class PQMovieInput: ImageSource {
         isPlay = false
         beginTime = 0
         currentTime = .zero
-        BFLog(2, message: "初始化播放开始时间、\(CMTimeGetSeconds(timeRange.start)) 结束时间\(CMTimeGetSeconds(timeRange.end)) 播放总时长:\(CMTimeGetSeconds(timeRange.end) - CMTimeGetSeconds(timeRange.start))")
+        FilterLog(2, message: "初始化播放开始时间、\(CMTimeGetSeconds(timeRange.start)) 结束时间\(CMTimeGetSeconds(timeRange.end)) 播放总时长:\(CMTimeGetSeconds(timeRange.end) - CMTimeGetSeconds(timeRange.start))")
   
         playeTimeRange = timeRange
         startTime = playeTimeRange.start
@@ -222,7 +222,7 @@ public class PQMovieInput: ImageSource {
 
     @objc func displayLinkClick(_ displayLink: CADisplayLink) {
         if assetReader == nil {
-            BFLog(2, message: "self.assetReader is null !!!!!!!!!!")
+            FilterLog(2, message: "self.assetReader is null !!!!!!!!!!")
             displayLink.isPaused = true
             return
         }
@@ -245,7 +245,7 @@ public class PQMovieInput: ImageSource {
                 if(midTime < 0.0001){
                     midTime = 0
                 }
-                BFLog(message: "CFAbsoluteTimeGetCurrent()\(CFAbsoluteTimeGetCurrent()) - self.beginTime  is:::::\(self.beginTime) 差值 \(midTime)")
+                FilterLog(message: "CFAbsoluteTimeGetCurrent()\(CFAbsoluteTimeGetCurrent()) - self.beginTime  is:::::\(self.beginTime) 差值 \(midTime)")
               
                 self.currentTime = CMTimeMakeWithSeconds(midTime +  CMTimeGetSeconds(startTime ?? CMTime.zero), preferredTimescale: BASE_FILTER_TIMESCALE)
             }else {
@@ -257,12 +257,12 @@ public class PQMovieInput: ImageSource {
   
             let prgressValue = currTime / Float64(duration)
             
-            BFLog(2, message: "\(mIsExport) MovieOutput total frames appended:播放进行中 总用时: \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0)) 播放器开始时间:\(CMTimeGetSeconds(playeTimeRange.start)) 播放器原始结束时间:\(CMTimeGetSeconds(playeTimeRange.end))    总时间:\(CMTimeGetSeconds(playeTimeRange.end) - CMTimeGetSeconds(playeTimeRange.start)) 播放进度当前时间:\(currTime) 进度:\(prgressValue) 帧id \(totalFramesSent)")
+            FilterLog(2, message: "\(mIsExport) MovieOutput total frames appended:播放进行中 总用时: \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0)) 播放器开始时间:\(CMTimeGetSeconds(playeTimeRange.start)) 播放器原始结束时间:\(CMTimeGetSeconds(playeTimeRange.end))    总时间:\(CMTimeGetSeconds(playeTimeRange.end) - CMTimeGetSeconds(playeTimeRange.start)) 播放进度当前时间:\(currTime) 进度:\(prgressValue) 帧id \(totalFramesSent)")
             totalFramesSent += 1
     
-            BFLog(2, message: "2222222222播放进行中 总用时: \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0)) 播放进度当前时间:\(currTime) 总时间为:\(duration)进度:\(prgressValue) 音频时长:\(    CMTimeGetSeconds(asset.duration) )")
+            FilterLog(2, message: "2222222222播放进行中 总用时: \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0)) 播放进度当前时间:\(currTime) 总时间为:\(duration)进度:\(prgressValue) 音频时长:\(    CMTimeGetSeconds(asset.duration) )")
             if currTime / duration > 1{
-                BFLog(2, message: "全部播放完成 总用时为:\(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0))")
+                FilterLog(2, message: "全部播放完成 总用时为:\(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0))")
                 if(self.completion != nil){
                     self.completion?()
                 }
@@ -276,7 +276,7 @@ public class PQMovieInput: ImageSource {
                 if !mIsExport {
                     self.start(isFreeBuffer: true,timeRange: playeTimeRange)
                 }else{
-                    BFLog(message: "强制停止!!!!")
+                    FilterLog(message: "强制停止!!!!")
                     displayLink.isPaused = true
                     return
                 }
@@ -286,9 +286,9 @@ public class PQMovieInput: ImageSource {
                 self.conditionLock.lock()
                 while self.readingShouldWait {
                     self.synchronizedEncodingDebugPrint("Disable reading")
-                    BFLog(2, message: "Disable reading 开始等待 \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0)) ")
+                    FilterLog(2, message: "Disable reading 开始等待 \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0)) ")
                     self.conditionLock.wait()
-                    BFLog(2, message: "Enable reading  停止等待 \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0))")
+                    FilterLog(2, message: "Enable reading  停止等待 \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0))")
                 }
                 self.conditionLock.unlock()
 
@@ -321,11 +321,11 @@ public class PQMovieInput: ImageSource {
     @objc public func start(isFreeBuffer: Bool, isExport: Bool = false,timeRange:CMTimeRange = CMTimeRange.init()) {
         
         debugStartTime = CFAbsoluteTimeGetCurrent()
-        BFLog(2, message: "开始播放的系统时钟时间 \(String(describing: debugStartTime))")
+        FilterLog(2, message: "开始播放的系统时钟时间 \(String(describing: debugStartTime))")
         
         playeTimeRange = timeRange
         readerAudioTrackOutput = nil
-        BFLog(2, message: "PQMoveInput开始")
+        FilterLog(2, message: "PQMoveInput开始")
         mFreeBuffer = isFreeBuffer
         assetReader = createReader()
     
@@ -333,7 +333,7 @@ public class PQMovieInput: ImageSource {
 
         isPlay = true
         if assetReader == nil {
-            BFLog(2, message: "assetReader is null!!!!!")
+            FilterLog(2, message: "assetReader is null!!!!!")
             return
         }
 
@@ -342,7 +342,7 @@ public class PQMovieInput: ImageSource {
             try NSObject.catchException { [self] in
                 if(!isUsedAVPlayer){
                     guard self.assetReader.startReading() else {
-                        BFLog(2, message: "ERROR: Unable to start reading: \(String(describing: self.assetReader.error))")
+                        FilterLog(2, message: "ERROR: Unable to start reading: \(String(describing: self.assetReader.error))")
                         return
                     }
                 }else{
@@ -354,19 +354,19 @@ public class PQMovieInput: ImageSource {
               
             }
         } catch {
-            BFLog(2, message: "ERROR: Unable to start reading: \(error)")
+            FilterLog(2, message: "ERROR: Unable to start reading: \(error)")
             return
         }
 
-        BFLog(2, message: "assetReader.outputs count is \(assetReader.outputs)")
+        FilterLog(2, message: "assetReader.outputs count is \(assetReader.outputs)")
         for output in assetReader.outputs {
             if output.mediaType == AVMediaType.video {
                 readerVideoTrackOutput = output
-                BFLog(2, message: " set  readerVideoTrackOutput")
+                FilterLog(2, message: " set  readerVideoTrackOutput")
             }
             if output.mediaType == AVMediaType.audio {
                 readerAudioTrackOutput = output
-                BFLog(2, message: " set  readerAudioTrackOutput")
+                FilterLog(2, message: " set  readerAudioTrackOutput")
             }
         }
 
@@ -383,11 +383,11 @@ public class PQMovieInput: ImageSource {
     }
 
     public func cancel() {
-        BFLog(2, message: "PQMoveInput取消")
+        FilterLog(2, message: "PQMoveInput取消")
         isPlay = false
 
         // 将定时器移除主循环
-        displayLink?.remove(from: RunLoop.main, forMode: RunLoop.Mode.default)
+        displayLink?.remove(from: RunLoop.main, forMode: RunLoop.Mode.common)
         // 停止定时器
         displayLink?.invalidate()
         displayLink = nil
@@ -398,7 +398,7 @@ public class PQMovieInput: ImageSource {
     }
 
     public func resume() {
-        BFLog(2, message: "PQMoveInput恢复播放")
+        FilterLog(2, message: "PQMoveInput恢复播放")
         mFreeBuffer = false
         isPlay = true
         if !mIsExport{
@@ -413,15 +413,15 @@ public class PQMovieInput: ImageSource {
 
     public func pause() {
         if !isPlay {
-            BFLog(2, message: "还不是播放状态")
+            FilterLog(2, message: "还不是播放状态")
             return
         }
 
         if displayLink == nil {
-            BFLog(2, message: "displayLink is erorr displaye bug !!!!")
+            FilterLog(2, message: "displayLink is erorr displaye bug !!!!")
             return
         }
-        BFLog(2, message: "PQMoveInput暂停 displayLink.timestamp:  \(displayLink!.timestamp)")
+        FilterLog(2, message: "PQMoveInput暂停 displayLink.timestamp:  \(displayLink!.timestamp)")
         isPlay = false
 
         // 暂停帧的刷新 true:停 ; false:开始
@@ -437,7 +437,7 @@ public class PQMovieInput: ImageSource {
             startTime = currentTime
         }
 
-        BFLog(2, message: "暂停时间:\(currTime)")
+        FilterLog(2, message: "暂停时间:\(currTime)")
 
         beginTime = 0
         
@@ -453,10 +453,10 @@ public class PQMovieInput: ImageSource {
     func createReader() -> AVAssetReader? {
         do {
             let assetReader = try AVAssetReader(asset: asset)
-            BFLog(2, message: "assetReader init \(assetReader)  asset url is \(asset)")
+            FilterLog(2, message: "assetReader init \(assetReader)  asset url is \(asset)")
             if audioMix == nil {
                 if let audioTrack = asset.tracks(withMediaType: .audio).first, let _ = audioEncodingTarget {
-                    BFLog(1, message: "audioTrack start \(audioTrack.timeRange.start) \(audioTrack.timeRange.duration.value)")
+                    FilterLog(1, message: "audioTrack start \(audioTrack.timeRange.start) \(audioTrack.timeRange.duration.value)")
 
                     let readerAudioTrackOutput = AVAssetReaderTrackOutput(track: audioTrack, outputSettings: audioSettings)
                     readerAudioTrackOutput.alwaysCopiesSampleData = false
@@ -467,7 +467,7 @@ public class PQMovieInput: ImageSource {
                 }
 
             } else {
-                BFLog(2, message: "self.asset.tracks is \(asset.tracks.count)")
+                FilterLog(2, message: "self.asset.tracks is \(asset.tracks.count)")
                 let readerAudioTrackOutput = AVAssetReaderAudioMixOutput(audioTracks: asset.tracks(withMediaType: .audio), audioSettings: audioSettings)
                 readerAudioTrackOutput.audioMix = audioMix
                 readerAudioTrackOutput.alwaysCopiesSampleData = false
@@ -475,21 +475,21 @@ public class PQMovieInput: ImageSource {
             }
 
             assetReader.timeRange = playeTimeRange
-            BFLog(2, message: "初始化播放器开始时间\(CMTimeGetSeconds(assetReader.timeRange.start)) 结束时间\(CMTimeGetSeconds(assetReader.timeRange.end)) 音乐的总时长\(asset.duration.seconds)")
+            FilterLog(2, message: "初始化播放器开始时间\(CMTimeGetSeconds(assetReader.timeRange.start)) 结束时间\(CMTimeGetSeconds(assetReader.timeRange.end)) 音乐的总时长\(asset.duration.seconds)")
        
 
             actualStartTime = nil
 
             return assetReader
         } catch {
-            BFLog(2, message: "ERROR: Unable to create asset reader: \(error)")
+            FilterLog(2, message: "ERROR: Unable to create asset reader: \(error)")
         }
         return nil
     }
 
     func readNextVideoFrame(with _: AVAssetReader) {
         
-        BFLog(2, message: "视频解码状态\(assetReader.status.rawValue)")
+        FilterLog(2, message: "视频解码状态\(assetReader.status.rawValue)")
      
         autoreleasepool {
             synchronizedEncodingDebugPrint("Process frame input")
@@ -501,7 +501,7 @@ public class PQMovieInput: ImageSource {
             
     
             let prgressValue = (currTime - start) / (duration - start)
-//            BFLog(1, message: "\(mIsExport) movinput 当前时间 is \(currTime) curr当前进度:\(prgressValue)")
+//            FilterLog(1, message: "\(mIsExport) movinput 当前时间 is \(currTime) curr当前进度:\(prgressValue)")
             progress?(currTime, duration, prgressValue)
 
             sharedImageProcessingContext.runOperationSynchronously { [weak self] in
@@ -513,12 +513,12 @@ public class PQMovieInput: ImageSource {
     func readNextAudioSample(with assetReader: AVAssetReader, from audioTrackOutput: AVAssetReaderOutput) {
         
         if(isUsedAVPlayer){
-            BFLog(2, message: "使用的 avplayer 播放模式")
+            FilterLog(2, message: "使用的 avplayer 播放模式")
             return
         }
        
         if !isPlay {
-            BFLog(2, message: "自动停到首帧的不处理音频")
+            FilterLog(2, message: "自动停到首帧的不处理音频")
             return
         }
         /*
@@ -527,35 +527,35 @@ public class PQMovieInput: ImageSource {
          case failed = 3
          case cancelled = 4
          */
-        BFLog(2, message: "音频解码状态\(assetReader.status.rawValue)")
+        FilterLog(2, message: "音频解码状态\(assetReader.status.rawValue)")
         
         autoreleasepool {
             guard let sampleBuffer = audioTrackOutput.copyNextSampleBuffer(),CMSampleBufferIsValid(sampleBuffer) else {
                 if(assetReader.status == .completed){
-                    BFLog(2, message: "提前结束的了!!!!\(String(describing: assetReader.error))")
+                    FilterLog(2, message: "提前结束的了!!!!\(String(describing: assetReader.error))")
                 }
                 if let movieOutput = synchronizedMovieOutput {
-                    BFLog(2, message: "this is runing assetWriterAudioInput  markAsFinished \(String(describing: assetReader.error)) \(assetReader)")
+                    FilterLog(2, message: "this is runing assetWriterAudioInput  markAsFinished \(String(describing: assetReader.error)) \(assetReader)")
 
                     movieOutput.movieProcessingContext.runOperationAsynchronously {
                         movieOutput.audioEncodingIsFinished = true
                         movieOutput.assetWriterAudioInput?.markAsFinished()
                     }
                 }
-                BFLog(2, message: "sampleBuffer is null 速度太快copy is error")
+                FilterLog(2, message: "sampleBuffer is null 速度太快copy is error")
                 return
             }
 
             synchronizedEncodingDebugPrint("Process audio sample input")
 
             let currentSampleTime = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer)
-            BFLog(2, message: "处理音频的时间戳 \(CMTimeGetSeconds(currentSampleTime)) 播放时间\(CMTimeGetSeconds(currentTime))")
+            FilterLog(2, message: "处理音频的时间戳 \(CMTimeGetSeconds(currentSampleTime)) 播放时间\(CMTimeGetSeconds(currentTime))")
 
             // https://www.itdaan.com/blog/2013/11/28/deb10f90970a5ea33f185c9faf2a0ab3.html
             if !mFreeBuffer {
                 audioEncodingTarget?.processAudioBuffer(sampleBuffer)
             }else{
-                BFLog(message: "不播放音频!!!!")
+                FilterLog(message: "不播放音频!!!!")
             }
         }
     }
@@ -565,7 +565,7 @@ public class PQMovieInput: ImageSource {
             let startPTime = CFAbsoluteTimeGetCurrent()
 
             imageFramebuffer.lock()
-            BFLog(message: "mIsExport:\(mIsExport) 实际设置的每一帧时间戳:\(CMTimeGetSeconds(currentTime))")
+            FilterLog(message: "mIsExport:\(mIsExport) 实际设置的每一帧时间戳:\(CMTimeGetSeconds(currentTime))")
             // 设置当前帧的时间戳
             imageFramebuffer.timingStyle = .videoFrame(timestamp: Timestamp(currentTime))
  
@@ -582,7 +582,7 @@ public class PQMovieInput: ImageSource {
                 totalFrameTimeDuringCapture += currentFrameTime
                 
                 
-                BFLog(2, message: "currentTime is \(String(format: "%.6f", CMTimeGetSeconds(currentTime))) 当前帧渲染时间 : \(String(format: "%.6f",1000.0 * currentFrameTime)) ms Average frame time : \(String(format: "%.6f", 1000.0 * totalFrameTimeDuringCapture / Double(totalFramesSent))) ms  totalFrameTimeDuringCapture is \(String(format: "%.6f",totalFrameTimeDuringCapture))")
+                FilterLog(2, message: "currentTime is \(String(format: "%.6f", CMTimeGetSeconds(currentTime))) 当前帧渲染时间 : \(String(format: "%.6f",1000.0 * currentFrameTime)) ms Average frame time : \(String(format: "%.6f", 1000.0 * totalFrameTimeDuringCapture / Double(totalFramesSent))) ms  totalFrameTimeDuringCapture is \(String(format: "%.6f",totalFrameTimeDuringCapture))")
              
             
 
@@ -638,7 +638,7 @@ public class PQMovieInput: ImageSource {
             conditionLock.signal()
             
         } else {
-            BFLog(1, message: "MovieOutput total frames appended 要加锁了")
+            FilterLog(1, message: "MovieOutput total frames appended 要加锁了")
             readingShouldWait = true
         }
         conditionLock.unlock()
@@ -730,7 +730,7 @@ extension PQMovieInput {
                 let range = strongSelf.musicPlayRanges?[strongSelf.indexRage]
                 playerItem.forwardPlaybackEndTime = range!.end
                 playerItem.reversePlaybackEndTime = range!.start
-//                BFLog(1, message: "curr: start ********************\(CMTimeGetSeconds(range.start)) - \(playerItem.reversePlaybackEndTime) - \(playerItem.forwardPlaybackEndTime)")
+//                FilterLog(1, message: "curr: start ********************\(CMTimeGetSeconds(range.start)) - \(playerItem.reversePlaybackEndTime) - \(playerItem.forwardPlaybackEndTime)")
                 strongSelf.avPlayer!.seek(to: playerItem.reversePlaybackEndTime) { isSuccess in
                     playerItem.seek(to: playerItem.reversePlaybackEndTime) { isSuccess in
                         strongSelf.avPlayer!.play()
@@ -743,7 +743,7 @@ extension PQMovieInput {
         
 //        avPlayerTimeObserver = avPlayer!.addPeriodicTimeObserver(forInterval: CMTime(value: 1, timescale: 4), queue: DispatchQueue.global()) {[weak self] time in
 //         //    进度监控
-//            BFLog(1, message: "cont:\(CMTimeGetSeconds(time) - CMTimeGetSeconds((self?.musicPlayRanges?.first!.start)!)), curr:\(CMTimeGetSeconds(time))")
+//            FilterLog(1, message: "cont:\(CMTimeGetSeconds(time) - CMTimeGetSeconds((self?.musicPlayRanges?.first!.start)!)), curr:\(CMTimeGetSeconds(time))")
 //        } as? NSKeyValueObservation
     }
     

+ 17 - 4
BFFramework/Classes/PQGPUImage/akfilters/Tools/PQCompositionExporter.swift

@@ -174,13 +174,26 @@ public class PQCompositionExporter {
         }
         var currentSticker:PQEditVisionTrackMaterialsModel?
        
-        for sticker in mStickers! {
-            BFLog(message: "sticker in \(sticker.timelineIn) out \(sticker.timelineOut)  currTime is \(currTime)")
-            if(sticker.timelineIn <= currTime && sticker.timelineOut >= currTime){
-                currentSticker = sticker
+//        for sticker in mStickers! {
+//            BFLog(message: "sticker in \(sticker.timelineIn) out \(sticker.timelineOut)  currTime is \(currTime)")
+//            if(sticker.timelineIn <= currTime && sticker.timelineOut >= currTime){
+//                currentSticker = sticker
+//                break
+//            }
+//        }
+        while true {
+            if let sticker = mStickers!.first {
+                if sticker.timelineIn <= currTime && sticker.timelineOut >= currTime {
+                    currentSticker = sticker
+                    break
+                }else{
+                    mStickers!.removeFirst()
+                }
+            }else{
                 break
             }
         }
+        
         //创建不同的filter
         if(currentSticker == nil){
             BFLog(message: "sticker data is error")

+ 4 - 4
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -1532,11 +1532,11 @@ extension PQStuckPointEditerController {
             }
         }
 
-        for point in stuckPoints {
-            BFLog(message: "没有 start end 计算后的卡点数\(point)")
-        }
+//        for point in stuckPoints {
+//            BFLog(message: "没有 start end 计算后的卡点数\(point)")
+//        }
         // 若音乐起点至第一个卡点点位之间时长t0<0.3时,此段时长与下一个点位时长合并,故第一段卡点部分时长为t0+d
-        if Float(stuckPointMusicData?.startTime ?? 0) - (stuckPoints.first ?? 0.0) < 0.3 {
+        while (stuckPoints.first ?? 0.0) - Float(stuckPointMusicData?.startTime ?? 0) < 0.3 {
             if stuckPoints.first != nil {
                 stuckPoints.removeFirst()
             }

+ 34 - 19
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointPublicController.swift

@@ -25,7 +25,8 @@ class PQStuckPointPublicController: PQBaseViewController {
     private var isSaveProjectSuccess: Bool = false // 是否保存项目完成
     private var isUploadSuccess: Bool = false // 是否上传完成
     private var isPublicSuccess: Bool = false // 是否发布完成
-    private var exportLocalURL: URL? // 导出的地址
+    // 导出正片的地址
+    private var exportLocalURL: URL?
     // 再创作数据
     private var reCreateData: PQReCreateModel?
     // 确定上传的数据
@@ -447,16 +448,16 @@ class PQStuckPointPublicController: PQBaseViewController {
     
     // 保存重试
     lazy var saveRetryBtn: UIButton = {
-        let finishedBtn = UIButton(type: .custom)
-        finishedBtn.setTitle("重试", for: .normal)
-        finishedBtn.setTitleColor(UIColor.white, for: .normal)
-        finishedBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
-        finishedBtn.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
-        finishedBtn.tag = 97
-        finishedBtn.isHidden = true
-        finishedBtn.addCorner(corner: 5)
-        finishedBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
-        return finishedBtn
+        let saveRetryBtn = UIButton(type: .custom)
+        saveRetryBtn.setTitle("重试", for: .normal)
+        saveRetryBtn.setTitleColor(UIColor.white, for: .normal)
+        saveRetryBtn.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
+        saveRetryBtn.backgroundColor = UIColor.hexColor(hexadecimal: PQBFConfig.shared.styleColor.rawValue)
+        saveRetryBtn.tag = 97
+        saveRetryBtn.isHidden = true
+        saveRetryBtn.addCorner(corner: 5)
+        saveRetryBtn.addTarget(self, action: #selector(btnClick(sender:)), for: .touchUpInside)
+        return saveRetryBtn
 
     }()
 
@@ -861,8 +862,11 @@ extension PQStuckPointPublicController {
                 BFLog(message: "拼接后音频时长\(asset.duration.seconds)  url is \(String(describing: completURL)) 用时\(CFAbsoluteTimeGetCurrent() - startMergeTime)")
                 //导出不带水印的正片
                 self?.beginExport(inputAsset: asset)
-                //导出带水印的正片
-                self?.beginExportWatermarkMovie(inputAsset:asset)
+                
+                if(PQBFConfig.shared.enableWatermarkMovie){
+                    //导出带水印的正片
+                    self?.beginExportWatermarkMovie(inputAsset:asset)
+                }
             }else{
                 cShowHUB(superView: self?.view, msg: "合成失败请重试。")
             }
@@ -902,6 +906,7 @@ extension PQStuckPointPublicController {
             }
         }
         BFLog(message: "导出设置的码率为:\(orgeBitRate)")
+        let tempBeginExport =  Date().timeIntervalSince1970
         exporter.showGaussianBlur = true
         if exporter.prepare(videoSize: CGSize(width: editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0, height: editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0), videoAverageBitRate: orgeBitRate) {
             BFLog(message: "开始导出 \(String(describing: playeTimeRange.start)) 结束 \(String(describing: playeTimeRange.end))")
@@ -909,7 +914,7 @@ extension PQStuckPointPublicController {
             BFLog(message: "开始导出")
         }
         exporter.progressClosure = { [weak self] _, _, progress in
-            BFLog(message: "正片合成进度 \(progress)")
+            BFLog(message: "正片合成进度 \(progress*100)%")
             let useProgress = progress > 1 ? 1 : progress
             if progress > 0, Int(useProgress * 100) > (self?.exportProgrss ?? 0) {
                 // 更新进度
@@ -927,9 +932,16 @@ extension PQStuckPointPublicController {
             if !(self?.isExportSuccess ?? false) {
                 self?.isExportSuccess = true
                 self?.exportEndDate = Date().timeIntervalSince1970
-                BFLog(message: "视频导出完成-开始去发布视频 总时长为\((self?.exportEndDate ?? 0) - (self?.startExportDate ?? 0) * 1000)")
-
+                BFLog(message: "视频导出完成-开始去发布视频 总时长为\((self?.exportEndDate ?? 0) - (self?.startExportDate ?? 0) * 1000) 总用时\((self?.exportEndDate ?? 0) - tempBeginExport)")
+   
                 self?.exportLocalURL = url
+                
+                
+                // add by ak 不生成水印视频时直接自动保存系统相册,e.g. 乐活圈中会执行
+                if(!PQBFConfig.shared.enableWatermarkMovie){
+                    self?.authorizationStatus()
+                }
+       
                 /// fp2-1-1 - 请求权限
 //                self?.authorizationStatus()
                 /// fp2-2 - 保存草稿
@@ -966,7 +978,9 @@ extension PQStuckPointPublicController {
     /// - Returns: <#description#>
     func saveStuckPointVideo() {
         
-        if(saveMovieLocalURL == nil){
+        let tempSaveMoveiLocal:URL? = PQBFConfig.shared.enableWatermarkMovie ? saveMovieLocalURL : exportLocalURL
+        
+        if(tempSaveMoveiLocal == nil){
             BFLog(message: "保存相册的视频导出地址无效!!!")
             cShowHUB(superView: nil, msg: "保存相册的视频导出地址无效")
             saveVideoTipsLabel.text = "视频保存失败"
@@ -982,7 +996,7 @@ extension PQStuckPointPublicController {
             let photoLibrary = PHPhotoLibrary.shared()
             photoLibrary.performChanges({ [weak self] in
                 self?.isSaveingLocalVideo = true
-                PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: (self?.saveMovieLocalURL)!)
+                PHAssetChangeRequest.creationRequestForAssetFromVideo(atFileURL: (tempSaveMoveiLocal)!)
             }) { [weak self] isFinished, _ in
                 self?.isSaveingLocalVideo = false
                 DispatchQueue.main.async { [weak self] in
@@ -1326,7 +1340,8 @@ extension PQStuckPointPublicController {
             bottomOprationBgView.isHidden = false
             //add by ak 发布成功后如果带片尾的视频还没有生成成功时,出提示
             self.saveRetryBtn.isHidden = true
-            if(saveMovieLocalURL == nil && self.isSaveingLocalVideo){
+            self.saveVideoTipsBgView.isHidden = false
+            if(self.isSaveingLocalVideo){
                 saveVideoTipsLabel.text = "视频保存中..."
             }else{
                 self.saveVideoTipsLabel.text = "视频已保存到相册"

+ 29 - 29
BFFramework/Classes/Stuckpoint/ViewModel/PQGPUImagePlayerView.swift

@@ -130,7 +130,7 @@ public class PQGPUImagePlayerView: UIView {
     var mStickers: [PQEditVisionTrackMaterialsModel]? {
         didSet {
             
-            BFLog(2, message: "设置线程为: \(Thread.current) \(OperationQueue.current?.underlyingQueue?.label as Any)")
+            FilterLog(2, message: "设置线程为: \(Thread.current) \(OperationQueue.current?.underlyingQueue?.label as Any)")
         
             configCache(beginTime: mStickers?.first?.timelineIn ?? 0)
         }
@@ -301,7 +301,7 @@ public class PQGPUImagePlayerView: UIView {
     // 设置画布比例
     public func resetCanvasFrame(frame: CGRect) {
         if self.frame.equalTo(frame) {
-            BFLog(2, message: "新老值一样,不重置")
+            FilterLog(2, message: "新老值一样,不重置")
             return
         }
 
@@ -313,7 +313,7 @@ public class PQGPUImagePlayerView: UIView {
             showBorderLayer()
         }
 
-        BFLog(2, message: "new frame is \(frame)")
+        FilterLog(2, message: "new frame is \(frame)")
         renderView.isHidden = true
         renderView.frame = CGRect(x: 0, y: 0, width: self.frame.size.width, height: self.frame.size.height)
         renderView.resatSize()
@@ -360,7 +360,7 @@ public class PQGPUImagePlayerView: UIView {
         stop()
         movie = nil
         speaker = nil
-        BFLog(1, message: "play view release")
+        FilterLog(1, message: "play view release")
     }
 
     /// XXXX 这里的 URL 使用的是全路径 ,如果不是全的会 crash ,方便复用 (不用处理业务的文件放在哪里)
@@ -371,11 +371,11 @@ public class PQGPUImagePlayerView: UIView {
         var composition: AVMutableComposition?
 
         let asset = AVURLAsset(url: url, options: nil)
-        BFLog(1, message:  "播放器初始化的音频时长\(asset.duration.seconds)  url is \(url),最终使用时长\(originMusicDuration),裁剪范围\(CMTimeGetSeconds(clipAudioRange.start)) 到 \(CMTimeGetSeconds(clipAudioRange.end))")
+        FilterLog(1, message:  "播放器初始化的音频时长\(asset.duration.seconds)  url is \(url),最终使用时长\(originMusicDuration),裁剪范围\(CMTimeGetSeconds(clipAudioRange.start)) 到 \(CMTimeGetSeconds(clipAudioRange.end))")
 
         self.asset = asset
         if (audioMixModel != nil && audioMixModel?.localPath != nil) || (videoStickers != nil && (videoStickers?.count ?? 0) > 0 || originMusicDuration != 0) {
-            BFLog(2, message: "有参加混音的数据。")
+            FilterLog(2, message: "有参加混音的数据。")
             (audioMix, composition) = PQPlayerViewModel.setupAudioMix(originAsset: asset, bgmData: audioMixModel, videoStickers: videoStickers,originMusicDuration:originMusicDuration,clipAudioRange: clipAudioRange)
         } else {
             audioMix = nil
@@ -397,7 +397,7 @@ public class PQGPUImagePlayerView: UIView {
 //        }
         do {
             if composition != nil {
-                BFLog(2, message: "composition 方式初始化")
+                FilterLog(2, message: "composition 方式初始化")
                 movie = try PQMovieInput(asset: composition!, videoComposition: videoComposition, audioMix: audioMix, playAtActualSpeed: true, loop: isLoop, audioSettings: audioSettings)
 //                movie?.exportAudioUrl = url // clipAudioRange
                 var ranges = Array<CMTimeRange>()
@@ -434,7 +434,7 @@ public class PQGPUImagePlayerView: UIView {
         movie.progress = { [weak self] currTime, duration, prgressValue in
             guard let strongSelf = self else { return }
 
-//            BFLog(1, message: " movie 进度\(currTime)")
+//            FilterLog(1, message: " movie 进度\(currTime)")
             strongSelf.changeFilter(currTime: currTime)
             strongSelf.progress?(currTime, duration, prgressValue)
 
@@ -489,11 +489,11 @@ public class PQGPUImagePlayerView: UIView {
     /// - Parameter beginTime: 开始缓存的开始时间,用在 seek操作时 老的缓存已经无效不能在使用了
     func configCache(beginTime: Float64 ) {
         cacheFilters.removeAll()
-        BFLog(2, message: "原素材 总数:\(mStickers?.count ?? 0) ")
+        FilterLog(2, message: "原素材 总数:\(mStickers?.count ?? 0) ")
        
         if mStickers?.count ?? 0 > 0 {
             for (index, currentSticker) in mStickers!.enumerated() {
-                BFLog(message: "mStickers timelinein:\(currentSticker.timelineIn) timelineout: \(currentSticker.timelineOut) index : \(index)")
+                FilterLog(message: "mStickers timelinein:\(currentSticker.timelineIn) timelineout: \(currentSticker.timelineOut) index : \(index)")
                //到达最大缓存数退出
                 if cacheFilters.count == cacheFiltersMaxCount {
                     break
@@ -511,7 +511,7 @@ public class PQGPUImagePlayerView: UIView {
                   
                 }
                 if showFitler != nil {
-                    BFLog(message: " 加入到缓存 的 filter timelinein:\(currentSticker.timelineIn) timelineout: \(currentSticker.timelineOut) in :\(currentSticker.model_in) out: \(currentSticker.out) index : \(index)")
+                    FilterLog(message: " 加入到缓存 的 filter timelinein:\(currentSticker.timelineIn) timelineout: \(currentSticker.timelineOut) in :\(currentSticker.model_in) out: \(currentSticker.out) index : \(index)")
                     cacheFilters.append(showFitler!)
                 }
 
@@ -519,7 +519,7 @@ public class PQGPUImagePlayerView: UIView {
             
             
             for (index, filter) in cacheFilters.enumerated() {
-                BFLog(2, message: " 初始化 config create currentSticker timelinein \(String(describing: filter.stickerInfo?.timelineIn)) timelineout \(String(describing: filter.stickerInfo?.timelineOut))  in :\(String(describing: filter.stickerInfo?.model_in)) out \(String(describing: filter.stickerInfo?.out))  index\(index)")
+                FilterLog(2, message: " 初始化 config create currentSticker timelinein \(String(describing: filter.stickerInfo?.timelineIn)) timelineout \(String(describing: filter.stickerInfo?.timelineOut))  in :\(String(describing: filter.stickerInfo?.model_in)) out \(String(describing: filter.stickerInfo?.out))  index\(index)")
             }
             
             if(cacheFilters.first != nil){
@@ -535,12 +535,12 @@ public class PQGPUImagePlayerView: UIView {
 
     //创建下一个filter 数据
     func createNextFilter() {
-        BFLog(2, message: "加入前 当前的缓存个数为: \(cacheFilters.count)  maxCount \(cacheFiltersMaxCount) 最后一个显示时间 \(String(describing: cacheFilters.last?.stickerInfo?.timelineIn))")
+        FilterLog(2, message: "加入前 当前的缓存个数为: \(cacheFilters.count)  maxCount \(cacheFiltersMaxCount) 最后一个显示时间 \(String(describing: cacheFilters.last?.stickerInfo?.timelineIn))")
           if cacheFilters.count <=  cacheFiltersMaxCount {
               let showIndex = mStickers?.firstIndex(where: { (sticker) -> Bool in
                 (cacheFilters.last?.stickerInfo == sticker)
               })
-                BFLog(2, message: "当前显示的showIndex: \(String(describing: showIndex))")
+                FilterLog(2, message: "当前显示的showIndex: \(String(describing: showIndex))")
               if ((showIndex ?? 0) + 1) < (mStickers?.count ?? 0) {
                   let currentSticker = mStickers?[(showIndex ?? 0) + 1]
                   if currentSticker != nil {
@@ -556,11 +556,11 @@ public class PQGPUImagePlayerView: UIView {
                           cacheFilters.append(showFitler!)
                       }
                   }else{
-                    BFLog(2, message: "缓存数据加入不成功!!!!!")
+                    FilterLog(2, message: "缓存数据加入不成功!!!!!")
                   }
               }
             
-            BFLog(2, message: "加入后 当前的缓存个数为: \(cacheFilters.count)  maxCount \(cacheFiltersMaxCount) 最后一个显示时间 \(String(describing: cacheFilters.last?.stickerInfo?.timelineIn))")
+            FilterLog(2, message: "加入后 当前的缓存个数为: \(cacheFilters.count)  maxCount \(cacheFiltersMaxCount) 最后一个显示时间 \(String(describing: cacheFilters.last?.stickerInfo?.timelineIn))")
              
           }
         
@@ -572,7 +572,7 @@ public class PQGPUImagePlayerView: UIView {
     /// - Parameter currTime: 当前播放时间
     func changeFilter(currTime: Float64) {
 //        let  starts:CFTimeInterval = CFAbsoluteTimeGetCurrent()
-        BFLog(message: " 要查找的 currTime is \(currTime)")
+        FilterLog(message: " 要查找的 currTime is \(currTime)")
         //1,删除已经显示过的 filter
         self.cacheFilters.removeAll(where: {(filter) -> Bool in
 
@@ -586,16 +586,16 @@ public class PQGPUImagePlayerView: UIView {
 
         })
         if(showIndex == nil){
-            BFLog(2, message: "缓存没有查找到?出现数据错误!!!!")
+            FilterLog(2, message: "缓存没有查找到?出现数据错误!!!!")
             return
         }
   
         let showFilter: PQBaseFilter = cacheFilters[showIndex ?? 0]
         
-        BFLog(2, message: "缓存操作   查找到命中的显示是为:\(currTime) 缓存数据timeline in :\(showFilter.stickerInfo?.timelineIn ?? 0.0)) timelineOut:\(showFilter.stickerInfo?.timelineOut ?? 0.0) in:\(showFilter.stickerInfo?.model_in ?? 0.0) out:\(showFilter.stickerInfo?.out ?? 0.0) 缓存数 \(cacheFilters.count) index: \(String(describing: showIndex))")
+        FilterLog(2, message: "缓存操作   查找到命中的显示是为:\(currTime) 缓存数据timeline in :\(showFilter.stickerInfo?.timelineIn ?? 0.0)) timelineOut:\(showFilter.stickerInfo?.timelineOut ?? 0.0) in:\(showFilter.stickerInfo?.model_in ?? 0.0) out:\(showFilter.stickerInfo?.out ?? 0.0) 缓存数 \(cacheFilters.count) index: \(String(describing: showIndex))")
         
         if(!(showFilter.isShow)){
-            BFLog(2, message: "showIndex当前时间为  \(currTime) showIndex is \(String(describing: showIndex)) 显示 filter timelineIn is: \(String(describing: showFilter.stickerInfo?.timelineIn)) timelineOut is: \(String(describing: showFilter.stickerInfo?.timelineOut))")
+            FilterLog(2, message: "showIndex当前时间为  \(currTime) showIndex is \(String(describing: showIndex)) 显示 filter timelineIn is: \(String(describing: showFilter.stickerInfo?.timelineIn)) timelineOut is: \(String(describing: showFilter.stickerInfo?.timelineOut))")
  
             showFilter.isShow = true
             
@@ -607,13 +607,13 @@ public class PQGPUImagePlayerView: UIView {
             //画面的比例
             let canverAspectRatio = String(format: "%.6f",(movie?.mShowVidoSize.width ?? 0.0) /  (movie?.mShowVidoSize.height ?? 0.0))
             if(showFilter.stickerInfo?.type == StickerType.IMAGE.rawValue && showGaussianBlur && Float(stickerAspectRatio) != Float(canverAspectRatio)){
-                      BFLog(2, message: "显示图片filter")
+                      FilterLog(2, message: "显示图片filter")
 //                    //高斯层
                         let  blurStickerModel:PQEditVisionTrackMaterialsModel? = showFilter.stickerInfo?.copy() as? PQEditVisionTrackMaterialsModel
                         blurStickerModel?.canvasFillType = stickerContentMode.aspectFillStr.rawValue
 
                         if blurStickerModel == nil {
-                            BFLog(2, message: "显示图片filter blurStickerModel is nil")
+                            FilterLog(2, message: "显示图片filter blurStickerModel is nil")
                             return
                         }
                         let showGaussianFitler:PQBaseFilter = PQImageFilter(sticker: blurStickerModel!, isExport: (movie?.mIsExport) ?? false, showUISize: mCanverSize)
@@ -626,7 +626,7 @@ public class PQGPUImagePlayerView: UIView {
                         iosb.addTarget(showFilter,atTargetIndex: 0)
                         showFilter.addTarget(self.renderView as ImageConsumer, atTargetIndex: 0)
                 
-                        BFLog(2, message: "filter 添加成功 注意是否添加成功。")
+                        FilterLog(2, message: "filter 添加成功 注意是否添加成功。")
                         
 //                    }
  
@@ -640,7 +640,7 @@ public class PQGPUImagePlayerView: UIView {
             }
 
         }else{
-            BFLog(2, message: " 添加过了 currTime is \(currTime) timelineIn:\(showFilter.stickerInfo?.timelineIn ?? 0.0)")
+            FilterLog(2, message: " 添加过了 currTime is \(currTime) timelineIn:\(showFilter.stickerInfo?.timelineIn ?? 0.0)")
         }
     }
 
@@ -678,7 +678,7 @@ public extension PQGPUImagePlayerView {
             self.progressLab.isHidden = false
         }
 //        guard status != .playing else {
-//            BFLog(2, message: "已经是播放状态")
+//            FilterLog(2, message: "已经是播放状态")
 //            return
 //        }
 
@@ -740,7 +740,7 @@ public extension PQGPUImagePlayerView {
 
     // 显示提示文字
     func showTip(show: Bool) {
-        BFLog(2, message: "showTip \(show)")
+        FilterLog(2, message: "showTip \(show)")
         tipLab.isHidden = !show
         if show {
             playerEmptyView.isHidden = true
@@ -780,15 +780,15 @@ public extension PQGPUImagePlayerView {
 // MARK: - RenderViewDelegate
 extension PQGPUImagePlayerView: RenderViewDelegate{
     public func willDisplayFramebuffer(renderView _: RenderView, framebuffer _: Framebuffer) {
-        BFLog(2, message: "willDisplayFramebuffer")
+        FilterLog(2, message: "willDisplayFramebuffer")
     }
 
     public func didDisplayFramebuffer(renderView _: RenderView, framebuffer: Framebuffer) {
-        BFLog(2, message: "didDisplayFramebuffer")
+        FilterLog(2, message: "didDisplayFramebuffer")
     }
 
     public func shouldDisplayNextFramebufferAfterMainThreadLoop() -> Bool {
-        BFLog(2, message: "didDisplayFramebuffer")
+        FilterLog(2, message: "didDisplayFramebuffer")
         
         return false
     }