Classes

struct  VideoFrame
 

Public Types

enum  VIDEO_FRAME_TYPE { FRAME_TYPE_YUV420 = 0, FRAME_TYPE_YUV422 = 1, FRAME_TYPE_RGBA = 2 }
 

Public Member Functions

virtual bool onCaptureVideoFrame (VideoFrame &videoFrame)=0
 
virtual bool onPreEncodeVideoFrame (VideoFrame &videoFrame)
 
virtual bool onRenderVideoFrame (unsigned int uid, VideoFrame &videoFrame)=0
 
virtual VIDEO_FRAME_TYPE getVideoFormatPreference ()
 
virtual bool getRotationApplied ()
 
virtual bool getMirrorApplied ()
 
virtual bool getSmoothRenderingEnabled ()
 

Detailed Description

Member Enumeration Documentation

◆ VIDEO_FRAME_TYPE

The video frame type.

Enumerator
FRAME_TYPE_YUV420 

0: YUV420

FRAME_TYPE_YUV422 

1: YUV422

FRAME_TYPE_RGBA 

2: RGBA

Member Function Documentation

◆ onCaptureVideoFrame()

virtual bool agora::media::IVideoFrameObserver::onCaptureVideoFrame ( VideoFrame videoFrame)
pure virtual

Occurs each time the SDK receives a video frame captured by the local camera.

After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is received. In this callback, you can get the video data captured by the local camera. You can then pre-process the data according to your scenarios.

After pre-processing, you can send the processed video data back to the SDK by setting the videoFrame parameter in this callback.

Note
This callback does not support sending processed RGBA video data back to the SDK.
Parameters
videoFramePointer to VideoFrame.
Returns
Whether or not to ignore the current video frame if the pre-processing fails:
  • true: Do not ignore.
  • false: Ignore the current video frame, and do not send it back to the SDK.

◆ onPreEncodeVideoFrame()

virtual bool agora::media::IVideoFrameObserver::onPreEncodeVideoFrame ( VideoFrame videoFrame)
inlinevirtual
Since
v3.0.0

Occurs each time the SDK receives a video frame before encoding.

After you successfully register the video frame observer, the SDK triggers this callback each time when it receives a video frame. In this callback, you can get the video data before encoding. You can then process the data according to your particular scenarios.

After processing, you can send the processed video data back to the SDK by setting the VideoFrame parameter in this callback.

Note
  • The video data that this callback gets has been pre-processed, with its content cropped, rotated, and the image enhanced.
  • This callback does not support sending processed RGBA video data back to the SDK.
Parameters
videoFrameA pointer to VideoFrame.
Returns
Whether to ignore the current video frame if the processing fails:
  • true: Do not ignore the current video frame.
  • false: Ignore the current video frame, and do not send it back to the SDK.

◆ onRenderVideoFrame()

virtual bool agora::media::IVideoFrameObserver::onRenderVideoFrame ( unsigned int  uid,
VideoFrame videoFrame 
)
pure virtual

Occurs each time the SDK receives a video frame sent by the remote user.

After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is received. In this callback, you can get the video data sent by the remote user. You can then post-process the data according to your scenarios.

After post-processing, you can send the processed data back to the SDK by setting the videoFrame parameter in this callback.

Note
This callback does not support sending processed RGBA video data back to the SDK.
Parameters
uidID of the remote user who sends the current video frame.
videoFramePointer to VideoFrame.
Returns
Whether or not to ignore the current video frame if the post-processing fails:
  • true: Do not ignore.
  • false: Ignore the current video frame, and do not send it back to the SDK.

◆ getVideoFormatPreference()

virtual VIDEO_FRAME_TYPE agora::media::IVideoFrameObserver::getVideoFormatPreference ( )
inlinevirtual

Occurs each time the SDK receives a video frame and prompts you to set the video format.

YUV420 is the default video format. If you want to receive other video formats, register this callback in the IVideoFrameObserver class.

After you successfully register the video frame observer, the SDK triggers this callback each time it receives a video frame. You need to set your preferred video data in the return value of this callback.

Returns
Sets the video format: VIDEO_FRAME_TYPE

◆ getRotationApplied()

virtual bool agora::media::IVideoFrameObserver::getRotationApplied ( )
inlinevirtual

Occurs each time the SDK receives a video frame and prompts you whether or not to rotate the captured video according to the rotation member in the VideoFrame class.

The SDK does not rotate the captured video by default. If you want to rotate the captured video according to the rotation member in the VideoFrame class, register this callback in the IVideoFrameObserver class.

After you successfully register the video frame observer, the SDK triggers this callback each time it receives a video frame. You need to set whether or not to rotate the video frame in the return value of this callback.

Note
This callback applies to RGBA video data only.
Returns
Sets whether or not to rotate the captured video:
  • true: Rotate.
  • false: (Default) Do not rotate.

◆ getMirrorApplied()

virtual bool agora::media::IVideoFrameObserver::getMirrorApplied ( )
inlinevirtual

Occurs each time the SDK receives a video frame and prompts you whether or not to mirror the captured video.

The SDK does not mirror the captured video by default. Register this callback in the IVideoFrameObserver class if you want to mirror the captured video.

After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is received. You need to set whether or not to mirror the captured video in the return value of this callback.

Note
This callback applies to RGBA video data only.
Returns
Sets whether or not to mirror the captured video:
  • true: Mirror.
  • false: (Default) Do not mirror.

◆ getSmoothRenderingEnabled()

virtual bool agora::media::IVideoFrameObserver::getSmoothRenderingEnabled ( )
inlinevirtual
Since
v3.0.0

Sets whether to output the acquired video frame smoothly.

If you want the video frames acquired from onRenderVideoFrame to be more evenly spaced, you can register the getSmoothRenderingEnabled callback in the IVideoFrameObserver class and set its return value as true.

Note
  • Register this callback before joining a channel.
  • This callback applies to scenarios where the acquired video frame is self-rendered after being processed, not to scenarios where the video frame is sent back to the SDK after being processed.
Returns
Set whether or not to smooth the video frames:
  • true: Smooth the video frame.
  • false: (Default) Do not smooth.