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 "RTCMediaSource.h" | |
12 | |
13 #import "webrtc/api/objc/RTCMediaSource+Private.h" | |
14 | |
15 @interface RTCMediaSource () { | |
tkchin_webrtc
2016/01/05 18:44:34
? Don't think you need this to be public
hjon
2016/01/06 00:17:15
Quite right. :-)
| |
16 rtc::scoped_refptr<webrtc::MediaSourceInterface> _mediaSource; | |
17 } | |
18 @end | |
19 | |
20 @implementation RTCMediaSource | |
21 | |
22 - (RTCSourceState)state { | |
23 return [[self class] objCSourceStateForNativeSourceState: | |
24 _mediaSource->state()]; | |
25 } | |
26 | |
27 - (NSString *)description { | |
28 return [NSString stringWithFormat:@"RTCMediaSource:\n%@", | |
29 [[self class] descriptionForObjCSourceState: | |
30 self.state]]; | |
31 } | |
32 | |
33 #pragma mark - Private | |
34 | |
35 - (rtc::scoped_refptr<webrtc::MediaSourceInterface>)nativeMediaSource { | |
36 return _mediaSource; | |
37 } | |
38 | |
39 - (instancetype)initWithMediaSource: | |
40 (rtc::scoped_refptr<webrtc::MediaSourceInterface>)mediaSource { | |
41 NSParameterAssert(mediaSource); | |
42 if (self = [super init]) { | |
43 _mediaSource = mediaSource; | |
44 } | |
45 return self; | |
46 } | |
47 | |
48 + (webrtc::MediaSourceInterface::SourceState)nativeSourceStateForObjCSourceState : | |
tkchin_webrtc
2016/01/05 18:44:34
just remove "ObjCSource" from all of these and it
hjon
2016/01/06 00:17:15
Done.
| |
49 (RTCSourceState)state { | |
50 switch (state) { | |
51 case RTCSourceStateInitializing: | |
52 return webrtc::MediaSourceInterface::kInitializing; | |
53 case RTCSourceStateLive: | |
54 return webrtc::MediaSourceInterface::kLive; | |
55 case RTCSourceStateEnded: | |
56 return webrtc::MediaSourceInterface::kEnded; | |
57 case RTCSourceStateMuted: | |
58 return webrtc::MediaSourceInterface::kMuted; | |
59 } | |
60 } | |
61 | |
62 + (RTCSourceState)objCSourceStateForNativeSourceState: | |
63 (webrtc::MediaSourceInterface::SourceState)nativeState { | |
64 switch (nativeState) { | |
65 case webrtc::MediaSourceInterface::kInitializing: | |
66 return RTCSourceStateInitializing; | |
67 case webrtc::MediaSourceInterface::kLive: | |
68 return RTCSourceStateLive; | |
69 case webrtc::MediaSourceInterface::kEnded: | |
70 return RTCSourceStateEnded; | |
71 case webrtc::MediaSourceInterface::kMuted: | |
72 return RTCSourceStateMuted; | |
73 } | |
74 } | |
75 | |
76 + (NSString *)descriptionForObjCSourceState:(RTCSourceState)state { | |
77 switch (state) { | |
78 case RTCSourceStateInitializing: | |
79 return @"Initializing"; | |
80 case RTCSourceStateLive: | |
81 return @"Live"; | |
82 case RTCSourceStateEnded: | |
83 return @"Ended"; | |
84 case RTCSourceStateMuted: | |
85 return @"Muted"; | |
86 } | |
87 } | |
88 | |
89 @end | |
OLD | NEW |