Agora RTC Objective-C API Reference  Refactor
NGIAgoraCameraCapturer.h
Go to the documentation of this file.
1 //
2 // Agora SDK
3 //
4 // Copyright (c) 2019 Agora.io. All rights reserved.
5 //
6 
7 #pragma once // NOLINT(build/header_guard)
8 
9 #include "AgoraBase.h"
10 #include "AgoraRefPtr.h"
11 
12 namespace agora {
13 namespace rtc {
14 class IVideoSinkBase;
15 class ICameraCaptureObserver;
20 
21  public:
34  };
35 
39  enum CAMERA_STATE {
48  };
49 
50  // Interface for receiving information about available camera devices.
54  class IDeviceInfo {
55  public:
56  virtual ~IDeviceInfo() {}
57 
61  virtual void release() = 0;
62 
67  virtual uint32_t NumberOfDevices() = 0;
68 
81  virtual int32_t GetDeviceName(uint32_t deviceNumber, char* deviceNameUTF8,
82  uint32_t deviceNameLength, char* deviceUniqueIdUTF8,
83  uint32_t deviceUniqueIdLength, char* productUniqueIdUTF8 = 0,
84  uint32_t productUniqueIdLength = 0) = 0;
85 
92  virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) = 0;
93 
102  virtual int32_t GetCapability(const char* deviceUniqueIdUTF8,
103  const uint32_t deviceCapabilityNumber,
104  VideoFormat& capability) = 0;
105  };
106 
107  public:
108 #if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
109 
120  virtual int setCameraSource(CAMERA_SOURCE source) = 0;
129  virtual CAMERA_SOURCE getCameraSource() = 0;
136  virtual void switchCamera() = 0;
147  virtual bool isZoomSupported() = 0;
160  virtual int32_t setCameraZoom(float zoomValue) = 0;
170  virtual float getCameraMaxZoom() = 0;
181  virtual bool isFocusSupported() = 0;
191  virtual int32_t setCameraFocus(float x, float y) = 0;
202  virtual bool isAutoFaceFocusSupported() = 0;
213  virtual int32_t setCameraAutoFaceFocus(bool enable) = 0;
224  virtual int32_t enableFaceDetection(bool enable) = 0;
225 
233  virtual bool isCameraFaceDetectSupported() = 0;
234 
255  virtual bool isCameraTorchSupported() = 0;
256 
273  virtual int setCameraTorchOn(bool isOn) = 0;
274 
286  virtual bool isCameraExposurePositionSupported() = 0;
287 
303  virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0;
304 
305 #if (defined(__APPLE__) && TARGET_OS_IOS)
306 
313  virtual bool isCameraAutoExposureFaceModeSupported() = 0;
314 
315 
329  virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0;
330 #endif
331 
332 #elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \
333  (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
334 
344  virtual IDeviceInfo* createDeviceInfo() = 0;
356  virtual int initWithDeviceId(const char* deviceId) = 0;
368  virtual int initWithDeviceName(const char* deviceName) = 0;
369 #endif
370 
375  virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation) = 0;
376 
384  virtual void setCaptureFormat(const VideoFormat& capture_format) = 0;
396  virtual int registerCameraObserver(ICameraCaptureObserver* observer) = 0;
403 
404  protected:
406 };
411  public:
423  virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) {
424  (void) imageWidth;
425  (void) imageHeight;
426  (void) x;
427  (void) y;
428 
429  }
458  virtual void onFacePositionChanged(
459  int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) {
460  (void) imageWidth;
461  (void) imageHeight;
462  (void) vecRectangle;
463  (void) vecDistance;
464  (void) numFaces;
465  }
466 
478  virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
479  (void)x;
480  (void)y;
481  (void)width;
482  (void)height;
483  }
484 
486  (void) state;
487  (void) source;
488  }
489 
490  protected:
492 };
493 
494 } // namespace rtc
495 } // namespace agora
agora::rtc::ICameraCapturer::CAMERA_SOURCE
CAMERA_SOURCE
Definition: NGIAgoraCameraCapturer.h:25
agora::rtc::ICameraCaptureObserver::onCameraStateChanged
virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source)
Definition: NGIAgoraCameraCapturer.h:485
agora::rtc::ICameraCaptureObserver::~ICameraCaptureObserver
virtual ~ICameraCaptureObserver()
Definition: NGIAgoraCameraCapturer.h:491
agora::rtc::ICameraCapturer::IDeviceInfo::~IDeviceInfo
virtual ~IDeviceInfo()
Definition: NGIAgoraCameraCapturer.h:56
AgoraBase.h
agora::rtc::ICameraCaptureObserver::onFacePositionChanged
virtual void onFacePositionChanged(int imageWidth, int imageHeight, const Rectangle *vecRectangle, const int *vecDistance, int numFaces)
Definition: NGIAgoraCameraCapturer.h:458
agora::rtc::ICameraCaptureObserver
Definition: NGIAgoraCameraCapturer.h:410
agora::rtc::ICameraCapturer::unregisterCameraObserver
virtual int unregisterCameraObserver(ICameraCaptureObserver *observer)=0
agora::rtc::ICameraCapturer::IDeviceInfo::release
virtual void release()=0
agora::rtc::ICameraCapturer::setDeviceOrientation
virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation)=0
agora::rtc::Rectangle
Definition: AgoraBase.h:1802
agora::rtc::ICameraCapturer::CAMERA_STATE
CAMERA_STATE
Definition: NGIAgoraCameraCapturer.h:39
agora::rtc::ICameraCapturer::IDeviceInfo
Definition: NGIAgoraCameraCapturer.h:54
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::VideoFormat
Definition: AgoraBase.h:2362
agora::rtc::ICameraCapturer::IDeviceInfo::GetDeviceName
virtual int32_t GetDeviceName(uint32_t deviceNumber, char *deviceNameUTF8, uint32_t deviceNameLength, char *deviceUniqueIdUTF8, uint32_t deviceUniqueIdLength, char *productUniqueIdUTF8=0, uint32_t productUniqueIdLength=0)=0
agora::rtc::ICameraCapturer::getCaptureFormat
virtual VideoFormat getCaptureFormat()=0
agora::rtc::ICameraCapturer
Definition: NGIAgoraCameraCapturer.h:19
agora::rtc::ICameraCapturer::IDeviceInfo::NumberOfDevices
virtual uint32_t NumberOfDevices()=0
agora::rtc::ICameraCapturer::CAMERA_BACK
@ CAMERA_BACK
Definition: NGIAgoraCameraCapturer.h:29
agora::rtc::ICameraCapturer::IDeviceInfo::GetCapability
virtual int32_t GetCapability(const char *deviceUniqueIdUTF8, const uint32_t deviceCapabilityNumber, VideoFormat &capability)=0
agora::rtc::ICameraCapturer::~ICameraCapturer
~ICameraCapturer()
Definition: NGIAgoraCameraCapturer.h:405
agora::rtc::VIDEO_ORIENTATION
VIDEO_ORIENTATION
Definition: AgoraBase.h:915
AgoraRefPtr.h
agora::rtc::ICameraCapturer::registerCameraObserver
virtual int registerCameraObserver(ICameraCaptureObserver *observer)=0
agora::rtc::ICameraCaptureObserver::onCameraFocusAreaChanged
virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y)
Definition: NGIAgoraCameraCapturer.h:423
agora::RefCountInterface
Definition: AgoraRefPtr.h:31
agora::rtc::ICameraCapturer::setCaptureFormat
virtual void setCaptureFormat(const VideoFormat &capture_format)=0
agora::rtc::ICameraCapturer::IDeviceInfo::NumberOfCapabilities
virtual int32_t NumberOfCapabilities(const char *deviceUniqueIdUTF8)=0
agora::rtc::ICameraCapturer::CAMERA_STOPPED
@ CAMERA_STOPPED
Definition: NGIAgoraCameraCapturer.h:47
agora::rtc::ICameraCapturer::CAMERA_STARTED
@ CAMERA_STARTED
Definition: NGIAgoraCameraCapturer.h:43
agora::rtc::ICameraCaptureObserver::onCameraExposureAreaChanged
virtual void onCameraExposureAreaChanged(int x, int y, int width, int height)
Definition: NGIAgoraCameraCapturer.h:478
agora::rtc::ICameraCapturer::CAMERA_FRONT
@ CAMERA_FRONT
Definition: NGIAgoraCameraCapturer.h:33