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 
81  virtual int32_t GetDeviceName(uint32_t deviceNumber, char* deviceNameUTF8,
82  uint32_t deviceNameLength, char* deviceUniqueIdUTF8,
83  uint32_t deviceUniqueIdLength, char* productUniqueIdUTF8 = 0,
84  uint32_t productUniqueIdLength = 0) = 0;
85 
92  virtual int32_t NumberOfCapabilities(const char* deviceUniqueIdUTF8) = 0;
93 
102  virtual int32_t GetCapability(const char* deviceUniqueIdUTF8,
103  const uint32_t deviceCapabilityNumber,
104  VideoFormat& capability) = 0;
105  };
106 
107  public:
108 #if defined(__ANDROID__) || (defined(__APPLE__) && TARGET_OS_IPHONE)
109 
120  virtual int setCameraSource(CAMERA_SOURCE source) = 0;
129  virtual CAMERA_SOURCE getCameraSource() = 0;
136  virtual void switchCamera() = 0;
147  virtual bool isZoomSupported() = 0;
160  virtual int32_t setCameraZoom(float zoomValue) = 0;
170  virtual float getCameraMaxZoom() = 0;
181  virtual bool isFocusSupported() = 0;
191  virtual int32_t setCameraFocus(float x, float y) = 0;
202  virtual bool isAutoFaceFocusSupported() = 0;
213  virtual int32_t setCameraAutoFaceFocus(bool enable) = 0;
224  virtual int32_t enableFaceDetection(bool enable) = 0;
225 
233  virtual bool isCameraFaceDetectSupported() = 0;
234 
242  virtual bool isCameraTorchSupported() = 0;
243 
251  virtual int setCameraTorchOn(bool isOn) = 0;
252 
264  virtual bool isCameraExposurePositionSupported() = 0;
265 
281  virtual int setCameraExposurePosition(float positionXinView, float positionYinView) = 0;
282 
283 #if (defined(__APPLE__) && TARGET_OS_IOS)
284 
291  virtual bool isCameraAutoExposureFaceModeSupported() = 0;
292 
293 
307  virtual int setCameraAutoExposureFaceModeEnabled(bool enabled) = 0;
308 #endif
309 
310 #elif defined(_WIN32) || (defined(__linux__) && !defined(__ANDROID__)) || \
311  (defined(__APPLE__) && TARGET_OS_MAC && !TARGET_OS_IPHONE)
312 
322  virtual IDeviceInfo* createDeviceInfo() = 0;
334  virtual int initWithDeviceId(const char* deviceId) = 0;
346  virtual int initWithDeviceName(const char* deviceName) = 0;
347 #endif
348 
353  virtual void setDeviceOrientation(VIDEO_ORIENTATION orientation) = 0;
354 
362  virtual void setCaptureFormat(const VideoFormat& capture_format) = 0;
374  virtual int registerCameraObserver(ICameraCaptureObserver* observer) = 0;
381 
382  protected:
383  ~ICameraCapturer() {}
384 };
389  public:
401  virtual void onCameraFocusAreaChanged(int imageWidth, int imageHeight, int x, int y) {
402  (void) imageWidth;
403  (void) imageHeight;
404  (void) x;
405  (void) y;
406 
407  }
436  virtual void onFacePositionChanged(
437  int imageWidth, int imageHeight, const Rectangle* vecRectangle, const int* vecDistance, int numFaces) {
438  (void) imageWidth;
439  (void) imageHeight;
440  (void) vecRectangle;
441  (void) vecDistance;
442  (void) numFaces;
443  }
444 
456  virtual void onCameraExposureAreaChanged(int x, int y, int width, int height) {
457  (void)x;
458  (void)y;
459  (void)width;
460  (void)height;
461  }
462 
463  virtual void onCameraStateChanged(ICameraCapturer::CAMERA_STATE state, ICameraCapturer::CAMERA_SOURCE source) {
464  (void) state;
465  (void) source;
466  }
467 
468  protected:
469  virtual ~ICameraCaptureObserver() {}
470 };
471 
472 } // namespace rtc
473 } // namespace agora
agora::rtc::ICameraCapturer::setCaptureFormat
virtual void setCaptureFormat(const VideoFormat &capture_format)=0
agora::rtc::ICameraCaptureObserver
Definition: NGIAgoraCameraCapturer.h:388
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::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)=0
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::Rectangle
Definition: AgoraBase.h:2054
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:401
agora::rtc::ICameraCaptureObserver::onCameraExposureAreaChanged
virtual void onCameraExposureAreaChanged(int x, int y, int width, int height)
Definition: NGIAgoraCameraCapturer.h:456
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:2589
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:436
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