Agora C++ API Reference for All Platforms
NGIAgoraCameraCapturer.h
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;
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 
287 
303  virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0;
304 
305 #if (defined(__APPLE__) && TARGET_OS_IOS)
306 
317  virtual bool enableMultiCamera(bool enable) = 0;
326 
327 
341  virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0;
342 #endif
343 
344 #elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \
345  (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
346 
368  virtual int initWithDeviceId(const char* deviceId) = 0;
380  virtual int initWithDeviceName(const char* deviceName) = 0;
381 #endif
382 
387  virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation) = 0;
388 
396  virtual void setCaptureFormat(const VideoFormat& capture_format) = 0;
408  virtual int registerCameraObserver(ICameraCaptureObserver* observer) = 0;
415 
416  protected:
418 };
423  public:
435  virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) {
436  (void) imageWidth;
437  (void) imageHeight;
438  (void) x;
439  (void) y;
440 
441  }
470  virtual void onFacePositionChanged(
471  int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) {
472  (void) imageWidth;
473  (void) imageHeight;
474  (void) vecRectangle;
475  (void) vecDistance;
476  (void) numFaces;
477  }
478 
490  virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
491  (void)x;
492  (void)y;
493  (void)width;
494  (void)height;
495  }
496 
498  (void) state;
499  (void) source;
500  }
501 
502  protected:
504 };
505 
506 } // namespace rtc
507 } // namespace agora
agora::rtc::ICameraCaptureObserver::~ICameraCaptureObserver
virtual ~ICameraCaptureObserver()
Definition: NGIAgoraCameraCapturer.h:503
agora::rtc::ICameraCapturer::~ICameraCapturer
~ICameraCapturer()
Definition: NGIAgoraCameraCapturer.h:417
agora::rtc::ICameraCapturer::setCaptureFormat
virtual void setCaptureFormat(const VideoFormat &capture_format)=0
agora::rtc::ICameraCapturer::createDeviceInfo
virtual IDeviceInfo * createDeviceInfo()=0
agora::rtc::ICameraCapturer::setCameraExposurePosition
virtual int setCameraExposurePosition(float positionXinView, float positionYinView)=0
agora::rtc::ICameraCapturer::setCameraSource
virtual int setCameraSource(CAMERA_SOURCE source)=0
agora::rtc::ICameraCaptureObserver
Definition: NGIAgoraCameraCapturer.h:422
agora::rtc::ICameraCapturer::IDeviceInfo::NumberOfCapabilities
virtual int32_t NumberOfCapabilities(const char *deviceUniqueIdUTF8)=0
agora::rtc::ICameraCapturer::CAMERA_SOURCE
CAMERA_SOURCE
Definition: NGIAgoraCameraCapturer.h:25
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::registerCameraObserver
virtual int registerCameraObserver(ICameraCaptureObserver *observer)=0
agora::rtc::ICameraCapturer::IDeviceInfo::GetCapability
virtual int32_t GetCapability(const char *deviceUniqueIdUTF8, const uint32_t deviceCapabilityNumber, VideoFormat &capability)=0
agora::rtc::ICameraCapturer::isFocusSupported
virtual bool isFocusSupported()=0
agora::rtc::Rectangle
Definition: AgoraBase.h:1930
agora::rtc::ICameraCapturer::isCameraAutoExposureFaceModeSupported
virtual bool isCameraAutoExposureFaceModeSupported()=0
agora::rtc::ICameraCapturer::isCameraTorchSupported
virtual bool isCameraTorchSupported()=0
agora::rtc::ICameraCapturer::IDeviceInfo
Definition: NGIAgoraCameraCapturer.h:54
agora::rtc::ICameraCapturer::setCameraAutoExposureFaceModeEnabled
virtual int setCameraAutoExposureFaceModeEnabled(bool enabled)=0
agora::rtc::ICameraCaptureObserver::onCameraFocusAreaChanged
virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y)
Definition: NGIAgoraCameraCapturer.h:435
agora::rtc::ICameraCaptureObserver::onCameraExposureAreaChanged
virtual void onCameraExposureAreaChanged(int x, int y, int width, int height)
Definition: NGIAgoraCameraCapturer.h:490
agora::rtc::ICameraCapturer::enableFaceDetection
virtual int32_t enableFaceDetection(bool enable)=0
agora::rtc::ICameraCapturer::IDeviceInfo::release
virtual void release()=0
agora::rtc::ICameraCaptureObserver::onCameraStateChanged
virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source)
Definition: NGIAgoraCameraCapturer.h:497
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::ICameraCapturer::setCameraTorchOn
virtual int setCameraTorchOn(bool isOn)=0
agora::rtc::ICameraCapturer::unregisterCameraObserver
virtual int unregisterCameraObserver(ICameraCaptureObserver *observer)=0
agora::rtc::ICameraCapturer::setCameraAutoFaceFocus
virtual int32_t setCameraAutoFaceFocus(bool enable)=0
agora::rtc::ICameraCapturer::CAMERA_FRONT
@ CAMERA_FRONT
Definition: NGIAgoraCameraCapturer.h:33
agora::rtc::VideoFormat
Definition: AgoraBase.h:2567
agora::rtc::ICameraCapturer::initWithDeviceId
virtual int initWithDeviceId(const char *deviceId)=0
agora::rtc::ICameraCapturer::getCameraMaxZoom
virtual float getCameraMaxZoom()=0
agora::rtc::VIDEO_ORIENTATION
VIDEO_ORIENTATION
Definition: AgoraBase.h:933
agora::rtc::ICameraCapturer::initWithDeviceName
virtual int initWithDeviceName(const char *deviceName)=0
agora::rtc::ICameraCapturer
Definition: NGIAgoraCameraCapturer.h:19
agora::rtc::ICameraCapturer::switchCamera
virtual void switchCamera()=0
agora::rtc::ICameraCapturer::setCameraFocus
virtual int32_t setCameraFocus(float x, float y)=0
agora::rtc::ICameraCapturer::enableMultiCamera
virtual bool enableMultiCamera(bool enable)=0
agora::rtc::ICameraCapturer::isCameraFaceDetectSupported
virtual bool isCameraFaceDetectSupported()=0
agora::rtc::ICameraCaptureObserver::onFacePositionChanged
virtual void onFacePositionChanged(int imageWidth, int imageHeight, const Rectangle *vecRectangle, const int *vecDistance, int numFaces)
Definition: NGIAgoraCameraCapturer.h:470
agora::rtc::ICameraCapturer::getCameraSource
virtual CAMERA_SOURCE getCameraSource()=0
agora::rtc::ICameraCapturer::isZoomSupported
virtual bool isZoomSupported()=0
agora::rtc::ICameraCapturer::setCameraZoom
virtual int32_t setCameraZoom(float zoomValue)=0
agora::RefCountInterface
Definition: AgoraRefPtr.h:31
agora::rtc::ICameraCapturer::setDeviceOrientation
virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation)=0
agora::rtc::ICameraCapturer::getCaptureFormat
virtual VideoFormat getCaptureFormat()=0
agora::rtc::ICameraCapturer::IDeviceInfo::~IDeviceInfo
virtual ~IDeviceInfo()
Definition: NGIAgoraCameraCapturer.h:56
agora::rtc::ICameraCapturer::CAMERA_STOPPED
@ CAMERA_STOPPED
Definition: NGIAgoraCameraCapturer.h:47
agora::rtc::ICameraCapturer::isCameraExposurePositionSupported
virtual bool isCameraExposurePositionSupported()=0
agora::rtc::ICameraCapturer::CAMERA_BACK
@ CAMERA_BACK
Definition: NGIAgoraCameraCapturer.h:29
agora::rtc::ICameraCapturer::CAMERA_STARTED
@ CAMERA_STARTED
Definition: NGIAgoraCameraCapturer.h:43
agora::rtc::ICameraCapturer::IDeviceInfo::NumberOfDevices
virtual uint32_t NumberOfDevices()=0
agora::rtc::ICameraCapturer::CAMERA_STATE
CAMERA_STATE
Definition: NGIAgoraCameraCapturer.h:39
agora::rtc::ICameraCapturer::isAutoFaceFocusSupported
virtual bool isAutoFaceFocusSupported()=0
rtc
Definition: video_node_i.h:25