Created
November 19, 2015 04:31
-
-
Save OneSadCookie/2f3b94d53d31b564d477 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CoreMedia | |
protocol PixelContainer { } | |
protocol Source { | |
typealias PixelContainerType: PixelContainer | |
func frameAtTime(time: CMTime) -> PixelContainerType? | |
} | |
class CaptureSource: Source { | |
typealias PixelContainerType = CMSampleBuffer | |
func frameAtTime(time: CMTime) -> PixelContainerType? { | |
let sample: CMSampleBuffer? = nil | |
return sample | |
} | |
} | |
class ImageSource: Source { | |
typealias PixelContainerType = CGImage | |
func frameAtTime(time: CMTime) -> PixelContainerType? { | |
let image: CGImage? = nil | |
return image | |
} | |
} | |
extension CMSampleBuffer: PixelContainer { } | |
extension CGImage: PixelContainer { } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment