Agora Java API Reference for Android
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;
21 
22  public:
35  };
36 
40  enum CAMERA_STATE {
49  };
50 
51  // Interface for receiving information about available camera devices.
55  class IDeviceInfo {
56  public:
57  virtual ~IDeviceInfo() {}
58 
62  virtual void release() = 0;
63 
68  virtual uint32_t NumberOfDevices() = 0;
69 
84  virtual int32_t GetDeviceName(uint32_t deviceNumber, char* deviceNameUTF8,
85  uint32_t deviceNameLength, char* deviceUniqueIdUTF8,
86  uint32_t deviceUniqueIdLength, char* productUniqueIdUTF8 = 0,
87  uint32_t productUniqueIdLength = 0,
88  char* deviceTypeUTF8 = 0, uint32_t deviceTypeLength = 0) = 0;
89 
96  virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) = 0;
97 
106  virtual int32_t GetCapability(const char* deviceUniqueIdUTF8,
107  const uint32_t deviceCapabilityNumber,
108  VideoFormat& capability) = 0;
109  };
110 
111  public:
112 #if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
113 
124  virtual int setCameraSource(CAMERA_SOURCE source, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
133  virtual CAMERA_SOURCE getCameraSource() = 0;
140  virtual int switchCamera(aosl_ref_t ares = AOSL_REF_INVALID) = 0;
151  virtual bool isZoomSupported() = 0;
164  virtual int32_t setCameraZoom(float zoomValue, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
174  virtual float getCameraMaxZoom() = 0;
185  virtual bool isFocusSupported() = 0;
195  virtual int32_t setCameraFocus(float x, float y, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
206  virtual bool isAutoFaceFocusSupported() = 0;
217  virtual int32_t setCameraAutoFaceFocus(bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
228  virtual int32_t enableFaceDetection(bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
229 
237  virtual bool isCameraFaceDetectSupported() = 0;
238 
259  virtual bool isCameraTorchSupported() = 0;
260 
277  virtual int setCameraTorchOn(bool on, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
278 
290  virtual bool isCameraExposurePositionSupported() = 0;
291 
307  virtual int setCameraExposurePosition(float positionXinView, float positionYinView, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
308 
321  virtual bool isCameraExposureSupported() = 0;
322 
333  virtual int setCameraExposureFactor(float value, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
334 
335 #if (defined(__APPLE__) && TARGET_OS_IOS)
336 
347  virtual bool enableMultiCamera(bool enable, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
355  virtual bool isCameraAutoExposureFaceModeSupported() = 0;
356 
357 
371  virtual int setCameraAutoExposureFaceModeEnabled(bool enabled, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
372 #endif
373 
374 #elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \
375  (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
376 
386  virtual IDeviceInfo* createDeviceInfo() = 0;
398  virtual int initWithDeviceId(const char* deviceId) = 0;
410  virtual int initWithDeviceName(const char* deviceName) = 0;
411 #endif
412 
417  virtual int setDeviceOrientation(VIDEO_ORIENTATION orientation, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
418 
426  virtual int setCaptureFormat(const VideoFormat& capture_format, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
438  virtual int registerCameraObserver(ICameraCaptureObserver* observer, aosl_ref_t ares = AOSL_REF_INVALID) = 0;
445 
446  protected:
447  ~ICameraCapturer() {}
448 };
453  public:
465  virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) {
466  (void) imageWidth;
467  (void) imageHeight;
468  (void) x;
469  (void) y;
470 
471  }
500  virtual void onFacePositionChanged(
501  int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) {
502  (void) imageWidth;
503  (void) imageHeight;
504  (void) vecRectangle;
505  (void) vecDistance;
506  (void) numFaces;
507  }
508 
520  virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
521  (void)x;
522  (void)y;
523  (void)width;
524  (void)height;
525  }
526 
527  virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source) {
528  (void) state;
529  (void) source;
530  }
531 
532  protected:
533  virtual ~ICameraCaptureObserver() {}
534 };
535 
536 } // namespace rtc
537 } // namespace agora
agora::rtc::ICameraCapturer::setCaptureFormat
virtual int setCaptureFormat(const VideoFormat &capture_format, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::rtc::ICameraCaptureObserver
Definition: NGIAgoraCameraCapturer.h:452
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::IDeviceInfo::GetCapability
virtual int32_t GetCapability(const char *deviceUniqueIdUTF8, const uint32_t deviceCapabilityNumber, VideoFormat &capability)=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:2005
agora::rtc::ICameraCapturer::IDeviceInfo
Definition: NGIAgoraCameraCapturer.h:55
agora::rtc::ICameraCaptureObserver::onCameraFocusAreaChanged
virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y)
Definition: NGIAgoraCameraCapturer.h:465
agora::rtc::ICameraCaptureObserver::onCameraExposureAreaChanged
virtual void onCameraExposureAreaChanged(int x, int y, int width, int height)
Definition: NGIAgoraCameraCapturer.h:520
agora::rtc::ICameraCapturer::IDeviceInfo::release
virtual void release()=0
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:2493
agora::rtc::ICameraCapturer
Definition: NGIAgoraCameraCapturer.h:20
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:500
agora::rtc::ICameraCapturer::registerCameraObserver
virtual int registerCameraObserver(ICameraCaptureObserver *observer, aosl_ref_t ares=AOSL_REF_INVALID)=0
agora::RefCountInterface
Definition: AgoraRefPtr.h:31
agora::rtc::ICameraCapturer::getCaptureFormat
virtual VideoFormat getCaptureFormat()=0
agora::rtc::ICameraCapturer::CAMERA_STOPPED
@ CAMERA_STOPPED
Definition: NGIAgoraCameraCapturer.h:48
agora::rtc::ICameraCapturer::CAMERA_BACK
@ CAMERA_BACK
Definition: NGIAgoraCameraCapturer.h:30
agora::rtc::ICameraCapturer::CAMERA_STARTED
@ CAMERA_STARTED
Definition: NGIAgoraCameraCapturer.h:44
agora::rtc::ICameraCapturer::IDeviceInfo::NumberOfDevices
virtual uint32_t NumberOfDevices()=0
agora::rtc::ICameraCapturer::CAMERA_STATE
CAMERA_STATE
Definition: NGIAgoraCameraCapturer.h:40