@_exported import AVFoundation // Clang module import CoreMedia import Foundation %{ from gyb_foundation_support import \ ObjectiveCBridgeableImplementationForNSValueWithCategoryMethods }% extension AVError { /// The device name. public var device: String? { return userInfo[AVErrorDeviceKey] as? String } /// The time. public var time: CMTime? { return userInfo[AVErrorTimeKey] as? CMTime } /// The file size. public var fileSize: Int64? { return (userInfo[AVErrorFileSizeKey] as? NSNumber)?.int64Value } /// The process ID number. public var processID: Int? { return userInfo[AVErrorPIDKey] as? Int } /// Whether the recording successfully finished. public var recordingSuccessfullyFinished: Bool? { return userInfo[AVErrorRecordingSuccessfullyFinishedKey] as? Bool } /// The media type. public var mediaType: String? { return userInfo[AVErrorMediaTypeKey] as? String } /// The media subtypes. public var mediaSubtypes: [Int]? { return userInfo[AVErrorMediaSubTypeKey] as? [Int] } } // Bridge CoreMedia structs to NSValue. // AVFoundation provides internal NSValue subclasses for these structures that // are incompatible with the NSConcreteValue subclasses you get using // -[NSValue valueWithBytes:objCType:]. ${ ObjectiveCBridgeableImplementationForNSValueWithCategoryMethods( Type="CMTime", initializer="{ NSValue(time: $0) }", getter="{ $0.timeValue }", ) } ${ ObjectiveCBridgeableImplementationForNSValueWithCategoryMethods( Type="CMTimeRange", initializer="{ NSValue(timeRange: $0) }", getter="{ $0.timeRangeValue }", ) } ${ ObjectiveCBridgeableImplementationForNSValueWithCategoryMethods( Type="CMTimeMapping", initializer="{ NSValue(timeMapping: $0) }", getter="{ $0.timeMappingValue }", ) }