Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [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 | |
| 11 | #import <Foundation/Foundation.h> |
| 12 | |
| 13 | #import "RTCMacros.h" |
| 14 | |
| 15 | NS_ASSUME_NONNULL_BEGIN |
| 16 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 17 | @class RTC_OBJC_TYPE(RTCAudioSource); |
| 18 | @class RTC_OBJC_TYPE(RTCAudioTrack); |
| 19 | @class RTC_OBJC_TYPE(RTCConfiguration); |
| 20 | @class RTC_OBJC_TYPE(RTCMediaConstraints); |
| 21 | @class RTC_OBJC_TYPE(RTCMediaStream); |
| 22 | @class RTC_OBJC_TYPE(RTCPeerConnection); |
| 23 | @class RTC_OBJC_TYPE(RTCVideoSource); |
| 24 | @class RTC_OBJC_TYPE(RTCVideoTrack); |
| 25 | @class RTC_OBJC_TYPE(RTCPeerConnectionFactoryOptions); |
| 26 | @protocol RTC_OBJC_TYPE |
| 27 | (RTCPeerConnectionDelegate); |
| 28 | @protocol RTC_OBJC_TYPE |
| 29 | (RTCVideoDecoderFactory); |
| 30 | @protocol RTC_OBJC_TYPE |
| 31 | (RTCVideoEncoderFactory); |
Yury Yaroshevich | 19a6e94 | 2022-03-11 09:22:08 +0100 | [diff] [blame^] | 32 | @protocol RTC_OBJC_TYPE |
| 33 | (RTCSSLCertificateVerifier); |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 34 | |
Mirko Bonadei | e8d5724 | 2018-09-17 10:22:56 +0200 | [diff] [blame] | 35 | RTC_OBJC_EXPORT |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 36 | @interface RTC_OBJC_TYPE (RTCPeerConnectionFactory) : NSObject |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 37 | |
| 38 | /* Initialize object with default H264 video encoder/decoder factories */ |
| 39 | - (instancetype)init; |
| 40 | |
| 41 | /* Initialize object with injectable video encoder/decoder factories */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 42 | - (instancetype) |
| 43 | initWithEncoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoEncoderFactory)>)encoderFactory |
| 44 | decoderFactory:(nullable id<RTC_OBJC_TYPE(RTCVideoDecoderFactory)>)decoderFactory; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 45 | |
| 46 | /** Initialize an RTCAudioSource with constraints. */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 47 | - (RTC_OBJC_TYPE(RTCAudioSource) *)audioSourceWithConstraints: |
| 48 | (nullable RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 49 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 50 | /** Initialize an RTCAudioTrack with an id. Convenience ctor to use an audio source |
| 51 | * with no constraints. |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 52 | */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 53 | - (RTC_OBJC_TYPE(RTCAudioTrack) *)audioTrackWithTrackId:(NSString *)trackId; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 54 | |
| 55 | /** Initialize an RTCAudioTrack with a source and an id. */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 56 | - (RTC_OBJC_TYPE(RTCAudioTrack) *)audioTrackWithSource:(RTC_OBJC_TYPE(RTCAudioSource) *)source |
| 57 | trackId:(NSString *)trackId; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 58 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 59 | /** Initialize a generic RTCVideoSource. The RTCVideoSource should be |
| 60 | * passed to a RTCVideoCapturer implementation, e.g. |
| 61 | * RTCCameraVideoCapturer, in order to produce frames. |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 62 | */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 63 | - (RTC_OBJC_TYPE(RTCVideoSource) *)videoSource; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 64 | |
Saúl Ibarra Corretgé | 4d0760e | 2021-08-06 16:17:12 +0200 | [diff] [blame] | 65 | /** Initialize a generic RTCVideoSource with he posibility of marking |
| 66 | * it as usable for screen sharing. The RTCVideoSource should be |
| 67 | * passed to a RTCVideoCapturer implementation, e.g. |
| 68 | * RTCCameraVideoCapturer, in order to produce frames. |
| 69 | */ |
| 70 | - (RTC_OBJC_TYPE(RTCVideoSource) *)videoSourceForScreenCast:(BOOL)forScreenCast; |
| 71 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 72 | /** Initialize an RTCVideoTrack with a source and an id. */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 73 | - (RTC_OBJC_TYPE(RTCVideoTrack) *)videoTrackWithSource:(RTC_OBJC_TYPE(RTCVideoSource) *)source |
| 74 | trackId:(NSString *)trackId; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 75 | |
| 76 | /** Initialize an RTCMediaStream with an id. */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 77 | - (RTC_OBJC_TYPE(RTCMediaStream) *)mediaStreamWithStreamId:(NSString *)streamId; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 78 | |
| 79 | /** Initialize an RTCPeerConnection with a configuration, constraints, and |
| 80 | * delegate. |
| 81 | */ |
Yura Yaroshevich | d140c8f | 2021-03-02 23:25:10 +0300 | [diff] [blame] | 82 | - (nullable RTC_OBJC_TYPE(RTCPeerConnection) *) |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 83 | peerConnectionWithConfiguration:(RTC_OBJC_TYPE(RTCConfiguration) *)configuration |
| 84 | constraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints |
| 85 | delegate:(nullable id<RTC_OBJC_TYPE(RTCPeerConnectionDelegate)>)delegate; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 86 | |
Yury Yaroshevich | 19a6e94 | 2022-03-11 09:22:08 +0100 | [diff] [blame^] | 87 | - (nullable RTC_OBJC_TYPE(RTCPeerConnection) *) |
| 88 | peerConnectionWithConfiguration:(RTC_OBJC_TYPE(RTCConfiguration) *)configuration |
| 89 | constraints:(RTC_OBJC_TYPE(RTCMediaConstraints) *)constraints |
| 90 | certificateVerifier: |
| 91 | (id<RTC_OBJC_TYPE(RTCSSLCertificateVerifier)>)certificateVerifier |
| 92 | delegate:(nullable id<RTC_OBJC_TYPE(RTCPeerConnectionDelegate)>)delegate; |
| 93 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 94 | /** Set the options to be used for subsequently created RTCPeerConnections */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 95 | - (void)setOptions:(nonnull RTC_OBJC_TYPE(RTCPeerConnectionFactoryOptions) *)options; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 96 | |
| 97 | /** Start an AecDump recording. This API call will likely change in the future. */ |
| 98 | - (BOOL)startAecDumpWithFilePath:(NSString *)filePath maxSizeInBytes:(int64_t)maxSizeInBytes; |
| 99 | |
| 100 | /* Stop an active AecDump recording */ |
| 101 | - (void)stopAecDump; |
| 102 | |
| 103 | @end |
| 104 | |
| 105 | NS_ASSUME_NONNULL_END |