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 "RTCVideoSource+Private.h" | |
12 | |
13 #include "webrtc/base/checks.h" | |
14 #include "webrtc/sdk/objc/Framework/Classes/objcvideotracksource.h" | |
15 | |
16 // TODO(magjed): Refactor this class and target ObjcVideoTrackSource only once | |
17 // RTCAVFoundationVideoSource is gone. See http://crbug/webrtc/7177 for more | |
18 // info. | |
19 @implementation RTCVideoSource { | |
20 rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> _nativeVideoSource; | |
21 } | |
22 | |
23 - (instancetype)initWithNativeVideoSource: | |
24 (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource { | |
25 RTC_DCHECK(nativeVideoSource); | |
26 if (self = [super initWithNativeMediaSource:nativeVideoSource | |
27 type:RTCMediaSourceTypeVideo]) { | |
28 _nativeVideoSource = nativeVideoSource; | |
29 } | |
30 return self; | |
31 } | |
32 | |
33 - (instancetype)initWithNativeMediaSource: | |
34 (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource | |
35 type:(RTCMediaSourceType)type { | |
36 RTC_NOTREACHED(); | |
37 return nil; | |
38 } | |
39 | |
40 - (NSString *)description { | |
41 NSString *stateString = [[self class] stringForState:self.state]; | |
42 return [NSString stringWithFormat:@"RTCVideoSource( %p ): %@", self, stateStri
ng]; | |
43 } | |
44 | |
45 - (void)capturer:(RTCVideoCapturer *)capturer didCaptureVideoFrame:(RTCVideoFram
e *)frame { | |
46 static_cast<webrtc::ObjcVideoTrackSource *>(_nativeVideoSource.get())->OnCaptu
redFrame(frame); | |
47 } | |
48 | |
49 - (void)adaptOutputFormatToWidth:(int)width height:(int)height fps:(int)fps { | |
50 static_cast<webrtc::ObjcVideoTrackSource *>(_nativeVideoSource.get()) | |
51 ->OnOutputFormatRequest(width, height, fps); | |
52 } | |
53 | |
54 #pragma mark - Private | |
55 | |
56 - (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource { | |
57 return _nativeVideoSource; | |
58 } | |
59 | |
60 @end | |
OLD | NEW |