mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
67 lines
1.7 KiB
Swift
67 lines
1.7 KiB
Swift
import Foundation
|
|
|
|
public struct MediaResourceId: Equatable, Hashable {
|
|
public var stringRepresentation: String
|
|
|
|
public init(_ stringRepresentation: String) {
|
|
self.stringRepresentation = stringRepresentation
|
|
}
|
|
}
|
|
|
|
public protocol MediaResource: AnyObject {
|
|
var id: MediaResourceId { get }
|
|
var size: Int64? { get }
|
|
var streamable: Bool { get }
|
|
var headerSize: Int32 { get }
|
|
|
|
func isEqual(to: MediaResource) -> Bool
|
|
}
|
|
|
|
public extension MediaResource {
|
|
var streamable: Bool {
|
|
return false
|
|
}
|
|
|
|
var headerSize: Int32 {
|
|
return 0
|
|
}
|
|
}
|
|
|
|
public protocol CachedMediaResourceRepresentation {
|
|
var uniqueId: String { get }
|
|
var keepDuration: CachedMediaRepresentationKeepDuration { get }
|
|
func isEqual(to: CachedMediaResourceRepresentation) -> Bool
|
|
}
|
|
|
|
public protocol MediaResourceFetchTag {
|
|
}
|
|
|
|
public protocol MediaResourceFetchInfo {
|
|
}
|
|
|
|
public final class MediaResourceStorageLocation {
|
|
public let peerId: PeerId
|
|
public let messageId: MessageId?
|
|
|
|
public init(peerId: PeerId, messageId: MessageId?) {
|
|
self.peerId = peerId
|
|
self.messageId = messageId
|
|
}
|
|
}
|
|
|
|
public struct MediaResourceFetchParameters {
|
|
public let tag: MediaResourceFetchTag?
|
|
public let info: MediaResourceFetchInfo?
|
|
public let location: MediaResourceStorageLocation?
|
|
public let contentType: UInt8
|
|
public let isRandomAccessAllowed: Bool
|
|
|
|
public init(tag: MediaResourceFetchTag?, info: MediaResourceFetchInfo?, location: MediaResourceStorageLocation?, contentType: UInt8, isRandomAccessAllowed: Bool) {
|
|
self.tag = tag
|
|
self.info = info
|
|
self.location = location
|
|
self.contentType = contentType
|
|
self.isRandomAccessAllowed = isRandomAccessAllowed
|
|
}
|
|
}
|