Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -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 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 11 | #import "RTCMediaStreamTrack.h" |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 12 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 13 | #include "api/mediastreaminterface.h" |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 14 | |
Jon Hjelle | ca91e38 | 2016-01-21 15:36:47 -0800 | [diff] [blame] | 15 | typedef NS_ENUM(NSInteger, RTCMediaStreamTrackType) { |
| 16 | RTCMediaStreamTrackTypeAudio, |
| 17 | RTCMediaStreamTrackTypeVideo, |
| 18 | }; |
| 19 | |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 20 | NS_ASSUME_NONNULL_BEGIN |
| 21 | |
Yura Yaroshevich | 01cee07 | 2018-07-11 15:35:40 +0300 | [diff] [blame] | 22 | @class RTCPeerConnectionFactory; |
| 23 | |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 24 | @interface RTCMediaStreamTrack () |
| 25 | |
Yura Yaroshevich | 01cee07 | 2018-07-11 15:35:40 +0300 | [diff] [blame] | 26 | @property(nonatomic, readonly) RTCPeerConnectionFactory *factory; |
| 27 | |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 28 | /** |
Jon Hjelle | ca91e38 | 2016-01-21 15:36:47 -0800 | [diff] [blame] | 29 | * The native MediaStreamTrackInterface passed in or created during |
| 30 | * construction. |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 31 | */ |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 32 | @property(nonatomic, readonly) rtc::scoped_refptr<webrtc::MediaStreamTrackInterface> nativeTrack; |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * Initialize an RTCMediaStreamTrack from a native MediaStreamTrackInterface. |
| 36 | */ |
Yura Yaroshevich | 01cee07 | 2018-07-11 15:35:40 +0300 | [diff] [blame] | 37 | - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory |
| 38 | nativeTrack:(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack |
| 39 | type:(RTCMediaStreamTrackType)type NS_DESIGNATED_INITIALIZER; |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 40 | |
Yura Yaroshevich | 01cee07 | 2018-07-11 15:35:40 +0300 | [diff] [blame] | 41 | - (instancetype)initWithFactory:(RTCPeerConnectionFactory *)factory |
| 42 | nativeTrack:(rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack; |
skvlad | 79b4b87 | 2016-04-08 17:28:55 -0700 | [diff] [blame] | 43 | |
| 44 | - (BOOL)isEqualToTrack:(RTCMediaStreamTrack *)track; |
| 45 | |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 46 | + (webrtc::MediaStreamTrackInterface::TrackState)nativeTrackStateForState: |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 47 | (RTCMediaStreamTrackState)state; |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 48 | |
| 49 | + (RTCMediaStreamTrackState)trackStateForNativeState: |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 50 | (webrtc::MediaStreamTrackInterface::TrackState)nativeState; |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 51 | |
| 52 | + (NSString *)stringForState:(RTCMediaStreamTrackState)state; |
| 53 | |
Yura Yaroshevich | 415920b | 2018-02-22 13:55:22 +0300 | [diff] [blame] | 54 | + (RTCMediaStreamTrack *)mediaTrackForNativeTrack: |
Yura Yaroshevich | 01cee07 | 2018-07-11 15:35:40 +0300 | [diff] [blame] | 55 | (rtc::scoped_refptr<webrtc::MediaStreamTrackInterface>)nativeTrack |
| 56 | factory:(RTCPeerConnectionFactory *)factory; |
Yura Yaroshevich | 415920b | 2018-02-22 13:55:22 +0300 | [diff] [blame] | 57 | |
Jon Hjelle | 8102879 | 2016-01-11 13:16:13 -0800 | [diff] [blame] | 58 | @end |
| 59 | |
| 60 | NS_ASSUME_NONNULL_END |