소스 검색

只是格式化

jsonwang 3 년 전
부모
커밋
f32587f808
1개의 변경된 파일144개의 추가작업 그리고 182개의 파일을 삭제
  1. 144 182
      BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

+ 144 - 182
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -69,7 +69,7 @@ class PQStuckPointEditerController: PQBaseViewController {
     var finallyStuckPoints: Array = Array<Float>.init()
     // 最终使用的音频时长
     var finallyUserAudioTime: Float = 0.0
-    
+
     // 注意推荐时间位置和后面最近的卡点时间与0.3的关系
     // 保存丢卡点处理后的卡点信息推荐开始到最后倒数第二个
     // 经过档位处理后的卡点信息
@@ -108,20 +108,19 @@ class PQStuckPointEditerController: PQBaseViewController {
         sustomSwitchView.switchChangeHandle = { [weak self] sender in
             // 改变速率,.只有快慢速且非只有图片素材时自动+1处理
             self?.stuckPointMusicData?.speed = sender.tag
- 
+
             self?.projectModel.sData?.getBGMSession()?.sectionTimeline?.audioTrack?.audioTrackMaterials.first?.bgmInfo?.rhythmMusicSpeed = sender.tag
             // 播放前先暂停
 //            self?.playerView.stop()
             // 开始播放
             self?.settingPlayerView()
-            
-            
+
             // 下面都是统计
             if self?.currentCreateStickersModel == .createStickersModelPoint {
                 PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectMusicVideoRhythm, pageSource: .sp_stuck_previewSyncedUp, extParams: nil, remindmsg: "点击上报:选择节奏")
-            }else if self?.currentCreateStickersModel == .createStickersModelSpeed {
+            } else if self?.currentCreateStickersModel == .createStickersModelSpeed {
                 PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectSpeedRhythm, pageSource: .sp_stuck_previewSyncedUp, extParams: nil, remindmsg: "点击上报:选择节奏")
-            }else if self?.currentCreateStickersModel == .createStickersModelOnlyMusic {
+            } else if self?.currentCreateStickersModel == .createStickersModelOnlyMusic {
                 PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectMusicVideoRepeatRhythm, pageSource: .sp_stuck_previewSyncedUp, extParams: nil, remindmsg: "点击上报:选择节奏")
             }
         }
