|
@@ -60,8 +60,11 @@ class PQStuckPointEditerController: PQBaseViewController {
|
|
|
var lastEditModelBtn: UIButton?
|
|
|
|
|
|
|
|
|
- var maxSpeed: Float = 1
|
|
|
- var minSpeed: Float = 1
|
|
|
+
|
|
|
+ var modelSpeed_maxSpeed: Float = 1.0
|
|
|
+ var modelSpeed_minSpeed: Float = 1.0
|
|
|
+
|
|
|
+ var modelPoint_speed:Float = 1.0
|
|
|
|
|
|
|
|
|
var lastSpeedSelectIndex: Int = 0
|
|
@@ -359,13 +362,15 @@ class PQStuckPointEditerController: PQBaseViewController {
|
|
|
|
|
|
if self?.speedSettingView.viewType == 1 {
|
|
|
self?.lastSpeedSelectIndex = selectIndex
|
|
|
+ self?.modelSpeed_maxSpeed = maxSpeed
|
|
|
+ self?.modelSpeed_minSpeed = minSpeed
|
|
|
} else if self?.speedSettingView.viewType == 2 {
|
|
|
self?.lastJumpSpeedSelectIndex = selectIndex
|
|
|
+ self?.modelPoint_speed = maxSpeed
|
|
|
} else {
|
|
|
self?.lastCyclesSelectIndex = selectIndex
|
|
|
}
|
|
|
- self?.maxSpeed = maxSpeed
|
|
|
- self?.minSpeed = minSpeed
|
|
|
+
|
|
|
} else {
|
|
|
BFLog(message: "设置速度无效")
|
|
|
}
|
|
@@ -384,16 +389,18 @@ class PQStuckPointEditerController: PQBaseViewController {
|
|
|
customSpeedSetView.isHidden = true
|
|
|
customSpeedSetView.selectSpeedCallBack = { [weak self, weak customSpeedSetView] maxSpeed, minSpeed, isJumpSpeedModel, isCancle in
|
|
|
if !isCancle {
|
|
|
- self?.maxSpeed = maxSpeed
|
|
|
- self?.minSpeed = minSpeed
|
|
|
+
|
|
|
BFLog(message: "自定义速度maxSpeed is\(maxSpeed) minSpeed \(minSpeed) \(isJumpSpeedModel)")
|
|
|
self?.musicEditBGView.pausePlayer()
|
|
|
|
|
|
|
|
|
if self?.speedSettingView.viewType == 1 {
|
|
|
self?.lastSpeedSelectIndex = -1
|
|
|
+ self?.modelSpeed_maxSpeed = maxSpeed
|
|
|
+ self?.modelSpeed_minSpeed = minSpeed
|
|
|
} else if self?.speedSettingView.viewType == 2 {
|
|
|
self?.lastJumpSpeedSelectIndex = -1
|
|
|
+ self?.modelPoint_speed = maxSpeed
|
|
|
} else {
|
|
|
self?.lastCyclesSelectIndex = Int(maxSpeed - 1)
|
|
|
}
|
|
@@ -833,8 +840,8 @@ class PQStuckPointEditerController: PQBaseViewController {
|
|
|
playerView.pause()
|
|
|
let videoExporter = PQStuckPointPublicController()
|
|
|
videoExporter.rhythmMode = currentCreateStickersModel
|
|
|
- videoExporter.syncedUpVideoSpeedMin = minSpeed
|
|
|
- videoExporter.syncedUpVideoSpeedMax = maxSpeed
|
|
|
+ videoExporter.syncedUpVideoSpeedMin = modelSpeed_maxSpeed
|
|
|
+ videoExporter.syncedUpVideoSpeedMax = modelSpeed_minSpeed
|
|
|
videoExporter.isReCreate = isReCreate
|
|
|
videoExporter.selectedTotalDuration = selectedTotalDuration
|
|
|
videoExporter.selectedDataCount = selectedDataCount
|
|
@@ -1265,7 +1272,8 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
var tempSpeed: Float = 1.0
|
|
|
if model == .createStickersModelSpeed {
|
|
|
- tempSpeed = (stickers.count % 2) == 0 ? maxSpeed : minSpeed
|
|
|
+
|
|
|
+ tempSpeed = (stickers.count % 2) == 0 ? modelSpeed_maxSpeed : modelSpeed_minSpeed
|
|
|
}
|
|
|
|
|
|
if stickers.count + 1 < finallyStuckPoints.count {
|
|
@@ -1314,7 +1322,7 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
lastOutTime = deepCopySticker?.out ?? 0
|
|
|
}
|
|
|
- BFLog(message: "测试人员创建 sticker crilp is in 视频 \(String(format: "%.6f", deepCopySticker?.model_in ?? 0)) out \(String(format: "%.6f", deepCopySticker?.out ?? 0)) ,分段素材时长:\(String(format: "%.6f", (deepCopySticker?.out ?? 0) - (deepCopySticker?.model_in ?? 0))) ,分段显示时长:\(String(format: "%.6f", (deepCopySticker?.timelineOut ?? 0) - (deepCopySticker?.timelineIn ?? 0))), 视频素材原时长\(CMTimeGetSeconds(asset.duration)) clipCount \(sticker.clipCount) timelineIN: \(String(format: "%.6f", deepCopySticker?.timelineIn ?? 0)) timelineOUT:\(String(format: "%.6f", deepCopySticker?.timelineOut ?? 0)) speedRate:\(deepCopySticker?.speedRate ?? 0.0)")
|
|
|
+ BFLog(message: "测试人员创建 sticker crilp is in 视频 \(String(format: "%.6f", deepCopySticker?.model_in ?? 0)) out \(String(format: "%.6f", deepCopySticker?.out ?? 0)) ,分段素材时长:\(String(format: "%.6f", (deepCopySticker?.out ?? 0) - (deepCopySticker?.model_in ?? 0))) ,分段显示时长:\(String(format: "%.6f", (deepCopySticker?.timelineOut ?? 0) - (deepCopySticker?.timelineIn ?? 0))), 视频素材原时长\(CMTimeGetSeconds(asset.duration)) clipNum \(sticker.clipCount) timelineIN: \(String(format: "%.6f", deepCopySticker?.timelineIn ?? 0)) timelineOUT:\(String(format: "%.6f", deepCopySticker?.timelineOut ?? 0)) speedRate:\(deepCopySticker?.speedRate ?? 0.0)")
|
|
|
|
|
|
if deepCopySticker != nil {
|
|
|
if(deepCopySticker?.timelineIn == 0){
|
|
@@ -1406,10 +1414,10 @@ extension PQStuckPointEditerController {
|
|
|
return stuckPoints
|
|
|
}
|
|
|
|
|
|
- func clipPoint(clipCount: Int, oldPoints: Array<Float>) {
|
|
|
- BFLog(message: "拼接卡点数:\(clipCount)")
|
|
|
- if(clipCount < 0 || oldPoints.count < 2){
|
|
|
- BFLog(message: "clipCount is error!!!! \(clipCount)")
|
|
|
+ func clipPoint(clipNum: Int, oldPoints: Array<Float>) {
|
|
|
+ BFLog(message: "拼接卡点数:\(clipNum)")
|
|
|
+ if(clipNum < 0 || oldPoints.count < 2){
|
|
|
+ BFLog(message: "clipNum is error!!!! \(clipNum)")
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -1417,7 +1425,7 @@ extension PQStuckPointEditerController {
|
|
|
finallyStuckPoints.append(stuckPointsTemp.first ?? 0.0)
|
|
|
}
|
|
|
|
|
|
- for i in finallyStuckPoints.count ... clipCount + finallyStuckPoints.count {
|
|
|
+ for i in finallyStuckPoints.count ... clipNum + finallyStuckPoints.count {
|
|
|
if (i % (oldPoints.count - 1)) != 1 {
|
|
|
let value = String(format: "%.6f", finallyStuckPoints[i - 1] + oldPoints[((i-1) % (oldPoints.count - 1)) + 1] - oldPoints[((i - 2) % (oldPoints.count - 1)) + 1])
|
|
|
|
|
@@ -1446,7 +1454,7 @@ extension PQStuckPointEditerController {
|
|
|
var i: Int = 0
|
|
|
|
|
|
|
|
|
- let jumpTime = Float(selectedTotalDuration) / Float(maxSpeed + 1)
|
|
|
+ let jumpTime = Float(selectedTotalDuration) / Float(modelPoint_speed + 1)
|
|
|
|
|
|
if jumpTime > 0 {
|
|
|
while useAssestDuration < Float(jumpTime) {
|
|
@@ -1464,7 +1472,7 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
|
|
|
|
|
|
- clipPoint(clipCount: clipNum, oldPoints: stuckPointsTemp)
|
|
|
+ clipPoint(clipNum: clipNum, oldPoints: stuckPointsTemp)
|
|
|
}
|
|
|
|
|
|
break
|
|
@@ -1473,11 +1481,11 @@ extension PQStuckPointEditerController {
|
|
|
var tempMaxSpeed: Float = 1
|
|
|
var tempMinSpeed: Float = 1
|
|
|
|
|
|
- if((maxSpeed == 0.0 && minSpeed == 0.0) && selectedDataCount != selectedImageDataCount && model == .createStickersModelSpeed){
|
|
|
- BFLog(message: "速度参数有错误 要重新计算!!!")
|
|
|
- dealWithDataSuccess()
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if model == .createStickersModelSpeed {
|
|
|
|
|
|
if model == .createStickersModelSpeed && selectedDataCount != selectedImageDataCount {
|
|
@@ -1486,8 +1494,8 @@ extension PQStuckPointEditerController {
|
|
|
stuckPointsTemp = getUsedStuckPoint(seed: (stuckPointMusicData?.speed ?? 0))
|
|
|
}
|
|
|
|
|
|
- tempMaxSpeed = maxSpeed
|
|
|
- tempMinSpeed = minSpeed
|
|
|
+ tempMaxSpeed = modelSpeed_maxSpeed
|
|
|
+ tempMinSpeed = modelSpeed_minSpeed
|
|
|
} else {
|
|
|
stuckPointsTemp = getUsedStuckPoint(seed: (stuckPointMusicData?.speed ?? 0))
|
|
|
|
|
@@ -1518,12 +1526,12 @@ extension PQStuckPointEditerController {
|
|
|
}
|
|
|
var j = finallyStuckPoints.count
|
|
|
|
|
|
- var pointCount:Int = 0
|
|
|
+ var pointCount:Int = 1
|
|
|
|
|
|
var useAssestDurationTemp: Float = 0.0
|
|
|
while useAssestDurationTemp < assetDuration {
|
|
|
|
|
|
- let useSpeed = (pointCount % 2 == 0 ) ? tempMaxSpeed : tempMinSpeed
|
|
|
+ let useSpeed = (pointCount % 2 != 0 ) ? tempMaxSpeed : tempMinSpeed
|
|
|
|
|
|
|
|
|
var sub:Float = 0.0
|
|
@@ -1557,10 +1565,10 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
|
|
|
if useAssestDurationTemp < assetDuration {
|
|
|
-
|
|
|
+
|
|
|
var tempSpeed: Float = 1.0
|
|
|
if model == .createStickersModelSpeed {
|
|
|
- tempSpeed = (sticker.clipCount) % 2 == 0 ? maxSpeed : minSpeed
|
|
|
+ tempSpeed = (sticker.clipCount) % 2 == 0 ? modelSpeed_maxSpeed : modelSpeed_minSpeed
|
|
|
}
|
|
|
|
|
|
let lastAssetDuration = Float(CMTimeGetSeconds(asset.duration)) - useAssestDurationTemp
|
|
@@ -1602,7 +1610,7 @@ extension PQStuckPointEditerController {
|
|
|
}
|
|
|
|
|
|
if selectedImageDataCount > 0 {
|
|
|
- clipPoint(clipCount: selectedImageDataCount - 1, oldPoints: stuckPointsTemp)
|
|
|
+ clipPoint(clipNum: selectedImageDataCount - 1, oldPoints: stuckPointsTemp)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1619,7 +1627,7 @@ extension PQStuckPointEditerController {
|
|
|
if lastCyclesSelectIndex != -1 {
|
|
|
|
|
|
if(lastCyclesSelectIndex != 0){
|
|
|
- clipPoint(clipCount: selectedImageDataCount * lastCyclesSelectIndex - 1, oldPoints: stuckPointsTemp)
|
|
|
+ clipPoint(clipNum: selectedImageDataCount * lastCyclesSelectIndex - 1, oldPoints: stuckPointsTemp)
|
|
|
}
|
|
|
|
|
|
} else {
|
|
@@ -1627,7 +1635,7 @@ extension PQStuckPointEditerController {
|
|
|
lastCyclesSelectIndex = 0
|
|
|
while oneSelectImageDuration < 10 {
|
|
|
|
|
|
- clipPoint(clipCount: selectedImageDataCount - 1, oldPoints: stuckPointsTemp)
|
|
|
+ clipPoint(clipNum: selectedImageDataCount - 1, oldPoints: stuckPointsTemp)
|
|
|
oneSelectImageDuration = Float((finallyStuckPoints.last ?? 0) - (finallyStuckPoints.first ?? 0))
|
|
|
|
|
|
lastCyclesSelectIndex = lastCyclesSelectIndex + 1
|