Jon Hjelle | f6c318e | 2016-01-11 14:39:01 -0800 | [diff] [blame] | 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 | |
tkchin | 9eeb624 | 2016-04-27 01:54:20 -0700 | [diff] [blame] | 11 | #import "RTCVideoSource+Private.h" |
Jon Hjelle | f6c318e | 2016-01-11 14:39:01 -0800 | [diff] [blame] | 12 | |
tkchin | d4bfbfc | 2016-08-30 11:56:05 -0700 | [diff] [blame] | 13 | #include "webrtc/base/checks.h" |
| 14 | |
Jon Hjelle | 065aacc | 2016-01-20 13:25:44 -0800 | [diff] [blame] | 15 | @implementation RTCVideoSource { |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame] | 16 | rtc::scoped_refptr<webrtc::VideoTrackSourceInterface> _nativeVideoSource; |
Jon Hjelle | f6c318e | 2016-01-11 14:39:01 -0800 | [diff] [blame] | 17 | } |
| 18 | |
tkchin | d4bfbfc | 2016-08-30 11:56:05 -0700 | [diff] [blame] | 19 | - (instancetype)initWithNativeVideoSource: |
| 20 | (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource { |
| 21 | RTC_DCHECK(nativeVideoSource); |
| 22 | if (self = [super initWithNativeMediaSource:nativeVideoSource |
| 23 | type:RTCMediaSourceTypeVideo]) { |
| 24 | _nativeVideoSource = nativeVideoSource; |
| 25 | } |
| 26 | return self; |
| 27 | } |
| 28 | |
| 29 | - (instancetype)initWithNativeMediaSource: |
| 30 | (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource |
| 31 | type:(RTCMediaSourceType)type { |
| 32 | RTC_NOTREACHED(); |
| 33 | return nil; |
Jon Hjelle | f6c318e | 2016-01-11 14:39:01 -0800 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | - (NSString *)description { |
tkchin | d4bfbfc | 2016-08-30 11:56:05 -0700 | [diff] [blame] | 37 | NSString *stateString = [[self class] stringForState:self.state]; |
| 38 | return [NSString stringWithFormat:@"RTCVideoSource( %p ): %@", self, stateString]; |
Jon Hjelle | f6c318e | 2016-01-11 14:39:01 -0800 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | #pragma mark - Private |
| 42 | |
perkj | a3ede6c | 2016-03-08 01:27:48 +0100 | [diff] [blame] | 43 | - (rtc::scoped_refptr<webrtc::VideoTrackSourceInterface>)nativeVideoSource { |
Jon Hjelle | 065aacc | 2016-01-20 13:25:44 -0800 | [diff] [blame] | 44 | return _nativeVideoSource; |
Jon Hjelle | f6c318e | 2016-01-11 14:39:01 -0800 | [diff] [blame] | 45 | } |
| 46 | |
Jon Hjelle | f6c318e | 2016-01-11 14:39:01 -0800 | [diff] [blame] | 47 | @end |