Initial video sticker implementation

This commit is contained in:
Ilya Laktyushin
2021-12-08 16:47:35 +04:00
parent e39736da87
commit c00520929c
13 changed files with 209 additions and 29 deletions

View File

@@ -57,7 +57,7 @@ public final class SoftwareVideoSource {
private var enqueuedFrames: [(MediaTrackFrame, CGFloat, CGFloat, Bool)] = []
private var hasReadToEnd: Bool = false
public init(path: String) {
public init(path: String, hintVP9: Bool) {
let _ = FFMpegMediaFrameSourceContextHelpers.registerFFMpegGlobals
var s = stat()
@@ -74,7 +74,9 @@ public final class SoftwareVideoSource {
self.path = path
let avFormatContext = FFMpegAVFormatContext()
if hintVP9 {
avFormatContext.forceVideoCodecId(FFMpegCodecIdVP9)
}
let ioBufferSize = 64 * 1024
let avIoContext = FFMpegAVIOContext(bufferSize: Int32(ioBufferSize), opaqueContext: Unmanaged.passUnretained(self).toOpaque(), readPacket: readPacketCallback, writePacket: nil, seek: seekCallback)