@@ -132,7 +131,7 @@ class PQStuckPointEditerController: PQBaseViewController {
     lazy var stuckPointCuttingView: PQStuckPointCuttingView = {
         let stuckPointCuttingView = PQStuckPointCuttingView(frame: CGRect(x: 0, y: optionlineView.frame.minY - 85 - 28, width: view.frame.width, height: 80), duration: CGFloat(Float(stuckPointMusicData?.duration ?? "0") ?? 0), startTime: CGFloat(stuckPointMusicData?.startTime ?? 0), endTime: CGFloat(stuckPointMusicData?.endTime ?? 0))
         /// 裁剪进度回调
-        stuckPointCuttingView.videoDidBeginDrag = { [weak self]  in
+        stuckPointCuttingView.videoDidBeginDrag = { [weak self] in
             BFLog(message: "开始划动")
             self?.playerView.pause()
         }
@@ -173,27 +172,27 @@ class PQStuckPointEditerController: PQBaseViewController {
                 self?.playeTimeRange = CMTimeRange(start: CMTimeMakeWithSeconds(Float64(startTime), preferredTimescale: BASE_FILTER_TIMESCALE), end: CMTimeMakeWithSeconds(Float64(endTime), preferredTimescale: BASE_FILTER_TIMESCALE))
 
                 self?.dealParameter(model: self?.currentCreateStickersModel ?? .createStickersModelSpeed)
-                
+
                 DispatchQueue.global().async { // 并行、异步
-                let beginTime: TimeInterval = Date().timeIntervalSince1970
-                    
-                self?.mStickers = self?.createStickers(sections: self?.projectModel.sData?.sections ?? List(), inputSize: CGSize(width: CGFloat(self?.projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(self?.projectModel.sData?.videoMetaData?.videoHeight ?? 0)), model: self?.currentCreateStickersModel ?? .createStickersModelSpeed)
-              
-                DispatchQueue.main.async { // 串行、异步
-                    self?.playerView.mStickers = self?.mStickers
-                    var endTime: TimeInterval = Date().timeIntervalSince1970
-                    BFLog(message: "endTime is endTimeendTime \(endTime = beginTime)")
-                    self?.playerView.play(pauseFirstFrame: false, playeTimeRange: self!.playeTimeRange)
-                    
-                    //更新一下时间条的UI总时间 及数据
-                    self?.stuckPointCuttingView.videoDuration = CGFloat(self?.finallyUserAudioTime ?? 0)
-                    
-                    self?.stuckPointCuttingView.stuckPointStartTime = CGFloat(CMTimeGetSeconds(self?.playeTimeRange.start ?? .zero))
-                    self?.stuckPointCuttingView.stuckPointEndTime = CGFloat(CMTimeGetSeconds(self?.playeTimeRange.end ?? .zero))
-                    self?.stuckPointCuttingView.tatalTimeLabel.text = "\(Float64(CMTimeGetSeconds(self?.playeTimeRange.end ?? .zero) - CMTimeGetSeconds(self?.playeTimeRange.start ?? .zero )).formatDurationToHMS())"
+                    let beginTime: TimeInterval = Date().timeIntervalSince1970
+
+                    self?.mStickers = self?.createStickers(sections: self?.projectModel.sData?.sections ?? List(), inputSize: CGSize(width: CGFloat(self?.projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(self?.projectModel.sData?.videoMetaData?.videoHeight ?? 0)), model: self?.currentCreateStickersModel ?? .createStickersModelSpeed)
+
+                    DispatchQueue.main.async { // 串行、异步
+                        self?.playerView.mStickers = self?.mStickers
+                        var endTime: TimeInterval = Date().timeIntervalSince1970
+                        BFLog(message: "endTime is endTimeendTime \(endTime = beginTime)")
+                        self?.playerView.play(pauseFirstFrame: false, playeTimeRange: self!.playeTimeRange)
+
+                        // 更新一下时间条的UI总时间 及数据
+                        self?.stuckPointCuttingView.videoDuration = CGFloat(self?.finallyUserAudioTime ?? 0)
+
+                        self?.stuckPointCuttingView.stuckPointStartTime = CGFloat(CMTimeGetSeconds(self?.playeTimeRange.start ?? .zero))
+                        self?.stuckPointCuttingView.stuckPointEndTime = CGFloat(CMTimeGetSeconds(self?.playeTimeRange.end ?? .zero))
+                        self?.stuckPointCuttingView.tatalTimeLabel.text = "\(Float64(CMTimeGetSeconds(self?.playeTimeRange.end ?? .zero) - CMTimeGetSeconds(self?.playeTimeRange.start ?? .zero)).formatDurationToHMS())"
+                    }
                 }
             }
-            }
         }
         return stuckPointCuttingView
     }()
@@ -283,7 +282,7 @@ class PQStuckPointEditerController: PQBaseViewController {
     lazy var speedStuckBtnGif: UIImageView = {
         let speedStuckBtnGif = UIImageView()
         speedStuckBtnGif.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "speedstuck_h", ofType: ".gif")!))
-        speedStuckBtnGif.isHidden  = true
+        speedStuckBtnGif.isHidden = true
         return speedStuckBtnGif
 
     }()
@@ -302,7 +301,7 @@ class PQStuckPointEditerController: PQBaseViewController {
     lazy var jumpPointBtnGif: UIImageView = {
         let jumpPointBtnGif = UIImageView()
         jumpPointBtnGif.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: "jumpPoint_n", ofType: ".gif")!))
-        jumpPointBtnGif.isHidden  = true
+        jumpPointBtnGif.isHidden = true
         return jumpPointBtnGif
 
     }()
@@ -317,7 +316,7 @@ class PQStuckPointEditerController: PQBaseViewController {
         onlyMusicBtn.adjustsImageWhenHighlighted = false
         return onlyMusicBtn
     }()
