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