mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-23 05:54:14 +00:00
34 lines
823 B
Swift
34 lines
823 B
Swift
import Foundation
|
|
import CoreMedia
|
|
import TelegramCorePrivateModule
|
|
|
|
enum MediaTrackFrameType {
|
|
case video
|
|
case audio
|
|
}
|
|
|
|
final class MediaTrackDecodableFrame {
|
|
let type: MediaTrackFrameType
|
|
let packet: UnsafeMutablePointer<AVPacket>
|
|
let pts: CMTime
|
|
let dts: CMTime
|
|
let duration: CMTime
|
|
|
|
init(type: MediaTrackFrameType, packet: UnsafePointer<AVPacket>, pts: CMTime, dts: CMTime, duration: CMTime) {
|
|
self.type = type
|
|
|
|
self.pts = pts
|
|
self.dts = dts
|
|
self.duration = duration
|
|
|
|
self.packet = UnsafeMutablePointer<AVPacket>.allocate(capacity: 1)
|
|
av_init_packet(self.packet)
|
|
av_packet_ref(self.packet, packet)
|
|
}
|
|
|
|
deinit {
|
|
av_packet_unref(self.packet)
|
|
self.packet.deallocate(capacity: 1)
|
|
}
|
|
}
|