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 #include <api/cpp/aosl_ares_class.h>
12
13 namespace agora {
14 namespace rtc {
15 class IVideoSinkBase;
16 class ICameraCaptureObserver;
20 class ICameraCapturer : public RefCountInterface {
21
22 public:
26 enum CAMERA_SOURCE {
30 CAMERA_BACK,
34 CAMERA_FRONT,
38 CAMERA_EXTRA,
39 };
40
44 enum CAMERA_STATE {
48 CAMERA_STARTED,
52 CAMERA_STOPPED,
53 };
54
55 // Interface for receiving information about available camera devices.
59 class IDeviceInfo {
60 public:
61 virtual ~IDeviceInfo() {}
62
66 virtual void release() = 0;
67
72 virtual uint32_t NumberOfDevices() = 0;
73
88 virtual int32_t GetDeviceName(uint32_t deviceNumber, char* deviceNameUTF8,
89 uint32_t deviceNameLength, char* deviceUniqueIdUTF8,
90 uint32_t deviceUniqueIdLength, char* productUniqueIdUTF8 = 0,
91 uint32_t productUniqueIdLength = 0,
92 char* deviceTypeUTF8 = 0, uint32_t deviceTypeLength = 0) = 0;
93
100 virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) = 0;
101
110 virtual int32_t GetCapability(const char* deviceUniqueIdUTF8,
111 const uint32_t deviceCapabilityNumber,
112 VideoFormat& capability) = 0;
113 };
114
115 public:
116 #if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
117
128 virtual int setCameraSource(CAMERA_SOURCE source, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
137 virtual CAMERA_SOURCE getCameraSource() = 0;
144 virtual int switchCamera(aosl_ref_t ares = AOSL_REF_INVALID) = 0;
155 virtual bool isZoomSupported() = 0;
168 virtual int32_t setCameraZoom(float zoomValue, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
178 virtual float getCameraMaxZoom() = 0;
189 virtual bool isFocusSupported() = 0;
199 virtual int32_t setCameraFocus(float x, float y, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
210 virtual bool isAutoFaceFocusSupported() = 0;
221 virtual int32_t setCameraAutoFaceFocus(bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
232 virtual int32_t enableFaceDetection(bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
233
241 virtual bool isCameraFaceDetectSupported() = 0;
242
263 virtual bool isCameraTorchSupported() = 0;
264
281 virtual int setCameraTorchOn(bool on, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
282
294 virtual bool isCameraExposurePositionSupported() = 0;
295
311 virtual int setCameraExposurePosition(float positionXinView, float positionYinView, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
312
325 virtual bool isCameraExposureSupported() = 0;
326
337 virtual int setCameraExposureFactor(float value, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
338
339 #if (defined(__APPLE__) && TARGET_OS_IOS)
340
351 virtual bool enableMultiCamera(bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
359 virtual bool isCameraAutoExposureFaceModeSupported() = 0;
360
361
375 virtual int setCameraAutoExposureFaceModeEnabled(bool enabled, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
376
382 virtual int setCameraStabilizationMode(CAMERA_STABILIZATION_MODE mode) = 0;
383 #endif
384
385 #elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \
386 (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
387
397 virtual IDeviceInfo* createDeviceInfo() = 0;
409 virtual int initWithDeviceId(const char* deviceId) = 0;
421 virtual int initWithDeviceName(const char* deviceName) = 0;
422 #endif
423
424 #if defined(__APPLE__)
425
432 virtual bool isCenterStageSupported() = 0;
433
442 virtual int enableCenterStage(bool enabled) = 0;
443 #endif
444
449 virtual int setDeviceOrientation(VIDEO_ORIENTATION orientation, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
450
458 virtual int setCaptureFormat(const VideoFormat& capture_format, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
464 virtual VideoFormat getCaptureFormat() = 0;
470 virtual int registerCameraObserver(ICameraCaptureObserver* observer, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
476 virtual int unregisterCameraObserver(ICameraCaptureObserver* observer) = 0;
477
478 protected:
479 ~ICameraCapturer() {}
480 };
484 class ICameraCaptureObserver {
485 public:
497 virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) {
498 (void) imageWidth;
499 (void) imageHeight;
500 (void) x;
501 (void) y;
502
503 }
532 virtual void onFacePositionChanged(
533 int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) {
534 (void) imageWidth;
535 (void) imageHeight;
536 (void) vecRectangle;
537 (void) vecDistance;
538 (void) numFaces;
539 }
540
552 virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
553 (void)x;
554 (void)y;
555 (void)width;
556 (void)height;
557 }
558
559 virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source) {
560 (void) state;
561 (void) source;
562 }
563
564 protected:
565 virtual ~ICameraCaptureObserver() {}
566 };
567
568 } // namespace rtc
569 } // namespace agora
agora::rtc::ICameraCapturer::setCaptureFormat
virtual int setCaptureFormat(const VideoFormat &capture_format, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCaptureObserver::~ICameraCaptureObserver
virtual ~ICameraCaptureObserver()
Definition: NGIAgoraCameraCapturer.h:565
agora::rtc::ICameraCapturer::~ICameraCapturer
~ICameraCapturer()
Definition: NGIAgoraCameraCapturer.h:479
agora::rtc::ICameraCapturer::isCenterStageSupported
virtual bool isCenterStageSupported()=0
agora::rtc::ICameraCapturer::createDeviceInfo
virtual IDeviceInfo * createDeviceInfo()=0
agora::rtc::ICameraCapturer::setCameraExposurePosition
virtual int setCameraExposurePosition(float positionXinView, float positionYinView, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::setCameraTorchOn
virtual int setCameraTorchOn(bool on, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCaptureObserver
Definition: NGIAgoraCameraCapturer.h:484
agora::rtc::ICameraCapturer::IDeviceInfo::NumberOfCapabilities
virtual int32_t NumberOfCapabilities(const char *deviceUniqueIdUTF8)=0
agora::rtc::ICameraCapturer::CAMERA_SOURCE
CAMERA_SOURCE
Definition: NGIAgoraCameraCapturer.h:26
agora::rtc::ICameraCapturer::enableCenterStage
virtual int enableCenterStage(bool enabled)=0
agora::rtc::ICameraCapturer::enableMultiCamera
virtual bool enableMultiCamera(bool enable, aosl_ref_t ares=AOSL_REF_INVALID)=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::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::Rectangle
Definition: AgoraBase.h:2224
agora::rtc::ICameraCapturer::isCameraAutoExposureFaceModeSupported
virtual bool isCameraAutoExposureFaceModeSupported()=0
agora::rtc::ICameraCapturer::isCameraTorchSupported
virtual bool isCameraTorchSupported()=0
agora::rtc::ICameraCapturer::isCameraExposureSupported
virtual bool isCameraExposureSupported()=0
agora::rtc::ICameraCapturer::IDeviceInfo
Definition: NGIAgoraCameraCapturer.h:59
agora::rtc::ICameraCaptureObserver::onCameraFocusAreaChanged
virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y)
Definition: NGIAgoraCameraCapturer.h:497
agora::rtc::ICameraCaptureObserver::onCameraExposureAreaChanged
virtual void onCameraExposureAreaChanged(int x, int y, int width, int height)
Definition: NGIAgoraCameraCapturer.h:552
agora::rtc::ICameraCapturer::IDeviceInfo::release
virtual void release()=0
agora::rtc::ICameraCapturer::setCameraZoom
virtual int32_t setCameraZoom(float zoomValue, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCaptureObserver::onCameraStateChanged
virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source)
Definition: NGIAgoraCameraCapturer.h:559
agora
Definition: AgoraAtomicOps.h:21
agora::rtc::ICameraCapturer::unregisterCameraObserver
virtual int unregisterCameraObserver(ICameraCaptureObserver *observer)=0
agora::rtc::ICameraCapturer::CAMERA_FRONT
@ CAMERA_FRONT
Definition: NGIAgoraCameraCapturer.h:34
agora::rtc::VideoFormat
Definition: AgoraBase.h:2727
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:951
agora::rtc::ICameraCapturer::initWithDeviceName
virtual int initWithDeviceName(const char *deviceName)=0
agora::rtc::ICameraCapturer
Definition: NGIAgoraCameraCapturer.h:20
agora::rtc::ICameraCapturer::setCameraExposureFactor
virtual int setCameraExposureFactor(float value, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::setCameraStabilizationMode
virtual int setCameraStabilizationMode(CAMERA_STABILIZATION_MODE mode)=0
agora::rtc::ICameraCapturer::isCameraFaceDetectSupported
virtual bool isCameraFaceDetectSupported()=0
agora::rtc::ICameraCapturer::setCameraFocus
virtual int32_t setCameraFocus(float x, float y, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::CAMERA_EXTRA
@ CAMERA_EXTRA
Definition: NGIAgoraCameraCapturer.h:38
agora::rtc::ICameraCapturer::setDeviceOrientation
virtual int setDeviceOrientation(VIDEO_ORIENTATION orientation, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCaptureObserver::onFacePositionChanged
virtual void onFacePositionChanged(int imageWidth, int imageHeight, const Rectangle *vecRectangle, const int *vecDistance, int numFaces)
Definition: NGIAgoraCameraCapturer.h:532
agora::rtc::ICameraCapturer::getCameraSource
virtual CAMERA_SOURCE getCameraSource()=0
agora::rtc::ICameraCapturer::registerCameraObserver
virtual int registerCameraObserver(ICameraCaptureObserver *observer, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::CAMERA_STABILIZATION_MODE
CAMERA_STABILIZATION_MODE
Definition: AgoraBase.h:2882
agora::rtc::ICameraCapturer::switchCamera
virtual int switchCamera(aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::isZoomSupported
virtual bool isZoomSupported()=0
agora::RefCountInterface
Definition: AgoraRefPtr.h:31
agora::rtc::ICameraCapturer::setCameraAutoFaceFocus
virtual int32_t setCameraAutoFaceFocus(bool enable, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::setCameraSource
virtual int setCameraSource(CAMERA_SOURCE source, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::getCaptureFormat
virtual VideoFormat getCaptureFormat()=0
agora::rtc::ICameraCapturer::IDeviceInfo::~IDeviceInfo
virtual ~IDeviceInfo()
Definition: NGIAgoraCameraCapturer.h:61
agora::rtc::ICameraCapturer::CAMERA_STOPPED
@ CAMERA_STOPPED
Definition: NGIAgoraCameraCapturer.h:52
agora::rtc::ICameraCapturer::isCameraExposurePositionSupported
virtual bool isCameraExposurePositionSupported()=0
agora::rtc::ICameraCapturer::CAMERA_BACK
@ CAMERA_BACK
Definition: NGIAgoraCameraCapturer.h:30
agora::rtc::ICameraCapturer::CAMERA_STARTED
@ CAMERA_STARTED
Definition: NGIAgoraCameraCapturer.h:48
agora::rtc::ICameraCapturer::IDeviceInfo::NumberOfDevices
virtual uint32_t NumberOfDevices()=0
agora::rtc::ICameraCapturer::CAMERA_STATE
CAMERA_STATE
Definition: NGIAgoraCameraCapturer.h:44
agora::rtc::ICameraCapturer::enableFaceDetection
virtual int32_t enableFaceDetection(bool enable, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::isAutoFaceFocusSupported
virtual bool isAutoFaceFocusSupported()=0
rtc
Definition: video_node_i.h:28
agora::rtc::ICameraCapturer::setCameraAutoExposureFaceModeEnabled
virtual int setCameraAutoExposureFaceModeEnabled(bool enabled, aosl_ref_t ares=AOSL_REF_INVALID)=0