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 
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 #endif
372 
373 #elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \
374  (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
375 
385  virtual IDeviceInfo* createDeviceInfo() = 0;
397  virtual int initWithDeviceId(const char* deviceId) = 0;
409  virtual int initWithDeviceName(const char* deviceName) = 0;
410 #endif
411 
416  virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation) = 0;
417 
425  virtual void setCaptureFormat(const VideoFormat& capture_format) = 0;
437  virtual int registerCameraObserver(ICameraCaptureObserver* observer) = 0;
444 
445  protected:
446  ~ICameraCapturer() {}
447 };
452  public:
464  virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) {
465  (void) imageWidth;
466  (void) imageHeight;
467  (void) x;
468  (void) y;
469 
470  }
499  virtual void onFacePositionChanged(
500  int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) {
501  (void) imageWidth;
502  (void) imageHeight;
503  (void) vecRectangle;
504  (void) vecDistance;
505  (void) numFaces;
506  }
507 
519  virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
520  (void)x;
521  (void)y;
522  (void)width;
523  (void)height;
524  }
525 
526  virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source) {
527  (void) state;
528  (void) source;
529  }
530 
531  protected:
532  virtual ~ICameraCaptureObserver() {}
533 };
534 
535 } // namespace rtc
536 } // namespace agora
agora::rtc::ICameraCapturer::setCaptureFormat
virtual void setCaptureFormat(const VideoFormat &capture_format)=0
agora::rtc::ICameraCaptureObserver
Definition: NGIAgoraCameraCapturer.h:451
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::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::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:1987
agora::rtc::ICameraCapturer::IDeviceInfo
Definition: NGIAgoraCameraCapturer.h:54
agora::rtc::ICameraCaptureObserver::onCameraFocusAreaChanged
virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y)
Definition: NGIAgoraCameraCapturer.h:464
agora::rtc::ICameraCaptureObserver::onCameraExposureAreaChanged
virtual void onCameraExposureAreaChanged(int x, int y, int width, int height)
Definition: NGIAgoraCameraCapturer.h:519
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:33
agora::rtc::VideoFormat
Definition: AgoraBase.h:2475
agora::rtc::ICameraCapturer
Definition: NGIAgoraCameraCapturer.h:19
agora::rtc::ICameraCaptureObserver::onFacePositionChanged
virtual void onFacePositionChanged(int imageWidth, int imageHeight, const Rectangle *vecRectangle, const int *vecDistance, int numFaces)
Definition: NGIAgoraCameraCapturer.h:499
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::CAMERA_STOPPED
@ CAMERA_STOPPED
Definition: NGIAgoraCameraCapturer.h:47
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