diff options
Diffstat (limited to 'talk/app/webrtc/objc/public')
30 files changed, 1764 insertions, 0 deletions
diff --git a/talk/app/webrtc/objc/public/RTCAVFoundationVideoSource.h b/talk/app/webrtc/objc/public/RTCAVFoundationVideoSource.h new file mode 100644 index 0000000000..b6a686a7dc --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCAVFoundationVideoSource.h @@ -0,0 +1,49 @@ +/* + * libjingle + * Copyright 2015 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "RTCVideoSource.h" + +@class AVCaptureSession; +@class RTCMediaConstraints; +@class RTCPeerConnectionFactory; + +// RTCAVFoundationVideoSource is a video source that uses +// webrtc::AVFoundationVideoCapturer. We do not currently provide a wrapper for +// that capturer because cricket::VideoCapturer is not ref counted and we cannot +// guarantee its lifetime. Instead, we expose its properties through the ref +// counted video source interface. +@interface RTCAVFoundationVideoSource : RTCVideoSource + +- (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory + constraints:(RTCMediaConstraints*)constraints; + +// Switches the camera being used (either front or back). +@property(nonatomic, assign) BOOL useBackCamera; +// Returns the active capture session. +@property(nonatomic, readonly) AVCaptureSession* captureSession; + +@end diff --git a/talk/app/webrtc/objc/public/RTCAudioSource.h b/talk/app/webrtc/objc/public/RTCAudioSource.h new file mode 100644 index 0000000000..c0d38fe7ed --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCAudioSource.h @@ -0,0 +1,40 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "RTCMediaSource.h" + +// RTCAudioSource is an ObjectiveC wrapper for AudioSourceInterface. It is +// used as the source for one or more RTCAudioTrack objects. +@interface RTCAudioSource : RTCMediaSource + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCAudioTrack.h b/talk/app/webrtc/objc/public/RTCAudioTrack.h new file mode 100644 index 0000000000..48c2783173 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCAudioTrack.h @@ -0,0 +1,39 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "RTCMediaStreamTrack.h" + +// RTCAudioTrack is an ObjectiveC wrapper for AudioTrackInterface. +@interface RTCAudioTrack : RTCMediaStreamTrack + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCDataChannel.h b/talk/app/webrtc/objc/public/RTCDataChannel.h new file mode 100644 index 0000000000..24a46f655c --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCDataChannel.h @@ -0,0 +1,118 @@ +/* + * libjingle + * Copyright 2014 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// ObjectiveC wrapper for a DataChannelInit object. +@interface RTCDataChannelInit : NSObject + +// Set to YES if ordered delivery is required +@property(nonatomic) BOOL isOrdered; +// Max period in milliseconds in which retransmissions will be sent. After this +// time, no more retransmissions will be sent. -1 if unset. +@property(nonatomic) NSInteger maxRetransmitTimeMs; +// The max number of retransmissions. -1 if unset. +@property(nonatomic) NSInteger maxRetransmits; +// Set to YES if the channel has been externally negotiated and we do not send +// an in-band signalling in the form of an "open" message +@property(nonatomic) BOOL isNegotiated; +// The stream id, or SID, for SCTP data channels. -1 if unset. +@property(nonatomic) NSInteger streamId; +// Set by the application and opaque to the WebRTC implementation. +@property(nonatomic) NSString* protocol; + +@end + +// ObjectiveC wrapper for a DataBuffer object. +@interface RTCDataBuffer : NSObject + +@property(nonatomic, readonly) NSData* data; +@property(nonatomic, readonly) BOOL isBinary; + +- (instancetype)initWithData:(NSData*)data isBinary:(BOOL)isBinary; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__(( + unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end + +// Keep in sync with webrtc::DataChannelInterface::DataState +typedef enum { + kRTCDataChannelStateConnecting, + kRTCDataChannelStateOpen, + kRTCDataChannelStateClosing, + kRTCDataChannelStateClosed +} RTCDataChannelState; + +@class RTCDataChannel; +// Protocol for receving data channel state and message events. +@protocol RTCDataChannelDelegate<NSObject> + +// Called when the data channel state has changed. +- (void)channelDidChangeState:(RTCDataChannel*)channel; + +// Called when a data buffer was successfully received. +- (void)channel:(RTCDataChannel*)channel + didReceiveMessageWithBuffer:(RTCDataBuffer*)buffer; + +@optional + +// Called when the buffered amount has changed. +- (void)channel:(RTCDataChannel*)channel + didChangeBufferedAmount:(NSUInteger)amount; + +@end + +// ObjectiveC wrapper for a DataChannel object. +// See talk/app/webrtc/datachannelinterface.h +@interface RTCDataChannel : NSObject + +@property(nonatomic, readonly) NSString* label; +@property(nonatomic, readonly) BOOL isReliable; +@property(nonatomic, readonly) BOOL isOrdered; +@property(nonatomic, readonly) NSUInteger maxRetransmitTime; +@property(nonatomic, readonly) NSUInteger maxRetransmits; +@property(nonatomic, readonly) NSString* protocol; +@property(nonatomic, readonly) BOOL isNegotiated; +@property(nonatomic, readonly) NSInteger streamId; +@property(nonatomic, readonly) RTCDataChannelState state; +@property(nonatomic, readonly) NSUInteger bufferedAmount; +@property(nonatomic, weak) id<RTCDataChannelDelegate> delegate; + +- (void)close; +- (BOOL)sendData:(RTCDataBuffer*)data; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__(( + unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCEAGLVideoView.h b/talk/app/webrtc/objc/public/RTCEAGLVideoView.h new file mode 100644 index 0000000000..32c834acf8 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCEAGLVideoView.h @@ -0,0 +1,46 @@ +/* + * libjingle + * Copyright 2014 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> +#import <UIKit/UIKit.h> + +#import "RTCVideoRenderer.h" + +@class RTCEAGLVideoView; +@protocol RTCEAGLVideoViewDelegate + +- (void)videoView:(RTCEAGLVideoView*)videoView didChangeVideoSize:(CGSize)size; + +@end + +// RTCEAGLVideoView is an RTCVideoRenderer which renders i420 frames in its +// bounds using OpenGLES 2.0. +@interface RTCEAGLVideoView : UIView <RTCVideoRenderer> + +@property(nonatomic, weak) id<RTCEAGLVideoViewDelegate> delegate; + +@end diff --git a/talk/app/webrtc/objc/public/RTCFileLogger.h b/talk/app/webrtc/objc/public/RTCFileLogger.h new file mode 100644 index 0000000000..3900cb6fbe --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCFileLogger.h @@ -0,0 +1,70 @@ +/* + * libjingle + * Copyright 2015 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// TODO(tkchin): Move this to a common location. +#ifndef NS_DESIGNATED_INITIALIZER +#define NS_DESIGNATED_INITIALIZER +#endif + +typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) { + kRTCFileLoggerSeverityVerbose, + kRTCFileLoggerSeverityInfo, + kRTCFileLoggerSeverityWarning, + kRTCFileLoggerSeverityError +}; + +// This class intercepts WebRTC logs and saves them to a file. The file size +// will not exceed the given maximum bytesize. When the maximum bytesize is +// reached logs from the beginning and the end are preserved while the middle +// section is overwritten instead. +// This class is not threadsafe. +@interface RTCFileLogger : NSObject + +// The severity level to capture. The default is kRTCFileLoggerSeverityInfo. +@property(nonatomic, assign) RTCFileLoggerSeverity severity; + +// Default constructor provides default settings for dir path and file size. +- (instancetype)init; + +- (instancetype)initWithDirPath:(NSString *)dirPath + maxFileSize:(NSUInteger)maxFileSize + NS_DESIGNATED_INITIALIZER; + +// Starts writing WebRTC logs to disk if not already started. Overwrites any +// existing file(s). +- (void)start; + +// Stops writing WebRTC logs to disk. This method is also called on dealloc. +- (void)stop; + +// Returns the current contents of the logs, or nil if start has been called +// without a stop. +- (NSData *)logData; + +@end diff --git a/talk/app/webrtc/objc/public/RTCI420Frame.h b/talk/app/webrtc/objc/public/RTCI420Frame.h new file mode 100644 index 0000000000..be16a04c3d --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCI420Frame.h @@ -0,0 +1,55 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// RTCI420Frame is an ObjectiveC version of cricket::VideoFrame. +@interface RTCI420Frame : NSObject + +@property(nonatomic, readonly) NSUInteger width; +@property(nonatomic, readonly) NSUInteger height; +@property(nonatomic, readonly) NSUInteger chromaWidth; +@property(nonatomic, readonly) NSUInteger chromaHeight; +@property(nonatomic, readonly) NSUInteger chromaSize; +// These can return NULL if the object is not backed by a buffer. +@property(nonatomic, readonly) const uint8_t* yPlane; +@property(nonatomic, readonly) const uint8_t* uPlane; +@property(nonatomic, readonly) const uint8_t* vPlane; +@property(nonatomic, readonly) NSInteger yPitch; +@property(nonatomic, readonly) NSInteger uPitch; +@property(nonatomic, readonly) NSInteger vPitch; + +- (BOOL)makeExclusive; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__(( + unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end + diff --git a/talk/app/webrtc/objc/public/RTCICECandidate.h b/talk/app/webrtc/objc/public/RTCICECandidate.h new file mode 100644 index 0000000000..25e4fe2aee --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCICECandidate.h @@ -0,0 +1,56 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// RTCICECandidate contains an instance of ICECandidateInterface. +@interface RTCICECandidate : NSObject + +// If present, this contains the identifier of the "media stream +// identification" as defined in [RFC 3388] for m-line this candidate is +// associated with. +@property(nonatomic, copy, readonly) NSString* sdpMid; + +// This indicates the index (starting at zero) of m-line in the SDP this +// candidate is associated with. +@property(nonatomic, assign, readonly) NSInteger sdpMLineIndex; + +// Creates an SDP-ized form of this candidate. +@property(nonatomic, copy, readonly) NSString* sdp; + +// Creates an ICECandidateInterface based on SDP string. +- (id)initWithMid:(NSString*)sdpMid + index:(NSInteger)sdpMLineIndex + sdp:(NSString*)sdp; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__(( + unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCICEServer.h b/talk/app/webrtc/objc/public/RTCICEServer.h new file mode 100644 index 0000000000..35acf0db5b --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCICEServer.h @@ -0,0 +1,49 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// RTCICEServer allows for the creation of ICEServer structs. +@interface RTCICEServer : NSObject + +// The server URI, username, and password. +@property(nonatomic, strong, readonly) NSURL* URI; +@property(nonatomic, copy, readonly) NSString* username; +@property(nonatomic, copy, readonly) NSString* password; + +// Initializer for RTCICEServer taking uri, username, and password. +- (id)initWithURI:(NSURL*)URI + username:(NSString*)username + password:(NSString*)password; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__(( + unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCLogging.h b/talk/app/webrtc/objc/public/RTCLogging.h new file mode 100644 index 0000000000..bcd160d921 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCLogging.h @@ -0,0 +1,92 @@ +/* + * libjingle + * Copyright 2015 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// Subset of rtc::LoggingSeverity. +typedef NS_ENUM(NSInteger, RTCLoggingSeverity) { + kRTCLoggingSeverityVerbose, + kRTCLoggingSeverityInfo, + kRTCLoggingSeverityWarning, + kRTCLoggingSeverityError, +}; + +#if defined(__cplusplus) +extern "C" void RTCLogEx(RTCLoggingSeverity severity, NSString* logString); +extern "C" void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); +extern "C" NSString* RTCFileName(const char* filePath); +#else + +// Wrapper for C++ LOG(sev) macros. +// Logs the log string to the webrtc logstream for the given severity. +extern void RTCLogEx(RTCLoggingSeverity severity, NSString* logString); + +// Wrapper for rtc::LogMessage::LogToDebug. +// Sets the minimum severity to be logged to console. +extern void RTCSetMinDebugLogLevel(RTCLoggingSeverity severity); + +// Returns the filename with the path prefix removed. +extern NSString* RTCFileName(const char* filePath); + +#endif + +// Some convenience macros. + +#define RTCLogString(format, ...) \ + [NSString stringWithFormat:@"(%@:%d %s): " format, \ + RTCFileName(__FILE__), \ + __LINE__, \ + __FUNCTION__, \ + ##__VA_ARGS__] + +#define RTCLogFormat(severity, format, ...) \ + do { \ + NSString *logString = RTCLogString(format, ##__VA_ARGS__); \ + RTCLogEx(severity, logString); \ + } while (false) + +#define RTCLogVerbose(format, ...) \ + RTCLogFormat(kRTCLoggingSeverityVerbose, format, ##__VA_ARGS__) \ + +#define RTCLogInfo(format, ...) \ + RTCLogFormat(kRTCLoggingSeverityInfo, format, ##__VA_ARGS__) \ + +#define RTCLogWarning(format, ...) \ + RTCLogFormat(kRTCLoggingSeverityWarning, format, ##__VA_ARGS__) \ + +#define RTCLogError(format, ...) \ + RTCLogFormat(kRTCLoggingSeverityError, format, ##__VA_ARGS__) \ + +#if !defined(NDEBUG) +#define RTCLogDebug(format, ...) RTCLogInfo(format, ##__VA_ARGS__) +#else +#define RTCLogDebug(format, ...) \ + do { \ + } while (false) +#endif + +#define RTCLog(format, ...) RTCLogInfo(format, ##__VA_ARGS__) diff --git a/talk/app/webrtc/objc/public/RTCMediaConstraints.h b/talk/app/webrtc/objc/public/RTCMediaConstraints.h new file mode 100644 index 0000000000..425150a804 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCMediaConstraints.h @@ -0,0 +1,39 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// RTCMediaConstraints contains the media constraints to be used in +// RTCPeerConnection and RTCMediaStream. +@interface RTCMediaConstraints : NSObject + +// Initializer for RTCMediaConstraints. The parameters mandatory and optional +// contain RTCPair objects with key/value for each constrant. +- (id)initWithMandatoryConstraints:(NSArray *)mandatory + optionalConstraints:(NSArray *)optional; + +@end diff --git a/talk/app/webrtc/objc/public/RTCMediaSource.h b/talk/app/webrtc/objc/public/RTCMediaSource.h new file mode 100644 index 0000000000..164d85de71 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCMediaSource.h @@ -0,0 +1,44 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +#import "RTCTypes.h" + +// RTCMediaSource is an ObjectiveC wrapper for MediaSourceInterface +@interface RTCMediaSource : NSObject + +// The current state of the RTCMediaSource. +@property(nonatomic, assign, readonly) RTCSourceState state; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__(( + unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCMediaStream.h b/talk/app/webrtc/objc/public/RTCMediaStream.h new file mode 100644 index 0000000000..40a63ee378 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCMediaStream.h @@ -0,0 +1,51 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +@class RTCAudioTrack; +@class RTCVideoTrack; + +// RTCMediaStream is an ObjectiveC wrapper for MediaStreamInterface. +@interface RTCMediaStream : NSObject + +@property(nonatomic, strong, readonly) NSArray *audioTracks; +@property(nonatomic, strong, readonly) NSArray *videoTracks; +@property(nonatomic, strong, readonly) NSString *label; + +- (BOOL)addAudioTrack:(RTCAudioTrack *)track; +- (BOOL)addVideoTrack:(RTCVideoTrack *)track; +- (BOOL)removeAudioTrack:(RTCAudioTrack *)track; +- (BOOL)removeVideoTrack:(RTCVideoTrack *)track; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCMediaStreamTrack.h b/talk/app/webrtc/objc/public/RTCMediaStreamTrack.h new file mode 100644 index 0000000000..2b098645ff --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCMediaStreamTrack.h @@ -0,0 +1,59 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +#import "RTCTypes.h" + +@class RTCMediaStreamTrack; +@protocol RTCMediaStreamTrackDelegate<NSObject> + +- (void)mediaStreamTrackDidChange:(RTCMediaStreamTrack*)mediaStreamTrack; + +@end + +// RTCMediaStreamTrack implements the interface common to RTCAudioTrack and +// RTCVideoTrack. Do not create an instance of this class, rather create one +// of the derived classes. +@interface RTCMediaStreamTrack : NSObject + +@property(nonatomic, readonly) NSString* kind; +@property(nonatomic, readonly) NSString* label; +@property(nonatomic, weak) id<RTCMediaStreamTrackDelegate> delegate; + +- (BOOL)isEnabled; +- (BOOL)setEnabled:(BOOL)enabled; +- (RTCTrackState)state; +- (BOOL)setState:(RTCTrackState)state; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCNSGLVideoView.h b/talk/app/webrtc/objc/public/RTCNSGLVideoView.h new file mode 100644 index 0000000000..2f07239ddd --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCNSGLVideoView.h @@ -0,0 +1,47 @@ +/* + * libjingle + * Copyright 2014 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#if TARGET_OS_IPHONE +#error "This file targets OSX." +#endif + +#import <AppKit/NSOpenGLView.h> + +#import "RTCVideoRenderer.h" + +@class RTCNSGLVideoView; +@protocol RTCNSGLVideoViewDelegate + +- (void)videoView:(RTCNSGLVideoView*)videoView didChangeVideoSize:(CGSize)size; + +@end + +@interface RTCNSGLVideoView : NSOpenGLView <RTCVideoRenderer> + +@property(nonatomic, weak) id<RTCNSGLVideoViewDelegate> delegate; + +@end diff --git a/talk/app/webrtc/objc/public/RTCOpenGLVideoRenderer.h b/talk/app/webrtc/objc/public/RTCOpenGLVideoRenderer.h new file mode 100644 index 0000000000..778930488e --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCOpenGLVideoRenderer.h @@ -0,0 +1,73 @@ +/* + * libjingle + * Copyright 2014 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> +#if TARGET_OS_IPHONE +#import <GLKit/GLKit.h> +#else +#import <AppKit/NSOpenGL.h> +#endif + +@class RTCI420Frame; + +// RTCOpenGLVideoRenderer issues appropriate OpenGL commands to draw a frame to +// the currently bound framebuffer. Supports OpenGL 3.2 and OpenGLES 2.0. OpenGL +// framebuffer creation and management should be handled elsewhere using the +// same context used to initialize this class. +@interface RTCOpenGLVideoRenderer : NSObject + +// The last successfully drawn frame. Used to avoid drawing frames unnecessarily +// hence saving battery life by reducing load. +@property(nonatomic, readonly) RTCI420Frame* lastDrawnFrame; + +#if TARGET_OS_IPHONE +- (instancetype)initWithContext:(EAGLContext*)context; +#else +- (instancetype)initWithContext:(NSOpenGLContext*)context; +#endif + +// Draws |frame| onto the currently bound OpenGL framebuffer. |setupGL| must be +// called before this function will succeed. +- (BOOL)drawFrame:(RTCI420Frame*)frame; + +// The following methods are used to manage OpenGL resources. On iOS +// applications should release resources when placed in background for use in +// the foreground application. In fact, attempting to call OpenGLES commands +// while in background will result in application termination. + +// Sets up the OpenGL state needed for rendering. +- (void)setupGL; +// Tears down the OpenGL state created by |setupGL|. +- (void)teardownGL; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__(( + unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCPair.h b/talk/app/webrtc/objc/public/RTCPair.h new file mode 100644 index 0000000000..51d20e721e --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCPair.h @@ -0,0 +1,45 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// A class to hold a key and value. +@interface RTCPair : NSObject + +@property(nonatomic, strong, readonly) NSString *key; +@property(nonatomic, strong, readonly) NSString *value; + +// Initialize a RTCPair object with a key and value. +- (id)initWithKey:(NSString *)key value:(NSString *)value; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCPeerConnection.h b/talk/app/webrtc/objc/public/RTCPeerConnection.h new file mode 100644 index 0000000000..a13ed3ecc3 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCPeerConnection.h @@ -0,0 +1,127 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "RTCPeerConnectionDelegate.h" + +@class RTCConfiguration; +@class RTCDataChannel; +@class RTCDataChannelInit; +@class RTCICECandidate; +@class RTCICEServers; +@class RTCMediaConstraints; +@class RTCMediaStream; +@class RTCMediaStreamTrack; +@class RTCSessionDescription; +@protocol RTCSessionDescriptionDelegate; +@protocol RTCStatsDelegate; + +// RTCPeerConnection is an ObjectiveC friendly wrapper around a PeerConnection +// object. See the documentation in talk/app/webrtc/peerconnectioninterface.h. +// or http://www.webrtc.org/reference/native-apis, which in turn is inspired by +// the JS APIs: http://dev.w3.org/2011/webrtc/editor/webrtc.html and +// http://www.w3.org/TR/mediacapture-streams/ +@interface RTCPeerConnection : NSObject + +@property(nonatomic, weak) id<RTCPeerConnectionDelegate> delegate; + +// Accessor methods to active local streams. +@property(nonatomic, strong, readonly) NSArray *localStreams; + +// The local description. +@property(nonatomic, assign, readonly) RTCSessionDescription *localDescription; + +// The remote description. +@property(nonatomic, assign, readonly) RTCSessionDescription *remoteDescription; + +// The current signaling state. +@property(nonatomic, assign, readonly) RTCSignalingState signalingState; +@property(nonatomic, assign, readonly) RTCICEConnectionState iceConnectionState; +@property(nonatomic, assign, readonly) RTCICEGatheringState iceGatheringState; + +// Add a new MediaStream to be sent on this PeerConnection. +// Note that a SessionDescription negotiation is needed before the +// remote peer can receive the stream. +- (BOOL)addStream:(RTCMediaStream *)stream; + +// Remove a MediaStream from this PeerConnection. +// Note that a SessionDescription negotiation is need before the +// remote peer is notified. +- (void)removeStream:(RTCMediaStream *)stream; + +// Create a data channel. +- (RTCDataChannel*)createDataChannelWithLabel:(NSString*)label + config:(RTCDataChannelInit*)config; + +// Create a new offer. +// Success or failure will be reported via RTCSessionDescriptionDelegate. +- (void)createOfferWithDelegate:(id<RTCSessionDescriptionDelegate>)delegate + constraints:(RTCMediaConstraints *)constraints; + +// Create an answer to an offer. +// Success or failure will be reported via RTCSessionDescriptionDelegate. +- (void)createAnswerWithDelegate:(id<RTCSessionDescriptionDelegate>)delegate + constraints:(RTCMediaConstraints *)constraints; + +// Sets the local session description. +// Success or failure will be reported via RTCSessionDescriptionDelegate. +- (void) + setLocalDescriptionWithDelegate:(id<RTCSessionDescriptionDelegate>)delegate + sessionDescription:(RTCSessionDescription *)sdp; + +// Sets the remote session description. +// Success or failure will be reported via RTCSessionDescriptionDelegate. +- (void) + setRemoteDescriptionWithDelegate:(id<RTCSessionDescriptionDelegate>)delegate + sessionDescription:(RTCSessionDescription *)sdp; + +// Sets the PeerConnection's global configuration to |configuration|. +// Any changes to STUN/TURN servers or ICE candidate policy will affect the +// next gathering phase, and cause the next call to createOffer to generate +// new ICE credentials. Note that the BUNDLE and RTCP-multiplexing policies +// cannot be changed with this method. +- (BOOL)setConfiguration:(RTCConfiguration *)configuration; + +// Provides a remote candidate to the ICE Agent. +- (BOOL)addICECandidate:(RTCICECandidate *)candidate; + +// Terminates all media and closes the transport. +- (void)close; + +// Gets statistics for the media track. If |mediaStreamTrack| is nil statistics +// are gathered for all tracks. +// Statistics information will be reported via RTCStatsDelegate. +- (BOOL)getStatsWithDelegate:(id<RTCStatsDelegate>)delegate + mediaStreamTrack:(RTCMediaStreamTrack*)mediaStreamTrack + statsOutputLevel:(RTCStatsOutputLevel)statsOutputLevel; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h b/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h new file mode 100644 index 0000000000..bf0c23104a --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCPeerConnectionDelegate.h @@ -0,0 +1,72 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +#import "RTCTypes.h" + +@class RTCDataChannel; +@class RTCICECandidate; +@class RTCMediaStream; +@class RTCPeerConnection; + +// RTCPeerConnectionDelegate is a protocol for an object that must be +// implemented to get messages from PeerConnection. +@protocol RTCPeerConnectionDelegate<NSObject> + +// Triggered when the SignalingState changed. +- (void)peerConnection:(RTCPeerConnection *)peerConnection + signalingStateChanged:(RTCSignalingState)stateChanged; + +// Triggered when media is received on a new stream from remote peer. +- (void)peerConnection:(RTCPeerConnection *)peerConnection + addedStream:(RTCMediaStream *)stream; + +// Triggered when a remote peer close a stream. +- (void)peerConnection:(RTCPeerConnection *)peerConnection + removedStream:(RTCMediaStream *)stream; + +// Triggered when renegotiation is needed, for example the ICE has restarted. +- (void)peerConnectionOnRenegotiationNeeded:(RTCPeerConnection *)peerConnection; + +// Called any time the ICEConnectionState changes. +- (void)peerConnection:(RTCPeerConnection *)peerConnection + iceConnectionChanged:(RTCICEConnectionState)newState; + +// Called any time the ICEGatheringState changes. +- (void)peerConnection:(RTCPeerConnection *)peerConnection + iceGatheringChanged:(RTCICEGatheringState)newState; + +// New Ice candidate have been found. +- (void)peerConnection:(RTCPeerConnection *)peerConnection + gotICECandidate:(RTCICECandidate *)candidate; + +// New data channel has been opened. +- (void)peerConnection:(RTCPeerConnection*)peerConnection + didOpenDataChannel:(RTCDataChannel*)dataChannel; + +@end diff --git a/talk/app/webrtc/objc/public/RTCPeerConnectionFactory.h b/talk/app/webrtc/objc/public/RTCPeerConnectionFactory.h new file mode 100644 index 0000000000..e1e69b4b7f --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCPeerConnectionFactory.h @@ -0,0 +1,77 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +@class RTCAudioTrack; +@class RTCConfiguration; +@class RTCMediaConstraints; +@class RTCMediaStream; +@class RTCPeerConnection; +@class RTCVideoCapturer; +@class RTCVideoSource; +@class RTCVideoTrack; +@protocol RTCPeerConnectionDelegate; + +// RTCPeerConnectionFactory is an ObjectiveC wrapper for PeerConnectionFactory. +// It is the main entry point to the PeerConnection API for clients. +@interface RTCPeerConnectionFactory : NSObject + +// Initialize & de-initialize the SSL subsystem. Failure is fatal. ++ (void)initializeSSL; ++ (void)deinitializeSSL; + +// Create an RTCPeerConnection object. RTCPeerConnectionFactory will create +// required libjingle threads, socket and network manager factory classes for +// networking. +- (RTCPeerConnection *) + peerConnectionWithICEServers:(NSArray *)servers + constraints:(RTCMediaConstraints *)constraints + delegate:(id<RTCPeerConnectionDelegate>)delegate; + +// Creates a peer connection using the default port allocator factory and identity service. +- (RTCPeerConnection *)peerConnectionWithConfiguration:(RTCConfiguration *)configuration + constraints:(RTCMediaConstraints *)constraints + delegate:(id<RTCPeerConnectionDelegate>)delegate; + +// Create an RTCMediaStream named |label|. +- (RTCMediaStream *)mediaStreamWithLabel:(NSString *)label; + +// Creates a RTCVideoSource. The new source takes ownership of |capturer|. +// |constraints| decides video resolution and frame rate but can be NULL. +- (RTCVideoSource *)videoSourceWithCapturer:(RTCVideoCapturer *)capturer + constraints:(RTCMediaConstraints *)constraints; + +// Creates a new local VideoTrack. The same |source| can be used in several +// tracks. +- (RTCVideoTrack *)videoTrackWithID:(NSString *)videoId + source:(RTCVideoSource *)source; + +// Creates an new AudioTrack. +- (RTCAudioTrack *)audioTrackWithID:(NSString *)audioId; + +@end diff --git a/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h b/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h new file mode 100644 index 0000000000..b0cc72b5b7 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCPeerConnectionInterface.h @@ -0,0 +1,75 @@ +/* + * libjingle + * Copyright 2015 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// See talk/app/webrtc/peerconnectioninterface.h. + +#import <Foundation/Foundation.h> + +typedef NS_ENUM(NSInteger, RTCIceTransportsType) { + kRTCIceTransportsTypeNone, + kRTCIceTransportsTypeRelay, + kRTCIceTransportsTypeNoHost, + kRTCIceTransportsTypeAll, +}; + +// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-08#section-4.1.1 +typedef NS_ENUM(NSInteger, RTCBundlePolicy) { + kRTCBundlePolicyBalanced, + kRTCBundlePolicyMaxBundle, + kRTCBundlePolicyMaxCompat, +}; + +// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-09#section-4.1.1 +typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { + kRTCRtcpMuxPolicyNegotiate, + kRTCRtcpMuxPolicyRequire, +}; + +typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) { + kRTCTcpCandidatePolicyEnabled, + kRTCTcpCandidatePolicyDisabled, +}; + +// Configuration object used for creating a peer connection. +@interface RTCConfiguration : NSObject + +@property(nonatomic, assign) RTCIceTransportsType iceTransportsType; +@property(nonatomic, copy) NSArray *iceServers; +@property(nonatomic, assign) RTCBundlePolicy bundlePolicy; +@property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; +@property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; +@property(nonatomic, assign) int audioJitterBufferMaxPackets; +@property(nonatomic, assign) int iceConnectionReceivingTimeout; + +- (instancetype)initWithIceTransportsType:(RTCIceTransportsType)iceTransportsType + bundlePolicy:(RTCBundlePolicy)bundlePolicy + rtcpMuxPolicy:(RTCRtcpMuxPolicy)rtcpMuxPolicy + tcpCandidatePolicy:(RTCTcpCandidatePolicy)tcpCandidatePolicy + audioJitterBufferMaxPackets:(int)audioJitterBufferMaxPackets + iceConnectionReceivingTimeout:(int)iceConnectionReceivingTimeout; + +@end diff --git a/talk/app/webrtc/objc/public/RTCSessionDescription.h b/talk/app/webrtc/objc/public/RTCSessionDescription.h new file mode 100644 index 0000000000..e3db21cb60 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCSessionDescription.h @@ -0,0 +1,50 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// Description of an RFC 4566 Session. +// RTCSessionDescription is an ObjectiveC wrapper for +// SessionDescriptionInterface. +@interface RTCSessionDescription : NSObject + +// The SDP description. +@property(nonatomic, copy, readonly) NSString *description; + +// The session type. +@property(nonatomic, copy, readonly) NSString *type; + +- (id)initWithType:(NSString *)type sdp:(NSString *)sdp; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end + diff --git a/talk/app/webrtc/objc/public/RTCSessionDescriptionDelegate.h b/talk/app/webrtc/objc/public/RTCSessionDescriptionDelegate.h new file mode 100644 index 0000000000..2fb0af91f0 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCSessionDescriptionDelegate.h @@ -0,0 +1,49 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +@class RTCPeerConnection; +@class RTCSessionDescription; + +extern NSString* const kRTCSessionDescriptionDelegateErrorDomain; +extern int const kRTCSessionDescriptionDelegateErrorCode; + +// RTCSessionDescriptionDelegate is a protocol for listening to callback +// messages when RTCSessionDescriptions are created or set. +@protocol RTCSessionDescriptionDelegate<NSObject> + +// Called when creating a session. +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didCreateSessionDescription:(RTCSessionDescription *)sdp + error:(NSError *)error; + +// Called when setting a local or remote description. +- (void)peerConnection:(RTCPeerConnection *)peerConnection + didSetSessionDescriptionWithError:(NSError *)error; + +@end diff --git a/talk/app/webrtc/objc/public/RTCStatsDelegate.h b/talk/app/webrtc/objc/public/RTCStatsDelegate.h new file mode 100644 index 0000000000..54e8e569a1 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCStatsDelegate.h @@ -0,0 +1,39 @@ +/* + * libjingle + * Copyright 2014 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +@class RTCPeerConnection; + +// RTCSessionDescriptionDelegate is a protocol for receiving statistic +// reports from RTCPeerConnection. +@protocol RTCStatsDelegate<NSObject> + +- (void)peerConnection:(RTCPeerConnection*)peerConnection + didGetStats:(NSArray*)stats; // NSArray of RTCStatsReport*. + +@end diff --git a/talk/app/webrtc/objc/public/RTCStatsReport.h b/talk/app/webrtc/objc/public/RTCStatsReport.h new file mode 100644 index 0000000000..691c1aa600 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCStatsReport.h @@ -0,0 +1,45 @@ +/* + * libjingle + * Copyright 2014 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// ObjectiveC friendly wrapper around a StatsReport object. +// See talk/app/webrtc/statsypes.h +@interface RTCStatsReport : NSObject + +@property(nonatomic, readonly) NSString* reportId; +@property(nonatomic, readonly) NSString* type; +@property(nonatomic, readonly) CFTimeInterval timestamp; +@property(nonatomic, readonly) NSArray* values; // NSArray of RTCPair*. + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__(( + unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCTypes.h b/talk/app/webrtc/objc/public/RTCTypes.h new file mode 100644 index 0000000000..99ac192c34 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCTypes.h @@ -0,0 +1,79 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// Enums that are common to the ObjectiveC version of the PeerConnection API. + +// RTCICEConnectionState correspond to the states in webrtc::ICEConnectionState. +typedef enum { + RTCICEConnectionNew, + RTCICEConnectionChecking, + RTCICEConnectionConnected, + RTCICEConnectionCompleted, + RTCICEConnectionFailed, + RTCICEConnectionDisconnected, + RTCICEConnectionClosed, + RTCICEConnectionMax, +} RTCICEConnectionState; + +// RTCICEGatheringState the states in webrtc::ICEGatheringState. +typedef enum { + RTCICEGatheringNew, + RTCICEGatheringGathering, + RTCICEGatheringComplete, +} RTCICEGatheringState; + +// RTCSignalingState correspond to the states in webrtc::SignalingState. +typedef enum { + RTCSignalingStable, + RTCSignalingHaveLocalOffer, + RTCSignalingHaveLocalPrAnswer, + RTCSignalingHaveRemoteOffer, + RTCSignalingHaveRemotePrAnswer, + RTCSignalingClosed, +} RTCSignalingState; + +// RTCStatsOutputLevel correspond to webrtc::StatsOutputLevel +typedef enum { + RTCStatsOutputLevelStandard, + RTCStatsOutputLevelDebug, +} RTCStatsOutputLevel; + +// RTCSourceState corresponds to the states in webrtc::SourceState. +typedef enum { + RTCSourceStateInitializing, + RTCSourceStateLive, + RTCSourceStateEnded, + RTCSourceStateMuted, +} RTCSourceState; + +// RTCTrackState corresponds to the states in webrtc::TrackState. +typedef enum { + RTCTrackStateInitializing, + RTCTrackStateLive, + RTCTrackStateEnded, + RTCTrackStateFailed, +} RTCTrackState; diff --git a/talk/app/webrtc/objc/public/RTCVideoCapturer.h b/talk/app/webrtc/objc/public/RTCVideoCapturer.h new file mode 100644 index 0000000000..d07c091fad --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCVideoCapturer.h @@ -0,0 +1,42 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> + +// RTCVideoCapturer is an ObjectiveC wrapper for VideoCapturerInterface. +@interface RTCVideoCapturer : NSObject + +// Create a new video capturer using the specified device. ++ (RTCVideoCapturer *)capturerWithDeviceName:(NSString *)deviceName; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCVideoRenderer.h b/talk/app/webrtc/objc/public/RTCVideoRenderer.h new file mode 100644 index 0000000000..c837b1c5ac --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCVideoRenderer.h @@ -0,0 +1,43 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Foundation/Foundation.h> +#if TARGET_OS_IPHONE +#import <UIKit/UIKit.h> +#endif + +@class RTCI420Frame; + +@protocol RTCVideoRenderer<NSObject> + +// The size of the frame. +- (void)setSize:(CGSize)size; + +// The frame to be displayed. +- (void)renderFrame:(RTCI420Frame*)frame; + +@end diff --git a/talk/app/webrtc/objc/public/RTCVideoSource.h b/talk/app/webrtc/objc/public/RTCVideoSource.h new file mode 100644 index 0000000000..15a9262b29 --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCVideoSource.h @@ -0,0 +1,39 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "RTCMediaSource.h" + +// RTCVideoSource is an ObjectiveC wrapper for VideoSourceInterface. +@interface RTCVideoSource : RTCMediaSource + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end diff --git a/talk/app/webrtc/objc/public/RTCVideoTrack.h b/talk/app/webrtc/objc/public/RTCVideoTrack.h new file mode 100644 index 0000000000..332c3ea80d --- /dev/null +++ b/talk/app/webrtc/objc/public/RTCVideoTrack.h @@ -0,0 +1,55 @@ +/* + * libjingle + * Copyright 2013 Google Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO + * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "RTCMediaStreamTrack.h" + +@protocol RTCVideoRenderer; +@class RTCPeerConnectionFactory; +@class RTCVideoSource; + +// RTCVideoTrack is an ObjectiveC wrapper for VideoTrackInterface. +@interface RTCVideoTrack : RTCMediaStreamTrack + +@property(nonatomic, readonly) RTCVideoSource* source; + +- (instancetype)initWithFactory:(RTCPeerConnectionFactory*)factory + source:(RTCVideoSource*)source + trackId:(NSString*)trackId; + +// Register a renderer that will render all frames received on this track. +- (void)addRenderer:(id<RTCVideoRenderer>)renderer; + +// Deregister a renderer. +- (void)removeRenderer:(id<RTCVideoRenderer>)renderer; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS +// Disallow init and don't add to documentation +- (id)init __attribute__( + (unavailable("init is not a supported initializer for this class."))); +#endif /* DOXYGEN_SHOULD_SKIP_THIS */ + +@end |