Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: webrtc/sdk/objc/Framework/Classes/RTCVideoFormatMapper.h

Issue 2488973002: Split avfoundationcapturer classes in separate files. (Closed)
Patch Set: Add wrapper class for static methosd Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/sdk/objc/Framework/Classes/RTCVideoFormatMapper.h
diff --git a/webrtc/sdk/objc/Framework/Headers/WebRTC/RTCRtpReceiver.h b/webrtc/sdk/objc/Framework/Classes/RTCVideoFormatMapper.h
similarity index 19%
copy from webrtc/sdk/objc/Framework/Headers/WebRTC/RTCRtpReceiver.h
copy to webrtc/sdk/objc/Framework/Classes/RTCVideoFormatMapper.h
index e98a8f3bea1d650b2677dae2d377ff780a997489..3e42be61417fca8d0548931601976366aab92f97 100644
--- a/webrtc/sdk/objc/Framework/Headers/WebRTC/RTCRtpReceiver.h
+++ b/webrtc/sdk/objc/Framework/Classes/RTCVideoFormatMapper.h
@@ -8,43 +8,47 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#import <AVFoundation/AVFoundation.h>
#import <Foundation/Foundation.h>
-#import <WebRTC/RTCMacros.h>
-#import <WebRTC/RTCMediaStreamTrack.h>
-#import <WebRTC/RTCRtpParameters.h>
+#include "webrtc/media/base/videocapturer.h"
-NS_ASSUME_NONNULL_BEGIN
-
-RTC_EXPORT
-@protocol RTCRtpReceiver <NSObject>
-
-/** A unique identifier for this receiver. */
-@property(nonatomic, readonly) NSString *receiverId;
+/**
+ * Helper class that encapsulates the mapping between cricket::VideoFormat and
+ * AVCaptureDeviceFormat.
+ */
+@interface RTCVideoFormatMapper : NSObject
-/** The currently active RTCRtpParameters, as defined in
- * https://www.w3.org/TR/webrtc/#idl-def-RTCRtpParameters.
+/**
+ * Maps the list of eligible AVCaptureDeviceFormat to cricket::VideoFormat.
*
- * The WebRTC specification only defines RTCRtpParameters in terms of senders,
- * but this API also applies them to receivers, similar to ORTC:
- * http://ortc.org/wp-content/uploads/2016/03/ortc.html#rtcrtpparameters*.
+ * The list of eligible formats for the provided device is filtered list
+ * of all formats the device has.
+ * The filtering is based on submedia type and framerate (for performance reasons).
+ * This list of eligible AVCaptureDeviceFormat is then mapped onto set of cricket::VideoFormat.
+ * @param device the capture device to be used
+ * @return set of cricket::VideoFormat instances that map to the eligible formats for the device
*/
-@property(nonatomic, readonly) RTCRtpParameters *parameters;
++ (std::set<cricket::VideoFormat>)getSupportedVideoFormatsForDevice:(AVCaptureDevice *)device;
-/** The RTCMediaStreamTrack associated with the receiver.
- * Note: reading this property returns a new instance of
- * RTCMediaStreamTrack. Use isEqual: instead of == to compare
- * RTCMediaStreamTrack instances.
+/**
+ * Configures the provided capture session by setting new AVCaptureDeviceFormat to the device.
+ *
+ * The new device format is object from the list of eligible formats that maps to the
+ * provided cricket::VideoFormat parameter.
+ * The list of eligible formats for the provided device is filtered list
+ * of all formats the device has.
+ * The filtering is based on submedia type and framerate (for performance reasons).
+ * The configuration of the session might not be successful if
+ * the device fails to lock for configuration or
+ * the new device format cannot be set as active format for the device.
+ * @param device The device that will have new device format
+ * @param session The capture session to be configured
+ * @param format The cricket::VideoFormat to be used for retrieving the new AVCaptureDeviceFormat
+ * @return YES if the session configuration was successful. No otherwise
*/
-@property(nonatomic, readonly) RTCMediaStreamTrack *track;
++ (BOOL)setFormatForCaptureDevice:(AVCaptureDevice *)device
+ captureSession:(AVCaptureSession *)session
+ format:(const cricket::VideoFormat)format;
kthelgason 2016/11/21 08:38:14 suggestion: rename to setFormat:(format)forCapture
daniela-webrtc 2016/11/21 10:14:20 Done.
@end
-
-RTC_EXPORT
-@interface RTCRtpReceiver : NSObject <RTCRtpReceiver>
-
-- (instancetype)init NS_UNAVAILABLE;
-
-@end
-
-NS_ASSUME_NONNULL_END

Powered by Google App Engine
This is Rietveld 408576698