|
@@ -120,7 +120,7 @@ public class PQCompositionExporter {
|
|
|
} catch {
|
|
|
print("Couldn't process movie with error: \(error)")
|
|
|
}
|
|
|
- FilterLog(message: "export mShowVidoSize is \(String(describing: input?.mShowVidoSize))")
|
|
|
+ BFLog(message: "export mShowVidoSize is \(String(describing: input?.mShowVidoSize))")
|
|
|
|
|
|
let videoEncodingSettings: [String: Any] = [
|
|
|
AVVideoCompressionPropertiesKey: [
|
|
@@ -169,21 +169,34 @@ public class PQCompositionExporter {
|
|
|
public func findShowStikcer(currTime:Float64) {
|
|
|
|
|
|
if(mStickers?.count ?? 0 == 0){
|
|
|
- FilterLog(message: "mStickers data is error")
|
|
|
+ BFLog(message: "mStickers data is error")
|
|
|
return
|
|
|
}
|
|
|
var currentSticker:PQEditVisionTrackMaterialsModel?
|
|
|
|
|
|
- for sticker in mStickers! {
|
|
|
- FilterLog(message: "sticker in \(sticker.timelineIn) out \(sticker.timelineOut) currTime is \(currTime)")
|
|
|
- if(sticker.timelineIn <= currTime && sticker.timelineOut >= currTime){
|
|
|
- currentSticker = sticker
|
|
|
+// for sticker in mStickers! {
|
|
|
+// BFLog(message: "sticker in \(sticker.timelineIn) out \(sticker.timelineOut) currTime is \(currTime)")
|
|
|
+// if(sticker.timelineIn <= currTime && sticker.timelineOut >= currTime){
|
|
|
+// currentSticker = sticker
|
|
|
+// break
|
|
|
+// }
|
|
|
+// }
|
|
|
+ while true {
|
|
|
+ if let sticker = mStickers!.first {
|
|
|
+ if sticker.timelineIn <= currTime && sticker.timelineOut >= currTime {
|
|
|
+ currentSticker = sticker
|
|
|
+ break
|
|
|
+ }else{
|
|
|
+ mStickers!.removeFirst()
|
|
|
+ }
|
|
|
+ }else{
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//创建不同的filter
|
|
|
if(currentSticker == nil){
|
|
|
- FilterLog(message: "sticker data is error")
|
|
|
+ BFLog(message: "sticker data is error")
|
|
|
return
|
|
|
}
|
|
|
if(input != nil && lastshowSticker != currentSticker){
|
|
@@ -254,7 +267,7 @@ public class PQCompositionExporter {
|
|
|
//高斯层
|
|
|
let json = currentSticker?.toJSONString(prettyPrint: false)
|
|
|
if json == nil {
|
|
|
- FilterLog(message: "数据转换有问题 跳转")
|
|
|
+ BFLog(message: "数据转换有问题 跳转")
|
|
|
return
|
|
|
}
|
|
|
let blurStickerModel: PQEditVisionTrackMaterialsModel? = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: json!)
|
|
@@ -278,7 +291,7 @@ public class PQCompositionExporter {
|
|
|
|
|
|
}else{
|
|
|
if(weatMaskFilter != nil){
|
|
|
- FilterLog(1, message: "find show stricker")
|
|
|
+ BFLog(1, message: "find show stricker")
|
|
|
currentTarget.addTarget(showFitler!, atTargetIndex: 0)
|
|
|
showFitler?.addTarget(weatMaskFilter!, atTargetIndex: 0)
|
|
|
weatMaskFilter?.addTarget(output!, atTargetIndex: 0)
|
|
@@ -301,7 +314,7 @@ public class PQCompositionExporter {
|
|
|
input?.completion = { [weak self] in
|
|
|
self?.output?.finishRecording { [weak self] in
|
|
|
self?.input?.removeAllTargets()
|
|
|
- FilterLog(message: "导出视频完成发通知")
|
|
|
+ BFLog(message: "导出视频完成发通知")
|
|
|
DispatchQueue.main.async {[weak self] in
|
|
|
if let url = self?.tmpExportURL {
|
|
|
self?.handleCaption(for: AVURLAsset(url: url, options: nil))
|
|
@@ -379,7 +392,7 @@ public class PQCompositionExporter {
|
|
|
exporter?.videoComposition = videoComposition
|
|
|
exporter?.exportAsynchronously { [weak self] in
|
|
|
guard let strongSelf = self else { return }
|
|
|
- FilterLog(message: "导出完成 \(strongSelf.exportURL)")
|
|
|
+ BFLog(message: "导出完成 \(strongSelf.exportURL)")
|
|
|
DispatchQueue.main.async {
|
|
|
strongSelf.progressClosure?(1, 1, 1)
|
|
|
strongSelf.completion?(strongSelf.exportURL)
|
|
@@ -393,7 +406,7 @@ public class PQCompositionExporter {
|
|
|
/// - Parameter beginTime: 开始缓存的开始时间,用在 seek操作时 老的缓存已经无效不能在使用了
|
|
|
func configCache(beginTime: Float64 ) {
|
|
|
cacheFilters.removeAll()
|
|
|
- FilterLog(2, message: "原素材 总数:\(mStickers?.count ?? 0) ")
|
|
|
+ BFLog(2, message: "原素材 总数:\(mStickers?.count ?? 0) ")
|
|
|
|
|
|
if mStickers?.count ?? 0 > 0 {
|
|
|
|
|
@@ -427,7 +440,7 @@ public class PQCompositionExporter {
|
|
|
|
|
|
|
|
|
for (index, filter) in cacheFilters.enumerated() {
|
|
|
- FilterLog(2, message: " 初始化 config create currentSticker timelinein \(String(describing: filter.stickerInfo?.timelineIn)) timelineout \(String(describing: filter.stickerInfo?.timelineOut)) in :\(String(describing: filter.stickerInfo?.model_in)) out \(String(describing: filter.stickerInfo?.out)) index\(index)")
|
|
|
+ BFLog(2, message: " 初始化 config create currentSticker timelinein \(String(describing: filter.stickerInfo?.timelineIn)) timelineout \(String(describing: filter.stickerInfo?.timelineOut)) in :\(String(describing: filter.stickerInfo?.model_in)) out \(String(describing: filter.stickerInfo?.out)) index\(index)")
|
|
|
}
|
|
|
|
|
|
if(cacheFilters.first != nil){
|
|
@@ -446,12 +459,12 @@ public class PQCompositionExporter {
|
|
|
|
|
|
//创建下一个filter 数据
|
|
|
func createNextFilter() {
|
|
|
- FilterLog(2, message: "加入前 当前的缓存个数为: \(cacheFilters.count) maxCount \(cacheFiltersMaxCount) 最后一个显示时间 \(String(describing: cacheFilters.last?.stickerInfo?.timelineIn))")
|
|
|
+ BFLog(2, message: "加入前 当前的缓存个数为: \(cacheFilters.count) maxCount \(cacheFiltersMaxCount) 最后一个显示时间 \(String(describing: cacheFilters.last?.stickerInfo?.timelineIn))")
|
|
|
if cacheFilters.count <= cacheFiltersMaxCount {
|
|
|
let showIndex = mStickers?.firstIndex(where: { (sticker) -> Bool in
|
|
|
(cacheFilters.last?.stickerInfo == sticker)
|
|
|
})
|
|
|
- FilterLog(2, message: "当前显示的showIndex: \(String(describing: showIndex))")
|
|
|
+ BFLog(2, message: "当前显示的showIndex: \(String(describing: showIndex))")
|
|
|
if ((showIndex ?? 0) + 1) < (mStickers?.count ?? 0) {
|
|
|
let currentSticker = mStickers?[(showIndex ?? 0) + 1]
|
|
|
if currentSticker != nil {
|
|
@@ -467,11 +480,11 @@ public class PQCompositionExporter {
|
|
|
cacheFilters.append(showFitler!)
|
|
|
}
|
|
|
}else{
|
|
|
- FilterLog(2, message: "缓存数据加入不成功!!!!!")
|
|
|
+ BFLog(2, message: "缓存数据加入不成功!!!!!")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- FilterLog(2, message: "加入后 当前的缓存个数为: \(cacheFilters.count) maxCount \(cacheFiltersMaxCount) 最后一个显示时间 \(String(describing: cacheFilters.last?.stickerInfo?.timelineIn))")
|
|
|
+ BFLog(2, message: "加入后 当前的缓存个数为: \(cacheFilters.count) maxCount \(cacheFiltersMaxCount) 最后一个显示时间 \(String(describing: cacheFilters.last?.stickerInfo?.timelineIn))")
|
|
|
|
|
|
}
|
|
|
|
|
@@ -482,7 +495,7 @@ public class PQCompositionExporter {
|
|
|
/// 按时间从缓存中取出要显示的filter
|
|
|
/// - Parameter currTime: 当前播放时间
|
|
|
func changeFilter(currTime: Float64) {
|
|
|
- FilterLog(2, message: " 要查找的 currTime is \(currTime)")
|
|
|
+ BFLog(2, message: " 要查找的 currTime is \(currTime)")
|
|
|
//1,删除已经显示过的 filter
|
|
|
self.cacheFilters.removeAll(where: {(filter) -> Bool in
|
|
|
|
|
@@ -508,7 +521,7 @@ public class PQCompositionExporter {
|
|
|
print("缓存操作 查找到命中的显示是为:\(currTime) 缓存数据timeline in :\(showFilter.stickerInfo?.timelineIn ?? 0.0)) timelineOut:\(showFilter.stickerInfo?.timelineOut ?? 0.0) 缓存数 \(cacheFilters.count) index: \(String(describing: showIndex))")
|
|
|
|
|
|
if(!(showFilter.isShow)){
|
|
|
- FilterLog(2, message: "showIndex当前时间为 \(currTime) showIndex is \(String(describing: showIndex)) 显示 filter timein is: \(String(describing: showFilter.stickerInfo?.timelineIn)) timeout is: \(String(describing: showFilter.stickerInfo?.timelineOut))")
|
|
|
+ BFLog(2, message: "showIndex当前时间为 \(currTime) showIndex is \(String(describing: showIndex)) 显示 filter timein is: \(String(describing: showFilter.stickerInfo?.timelineIn)) timeout is: \(String(describing: showFilter.stickerInfo?.timelineOut))")
|
|
|
|
|
|
showFilter.isShow = true
|
|
|
|
|
@@ -520,7 +533,7 @@ public class PQCompositionExporter {
|
|
|
//高斯层
|
|
|
let json = showFilter.stickerInfo?.toJSONString(prettyPrint: false)
|
|
|
if json == nil {
|
|
|
- FilterLog(2, message: "数据转换有问题 跳转")
|
|
|
+ BFLog(2, message: "数据转换有问题 跳转")
|
|
|
return
|
|
|
}
|
|
|
|