Agora C++ API Reference for All Platforms
|
#include <IAgoraMediaEngine.h>
Classes | |
struct | VideoFrame |
Public Types | |
enum | VIDEO_FRAME_TYPE { FRAME_TYPE_YUV420 = 0 , FRAME_TYPE_YUV422 = 1 , FRAME_TYPE_RGBA = 2 } |
enum | VIDEO_OBSERVER_POSITION { POSITION_POST_CAPTURER = 1 << 0 , POSITION_PRE_RENDERER = 1 << 1 , POSITION_PRE_ENCODER = 1 << 2 } |
Public Member Functions | |
IVideoFrameObserver () | |
virtual | ~IVideoFrameObserver () |
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 () AGORA_DEPRECATED_ATTRIBUTE |
virtual uint32_t | getObservedFramePosition () |
virtual bool | isMultipleChannelFrameWanted () |
virtual bool | onRenderVideoFrameEx (const char *channelId, unsigned int uid, VideoFrame &videoFrame) |
The IVideoFrameObserver class.
The frame position of the video observer.
|
inline |
|
inlinevirtual |
|
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.
videoFrame | Pointer to VideoFrame. |
|
inlinevirtual |
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.
POSITION_PRE_ENCODE(1 << 2)
as a frame position in the getObservedFramePosition callback.videoFrame | A pointer to 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 and isMultipleChannelFrameWanted return false, 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.
uid | ID of the remote user who sends the current video frame. |
videoFrame | Pointer to VideoFrame. |
|
inlinevirtual |
Occurs each time the SDK receives a video frame and prompts you to set the video format.
YUV 420 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.
|
inlinevirtual |
Occurs each time the SDK receives a video frame and prompts you whether to rotate the raw video frame according to the rotation member in the VideoFrame class.
The SDK does not rotate the raw video frame by default. If you want to receive the raw video frame rotated 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 to rotate the raw video frame in the return value of this callback.
|
inlinevirtual |
Occurs each time the SDK receives a video frame and prompts you whether to mirror the raw video frame.
The SDK does not mirror the raw video frame by default. If you want to receive the raw video frame mirrored, register this callback in the IVideoFrameObserver class.
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 to mirror the raw video frame in the return value of this callback.
|
inlinevirtual |
Sets whether to output the acquired video frame smoothly.
onRenderVideoFrame
and onRenderVideoFrameEx
by default.If you want the video frames acquired from onRenderVideoFrame
or onRenderVideoFrameEx
to be more evenly spaced, you can register the getSmoothRenderingEnabled
callback in the IVideoFrameObserver
class and set its return value as true
.
|
inlinevirtual |
Sets the frame position for the video observer.
After you successfully register the video observer, the SDK triggers this callback each time it receives a video frame. You can determine which position to observe by setting the return value. The SDK provides 3 positions for observer. Each position corresponds to a callback function:
POSITION_POST_CAPTURER(1 << 0)
: The position after capturing the video data, which corresponds to the onCaptureVideoFrame callback.POSITION_PRE_RENDERER(1 << 1)
: The position before receiving the remote video data, which corresponds to the onRenderVideoFrame callback.POSITION_PRE_ENCODER(1 << 2)
: The position before encoding the video data, which corresponds to the onPreEncodeVideoFrame callback.POSITION_POST_CAPTURER(1 << 0)
and POSITION_PRE_RENDERER(1 << 1)
by default.
|
inlinevirtual |
Determines whether to receive video data from multiple channels.
After you register the video frame observer, the SDK triggers this callback every time it captures a video frame.
In the multi-channel scenario, if you want to get video data from multiple channels, set the return value of this callback as true. After that, the SDK triggers the onRenderVideoFrameEx callback to send you the video data from various channels. You can also get the channel ID of each video frame.
onRenderVideoFrameEx
callback to send the video frame. onRenderVideoFrame will not be triggered. In the multi-channel scenario, Agora recommends setting the return value as true.onRenderVideoFrame
callback to send the video data. true
: Receive video data from multiple channels.false
: Do not receive video data from multiple channels.
|
inlinevirtual |
Gets the video frame from multiple channels.
After you successfully register the video frame observer, if you set the return value of isMultipleChannelFrameWanted as true, the SDK triggers this callback each time it receives a video frame from any of the channel.
You can process the video data retrieved from this callback according to your scenario, and send the processed data back to the SDK using the videoFrame
parameter in this callback.
channelId | The channel ID of this video frame. |
uid | The ID of the user sending this video frame. |
videoFrame | The pointer to VideoFrame. |