Video SDK v3.7.1 API Reference for All Platforms (C++)
agora::rtc::IVideoSink Class Referenceabstract

Public Member Functions

virtual bool onInitialize ()=0
 
virtual bool onStart ()=0
 
virtual void onStop ()=0
 
virtual void onDispose ()=0
 
virtual agora::media::ExternalVideoFrame::VIDEO_BUFFER_TYPE getBufferType ()=0
 
virtual agora::media::ExternalVideoFrame::VIDEO_PIXEL_FORMAT getPixelFormat ()=0
 
virtual void onRenderPixelBuffer (CVPixelBufferRef pixelBuffer, int rotation)=0
 
virtual void onRenderRawData (uint8_t *rawData, int width, int height, int rotation)=0
 

Detailed Description

Since
v3.5.0

The IVideoSink class, which can set up a custom video renderer.

During a real-time audio and video interaction, the Agora SDK enables the default renderer to render local and remote video. The IVideoSink class can customize the video renderer. You can implement this interface first, and then customize the video renderer that you want by calling setLocalVideoRenderer or setRemoteVideoRenderer.

Member Function Documentation

◆ onInitialize()

virtual bool agora::rtc::IVideoSink::onInitialize ( )
pure virtual

Notification for initializing the custom video renderer.

Since
v3.5.0

The SDK triggers this callback to remind you to initialize the custom video renderer. After receiving this callback, you can do some preparation, and then use the return value to tell the SDK whether the custom video renderer is prepared. The SDK takes the corresponding behavior based on the return value.

Returns
  • true: The custom video renderer is initialized. The SDK is ready to send the video data to be rendered.
  • false: The custom video renderer is not ready or fails to initialize. The SDK reports the error.

◆ onStart()

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

Notification for starting the custom video source.

Since
v3.5.0

The SDK triggers this callback to remind you to start the custom video source for capturing video. After receiving this callback, you can do some preparation, and then use the return value to tell the SDK whether the custom video renderer is started. The SDK takes the corresponding behavior based on the return value.

Returns
  • true: The custom video renderer is started. The SDK is ready to send the video data to be rendered to the custom video renderer for rendering.
  • false: The custom video renderer is not ready or fails to initialize. The SDK stops and reports the error.

◆ onStop()

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

Notification for stopping rendering the video.

Since
v3.5.0

The SDK triggers this callback to remind you to stop rendering the video. This callback informs you that the SDK is about to stop sending video data to the custom video renderer.

◆ onDispose()

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

Notification for disabling the custom video renderer.

Since
v3.5.0

The SDK triggers this callback to remind you to disable the custom video renderer.

◆ getBufferType()

virtual agora::media::ExternalVideoFrame::VIDEO_BUFFER_TYPE agora::rtc::IVideoSink::getBufferType ( )
pure virtual

Gets the video frame type.

Since
v3.5.0

Before you initialize the custom video renderer, the SDK triggers this callback to query the data type of the video frame that you want to process. You must specify the data type of the video frame in the return value of this callback and then pass it to the SDK.

Returns
VIDEO_BUFFER_TYPE

◆ getPixelFormat()

virtual agora::media::ExternalVideoFrame::VIDEO_PIXEL_FORMAT agora::rtc::IVideoSink::getPixelFormat ( )
pure virtual

Gets the video frame pixel format.

Since
v3.5.0

Before you initialize the custom video renderer, the SDK triggers this callback to query the pixel format of the video frame that you want to process. You must specify a pixel format for the video frame in the return value of this callback and then pass it to the SDK.

Returns
VIDEO_PIXEL_FORMAT

◆ onRenderPixelBuffer()

virtual void agora::rtc::IVideoSink::onRenderPixelBuffer ( CVPixelBufferRef  pixelBuffer,
int  rotation 
)
pure virtual

Notification for rendering the video in the pixel data type.

Since
v3.5.0

The SDK triggers this callback after capturing video in the pixel data type to alter the custom video renderer to process the video data.

Note
This method applies to iOS only.
Parameters
pixelBufferThe video data in the pixel data type.
rotationThe clockwise rotation angle of the video.

◆ onRenderRawData()

virtual void agora::rtc::IVideoSink::onRenderRawData ( uint8_t *  rawData,
int  width,
int  height,
int  rotation 
)
pure virtual

Notification for rendering the video in the raw data type.

Since
v3.5.0

The SDK triggers this callback after capturing video in the raw data type to alter the custom video renderer to process the video data.

Parameters
rawDataThe video data in the raw data type.
widthThe width (px) of the video.
heightThe height (px) of the video.
rotationThe clockwise rotation angle of the video.