OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #import "RTCAVFoundationVideoSource+Private.h" |
| 12 |
| 13 #import "webrtc/api/objc/RTCMediaConstraints+Private.h" |
| 14 #import "webrtc/api/objc/RTCPeerConnectionFactory+Private.h" |
| 15 #import "webrtc/api/objc/RTCVideoSource+Private.h" |
| 16 |
| 17 @implementation RTCAVFoundationVideoSource |
| 18 |
| 19 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory |
| 20 constraints:(RTCMediaConstraints *)constraints { |
| 21 NSParameterAssert(factory); |
| 22 rtc::scoped_ptr<webrtc::AVFoundationVideoCapturer> capturer; |
| 23 capturer.reset(new webrtc::AVFoundationVideoCapturer()); |
| 24 rtc::scoped_refptr<webrtc::VideoSourceInterface> source = |
| 25 factory.nativeFactory->CreateVideoSource(capturer.release(), |
| 26 constraints.nativeConstraints.get()); |
| 27 return [super initWithNativeVideoSource:source]; |
| 28 } |
| 29 |
| 30 - (BOOL)useBackCamera { |
| 31 return self.capturer->GetUseBackCamera(); |
| 32 } |
| 33 |
| 34 - (void)setUseBackCamera:(BOOL)useBackCamera { |
| 35 self.capturer->SetUseBackCamera(useBackCamera); |
| 36 } |
| 37 |
| 38 - (AVCaptureSession *)captureSession { |
| 39 return self.capturer->GetCaptureSession(); |
| 40 } |
| 41 |
| 42 - (webrtc::AVFoundationVideoCapturer *)capturer { |
| 43 cricket::VideoCapturer *capturer = self.nativeVideoSource->GetVideoCapturer(); |
| 44 // This should be safe because no one should have changed the underlying video |
| 45 // source. |
| 46 webrtc::AVFoundationVideoCapturer *foundationCapturer = |
| 47 static_cast<webrtc::AVFoundationVideoCapturer *>(capturer); |
| 48 return foundationCapturer; |
| 49 } |
| 50 |
| 51 @end |
OLD | NEW |