|
@@ -120,7 +120,7 @@ class PQStuckPointEditerController: PQBaseViewController {
|
|
|
self?.projectModel.sData?.getBGMSession()?.sectionTimeline?.audioTrack?.audioTrackMaterials.first?.timelineOut = Float64(endTime)
|
|
|
BFLog(message: "调整后总时长: \(endTime - startTime) startTime:\(startTime) endTime:\(endTime)")
|
|
|
|
|
|
- self?.playeTimeRange = CMTimeRange(start: CMTime(value: CMTimeValue(Int64(startTime * 600)), timescale: 600), end: CMTime(value: CMTimeValue(Int64(endTime * 600)), timescale: 600))
|
|
|
+ self?.playeTimeRange = CMTimeRange(start: CMTimeMakeWithSeconds(Float64(startTime), preferredTimescale: BASE_FILTER_TIMESCALE), end: CMTimeMakeWithSeconds(Float64(endTime), preferredTimescale: BASE_FILTER_TIMESCALE))
|
|
|
|
|
|
DispatchQueue.global().async {
|
|
|
let beginTime: TimeInterval = Date().timeIntervalSince1970
|
|
@@ -397,6 +397,8 @@ class PQStuckPointEditerController: PQBaseViewController {
|
|
|
let audioPath = self.stuckPointMusicData?.localPath ?? ""
|
|
|
BFLog(message: "初始化音频播放器的音频地址为:\(audioPath)")
|
|
|
self.playerView.stop()
|
|
|
+
|
|
|
+
|
|
|
self.playerView.updateAsset(URL(fileURLWithPath: documensDirectory + audioPath), videoComposition: nil, audioMixModel: nil)
|
|
|
|
|
|
let end2: TimeInterval = Date().timeIntervalSince1970
|
|
@@ -533,9 +535,9 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
var stuckPointsTemp = Array<Float>.init()
|
|
|
for (index, dunshu) in stuckPointMusicData!.rhythmSdata[0].pointTimes.enumerated() {
|
|
|
- BFLog(message: "所有卡点数:\(Float64(dunshu) / 1_000_000.0)")
|
|
|
- if Float64(dunshu) / 1_000_000.0 > CMTimeGetSeconds(playeTimeRange.start), Float64(dunshu) / 1_000_000.0 < CMTimeGetSeconds(playeTimeRange.end) {
|
|
|
- stuckPointsTemp.append(Float(dunshu) / 1_000_000.0)
|
|
|
+ BFLog(message: "原所有卡点数:\(index) \(Float(dunshu) / Float(BASE_FILTER_TIMESCALE))")
|
|
|
+ if Float64(dunshu) / Float64(BASE_FILTER_TIMESCALE) > CMTimeGetSeconds(playeTimeRange.start), Float64(dunshu) / Float64(BASE_FILTER_TIMESCALE) < CMTimeGetSeconds(playeTimeRange.end) {
|
|
|
+ stuckPointsTemp.append(Float(dunshu) / Float(BASE_FILTER_TIMESCALE))
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -548,7 +550,7 @@ extension PQStuckPointEditerController {
|
|
|
BFLog(message: "stuckPointMusicData?.speed is \(String(describing: stuckPointMusicData?.speed))")
|
|
|
for (index, point) in stuckPointsTemp.enumerated() {
|
|
|
if stuckPointMusicData?.speed == 1 {
|
|
|
- stuckPoints.append(point)
|
|
|
+ stuckPoints.append(Float(point))
|
|
|
} else if stuckPointMusicData?.speed == 2 {
|
|
|
if index % 2 == 0 {
|
|
|
stuckPoints.append(point)
|
|
@@ -562,7 +564,7 @@ extension PQStuckPointEditerController {
|
|
|
}
|
|
|
|
|
|
for point in stuckPoints {
|
|
|
- BFLog(message: "有 start end 计算后的卡点数\(point)")
|
|
|
+ BFLog(message: "没有 start end 计算后的卡点数\(point)")
|
|
|
}
|
|
|
if stuckPoints.first != nil {
|
|
|
stuckPoints.removeFirst()
|
|
@@ -570,9 +572,14 @@ extension PQStuckPointEditerController {
|
|
|
if stuckPoints.last != nil {
|
|
|
stuckPoints.removeLast()
|
|
|
}
|
|
|
+
|
|
|
stuckPoints.insert(Float(CMTimeGetSeconds(playeTimeRange.start)), at: 0)
|
|
|
- stuckPoints.insert(Float(CMTimeGetSeconds(playeTimeRange.end)), at: stuckPoints.count)
|
|
|
+ stuckPoints.insert((Float(CMTimeGetSeconds(playeTimeRange.end))), at: stuckPoints.count)
|
|
|
|
|
|
+ for point in stuckPoints {
|
|
|
+ BFLog(message: "有 start end 计算后的卡点数\(point)")
|
|
|
+ }
|
|
|
+
|
|
|
BFLog(message: "stuckPoints count is \(stuckPoints.count)")
|
|
|
|
|
|
if section.sectionTimeline!.visionTrack!.getEnableVisionTrackMaterials().count >= stuckPointMusicData!.rhythmSdata[0].pointTimes.count {
|
|
@@ -582,9 +589,8 @@ extension PQStuckPointEditerController {
|
|
|
break
|
|
|
}
|
|
|
BFLog(message: "创建 filter start :\(sticker.timelineIn) end :\(sticker.timelineOut) type is \(sticker.type) \(sticker.locationPath)")
|
|
|
-
|
|
|
- sticker.timelineIn = Float64(stuckPoints[index])
|
|
|
- sticker.timelineOut = Float64(stuckPoints[index + 1])
|
|
|
+ sticker.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0
|
|
|
+ sticker.timelineOut = Float64("\(stuckPoints[index + 1])") ?? 0.0
|
|
|
BFLog(message: "卡点 间隔 \(sticker.timelineIn - sticker.timelineOut)")
|
|
|
sticker.generateDefaultValues()
|
|
|
stickers.append(sticker)
|
|
@@ -603,8 +609,8 @@ extension PQStuckPointEditerController {
|
|
|
let deepCopySticker = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: stickerjson!)
|
|
|
if deepCopySticker!.type == StickerType.IMAGE.rawValue {
|
|
|
if index + 1 < stuckPoints.count {
|
|
|
- deepCopySticker!.timelineIn = Float64(stuckPoints[index])
|
|
|
- deepCopySticker!.timelineOut = Float64(stuckPoints[index + 1])
|
|
|
+ deepCopySticker!.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0
|
|
|
+ deepCopySticker!.timelineOut = Float64("\(stuckPoints[index + 1])") ?? 0.0
|
|
|
if deepCopySticker != nil {
|
|
|
deepCopySticker?.generateDefaultValues()
|
|
|
stickers.append(deepCopySticker!)
|
|
@@ -616,19 +622,19 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
let clipFilters = clipVideoMerage(section: section, stuckPoints: stuckPoints)
|
|
|
for (index, point) in stuckPoints.enumerated() {
|
|
|
- BFLog(message: "aaaaaindexindeindexxindexindexindex \(index)")
|
|
|
+ BFLog(message: "aaaaaindexindeindexxindexindexindex \(index) \(point)")
|
|
|
if index + 1 < stuckPoints.count, index < clipFilters.count {
|
|
|
- BFLog(message: "bbbbbindexindeindexxindexindexindex \(index)")
|
|
|
+ BFLog(message: "bbbbbindexindeindexxindexindexindex \(index) \(point)")
|
|
|
let sticker: PQEditVisionTrackMaterialsModel = clipFilters[index]
|
|
|
- sticker.timelineIn = Float64(stuckPoints[index])
|
|
|
+ sticker.timelineIn = Float64("\(stuckPoints[index])") ?? 0.0
|
|
|
|
|
|
- sticker.timelineOut = Float64(stuckPoints[index + 1]) + 1
|
|
|
+ sticker.timelineOut = Float64("\(stuckPoints[index + 1] )") ?? 0.0
|
|
|
|
|
|
let timelineInterval = sticker.timelineOut - sticker.timelineIn
|
|
|
let inOutInterval = sticker.out - sticker.model_in
|
|
|
if timelineInterval > inOutInterval {
|
|
|
BFLog(message: "实际要显示卡点时长\(timelineInterval) 素材裁剪时长:\(inOutInterval)")
|
|
|
- sticker.out = sticker.model_in + timelineInterval + 0.01
|
|
|
+ sticker.out = sticker.model_in + timelineInterval
|
|
|
|
|
|
|
|
|
let stickerInOut = sticker.out - sticker.model_in
|
|
@@ -642,7 +648,7 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
let offsetAssetDuration = sticker.out - sticker.duration
|
|
|
if offsetAssetDuration > 0 {
|
|
|
- sticker.model_in = sticker.model_in - offsetAssetDuration - 0.01
|
|
|
+ sticker.model_in = sticker.model_in - offsetAssetDuration
|
|
|
sticker.out = sticker.out - offsetAssetDuration
|
|
|
}
|
|
|
|
|
@@ -838,7 +844,8 @@ extension PQStuckPointEditerController {
|
|
|
if !isSynchroMusicInfoSuccess || !isStuckPointDataSuccess || !isExportVideosSuccess {
|
|
|
return
|
|
|
}
|
|
|
- playeTimeRange = CMTimeRange(start: CMTime(value: CMTimeValue(Int64((stuckPointMusicData?.startTime ?? 0) * 600)), timescale: 600), end: CMTime(value: CMTimeValue(Int64((stuckPointMusicData?.endTime ?? 0) * 600)), timescale: 600))
|
|
|
+
|
|
|
+ playeTimeRange = CMTimeRange(start: CMTimeMakeWithSeconds(stuckPointMusicData?.startTime ?? 0, preferredTimescale: BASE_FILTER_TIMESCALE), end: CMTimeMakeWithSeconds(stuckPointMusicData?.endTime ?? 0, preferredTimescale: BASE_FILTER_TIMESCALE))
|
|
|
createPorjectData()
|
|
|
settingPlayerView()
|
|
|
|