- 
+
     // 操作面板上的分割线
     lazy var optionlineView: UIView = {
         let optionlineView = UIView()
@@ -331,12 +330,12 @@ class PQStuckPointEditerController: PQBaseViewController {
         speedSettingView.backgroundColor = .clear
         speedSettingView.selectSpeedCallBack = { [weak self] maxSpeed, minSpeed, selectIndex, isSettingPlayer in
             BFLog(message: "固定maxSpeed is\(maxSpeed) minSpeed \(minSpeed)")
-         
+
             if maxSpeed == -1.0 && minSpeed == -1.0 {
                 self?.customSpeedSettingView.isHidden = false
                 self?.customSpeedSettingView.viewType = speedSettingView.viewType
-            }else{
-                if(maxSpeed != 0.0){
+            } else {
+                if maxSpeed != 0.0 {
                     // 更新最后一次选择的位置恢复时使用
                     if speedSettingView.viewType == 1 {
                         self?.lastSpeedSelectIndex = selectIndex
@@ -347,7 +346,7 @@ class PQStuckPointEditerController: PQBaseViewController {
                     }
                     self?.maxSpeed = maxSpeed
                     self?.minSpeed = minSpeed
-                }else{
+                } else {
                     BFLog(message: "设置速度无效")
                 }
             }
@@ -363,40 +362,36 @@ class PQStuckPointEditerController: PQBaseViewController {
     lazy var customSpeedSettingView: PQCustomSpeedSettingView = {
         let customSpeedSettingView = PQCustomSpeedSettingView(frame: CGRect(x: 0, y: cScreenHeigth - 354, width: cScreenWidth, height: 354))
         customSpeedSettingView.isHidden = true
-        customSpeedSettingView.selectSpeedCallBack = { [weak self] maxSpeed, minSpeed, isJumpSpeedModel ,isCancle in
-            if(!isCancle){
+        customSpeedSettingView.selectSpeedCallBack = { [weak self] maxSpeed, minSpeed, isJumpSpeedModel, isCancle in
+            if !isCancle {
                 self?.maxSpeed = maxSpeed
                 self?.minSpeed = minSpeed
                 BFLog(message: "自定义速度maxSpeed is\(maxSpeed) minSpeed \(minSpeed) \(isJumpSpeedModel)")
-               
-                //自定定义的更新一下最后的选择位置
-                if self?.speedSettingView.viewType == 1{
+
+                // 自定定义的更新一下最后的选择位置
+                if self?.speedSettingView.viewType == 1 {
                     self?.lastSpeedSelectIndex = -1
-                }else if self?.speedSettingView.viewType == 2{
+                } else if self?.speedSettingView.viewType == 2 {
                     self?.lastJumpSpeedSelectIndex = -1
-                }else{
+                } else {
                     self?.lastCyclesSelectIndex = Int(maxSpeed - 1)
                 }
-                
+
                 self?.settingPlayerView()
-                //确认后 选中自定义
+                // 确认后 选中自定义
                 self?.speedSettingView.selectCustom()
-            }else{
-                
-                //取消后恢复上一次选择的位置
-                if self?.speedSettingView.viewType == 1{
+            } else {
+                // 取消后恢复上一次选择的位置
+                if self?.speedSettingView.viewType == 1 {
                     self?.speedSettingView.setSelectItem(index: self?.lastSpeedSelectIndex ?? 0, isSettingPlayer: false)
-                }else if self?.speedSettingView.viewType == 2{
+                } else if self?.speedSettingView.viewType == 2 {
                     self?.speedSettingView.setSelectItem(index: self?.lastJumpSpeedSelectIndex ?? 0, isSettingPlayer: false)
-                }else{
+                } else {
                     self?.speedSettingView.setSelectItem(index: self?.lastCyclesSelectIndex ?? 0, isSettingPlayer: false)
                 }
-                
+
                 customSpeedSettingView.isHidden = true
-               
             }
-            
-
         }
         return customSpeedSettingView
 
@@ -482,8 +477,8 @@ class PQStuckPointEditerController: PQBaseViewController {
         } else {
             musicNameLab.text = " \(stuckPointMusicData?.musicName ?? "") "
         }
-        
-        //更新一下节奏的 UI
+
+        // 更新一下节奏的 UI
         sustomSwitchView.selectOneBtn(Index: (stuckPointMusicData?.speed ?? 2))
     }
 
@@ -526,11 +521,12 @@ class PQStuckPointEditerController: PQBaseViewController {
         PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_musicTab, pageSource: .sp_shanyinApp_main, extParams: nil, remindmsg: "")
     }
 
-    @objc func editModelClick1(sender: UIButton){
+    @objc func editModelClick1(sender: UIButton) {
         editModelClick(sender: sender)
     }
+
     // 三种模式修改
-    @objc func editModelClick(sender: UIButton , reportLog:Bool = true) {
+    @objc func editModelClick(sender: UIButton, reportLog: Bool = true) {
 //        if sender.isSelected {
 //            BFLog(message: "已经是选中状态")
 //            return  “”
@@ -580,11 +576,10 @@ class PQStuckPointEditerController: PQBaseViewController {
             speedSettingView.isHidden = false
             speedTitleLab.isHidden = false
             sustomSwitchView.isHidden = false
-            if(lastCyclesSelectIndex != -1){
+            if lastCyclesSelectIndex != -1 {
                 speedSettingView.setSelectItem(index: lastCyclesSelectIndex, isSettingPlayer: false)
             }
 
-
         } else {
             if sender.tag == 1 { // 快慢速
                 speedSettingView.setSelectItem(index: lastSpeedSelectIndex, isSettingPlayer: false, setDisable: (selectedTotalDuration < 6 && selectedDataCount != selectedImageDataCount) ? true : false)
@@ -602,38 +597,35 @@ class PQStuckPointEditerController: PQBaseViewController {
             speedStuckBtnGifName = "speedstuck_h"
             jumpPointBtnGifName = "jumpPoint_n"
             currentCreateStickersModel = .createStickersModelSpeed
-            
-            if(reportLog){
-            PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectPatternSpeed, pageSource: .sp_shanyinApp_main, extParams: nil, remindmsg: "")
+
+            if reportLog {
+                PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectPatternSpeed, pageSource: .sp_shanyinApp_main, extParams: nil, remindmsg: "")
             }
 
         } else if sender.tag == 2 { // 跳跃卡点
             speedStuckBtnGifName = "speedstuck_n"
             jumpPointBtnGifName = "jumpPoint_h"
             currentCreateStickersModel = .createStickersModelPoint
-            
-            if(reportLog){
-            PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectPatternMusicVideo, pageSource: .sp_shanyinApp_main, extParams: nil, remindmsg: "")
+
+            if reportLog {
+                PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectPatternMusicVideo, pageSource: .sp_shanyinApp_main, extParams: nil, remindmsg: "")
             }
 
         } else if sender.tag == 3 { // 仅音乐
             speedStuckBtnGifName = "speedstuck_n"
             jumpPointBtnGifName = "jumpPoint_n"
             currentCreateStickersModel = .createStickersModelOnlyMusic
-            if(reportLog){
-            PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectPatternBgm, pageSource: .sp_shanyinApp_main, extParams: nil, remindmsg: "")
+            if reportLog {
+                PQEventTrackViewModel.baseReportUpload(businessType: .bt_buttonClick, objectType: .ot_shanyinApp_musicVideoPreview_selectPatternBgm, pageSource: .sp_shanyinApp_main, extParams: nil, remindmsg: "")
             }
-                
         }
         speedStuckBtnGif.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: speedStuckBtnGifName, ofType: ".gif")!))
         jumpPointBtnGif.kf.setImage(with: URL(fileURLWithPath: Bundle().BF_mainbundle().path(forResource: jumpPointBtnGifName, ofType: ".gif")!))
-        
+
         speedStuckBtnGif.isHidden = false
         jumpPointBtnGif.isHidden = false
-        
-        settingPlayerView()
-        
 
+        settingPlayerView()
     }
 
     override func viewWillDisappear(_ animated: Bool) {
@@ -768,7 +760,7 @@ class PQStuckPointEditerController: PQBaseViewController {
             make.height.equalTo(80)
             make.width.equalTo(64)
         }
-     
+
         speedSettingView.snp.makeConstraints { make in
             make.left.equalToSuperview().offset(16)
             make.right.equalToSuperview()
@@ -830,7 +822,7 @@ class PQStuckPointEditerController: PQBaseViewController {
     /// 通过传入的    selectedPhotoData 、 stuckPointMusicData 创建 projectModel 模型 后面都使用 projectModel 参数
     func createPorjectData() {
         // 1,添加选择的视觉素材
-        if( projectModel.sData?.sections.count == 0){
+        if projectModel.sData?.sections.count == 0 {
             let section: PQEditSectionModel = PQEditSectionModel()
             selectedPhotoData?.forEach { model in
 
@@ -861,14 +853,13 @@ class PQStuckPointEditerController: PQBaseViewController {
 
     // 设置播放器
     func settingPlayerView() {
-        
         stuckPointCuttingView.resetDefaultsColor()
         synchroMarskView.removeFromSuperview()
         if synchroMarskView.superview == nil {
             UIApplication.shared.keyWindow?.addSubview(synchroMarskView)
             synchroMarskView.show()
         }
-        
+
         // 1,设置播放器的显示区域 和画布大小
         //  - 按第一个素材尺寸自适应
         playerView.pause()
@@ -930,19 +921,17 @@ class PQStuckPointEditerController: PQBaseViewController {
         projectModel.sData?.videoMetaData?.videoWidth = Int(videoSize.width)
         projectModel.sData?.videoMetaData?.videoHeight = Int(videoSize.height)
 
-       
         let beginTime: TimeInterval = Date().timeIntervalSince1970
         dealParameter(model: currentCreateStickersModel)
-        
+
         // 更新裁剪时间条的的ui数据
         stuckPointCuttingView.videoDuration = CGFloat(finallyUserAudioTime)
         stuckPointCuttingView.updateEndTime(startTime: CGFloat(CMTimeGetSeconds(playeTimeRange.start)), endTime: CGFloat(CMTimeGetSeconds(playeTimeRange.end)))
-     
+
         // 2,创建滤镜
         DispatchQueue.global().async {
             self.mStickers = self.createStickers(sections: self.projectModel.sData?.sections ?? List(), inputSize: CGSize(width: CGFloat(self.projectModel.sData?.videoMetaData?.videoWidth ?? 0), height: CGFloat(self.projectModel.sData?.videoMetaData?.videoHeight ?? 0)), model: self.currentCreateStickersModel)
             DispatchQueue.main.async { // 串行、异步
-                
                 self.playerView.mStickers = self.mStickers
 
                 let end: TimeInterval = Date().timeIntervalSince1970
@@ -954,7 +943,7 @@ class PQStuckPointEditerController: PQBaseViewController {
                 BFLog(message: "初始化音频播放器的音频地址为:\(audioPath)")
                 self.playerView.stop()
                 // 这里的测试这个音乐播放有问题
-        //        self.playerView.updateAsset(URL(fileURLWithPath: "63930549652d74e477141e3b79c8d29a9ef8af81625053214516.mp3", relativeTo:Bundle.main.resourceURL!), videoComposition: nil, audioMixModel: nil)
+                //        self.playerView.updateAsset(URL(fileURLWithPath: "63930549652d74e477141e3b79c8d29a9ef8af81625053214516.mp3", relativeTo:Bundle.main.resourceURL!), videoComposition: nil, audioMixModel: nil)
 
                 self.playerView.updateAsset(URL(fileURLWithPath: documensDirectory + audioPath), videoComposition: nil, audioMixModel: nil, originMusicDuration: self.finallyUserAudioTime, clipAudioRange: self.getClipAudioRange())
 
@@ -989,12 +978,8 @@ class PQStuckPointEditerController: PQBaseViewController {
                         self?.synchroMarskView.removeMarskView()
                     }
                 }
-                
             }
         }
-        
-     
-      
     }
 
     deinit {
@@ -1083,7 +1068,7 @@ extension PQStuckPointEditerController {
     func createStickers(sections: List<PQEditSectionModel>, inputSize _: CGSize = .zero, model: createStickersModel = .createStickersModelPoint) -> [PQEditVisionTrackMaterialsModel] {
         // 推荐卡点数
         let beginDecoderTime: TimeInterval = Date().timeIntervalSince1970
- 
+
         // 保存滤镜对象数据
         var stickers: Array = Array<PQEditVisionTrackMaterialsModel>.init()
         for section in sections {
@@ -1157,14 +1142,14 @@ extension PQStuckPointEditerController {
                                 let asset: AVURLAsset = AVURLAsset(url: URL(fileURLWithPath: documensDirectory + sticker.locationPath), options: nil)
                                 BFLog(message: "单个视频\(sticker.locationPath)时长::\(CMTimeGetSeconds(asset.duration)) ,clipNum is:\(sticker.clipCount)")
                                 var lastOutTime: Float64 = 0.0
-                                for clipindex in 0 ... sticker.clipCount  {
+                                for clipindex in 0 ... sticker.clipCount {
                                     // deep copy sticker model 防止只有一个对象
                                     let deepCopyStickerDecoderTime: TimeInterval = Date().timeIntervalSince1970
 
                                     let stickerjson = sticker.toJSONString(prettyPrint: false)
-                              
-                                    let deepCopySticker =  Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: stickerjson!)
-                                    
+
+                                    let deepCopySticker = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: stickerjson!)
+
                                     BFLog(message: "生成stickers 总时长为 aaa\(Date().timeIntervalSince1970 - deepCopyStickerDecoderTime)")
                                     // 设置循环模式和适配模式
                                     deepCopySticker?.generateDefaultValues()
@@ -1175,13 +1160,13 @@ extension PQStuckPointEditerController {
                                         tempSpeed = (totalClipNum + clipindex) % 2 == 0 ? maxSpeed : minSpeed
                                     }
 
-                                    if totalClipNum  + clipindex + 1 < finallyStuckPoints.count {
+                                    if totalClipNum + clipindex + 1 < finallyStuckPoints.count {
                                         deepCopySticker?.speedRate = tempSpeed
                                         // 定义临时使用的变量
                                         // 素材显示的开始时间和结束时间
                                         let tempTimelineIn = Float64(finallyStuckPoints[totalClipNum + clipindex])
                                         let timelineOut = Float64(finallyStuckPoints[totalClipNum + 1 + clipindex])
-                                        
+
                                         // 素材分割的开始时间和结束时间
                                         let tempModel_In = lastOutTime
                                         var tempOut = lastOutTime + Float64(tempSpeed) * (timelineOut - tempTimelineIn)
@@ -1208,8 +1193,8 @@ extension PQStuckPointEditerController {
                                                     continue
                                                 }
                                             }
-                                            
-                                            tempOut =  CMTimeGetSeconds(asset.duration)
+
+                                            tempOut = CMTimeGetSeconds(asset.duration)
                                         }
 
                                         deepCopySticker?.model_in = tempModel_In
@@ -1230,7 +1215,7 @@ extension PQStuckPointEditerController {
                                 totalClipNum = totalClipNum + sticker.clipCount
                             } else if sticker.type == StickerType.IMAGE.rawValue {
                                 if totalClipNum + 2 >= finallyStuckPoints.count {
-                                    BFLog(message: "数据出现错误!!!查正")//155.318253
+                                    BFLog(message: "数据出现错误!!!查正") // 155.318253
                                     break
                                 }
                                 sticker.generateDefaultValues()
@@ -1245,7 +1230,7 @@ extension PQStuckPointEditerController {
                 }
             }
         }
-        
+
         BFLog(message: "生成stickers 总时长为:\(Date().timeIntervalSince1970 - beginDecoderTime)")
         return stickers
     }
@@ -1307,24 +1292,20 @@ extension PQStuckPointEditerController {
 
         return stuckPoints
     }
-    
-    func clipPoint(clipCount:Int,oldPoints: Array<Float>)  {
+
+    func clipPoint(clipCount: Int, oldPoints: Array<Float>) {
         BFLog(message: "拼接卡点数:\(clipCount)")
-        
-        //如果是第一次拼接先补第0位
-        if(finallyStuckPoints.count == 0){
+
+        // 如果是第一次拼接先补第0位
+        if finallyStuckPoints.count == 0 {
             finallyStuckPoints.append(stuckPointsTemp.first ?? 0.0)
-            
-        }
-        for i in finallyStuckPoints.count...clipCount + finallyStuckPoints.count  {
- 
-            if ((i % (oldPoints.count - 1)) != 0){
-                finallyStuckPoints.append(finallyStuckPoints[i-1] + oldPoints[i%(oldPoints.count - 1)] - oldPoints[(i-1)%(oldPoints.count - 1)])
-            }else {
-                finallyStuckPoints.append(finallyStuckPoints[i-1] + oldPoints[1] - oldPoints[0])
-                
+        }
+        for i in finallyStuckPoints.count ... clipCount + finallyStuckPoints.count {
+            if (i % (oldPoints.count - 1)) != 0 {
+                finallyStuckPoints.append(finallyStuckPoints[i - 1] + oldPoints[i % (oldPoints.count - 1)] - oldPoints[(i - 1) % (oldPoints.count - 1)])
+            } else {
+                finallyStuckPoints.append(finallyStuckPoints[i - 1] + oldPoints[1] - oldPoints[0])
             }
-        
         }
     }
 
@@ -1332,7 +1313,7 @@ extension PQStuckPointEditerController {
     func dealParameter(model: createStickersModel) {
         // 清空上一次使用的卡点数据
         finallyStuckPoints.removeAll()
-     
+
         // 已经取到的视频素材总长度,用于和原视频素材时长做对比,不够多加一个点
         var useAssestDuration: Float = 0.0
         switch model {
@@ -1344,10 +1325,10 @@ extension PQStuckPointEditerController {
 
             var i: Int = 0
             // L/(n+1)  L -原视觉素材总时长  n-抛留倍数  lastJumpSpeedSelectIndex 是位置 对应的值要+1
-            //根据公式计划出的总时长
+            // 根据公式计划出的总时长
             let jumpTime = Float(selectedTotalDuration) / Float(maxSpeed + 1)
-            //只有图片素材时会为0
-            if(jumpTime > 0){
+            // 只有图片素材时会为0
+            if jumpTime > 0 {
                 while useAssestDuration < Float(jumpTime) {
                     // 回环从头取\
                     if i + 1 >= stuckPointsTemp.count {
@@ -1356,17 +1337,15 @@ extension PQStuckPointEditerController {
                     // 快速段
                     let LA = (stuckPointsTemp[i + 1] - stuckPointsTemp[i])
                     useAssestDuration = useAssestDuration + Float(LA)
-                    
+
                     i = i + 1
                     clipNum = clipNum + 1
                 }
 
                 // 拼接要使用的卡点信息
-           
-                clipPoint(clipCount:clipNum , oldPoints: stuckPointsTemp)
+
+                clipPoint(clipCount: clipNum, oldPoints: stuckPointsTemp)
             }
-   
-            
 
             break
         case .createStickersModelSpeed, .createStickersModelOnlyMusic: // 快慢速
@@ -1446,33 +1425,32 @@ extension PQStuckPointEditerController {
                             sticker.clipCount = LACount + LBCount
                             // LACount + LBCount = 0 ?  11s视频x6倍速
                             if sticker.clipCount == 0 { sticker.clipCount = 1 }
-                      
-                            if(stuckPointsTemp.count < 1){
+
+                            if stuckPointsTemp.count < 1 {
                                 //todo 和产品沟通提示
                                 BFLog(message: "卡点数据有错误!!!")
                                 return
                             }
-             
-                            //sticker.clipCount + 1 是都先补一位,当不用补时删除最后多的一位
-                            clipPoint(clipCount: sticker.clipCount , oldPoints: stuckPointsTemp)
+
+                            // sticker.clipCount + 1 是都先补一位,当不用补时删除最后多的一位
+                            clipPoint(clipCount: sticker.clipCount, oldPoints: stuckPointsTemp)
                             BFLog(message: "finallyStuckPoints\(finallyStuckPoints)")
- 
+
                             // 3,多补一个卡点 做 C级 速处理,要根据条件不满足 要删除最后一位,
                             if useAssestDurationTemp < assetDuration {
-                                
-                                //下一个卡的的速度性质快、慢
+                                // 下一个卡的的速度性质快、慢
                                 var tempSpeed: Float = 1.0
                                 if model == .createStickersModelSpeed {
                                     tempSpeed = (sticker.clipCount) % 2 == 0 ? maxSpeed : minSpeed
                                 }
                                 // 最后一点素材时长
                                 let lastAssetDuration = Float(CMTimeGetSeconds(asset.duration)) - useAssestDurationTemp
-                                
+
                                 lastPointIndex = (sticker.clipCount % stuckPointsTemp.count)
-                                //两个卡点
-                                let a:Float = stuckPointsTemp[lastPointIndex ?? 0]
-                                var b:Float = 0.0
-                                if((lastPointIndex ?? 0) + 1 < stuckPointsTemp.count){
+                                // 两个卡点
+                                let a: Float = stuckPointsTemp[lastPointIndex ?? 0]
+                                var b: Float = 0.0
+                                if (lastPointIndex ?? 0) + 1 < stuckPointsTemp.count {
                                     b = stuckPointsTemp[(lastPointIndex ?? 0) + 1]
                                     let pointDuration = b - a
                                     // 要适应到卡点内要使用的C速度
@@ -1486,17 +1464,12 @@ extension PQStuckPointEditerController {
                                     } else { // 当前卡点段为慢速
                                         if needSpeed >= 0.4 * tempSpeed && needSpeed >= 0.2 {
                                             // 查找使用的最后一个卡点在原数组中的位置
-                                        }else{
-                                           
+                                        } else {
                                             BFLog(message: "条件不满足不用补位 删除多加的一位")
                                             finallyStuckPoints.removeLast()
                                         }
                                     }
-                                  
                                 }
-                                
-                              
-                               
                             }
                         }
                     }
@@ -1507,26 +1480,25 @@ extension PQStuckPointEditerController {
         }
         // 拼接图片所使用的时长.选择一组图片 按图片数量计算卡点的总时长
         if selectedImageDataCount > 0 {
-            clipPoint(clipCount:selectedImageDataCount - 1, oldPoints: stuckPointsTemp)
-  
-        }
-        
-        //全是图片时数组里放着的一定都是图片的使用的卡点
-        //定义一次循环的总时长
-        var oneSelectImageDuration:Float = 0.0
-        if(selectedDataCount == selectedImageDataCount){
+            clipPoint(clipCount: selectedImageDataCount - 1, oldPoints: stuckPointsTemp)
+        }
+
+        // 全是图片时数组里放着的一定都是图片的使用的卡点
+        // 定义一次循环的总时长
+        var oneSelectImageDuration: Float = 0.0
+        if selectedDataCount == selectedImageDataCount {
             oneSelectImageDuration = (finallyStuckPoints.last ?? 0) - (finallyStuckPoints.first ?? 0)
         }
 
         // 3)素材全是图片时如果时长 < 10s要做轮播处理
         if selectedDataCount == selectedImageDataCount && oneSelectImageDuration < 10 {
-            //设置 UI类型为循环模式
+            // 设置 UI类型为循环模式
             speedSettingView.viewType = 3
 
             // lastCyclesSelectIndex != -1 已经设置过循环次数 应该是手动设置的值
-            if lastCyclesSelectIndex != -1 { 
-                //纯图片时 已经默认添加一次循环 所以要用lastCyclesSelectIndex - 1
-                for i in 0 ..< lastCyclesSelectIndex{
+            if lastCyclesSelectIndex != -1 {
+                // 纯图片时 已经默认添加一次循环 所以要用lastCyclesSelectIndex - 1
+                for i in 0 ..< lastCyclesSelectIndex {
                     var pointIndex = stuckPointsTemp.firstIndex(where: { (point) -> Bool in
                         (point == (finallyStuckPoints.last ?? 0).truncatingRemainder(dividingBy: (stuckPointsTemp.last ?? 0)))
                     })
@@ -1537,8 +1509,7 @@ extension PQStuckPointEditerController {
                         finallyStuckPoints.append(a + b)
                     }
                 }
-               
-             
+
             } else {
                 lastCyclesSelectIndex = 0
                 while oneSelectImageDuration < 10 {
@@ -1552,30 +1523,25 @@ extension PQStuckPointEditerController {
                         let b = Float((i + Int(pointIndex ?? 0)) / stuckPointsTemp.count) * (stuckPointsTemp.first ?? 0)
                         finallyStuckPoints.append(a + b)
                     }
-                    oneSelectImageDuration = Float((finallyStuckPoints.last ?? 0) - (finallyStuckPoints.first ?? 0)) +  oneSelectImageDuration
- 
+                    oneSelectImageDuration = Float((finallyStuckPoints.last ?? 0) - (finallyStuckPoints.first ?? 0)) + oneSelectImageDuration
+
                     lastCyclesSelectIndex = lastCyclesSelectIndex + 1
                 }
                 speedSettingView.setSelectItem(index: lastCyclesSelectIndex, isSettingPlayer: false)
             }
-        }else{
-            
-            //设置速度选择的位置
-            if speedSettingView.viewType == 1{
-                speedSettingView.setSelectItem(index: lastSpeedSelectIndex , isSettingPlayer: false)
-            }else if speedSettingView.viewType == 2{
+        } else {
+            // 设置速度选择的位置
+            if speedSettingView.viewType == 1 {
+                speedSettingView.setSelectItem(index: lastSpeedSelectIndex, isSettingPlayer: false)
+            } else if speedSettingView.viewType == 2 {
                 speedSettingView.setSelectItem(index: lastJumpSpeedSelectIndex, isSettingPlayer: false)
-            }else if speedSettingView.viewType == 3{
-                
-                if(lastCyclesSelectIndex != -1){
-                    speedSettingView.setSelectItem(index: lastCyclesSelectIndex , isSettingPlayer: false)
-                }else{
-                    speedSettingView.setSelectItem(index: 0 , isSettingPlayer: false)
+            } else if speedSettingView.viewType == 3 {
+                if lastCyclesSelectIndex != -1 {
+                    speedSettingView.setSelectItem(index: lastCyclesSelectIndex, isSettingPlayer: false)
+                } else {
+                    speedSettingView.setSelectItem(index: 0, isSettingPlayer: false)
                 }
-                
             }
- 
-          
         }
 
         // 四,背景音乐时长处理)计算最后使用的音频时长, 如果不用拼接音频时长度是卡点的倒数第二位时间
@@ -1594,11 +1560,8 @@ extension PQStuckPointEditerController {
         for (index, usePoint) in finallyStuckPoints.enumerated() {
             BFLog(message: "测试人员最后使用的卡点信息 \(index) : \(usePoint)")
         }
-        
-        BFLog(message: "计算后给播放器使用的开始:\(CMTimeGetSeconds(playeTimeRange.start)) 结束时间\(CMTimeGetSeconds(playeTimeRange.end)) 播放总时长:\(CMTimeGetSeconds(playeTimeRange.end) - CMTimeGetSeconds(playeTimeRange.start))")
-  
 
-   
+        BFLog(message: "计算后给播放器使用的开始:\(CMTimeGetSeconds(playeTimeRange.start)) 结束时间\(CMTimeGetSeconds(playeTimeRange.end)) 播放总时长:\(CMTimeGetSeconds(playeTimeRange.end) - CMTimeGetSeconds(playeTimeRange.start))")
     }
 }
 
@@ -1623,8 +1586,7 @@ extension PQStuckPointEditerController {
                     if newMusicData?.speed != nil {
                         self?.stuckPointMusicData?.speed = newMusicData?.speed ?? 2
                     }
- 
-                    
+
                     if self?.stuckPointMusicData?.localPath == nil || (self?.stuckPointMusicData?.localPath?.count ?? 0) > 0 {
                         PQDownloadManager.downLoadFile(url: self?.stuckPointMusicData?.musicPath ?? "") { [weak self] filePath, error in
                             if error == nil, filePath != nil {
@@ -1788,9 +1750,9 @@ extension PQStuckPointEditerController {
             lastJumpSpeedSelectIndex = 2
         } else if selectedTotalDuration >= 160 && selectedTotalDuration < 200 {
             lastJumpSpeedSelectIndex = 3
-        } else if (selectedTotalDuration >= 200 && selectedTotalDuration < 240 ) || selectedTotalDuration >= 240  {
+        } else if (selectedTotalDuration >= 200 && selectedTotalDuration < 240) || selectedTotalDuration >= 240 {
             lastJumpSpeedSelectIndex = 4
-        } 
+        }
 
         /* 默认进入快慢速模式
          - 当素材总时长∈[120,144]s 时,快慢速处理方式:快速为 6x,慢速为 1.2x,效果是快&快
@@ -1821,14 +1783,14 @@ extension PQStuckPointEditerController {
             BFLog(message: "是再创作进来的 \(reCreateVideoData!.rhythmMode)")
             switch reCreateVideoData!.rhythmMode {
             case 1:
-                editModelClick(sender: jumpPointBtn,reportLog: false)
+                editModelClick(sender: jumpPointBtn, reportLog: false)
                 break
             case 2:
-                editModelClick(sender: speedStuckBtn,reportLog: false)
+                editModelClick(sender: speedStuckBtn, reportLog: false)
 
                 break
             case 3:
-                editModelClick(sender: onlyMusicBtn,reportLog: false)
+                editModelClick(sender: onlyMusicBtn, reportLog: false)
                 break
             default: break
             }
@@ -1851,16 +1813,16 @@ extension PQStuckPointEditerController {
             BFLog(message: "全是图片 \(selectedDataCount) \(selectedImageDataCount)")
 
             // 默认进入跳跃卡点模式
-            editModelClick(sender: jumpPointBtn,reportLog: false)
+            editModelClick(sender: jumpPointBtn, reportLog: false)
 
         } else {
             // 默认进入快慢速模式
             if selectedTotalDuration > 0 && selectedTotalDuration <= 144 {
-                editModelClick(sender: speedStuckBtn ,reportLog: false)
+                editModelClick(sender: speedStuckBtn, reportLog: false)
 
             } else {
                 // 默认进入卡点模式
-                editModelClick(sender: jumpPointBtn,reportLog: false)
+                editModelClick(sender: jumpPointBtn, reportLog: false)
             }
         }
     }