| 
					
				 | 
			
			
				@@ -108,6 +108,9 @@ class PQMovieFilter: PQBaseFilter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var startTimeStamp: CMTime? 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 最后一次显示帧时间戳 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     var targetTimeStamp: CMTime = .zero 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 当前帧 id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    var framebufferIndex:Int = 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     deinit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FilterLog(message: "movie filter deinit") 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -181,7 +184,7 @@ class PQMovieFilter: PQBaseFilter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         inputSize = inputFramebuffer.sizeForTargetOrientation(.portrait) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         currentTime = CMTime(value: inputFramebuffer.timingStyle.timestamp!.value, timescale: inputFramebuffer.timingStyle.timestamp!.timescale) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        FilterLog(message: "duration is currentSampleTime is \(CMTimeGetSeconds(currentTime))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FilterLog(message: "wwwwwwwww duration is currentSampleTime is \(CMTimeGetSeconds(currentTime))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         renderFramebuffer = sharedImageProcessingContext.framebufferCache.requestFramebufferWithProperties(orientation: mImageOrientation, size: inputSize, stencil: false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -193,7 +196,6 @@ class PQMovieFilter: PQBaseFilter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                              vertexBufferObject: sharedImageProcessingContext.standardImageVBO, inputTextures: [textureProperties]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         releaseIncomingFramebuffers() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        if CMTimeGetSeconds(currentTime) >= moveSticker!.timelineIn, CMTimeGetSeconds(currentTime) <= moveSticker!.timelineOut { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FilterLog(message: "开始显示 movefilter 了 开始\(String(describing: moveSticker?.timelineIn)) 结束 :\(String(describing: moveSticker?.timelineOut)) currentTime \(CMTimeGetSeconds(currentTime)) 裁剪开始时间:\(String(describing: moveSticker?.model_in)) ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if enableSeek { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -201,25 +203,27 @@ class PQMovieFilter: PQBaseFilter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             resetRangeTime(startTime: currentTime) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             enableSeek = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if startTimeStamp == nil { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             startTimeStamp = currentTime 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let stickerTime = CMTime(value: Int64((moveSticker?.model_in ?? 0)  * Float64(BASE_FILTER_TIMESCALE)), timescale: BASE_FILTER_TIMESCALE) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        let PTSTime = CMTimeAdd(stickerTime, CMTimeSubtract(currentTime, startTimeStamp ?? .zero)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        readNextVideoFrame(showTimeStamp: CMTime(value: CMTimeValue(Int(Float(Float64(PTSTime.value) - (moveSticker?.model_in ?? 0) * Float64(BASE_FILTER_TIMESCALE)) * Float(stickerInfo!.speedRate))), timescale: PTSTime.timescale)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            FilterLog(message: "movefilter 了 结束了  timelineIN\(String(describing: moveSticker?.timelineIn)) timelineOut\(String(describing: moveSticker?.timelineOut)) currentTime  \(CMTimeGetSeconds(currentTime)) 裁剪in:\(String(describing: moveSticker?.model_in))  裁剪out:\(String(describing: moveSticker?.out)) ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            FilterLog(message: "不显示 movefilter 了") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-// 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            assetReader?.cancelReading() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            // 重新初始化解码器 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//            startReading() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //视频素材开始裁剪时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        BFLog(message: "showtimeStamp is \(CMTimeGetSeconds(showtimeStamp))") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        readNextVideoFrame(showTimeStamp: showtimeStamp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        framebufferIndex = framebufferIndex + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 原视频角度类型 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -337,7 +341,7 @@ class PQMovieFilter: PQBaseFilter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             renderPixelBuffler(movieFrame: lastImageBuffer!, withSampleTime: currentTime) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				          
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if CMTimeGetSeconds(targetTimeStamp) - (stickerInfo?.model_in ?? 0) >= CMTimeGetSeconds(showTimeStamp)  && CMTimeGetSeconds(targetTimeStamp) != 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if CMTimeGetSeconds(targetTimeStamp) >= CMTimeGetSeconds(showTimeStamp)  && CMTimeGetSeconds(targetTimeStamp) != 0 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 最后一帧的PTS > 要显示的目标时间 就不从解码器要数据,直接返回 view 不刷新 只有慢速时会调用 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //        if CMTimeGetSeconds(targetTimeStamp) >= CMTimeGetSeconds(showTimeStamp) + (stickerInfo?.model_in ?? 0) && CMTimeGetSeconds(targetTimeStamp) != 0 { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -373,18 +377,21 @@ class PQMovieFilter: PQBaseFilter { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             targetTimeStamp = CMSampleBufferGetOutputPresentationTimeStamp(sampleBuffer!) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 目标帧 时间 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if sampleBuffer != nil && CMTimeGetSeconds(targetTimeStamp) >= (CMTimeGetSeconds(showTimeStamp).truncatingRemainder(dividingBy: moveSticker!.out)) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if sampleBuffer != nil && CMTimeGetSeconds(targetTimeStamp) >= CMTimeGetSeconds(showTimeStamp) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 let endDecoderTime: TimeInterval = Date().timeIntervalSince1970 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                FilterLog(message: " speedRate is \(stickerInfo!.speedRate) 当前主线时间为:\(String(format: "%.6f", CMTimeGetSeconds(currentTime))) 查找的帧时间为:\(String(format: "%.6f", CMTimeGetSeconds(showTimeStamp).truncatingRemainder(dividingBy: moveSticker!.out)))  命中时间为: \(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)) ") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FilterLog(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 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                FilterLog(message: "不丢帧显示") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                usleep(2) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                sharedImageProcessingContext.runOperationSynchronously { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    self.renderPixelBuffler(movieFrame: CMSampleBufferGetImageBuffer(sampleBuffer!)!, withSampleTime: currentTime) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                FilterLog(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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+////                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//                break 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 一,显示命中的帧数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if sampleBuffer != nil { 
			 |