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/RTCMediaSource+Private.h" | |
15 #import "webrtc/api/objc/RTCPeerConnectionFactory+Private.h" | |
16 #import "webrtc/api/objc/RTCVideoSource+Private.h" | |
17 | |
18 @implementation RTCAVFoundationVideoSource | |
19 | |
20 - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory | |
21 constraints:(RTCMediaConstraints *)constraints { | |
22 NSParameterAssert(factory); | |
23 rtc::scoped_ptr<webrtc::AVFoundationVideoCapturer> capturer; | |
24 capturer.reset(new webrtc::AVFoundationVideoCapturer()); | |
25 rtc::scoped_refptr<webrtc::VideoSourceInterface> source = | |
26 factory.nativeFactory->CreateVideoSource(capturer.release(), | |
27 constraints.nativeConstraints); | |
28 return [super initWithNativeMediaSource:source]; | |
tkchin_webrtc
2016/01/20 21:51:12
probably needs to be merged
hjon
2016/01/20 22:25:34
Done.
| |
29 } | |
30 | |
31 - (BOOL)useBackCamera { | |
32 return self.capturer->GetUseBackCamera(); | |
33 } | |
34 | |
35 - (void)setUseBackCamera:(BOOL)useBackCamera { | |
36 self.capturer->SetUseBackCamera(useBackCamera); | |
37 } | |
38 | |
39 - (AVCaptureSession *)captureSession { | |
40 return self.capturer->GetCaptureSession(); | |
41 } | |
42 | |
43 - (webrtc::AVFoundationVideoCapturer *)capturer { | |
44 cricket::VideoCapturer *capturer = self.nativeVideoSource->GetVideoCapturer(); | |
45 // This should be safe because no one should have changed the underlying video | |
46 // source. | |
47 webrtc::AVFoundationVideoCapturer *foundationCapturer = | |
48 static_cast<webrtc::AVFoundationVideoCapturer *>(capturer); | |
49 return foundationCapturer; | |
50 } | |
51 | |
52 @end | |
OLD | NEW |