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:
38  };
39 
43  enum CAMERA_STATE {
52  };
53 
54  // Interface for receiving information about available camera devices.
58  class IDeviceInfo {
59  public:
60  virtual ~IDeviceInfo() {}
61 
65  virtual void release() = 0;
66 
71  virtual uint32_t NumberOfDevices() = 0;
72 
87  virtual int32_t GetDeviceName(uint32_t deviceNumber, char* deviceNameUTF8,
88  uint32_t deviceNameLength, char* deviceUniqueIdUTF8,
89  uint32_t deviceUniqueIdLength, char* productUniqueIdUTF8 = 0,
90  uint32_t productUniqueIdLength = 0,
91  char* deviceTypeUTF8 = 0, uint32_t deviceTypeLength = 0) = 0;
92 
99  virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) = 0;
100 
109  virtual int32_t GetCapability(const char* deviceUniqueIdUTF8,
110  const uint32_t deviceCapabilityNumber,
111  VideoFormat& capability) = 0;
112  };
113 
114  public:
115 #if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
116 
127  virtual int setCameraSource(CAMERA_SOURCE source) = 0;
136  virtual CAMERA_SOURCE getCameraSource() = 0;
143  virtual void switchCamera() = 0;
154  virtual bool isZoomSupported() = 0;
167  virtual int32_t setCameraZoom(float zoomValue) = 0;
177  virtual float getCameraMaxZoom() = 0;
188  virtual bool isFocusSupported() = 0;
198  virtual int32_t setCameraFocus(float x, float y) = 0;
209  virtual bool isAutoFaceFocusSupported() = 0;
220  virtual int32_t setCameraAutoFaceFocus(bool enable) = 0;
231  virtual int32_t enableFaceDetection(bool enable) = 0;
232 
240  virtual bool isCameraFaceDetectSupported() = 0;
241 
262  virtual bool isCameraTorchSupported() = 0;
263 
280  virtual int setCameraTorchOn(bool isOn) = 0;
281 
293  virtual bool isCameraExposurePositionSupported() = 0;
294 
310  virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0;
311 
324  virtual bool isCameraExposureSupported() = 0;
325 
336  virtual int setCameraExposureFactor(float value) = 0;
337 
338 #if (defined(__APPLE__) && TARGET_OS_IOS)
339 
350  virtual bool enableMultiCamera(bool enable) = 0;
358  virtual bool isCameraAutoExposureFaceModeSupported() = 0;
359 
360 
374  virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0;
375 
381  virtual int setCameraStabilizationMode(CAMERA_STABILIZATION_MODE mode) = 0;
382 #endif
383 
384 #elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \
385  (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
386 
396  virtual IDeviceInfo* createDeviceInfo() = 0;
408  virtual int initWithDeviceId(const char* deviceId) = 0;
420  virtual int initWithDeviceName(const char* deviceName) = 0;
421 #endif
422 
423 #if defined(__APPLE__)
424 
431  virtual bool isSupportCenterStage() = 0;
432 
441  virtual int enableCenterStage(bool enabled) = 0;
442 #endif
443 
448  virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation) = 0;
449 
457  virtual void setCaptureFormat(const VideoFormat& capture_format) = 0;
469  virtual int registerCameraObserver(ICameraCaptureObserver* observer) = 0;
476 
477  protected:
479 };
484  public:
496  virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) {
497  (void) imageWidth;
498  (void) imageHeight;
499  (void) x;
500  (void) y;
501 
502  }
531  virtual void onFacePositionChanged(
532  int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) {
533  (void) imageWidth;
534  (void) imageHeight;
535  (void) vecRectangle;
536  (void) vecDistance;
537  (void) numFaces;
538  }
539 
551  virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
552  (void)x;
553  (void)y;
554  (void)width;
555  (void)height;
556  }
557 
559  (void) state;
560  (void) source;
561  }
562 
563  protected:
565 };
566 
567 } // namespace rtc
568 } // 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:558
agora::rtc::ICameraCaptureObserver::~ICameraCaptureObserver
virtual ~ICameraCaptureObserver()
Definition: NGIAgoraCameraCapturer.h:564
agora::rtc::ICameraCapturer::IDeviceInfo::~IDeviceInfo
virtual ~IDeviceInfo()
Definition: NGIAgoraCameraCapturer.h:60
AgoraBase.h
agora::rtc::ICameraCaptureObserver::onFacePositionChanged
virtual void onFacePositionChanged(int imageWidth, int imageHeight, const Rectangle *vecRectangle, const int *vecDistance, int numFaces)
Definition: NGIAgoraCameraCapturer.h:531
agora::rtc::ICameraCaptureObserver
Definition: NGIAgoraCameraCapturer.h:483
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, char *deviceTypeUTF8=0, uint32_t deviceTypeLength=0)=0
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:2008
agora::rtc::ICameraCapturer::CAMERA_STATE
CAMERA_STATE
Definition: NGIAgoraCameraCapturer.h:43
agora::rtc::ICameraCapturer::IDeviceInfo
Definition: NGIAgoraCameraCapturer.h:58
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::VideoFormat
Definition: AgoraBase.h:2496
agora::rtc::ICameraCapturer::getCaptureFormat
virtual VideoFormat getCaptureFormat()=0
agora::rtc::ICameraCapturer
Definition: NGIAgoraCameraCapturer.h:19
agora::rtc::ICameraCapturer::CAMERA_EXTRA
@ CAMERA_EXTRA
Definition: NGIAgoraCameraCapturer.h:37
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:478
agora::rtc::VIDEO_ORIENTATION
VIDEO_ORIENTATION
Definition: AgoraBase.h:935
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:496
agora::RefCountInterface
Definition: AgoraRefPtr.h:31
agora::rtc::ICameraCapturer::setCaptureFormat
virtual void setCaptureFormat(const VideoFormat &capture_format)=0
agora::rtc::CAMERA_STABILIZATION_MODE
CAMERA_STABILIZATION_MODE
Definition: AgoraBase.h:2622
agora::rtc::ICameraCapturer::IDeviceInfo::NumberOfCapabilities
virtual int32_t NumberOfCapabilities(const char *deviceUniqueIdUTF8)=0
agora::rtc::ICameraCapturer::CAMERA_STOPPED
@ CAMERA_STOPPED
Definition: NGIAgoraCameraCapturer.h:51
agora::rtc::ICameraCapturer::CAMERA_STARTED
@ CAMERA_STARTED
Definition: NGIAgoraCameraCapturer.h:47
agora::rtc::ICameraCaptureObserver::onCameraExposureAreaChanged
virtual void onCameraExposureAreaChanged(int x, int y, int width, int height)
Definition: NGIAgoraCameraCapturer.h:551
agora::rtc::ICameraCapturer::CAMERA_FRONT
@ CAMERA_FRONT
Definition: NGIAgoraCameraCapturer.h:33