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 "RTCMediaStreamTrack.h"
12 
13 #include "api/media_stream_interface.h"
14 
15 typedef NS_ENUM(NSInteger, RTCMediaStreamTrackType) {
16   RTCMediaStreamTrackTypeAudio,
17   RTCMediaStreamTrackTypeVideo,
18 };
19 
20 NS_ASSUME_NONNULL_BEGIN
21 
22 @class RTC_OBJC_TYPE(RTCPeerConnectionFactory);
23 
24 @interface RTC_OBJC_TYPE (RTCMediaStreamTrack)
25 ()
26 
27         @property(nonatomic, readonly) RTC_OBJC_TYPE(RTCPeerConnectionFactory) *
28     factory;
29 
30 /**
31  * The native MediaStreamTrackInterface passed in or created during
32  * construction.
33  */
34 @property(nonatomic, readonly) rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack;
35 
36 /**
37  * Initialize an RTCMediaStreamTrack from a native MediaStreamTrackInterface.
38  */
39 - (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory
40                     nativeTrack:(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack
41                            type:(RTCMediaStreamTrackType)type NS_DESIGNATED_INITIALIZER;
42 
43 - (instancetype)initWithFactory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory
44                     nativeTrack:(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack;
45 
46 - (BOOL)isEqualToTrack:(RTC_OBJC_TYPE(RTCMediaStreamTrack) *)track;
47 
48 + (webrtc::MediaStreamTrackInterface::TrackState)nativeTrackStateForState:
49         (RTCMediaStreamTrackState)state;
50 
51 + (RTCMediaStreamTrackState)trackStateForNativeState:
52         (webrtc::MediaStreamTrackInterface::TrackState)nativeState;
53 
54 + (NSString *)stringForState:(RTCMediaStreamTrackState)state;
55 
56 + (RTC_OBJC_TYPE(RTCMediaStreamTrack) *)
57     mediaTrackForNativeTrack:(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack
58                      factory:(RTC_OBJC_TYPE(RTCPeerConnectionFactory) *)factory;
59 
60 @end
61 
62 NS_ASSUME_NONNULL_END
63