Agora C++ API Reference for All Platforms
agora::rtc::IVideoSource Class Referenceabstract

#include <IAgoraRtcEngine.h>

Public Member Functions

virtual bool onInitialize (IVideoFrameConsumer *consumer)=0
 
virtual void onDispose ()=0
 
virtual bool onStart ()=0
 
virtual void onStop ()=0
 
virtual agora::media::ExternalVideoFrame::VIDEO_PIXEL_FORMAT getBufferType ()=0
 
virtual VIDEO_CAPTURE_TYPE getVideoCaptureType ()=0
 
virtual VideoContentHint getVideoContentHint ()=0
 

Detailed Description

The IVideoSource class. You can use it to customize the video source.

Member Function Documentation

◆ onInitialize()

virtual bool agora::rtc::IVideoSource::onInitialize ( IVideoFrameConsumer consumer)
pure virtual

Notification for initializing the custom video source.

The SDK triggers this callback to remind you to initialize the custom video source. After receiving this callback, you can do some preparation, such as enabling the camera, and then use the return value to tell the SDK whether the custom video source is prepared.

Parameters
consumerAn IVideoFrameConsumer object that the SDK passes to you. You need to reserve this object and use it to send the video frame to the SDK once the custom video source is started. See IVideoFrameConsumer.
Returns
  • true: The custom video source is initialized.
  • false: The custom video source is not ready or fails to initialize. The SDK stops and reports the error.

◆ onDispose()

virtual void agora::rtc::IVideoSource::onDispose ( )
pure virtual

Notification for disabling the custom video source.

The SDK triggers this callback to remind you to disable the custom video source device. This callback tells you that the SDK is about to release the IVideoFrameConsumer object. Ensure that you no longer use IVideoFrameConsumer after receiving this callback.

◆ onStart()

virtual bool agora::rtc::IVideoSource::onStart ( )
pure virtual

Notification for starting the custom video source.

The SDK triggers this callback to remind you to start the custom video source for capturing video. The SDK uses IVideoFrameConsumer to receive the video frame that you capture after the video source is started. You must use the return value to tell the SDK whether the custom video source is started.

Returns
  • true: The custom video source is started.
  • false: The custom video source fails to start. The SDK stops and reports the error.

◆ onStop()

virtual void agora::rtc::IVideoSource::onStop ( )
pure virtual

Notification for stopping capturing video.

The SDK triggers this callback to remind you to stop capturing video. This callback tells you that the SDK is about to stop using IVideoFrameConsumer to receive the video frame that you capture.

◆ getBufferType()

virtual agora::media::ExternalVideoFrame::VIDEO_PIXEL_FORMAT agora::rtc::IVideoSource::getBufferType ( )
pure virtual

Gets the video frame type.

Before you initialize the custom video source, the SDK triggers this callback to query the video frame type. You must specify the video frame type in the return value and then pass it to the SDK.

Note
Ensure that the video frame type that you specify in this callback is the same as that in the consumeRawVideoFrame method.
Returns
VIDEO_PIXEL_FORMAT

◆ getVideoCaptureType()

virtual VIDEO_CAPTURE_TYPE agora::rtc::IVideoSource::getVideoCaptureType ( )
pure virtual

Gets the capture type of the custom video source.

Before you initialize the custom video source, the SDK triggers this callback to query the capture type of the video source. You must specify the capture type in the return value and then pass it to the SDK. The SDK enables the corresponding video processing algorithm according to the capture type after receiving the video frame.

Returns
VIDEO_CAPTURE_TYPE

◆ getVideoContentHint()

virtual VideoContentHint agora::rtc::IVideoSource::getVideoContentHint ( )
pure virtual

Gets the content hint of the custom video source.

If you specify the custom video source as a screen-sharing video, the SDK triggers this callback to query the content hint of the video source before you initialize the video source. You must specify the content hint in the return value and then pass it to the SDK. The SDK enables the corresponding video processing algorithm according to the content hint after receiving the video frame.

Returns
VideoContentHint