Index: webrtc/sdk/objc/Framework/Classes/RTCAVFoundationFormatMapper.h |
diff --git a/webrtc/sdk/objc/Framework/Classes/RTCAVFoundationFormatMapper.h b/webrtc/sdk/objc/Framework/Classes/RTCAVFoundationFormatMapper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bedb29e13db22eddb2ad81b45323f5e6138e6834 |
--- /dev/null |
+++ b/webrtc/sdk/objc/Framework/Classes/RTCAVFoundationFormatMapper.h |
@@ -0,0 +1,48 @@ |
+/* |
+ * Copyright 2016 The WebRTC project authors. All Rights Reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#import <AVFoundation/AVFoundation.h> |
+#import <Foundation/Foundation.h> |
+ |
+#include "webrtc/media/base/videocapturer.h" |
+ |
+/** |
+ * Helper class that encapsulates the mapping between cricket::VideoFormat and |
+ * AVCaptureDeviceFormat. |
+ */ |
+@interface RTCAVFoundationFormatMapper : NSObject |
+ |
+/** |
+ * Return the list of eligible cricket::VideoFormat instances for the given device. |
+ * |
+ * The list of eligible formats for the provided device is filtered list based on |
+ * submedia type (pixel color format) and framerate. This filetring is for performance reasons. |
+ * @param device the capture device to be used |
+ * @return set of cricket::VideoFormat instances that map to the eligible formats for the device |
+ */ |
++ (std::set<cricket::VideoFormat>)supportedVideoFormatsForDevice:(AVCaptureDevice *)device; |
tkchin_webrtc
2016/11/21 18:51:47
I don't recommend returning C++ objects in ObjC he
daniela-webrtc
2016/11/22 11:43:44
Done.
|
+ |
+/** |
+ * Sets new capture format for the provided device and session. |
+ * |
+ * The new device format must be one of the formats returned from |
+ * supportedVideoFormatsForDevice. |
+ * 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 format The cricket::VideoFormat to be used for retrieving the new AVCaptureDeviceFormat |
+ * @param device The device that will have new device format |
+ * @param session The capture session to be configured |
+ * @return YES if the session configuration was successful. No otherwise |
+ */ |
++ (BOOL)setFormat:(const cricket::VideoFormat)format |
+ forCaptureDevice:(AVCaptureDevice *)device |
+ captureSession:(AVCaptureSession *)session; |
+@end |