Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
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 public:
56#if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE) || defined (__OHOS__)
68 virtual int setCameraSource(CAMERA_SOURCE source, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
77 virtual CAMERA_SOURCE getCameraSource() = 0;
84 virtual int switchCamera(aosl_ref_t ares = AOSL_REF_INVALID) = 0;
95 virtual bool isZoomSupported() = 0;
108 virtual int32_t setCameraZoom(float zoomValue, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
118 virtual float getCameraMaxZoom() = 0;
129 virtual bool isFocusSupported() = 0;
139 virtual int32_t setCameraFocus(float x, float y, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
150 virtual bool isAutoFaceFocusSupported() = 0;
161 virtual int32_t setCameraAutoFaceFocus(bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
172 virtual int32_t enableFaceDetection(bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
173
181 virtual bool isCameraFaceDetectSupported() = 0;
182
203 virtual bool isCameraTorchSupported() = 0;
204
221 virtual int setCameraTorchOn(bool on, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
222
234 virtual bool isCameraExposurePositionSupported() = 0;
235
251 virtual int setCameraExposurePosition(float positionXinView, float positionYinView, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
252
265 virtual bool isCameraExposureSupported() = 0;
266
277 virtual int setCameraExposureFactor(float value, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
278
279#if (defined(__APPLE__) && TARGET_OS_IOS)
291 virtual bool enableMultiCamera(bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
299 virtual bool isCameraAutoExposureFaceModeSupported() = 0;
300
301
315 virtual int setCameraAutoExposureFaceModeEnabled(bool enabled, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
316
322 virtual int setCameraStabilizationMode(CAMERA_STABILIZATION_MODE mode) = 0;
323#endif
324
325#elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__) && !defined (__OHOS__)) || \
326 (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
327
339 virtual int initWithDeviceId(const char* deviceId) = 0;
351 virtual int initWithDeviceName(const char* deviceName) = 0;
352#endif
353
354#if defined(__APPLE__)
362 virtual bool isCenterStageSupported() = 0;
363
372 virtual int enableCenterStage(bool enabled) = 0;
373#endif
374
379 virtual int setDeviceOrientation(VIDEO_ORIENTATION orientation, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
380
388 virtual int setCaptureFormat(const VideoFormat& capture_format, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
394 virtual VideoFormat getCaptureFormat() = 0;
400 virtual int registerCameraObserver(ICameraCaptureObserver* observer, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
406 virtual int unregisterCameraObserver(ICameraCaptureObserver* observer) = 0;
407
408 protected:
409 ~ICameraCapturer() {}
410};
411
414 class ICameraCaptureObserver {
415 public:
427 virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) {
428 (void) imageWidth;
429 (void) imageHeight;
430 (void) x;
431 (void) y;
432
433 }
434
462 virtual void onFacePositionChanged(
463 int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) {
464 (void) imageWidth;
465 (void) imageHeight;
466 (void) vecRectangle;
467 (void) vecDistance;
468 (void) numFaces;
469 }
470
482 virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
483 (void)x;
484 (void)y;
485 (void)width;
486 (void)height;
487 }
488
489 virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source) {
490 (void) state;
491 (void) source;
492 }
493
494 protected:
495 virtual ~ICameraCaptureObserver() {}
496};
497
498} // namespace rtc
499} // namespace agora
agora::RefCountInterface
Definition AgoraRefPtr.h:31
agora::rtc::ICameraCaptureObserver
Definition NGIAgoraCameraCapturer.h:414
agora::rtc::ICameraCaptureObserver::onCameraFocusAreaChanged
virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y)
Definition NGIAgoraCameraCapturer.h:427
agora::rtc::ICameraCaptureObserver::onCameraStateChanged
virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source)
Definition NGIAgoraCameraCapturer.h:489
agora::rtc::ICameraCaptureObserver::onFacePositionChanged
virtual void onFacePositionChanged(int imageWidth, int imageHeight, const Rectangle *vecRectangle, const int *vecDistance, int numFaces)
Definition NGIAgoraCameraCapturer.h:462
agora::rtc::ICameraCaptureObserver::~ICameraCaptureObserver
virtual ~ICameraCaptureObserver()
Definition NGIAgoraCameraCapturer.h:495
agora::rtc::ICameraCaptureObserver::onCameraExposureAreaChanged
virtual void onCameraExposureAreaChanged(int x, int y, int width, int height)
Definition NGIAgoraCameraCapturer.h:482
agora::rtc::ICameraCapturer
Definition NGIAgoraCameraCapturer.h:20
agora::rtc::ICameraCapturer::isFocusSupported
virtual bool isFocusSupported()=0
agora::rtc::ICameraCapturer::setDeviceOrientation
virtual int setDeviceOrientation(VIDEO_ORIENTATION orientation, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::enableMultiCamera
virtual bool enableMultiCamera(bool enable, 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::ICameraCapturer::~ICameraCapturer
~ICameraCapturer()
Definition NGIAgoraCameraCapturer.h:409
agora::rtc::ICameraCapturer::unregisterCameraObserver
virtual int unregisterCameraObserver(ICameraCaptureObserver *observer)=0
agora::rtc::ICameraCapturer::getCameraMaxZoom
virtual float getCameraMaxZoom()=0
agora::rtc::ICameraCapturer::getCameraSource
virtual CAMERA_SOURCE getCameraSource()=0
agora::rtc::ICameraCapturer::setCameraSource
virtual int setCameraSource(CAMERA_SOURCE source, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::enableFaceDetection
virtual int32_t enableFaceDetection(bool enable, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::registerCameraObserver
virtual int registerCameraObserver(ICameraCaptureObserver *observer, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::isCenterStageSupported
virtual bool isCenterStageSupported()=0
agora::rtc::ICameraCapturer::setCameraExposureFactor
virtual int setCameraExposureFactor(float value, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::switchCamera
virtual int switchCamera(aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::CAMERA_STATE
CAMERA_STATE
Definition NGIAgoraCameraCapturer.h:44
agora::rtc::ICameraCapturer::CAMERA_STOPPED
@ CAMERA_STOPPED
Definition NGIAgoraCameraCapturer.h:52
agora::rtc::ICameraCapturer::CAMERA_STARTED
@ CAMERA_STARTED
Definition NGIAgoraCameraCapturer.h:48
agora::rtc::ICameraCapturer::initWithDeviceName
virtual int initWithDeviceName(const char *deviceName)=0
agora::rtc::ICameraCapturer::isZoomSupported
virtual bool isZoomSupported()=0
agora::rtc::ICameraCapturer::setCameraStabilizationMode
virtual int setCameraStabilizationMode(CAMERA_STABILIZATION_MODE mode)=0
agora::rtc::ICameraCapturer::setCameraAutoFaceFocus
virtual int32_t setCameraAutoFaceFocus(bool enable, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::setCameraAutoExposureFaceModeEnabled
virtual int setCameraAutoExposureFaceModeEnabled(bool enabled, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::setCameraExposurePosition
virtual int setCameraExposurePosition(float positionXinView, float positionYinView, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::initWithDeviceId
virtual int initWithDeviceId(const char *deviceId)=0
agora::rtc::ICameraCapturer::setCameraFocus
virtual int32_t setCameraFocus(float x, float y, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::isAutoFaceFocusSupported
virtual bool isAutoFaceFocusSupported()=0
agora::rtc::ICameraCapturer::CAMERA_SOURCE
CAMERA_SOURCE
Definition NGIAgoraCameraCapturer.h:26
agora::rtc::ICameraCapturer::CAMERA_BACK
@ CAMERA_BACK
Definition NGIAgoraCameraCapturer.h:30
agora::rtc::ICameraCapturer::CAMERA_EXTRA
@ CAMERA_EXTRA
Definition NGIAgoraCameraCapturer.h:38
agora::rtc::ICameraCapturer::CAMERA_FRONT
@ CAMERA_FRONT
Definition NGIAgoraCameraCapturer.h:34
agora::rtc::ICameraCapturer::isCameraFaceDetectSupported
virtual bool isCameraFaceDetectSupported()=0
agora::rtc::ICameraCapturer::isCameraAutoExposureFaceModeSupported
virtual bool isCameraAutoExposureFaceModeSupported()=0
agora::rtc::ICameraCapturer::isCameraExposureSupported
virtual bool isCameraExposureSupported()=0
agora::rtc::ICameraCapturer::setCaptureFormat
virtual int setCaptureFormat(const VideoFormat &capture_format, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::setCameraZoom
virtual int32_t setCameraZoom(float zoomValue, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCapturer::isCameraTorchSupported
virtual bool isCameraTorchSupported()=0
agora::rtc::ICameraCapturer::isCameraExposurePositionSupported
virtual bool isCameraExposurePositionSupported()=0
agora::rtc::ICameraCapturer::getCaptureFormat
virtual VideoFormat getCaptureFormat()=0
agora::rtc::ICameraCapturer::enableCenterStage
virtual int enableCenterStage(bool enabled)=0
agora::rtc::IVideoSinkBase
Definition NGIAgoraMediaNode.h:167
agora::rtc
Definition AgoraExtensions.h:5
agora::rtc::CAMERA_STABILIZATION_MODE
CAMERA_STABILIZATION_MODE
Camera stabilization modes.
Definition AgoraBase.h:3373
agora::rtc::VIDEO_ORIENTATION
VIDEO_ORIENTATION
The clockwise rotation of the video.
Definition AgoraBase.h:1001
agora
Definition AgoraAtomicOps.h:21
agora::rtc::Rectangle
The location of the target area relative to the screen or window. If you do not set this parameter,...
Definition AgoraBase.h:2342
agora::rtc::VideoFormat
The format of the video frame.
Definition AgoraBase.h:3166