Explorar el Código

临时解决方案,卡点合成后黑屏问题

jsonwang hace 3 años
padre
commit
2460e54cfa

+ 24 - 2
BFFramework/Classes/PQGPUImage/akfilters/PQMovieFilter.swift

@@ -114,6 +114,9 @@ public class PQMovieFilter: PQBaseFilter {
     
     public var imageVertexBuffer: GLuint = 0
     
+    //临时方案,是否是卡点模式
+    public var isPointModel:Bool = false
+    
     deinit {
         FilterLog(1, message: "movie filter release")
         clearData()
@@ -218,8 +221,7 @@ public class PQMovieFilter: PQBaseFilter {
             startTimeStamp = currentTime
         }
         
-        if CMTimeGetSeconds(currentTime) >= stickerInfo!.timelineIn && CMTimeGetSeconds(currentTime) <= stickerInfo!.timelineOut {
-            
+        if(isPointModel){
             //视频素材开始裁剪时间
             let stickerModelIn = CMTime(value: Int64((moveSticker?.model_in ?? 0)  * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE)
             
@@ -234,7 +236,27 @@ public class PQMovieFilter: PQBaseFilter {
             readNextVideoFrame(showTimeStamp: showtimeStamp)
             
             framebufferIndex = framebufferIndex + 1
+        }else{
+            
+            if CMTimeGetSeconds(currentTime) >= stickerInfo!.timelineIn && CMTimeGetSeconds(currentTime) <= stickerInfo!.timelineOut {
+                
+                //视频素材开始裁剪时间
+                let stickerModelIn = CMTime(value: Int64((moveSticker?.model_in ?? 0)  * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE)
+                
+                //要显示的帧时间
+                let targetTime =  CMTimeValue(Int(Float( 1.0 / 30.0 * Float64(framebufferIndex) * Float64(BASE_FILTER_TIMESCALE)) * Float(stickerInfo?.speedRate ?? 1.0)))
+                
+                //要显示的帧时间戳
+                var showtimeStamp = CMTime(value:targetTime, timescale: BASE_FILTER_TIMESCALE)
+                showtimeStamp = CMTimeAdd(showtimeStamp, stickerModelIn)
+                
+                FilterLog(message: "showtimeStamp is \(CMTimeGetSeconds(showtimeStamp))")
+                readNextVideoFrame(showTimeStamp: showtimeStamp)
+                
+                framebufferIndex = framebufferIndex + 1
+            }
         }
+       
         
     }
     

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

@@ -863,10 +863,10 @@ extension PQStuckPointPublicController {
                 //导出不带水印的正片
                 self?.beginExport(inputAsset: asset)
                 
-                if(PQBFConfig.shared.enableWatermarkMovie){
-                    //导出带水印的正片
-                    self?.beginExportWatermarkMovie(inputAsset:asset)
-                }
+//                if(PQBFConfig.shared.enableWatermarkMovie){
+//                    //导出带水印的正片
+//                    self?.beginExportWatermarkMovie(inputAsset:asset)
+//                }
             }else{
                 cShowHUB(superView: self?.view, msg: "合成失败请重试。")
             }