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 
83  virtual int32_t GetDeviceName(uint32_t deviceNumber, char* deviceNameUTF8,
84  uint32_t deviceNameLength, char* deviceUniqueIdUTF8,
85  uint32_t deviceUniqueIdLength, char* productUniqueIdUTF8 = 0,
86  uint32_t productUniqueIdLength = 0,
87  char* deviceTypeUTF8 = 0, uint32_t deviceTypeLength = 0) = 0;
88 
95  virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) = 0;
96 
105  virtual int32_t GetCapability(const char* deviceUniqueIdUTF8,
106  const uint32_t deviceCapabilityNumber,
107  VideoFormat& capability) = 0;
108  };
109 
110  public:
111 #if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
112 
123  virtual int setCameraSource(CAMERA_SOURCE source) = 0;
132  virtual CAMERA_SOURCE getCameraSource() = 0;
139  virtual void switchCamera() = 0;
150  virtual bool isZoomSupported() = 0;
163  virtual int32_t setCameraZoom(float zoomValue) = 0;
173  virtual float getCameraMaxZoom() = 0;
184  virtual bool isFocusSupported() = 0;
194  virtual int32_t setCameraFocus(float x, float y) = 0;
205  virtual bool isAutoFaceFocusSupported() = 0;
216  virtual int32_t setCameraAutoFaceFocus(bool enable) = 0;
227  virtual int32_t enableFaceDetection(bool enable) = 0;
228 
236  virtual bool isCameraFaceDetectSupported() = 0;
237 
258  virtual bool isCameraTorchSupported() = 0;
259 
276  virtual int setCameraTorchOn(bool isOn) = 0;
277 
289  virtual bool isCameraExposurePositionSupported() = 0;
290 
306  virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0;
307 
320  virtual bool isCameraExposureSupported() = 0;
321 
332  virtual int setCameraExposureFactor(float value) = 0;
333 
334 #if (defined(__APPLE__) && TARGET_OS_IOS)
335 
346  virtual bool enableMultiCamera(bool enable) = 0;
354  virtual bool isCameraAutoExposureFaceModeSupported() = 0;
355 
356 
370  virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0;
371 
377  virtual int setCameraStabilizationMode(CAMERA_STABILIZATION_MODE mode) = 0;
378 #endif
379 
380 #elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \
381  (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
382 
392  virtual IDeviceInfo* createDeviceInfo() = 0;
404  virtual int initWithDeviceId(const char* deviceId) = 0;
416  virtual int initWithDeviceName(const char* deviceName) = 0;
417 #endif
418 
419 #if defined(__APPLE__)
420 
427  virtual bool isSupportCenterStage() = 0;
428 
437  virtual int enableCenterStage(bool enabled) = 0;
438 #endif
439 
444  virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation) = 0;
445 
453  virtual void setCaptureFormat(const VideoFormat& capture_format) = 0;
465  virtual int registerCameraObserver(ICameraCaptureObserver* observer) = 0;
472 
473  protected:
475 };
480  public:
492  virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) {
493  (void) imageWidth;
494  (void) imageHeight;
495  (void) x;
496  (void) y;
497 
498  }
527  virtual void onFacePositionChanged(
528  int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) {
529  (void) imageWidth;
530  (void) imageHeight;
531  (void) vecRectangle;
532  (void) vecDistance;
533  (void) numFaces;
534  }
535 
547  virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
548  (void)x;
549  (void)y;
550  (void)width;
551  (void)height;
552  }
553 
555  (void) state;
556  (void) source;
557  }
558 
559  protected:
561 };
562 
563 } // namespace rtc
564 } // 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:554
agora::rtc::ICameraCaptureObserver::~ICameraCaptureObserver
virtual ~ICameraCaptureObserver()
Definition: NGIAgoraCameraCapturer.h:560
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:527
agora::rtc::ICameraCaptureObserver
Definition: NGIAgoraCameraCapturer.h:479
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:1996
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:2484
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:474
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:492
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:2610
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:547
agora::rtc::ICameraCapturer::CAMERA_FRONT
@ CAMERA_FRONT
Definition: NGIAgoraCameraCapturer.h:33