1
1
import AVFoundation
2
2
import CoreImage
3
3
4
- final class VideoIOComponent : IOComponent {
4
+ final class AVVideoIOUnit : AVIOUnit {
5
5
#if os(macOS)
6
6
static let defaultAttributes : [ NSString : NSObject ] = [
7
7
kCVPixelBufferPixelFormatTypeKey: NSNumber ( value: kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange) ,
@@ -56,7 +56,7 @@ final class VideoIOComponent: IOComponent {
56
56
}
57
57
58
58
private var attributes : [ NSString : NSObject ] {
59
- var attributes : [ NSString : NSObject ] = VideoIOComponent . defaultAttributes
59
+ var attributes : [ NSString : NSObject ] = Self . defaultAttributes
60
60
attributes [ kCVPixelBufferWidthKey] = NSNumber ( value: Int ( extent. width) )
61
61
attributes [ kCVPixelBufferHeightKey] = NSNumber ( value: Int ( extent. height) )
62
62
return attributes
@@ -399,7 +399,7 @@ final class VideoIOComponent: IOComponent {
399
399
}
400
400
}
401
401
402
- extension VideoIOComponent {
402
+ extension AVVideoIOUnit {
403
403
func encodeSampleBuffer( _ sampleBuffer: CMSampleBuffer ) {
404
404
guard let buffer: CVImageBuffer = CMSampleBufferGetImageBuffer ( sampleBuffer) else {
405
405
return
@@ -444,7 +444,7 @@ extension VideoIOComponent {
444
444
}
445
445
}
446
446
447
- extension VideoIOComponent {
447
+ extension AVVideoIOUnit {
448
448
func startDecoding( ) {
449
449
decoder. startRunning ( )
450
450
}
@@ -455,7 +455,7 @@ extension VideoIOComponent {
455
455
}
456
456
}
457
457
458
- extension VideoIOComponent : AVCaptureVideoDataOutputSampleBufferDelegate {
458
+ extension AVVideoIOUnit : AVCaptureVideoDataOutputSampleBufferDelegate {
459
459
// MARK: AVCaptureVideoDataOutputSampleBufferDelegate
460
460
func captureOutput( _ captureOutput: AVCaptureOutput , didOutput sampleBuffer: CMSampleBuffer , from connection: AVCaptureConnection ) {
461
461
#if os(macOS)
@@ -467,7 +467,7 @@ extension VideoIOComponent: AVCaptureVideoDataOutputSampleBufferDelegate {
467
467
}
468
468
}
469
469
470
- extension VideoIOComponent : VideoDecoderDelegate {
470
+ extension AVVideoIOUnit : VideoDecoderDelegate {
471
471
// MARK: VideoDecoderDelegate
472
472
func sampleOutput( video sampleBuffer: CMSampleBuffer ) {
473
473
renderer? . enqueue ( sampleBuffer)
0 commit comments