mirror of
https://github.com/HaishinKit/HaishinKit.swift.git
synced 2026-05-07 20:12:28 +00:00
19 lines
553 B
Swift
19 lines
553 B
Swift
import CoreMedia
|
|
import Foundation
|
|
import HaishinKit
|
|
|
|
extension NALUnitReader {
|
|
func makeFormatDescription(_ data: inout Data, type: ESStreamType) -> CMFormatDescription? {
|
|
switch type {
|
|
case .h264:
|
|
let units = read(&data, type: H264NALUnit.self)
|
|
return units.makeFormatDescription(nalUnitHeaderLength)
|
|
case .h265:
|
|
let units = read(&data, type: HEVCNALUnit.self)
|
|
return units.makeFormatDescription(nalUnitHeaderLength)
|
|
default:
|
|
return nil
|
|
}
|
|
}
|
|
}
|