Agora C++ API Reference for All Platforms

Public Member Functions | List of all members
agora::rtc::IVideoDeviceManager Class Referenceabstract

## Public Member Functions
virtual | ~IVideoDeviceManager ()
virtual IVideoDeviceCollection * | enumerateVideoDevices ()=0
virtual int | setDevice (const char deviceIdUTF8[MAX_DEVICE_ID_LENGTH])=0
virtual int | getDevice (char deviceIdUTF8[MAX_DEVICE_ID_LENGTH])=0
virtual int | numberOfCapabilities (const char *deviceIdUTF8)=0
virtual int | getCapability (const char *deviceIdUTF8, const uint32_t deviceCapabilityNumber, VideoFormat &capability)=0
virtual int | startDeviceTest (view_t hwnd)=0
virtual int | stopDeviceTest ()=0
virtual void | release ()=0

## Detailed Description

The IVideoDeviceManager class.

## Constructor & Destructor Documentation

## ◆ ~IVideoDeviceManager()

virtual agora::rtc::IVideoDeviceManager::~IVideoDeviceManager | ( |  | ) |
| inline virtual

## Member Function Documentation

## ◆ enumerateVideoDevices()

virtual IVideoDeviceCollection* agora::rtc::IVideoDeviceManager::enumerateVideoDevices | ( |  | ) |
| pure virtual

Enumerates the video devices.

This method returns an `IVideoDeviceCollection` object including all video devices in the system. With the `IVideoDeviceCollection` object, the application can enumerate video devices. The application must call the release method to release the returned object after using it.

Returns
  - Success: An `IVideoDeviceCollection` object including all video devices in the system.
  - Failure: NULL.

## ◆ setDevice()

virtual int agora::rtc::IVideoDeviceManager::setDevice | ( | const char | deviceIdUTF8[MAX_DEVICE_ID_LENGTH] | ) |
| pure virtual

Specifies the video capture device with the device ID.

Parameters

  deviceIdUTF8 | he device ID. You can get the device ID by calling `enumerateVideoDevices`. The maximum length is #MAX_DEVICE_ID_LENGTH.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ getDevice()

virtual int agora::rtc::IVideoDeviceManager::getDevice | ( | char | deviceIdUTF8[MAX_DEVICE_ID_LENGTH] | ) |
| pure virtual

Retrieves the current video capture device.

Parameters

  deviceIdUTF8 | Output parameter. The device ID. The maximum length is #MAX_DEVICE_ID_LENGTH_TYPE.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ numberOfCapabilities()

virtual int agora::rtc::IVideoDeviceManager::numberOfCapabilities | ( | const char * | deviceIdUTF8 | ) |
| pure virtual

Gets the number of video formats supported by the specified video capture device.

Video capture devices may support multiple video formats, and each format supports different combinations of video frame width, video frame height, and frame rate.

You can call this method to get how many video formats the specified video capture device can support, and then call `getCapability` to get the specific video frame information in the specified video format.

Parameters

  deviceIdUTF8 | The ID of the video capture device.

Returns
  - 0: Success. Returns the number of video formats supported by this device. For example: If the specified camera supports 10 different video formats, the return value is 10.
  - < 0: Failure.

## ◆ getCapability()

virtual int agora::rtc::IVideoDeviceManager::getCapability | ( | const char * | deviceIdUTF8,
|  | const uint32_t | deviceCapabilityNumber,
|  | VideoFormat & | capability
| ) |  |
| pure virtual

Gets the detailed video frame information of the video capture device in the specified video format.

After calling `numberOfCapabilities` to get the number of video formats supported by the video capture device, you can call this method to get the specific video frame information supported by the specified index number.

Parameters

  deviceIdUTF8 | ID of the video capture device.
  deviceCapabilityNumber | The index number of the video format. If the return value of `numberOfCapabilities` is i, the value range of this parameter is [0,i).
  capability | Output parameter. Indicates the specific information of the specified video format, including width (px), height (px), and frame rate (fps). See VideoFormat.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ startDeviceTest()

virtual int agora::rtc::IVideoDeviceManager::startDeviceTest | ( | view_t | hwnd | ) |
| pure virtual

Starts the video capture device test.

This method tests whether the video capture device works properly. Before calling this method, ensure that you have already called enableVideo, and the HWND window handle of the incoming parameter is valid.

Parameters

  hwnd | An Output parameter that specifies the window handle to display the video.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ stopDeviceTest()

virtual int agora::rtc::IVideoDeviceManager::stopDeviceTest | ( |  | ) |
| pure virtual

Stops the video capture device test.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ release()

virtual void agora::rtc::IVideoDeviceManager::release | ( |  | ) |
| pure virtual

Releases all the resources occupied by the `IVideoDeviceManager` object.