|
@@ -152,7 +152,7 @@ public class PQGPUImagePlayerView: UIView {
|
|
// 渲染区view
|
|
// 渲染区view
|
|
private lazy var renderView: RenderView = {
|
|
private lazy var renderView: RenderView = {
|
|
let view = RenderView()
|
|
let view = RenderView()
|
|
- view.backgroundColor = UIColor.black
|
|
|
|
|
|
+ view.backgroundColor = PQBFConfig.shared.styleBackGroundColor
|
|
view.frame = self.bounds
|
|
view.frame = self.bounds
|
|
view.delegate = self
|
|
view.delegate = self
|
|
let tap = UITapGestureRecognizer(target: self, action: #selector(RenderViewOnclick))
|
|
let tap = UITapGestureRecognizer(target: self, action: #selector(RenderViewOnclick))
|
|
@@ -210,8 +210,7 @@ public class PQGPUImagePlayerView: UIView {
|
|
addSubview(renderView)
|
|
addSubview(renderView)
|
|
addSubview(playView)
|
|
addSubview(playView)
|
|
addSubview(progressLab)
|
|
addSubview(progressLab)
|
|
- backgroundColor = UIColor.black
|
|
|
|
-
|
|
|
|
|
|
+ backgroundColor = PQBFConfig.shared.styleBackGroundColor
|
|
playerEmptyView = UIImageView(frame: bounds)
|
|
playerEmptyView = UIImageView(frame: bounds)
|
|
playerEmptyView.backgroundColor = .black
|
|
playerEmptyView.backgroundColor = .black
|
|
playerEmptyView.image = UIImage().BF_Image(named: "playEmpty")
|
|
playerEmptyView.image = UIImage().BF_Image(named: "playEmpty")
|
|
@@ -458,10 +457,13 @@ public class PQGPUImagePlayerView: UIView {
|
|
FilterLog(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)")
|
|
FilterLog(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)")
|
|
}
|
|
}
|
|
|
|
|
|
- movie?.removeAllTargets()
|
|
|
|
- let showFilter: PQBaseFilter = cacheFilters.first!
|
|
|
|
- movie?.addTarget(showFilter, atTargetIndex: 0)
|
|
|
|
- showFilter.addTarget(renderView, atTargetIndex: 0)
|
|
|
|
|
|
+ if(cacheFilters.first != nil){
|
|
|
|
+ movie?.removeAllTargets()
|
|
|
|
+ let showFilter: PQBaseFilter = cacheFilters.first!
|
|
|
|
+ movie?.addTarget(showFilter, atTargetIndex: 0)
|
|
|
|
+ showFilter.addTarget(renderView, atTargetIndex: 0)
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -513,9 +515,7 @@ public class PQGPUImagePlayerView: UIView {
|
|
|
|
|
|
(currTime > (filter.stickerInfo?.timelineOut ?? 0.0))
|
|
(currTime > (filter.stickerInfo?.timelineOut ?? 0.0))
|
|
})
|
|
})
|
|
- for (index,bsFilter )in cacheFilters.enumerated() {
|
|
|
|
- print( "111111缓存操作 没要查找到要查找的显示是为:\(currTime) 缓存数据timeline in :\(bsFilter.stickerInfo?.timelineIn ?? 0.0)) timelineOut:\(bsFilter.stickerInfo?.timelineOut ?? 0.0) 缓存数 \(cacheFilters.count) index: \(index)")
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
// 2,找出一个要显示的 fitler
|
|
// 2,找出一个要显示的 fitler
|
|
let showIndex = cacheFilters.firstIndex(where: { (filter) -> Bool in
|
|
let showIndex = cacheFilters.firstIndex(where: { (filter) -> Bool in
|
|
(currTime >= (filter.stickerInfo?.timelineIn ?? 0.0) && currTime <= (filter.stickerInfo?.timelineOut ?? 0.0))
|
|
(currTime >= (filter.stickerInfo?.timelineIn ?? 0.0) && currTime <= (filter.stickerInfo?.timelineOut ?? 0.0))
|
|
@@ -532,7 +532,7 @@ public class PQGPUImagePlayerView: UIView {
|
|
|
|
|
|
let showFilter: PQBaseFilter = cacheFilters[showIndex ?? 0]
|
|
let showFilter: PQBaseFilter = cacheFilters[showIndex ?? 0]
|
|
|
|
|
|
- print("缓存操作 查找到命中的显示是为:\(currTime) 缓存数据timeline in :\(showFilter.stickerInfo?.timelineIn ?? 0.0)) timelineOut:\(showFilter.stickerInfo?.out ?? 0.0) 缓存数 \(cacheFilters.count) index: \(String(describing: showIndex))")
|
|
|
|
|
|
+ print("缓存操作 查找到命中的显示是为:\(currTime) 缓存数据timeline in :\(showFilter.stickerInfo?.timelineIn ?? 0.0)) timelineOut:\(showFilter.stickerInfo?.timelineOut ?? 0.0) 缓存数 \(cacheFilters.count) index: \(String(describing: showIndex))")
|
|
|
|
|
|
if(!(showFilter.isShow)){
|
|
if(!(showFilter.isShow)){
|
|
FilterLog(message: "showIndex当前时间为 \(currTime) showIndex is \(String(describing: showIndex)) 显示 filter timein is: \(String(describing: showFilter.stickerInfo?.timelineIn)) timeout is: \(String(describing: showFilter.stickerInfo?.timelineOut))")
|
|
FilterLog(message: "showIndex当前时间为 \(currTime) showIndex is \(String(describing: showIndex)) 显示 filter timein is: \(String(describing: showFilter.stickerInfo?.timelineIn)) timeout is: \(String(describing: showFilter.stickerInfo?.timelineOut))")
|
|
@@ -540,16 +540,17 @@ public class PQGPUImagePlayerView: UIView {
|
|
showFilter.isShow = true
|
|
showFilter.isShow = true
|
|
|
|
|
|
movie!.removeAllTargets()
|
|
movie!.removeAllTargets()
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
if(showFilter.stickerInfo?.type == StickerType.IMAGE.rawValue && showGaussianBlur){
|
|
if(showFilter.stickerInfo?.type == StickerType.IMAGE.rawValue && showGaussianBlur){
|
|
- //高斯层
|
|
|
|
- let json = showFilter.stickerInfo?.toJSONString(prettyPrint: false)
|
|
|
|
- if json == nil {
|
|
|
|
- FilterLog(message: "数据转换有问题 跳转")
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
self.createFiltersQueue.async {
|
|
self.createFiltersQueue.async {
|
|
|
|
+ //高斯层
|
|
|
|
+ let json = showFilter.stickerInfo?.toJSONString(prettyPrint: false)
|
|
|
|
+ if json == nil {
|
|
|
|
+ FilterLog(message: "数据转换有问题 跳转")
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
let blurStickerModel: PQEditVisionTrackMaterialsModel? = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: json!)
|
|
let blurStickerModel: PQEditVisionTrackMaterialsModel? = Mapper<PQEditVisionTrackMaterialsModel>().map(JSONString: json!)
|
|
blurStickerModel?.canvasFillType = stickerContentMode.aspectFillStr.rawValue
|
|
blurStickerModel?.canvasFillType = stickerContentMode.aspectFillStr.rawValue
|
|
let showGaussianFitler:PQBaseFilter = PQImageFilter(sticker: blurStickerModel!)
|
|
let showGaussianFitler:PQBaseFilter = PQImageFilter(sticker: blurStickerModel!)
|
|
@@ -558,11 +559,11 @@ public class PQGPUImagePlayerView: UIView {
|
|
iosb.blurRadiusInPixels = 20
|
|
iosb.blurRadiusInPixels = 20
|
|
showGaussianFitler.addTarget(iosb)
|
|
showGaussianFitler.addTarget(iosb)
|
|
|
|
|
|
- DispatchQueue.main.async {[weak self] in
|
|
|
|
|
|
+ sharedImageProcessingContext.runOperationAsynchronously{ [self] in
|
|
|
|
|
|
- self?.movie?.addTarget(showGaussianFitler, atTargetIndex: 0)
|
|
|
|
|
|
+ self.movie?.addTarget(showGaussianFitler, atTargetIndex: 0)
|
|
iosb.addTarget(showFilter)
|
|
iosb.addTarget(showFilter)
|
|
- showFilter.addTarget(self?.renderView as! ImageConsumer, atTargetIndex: 0)
|
|
|
|
|
|
+ showFilter.addTarget(self.renderView as! ImageConsumer, atTargetIndex: 0)
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|