|
@@ -50,7 +50,7 @@ class OJAAssetReader: NSObject {
|
|
|
if trackStatus == AVKeyValueStatus.loaded {
|
|
|
self.setupTrackOutput(asset: self.urlAsset)
|
|
|
} else {
|
|
|
- NSLog("loadValuesAsynchronously error: \(error ?? NSError())")
|
|
|
+ WSSSimpleLog("loadValuesAsynchronously error: \(error ?? NSError())")
|
|
|
}
|
|
|
semaphore.signal()
|
|
|
}
|
|
@@ -63,7 +63,7 @@ class OJAAssetReader: NSObject {
|
|
|
do {
|
|
|
try assetReader = AVAssetReader(asset: asset)
|
|
|
} catch {
|
|
|
- NSLog("creating assetReader error")
|
|
|
+ WSSSimpleLog("creating assetReader error")
|
|
|
}
|
|
|
guard let reader = assetReader else {
|
|
|
return
|
|
@@ -71,7 +71,7 @@ class OJAAssetReader: NSObject {
|
|
|
|
|
|
let dict = [kCVPixelBufferPixelFormatTypeKey as String : kCVPixelFormatType_420YpCbCr8BiPlanarFullRange]
|
|
|
guard let videoTrack = asset.tracks(withMediaType: .video).safeObject(atIndex: 0) else {
|
|
|
- NSLog("no video track")
|
|
|
+ WSSSimpleLog("no video track")
|
|
|
return
|
|
|
}
|
|
|
let videoTrackOutput = AVAssetReaderTrackOutput(track: videoTrack, outputSettings: dict)
|
|
@@ -89,7 +89,7 @@ class OJAAssetReader: NSObject {
|
|
|
|
|
|
let success = reader.startReading()
|
|
|
if !success {
|
|
|
- NSLog("reading error: \(String(describing: reader.error)) \n ***\(self.urlAsset)")
|
|
|
+ WSSSimpleLog("reading error: \(String(describing: reader.error)) \n ***\(self.urlAsset)")
|
|
|
}
|
|
|
self.lock.unlock()
|
|
|
|
|
@@ -100,7 +100,7 @@ class OJAAssetReader: NSObject {
|
|
|
let buffer: CMSampleBuffer? = audioTrackOutput?.copyNextSampleBuffer()
|
|
|
|
|
|
if let reader = assetReader, reader.status == .completed {
|
|
|
- NSLog("reader audio completed")
|
|
|
+ WSSSimpleLog("reader audio completed")
|
|
|
}
|
|
|
self.lock.unlock()
|
|
|
return buffer
|
|
@@ -111,7 +111,7 @@ class OJAAssetReader: NSObject {
|
|
|
let buffer: CMSampleBuffer? = videoTrackOutput?.copyNextSampleBuffer()
|
|
|
self.lock.unlock()
|
|
|
if let reader = assetReader, reader.status == .completed {
|
|
|
- NSLog("reader video completed")
|
|
|
+ WSSSimpleLog("reader video completed")
|
|
|
if self.shouldRepeat {
|
|
|
self.reset() //按理说如果视频不够长,则需要循环播放
|
|
|
}
|