Agora Server Gateway SDK C++ API Reference
Public Types | Public Member Functions | List of all members
agora::media::IVideoFrameObserver Class Referenceabstract

#include <AgoraMediaBase.h>

Public Types

enum  VIDEO_FRAME_PROCESS_MODE { PROCESS_MODE_READ_ONLY , PROCESS_MODE_READ_WRITE }
 
typedef media::base::VideoFrame VideoFrame
 

Public Member Functions

virtual ~IVideoFrameObserver ()
 
virtual bool onPreEncodeVideoFrame (VideoFrame &videoFrame)=0
 
virtual bool onRenderVideoFrame (const char *channelId, rtc::uid_t remoteUid, VideoFrame &videoFrame)=0
 
virtual bool onTranscodedVideoFrame (VideoFrame &videoFrame)=0
 
virtual VIDEO_FRAME_PROCESS_MODE getVideoFrameProcessMode ()
 
virtual base::VIDEO_PIXEL_FORMAT getVideoPixelFormatPreference ()
 
virtual bool getRotationApplied ()
 
virtual bool getMirrorApplied ()
 
virtual uint32_t getObservedFramePosition ()
 
virtual bool isExternal ()
 

Detailed Description

The IVideoFrameObserver class.

Member Typedef Documentation

◆ VideoFrame

Member Enumeration Documentation

◆ VIDEO_FRAME_PROCESS_MODE

Enumerator
PROCESS_MODE_READ_ONLY 
PROCESS_MODE_READ_WRITE 

Constructor & Destructor Documentation

◆ ~IVideoFrameObserver()

virtual agora::media::IVideoFrameObserver::~IVideoFrameObserver ( )
inlinevirtual

Member Function Documentation

◆ getMirrorApplied()

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

Occurs each time needs to get whether mirror is applied or not.

Returns
Determines whether to mirror.
  • true: need to mirror.
  • false: no mirror.

◆ getObservedFramePosition()

virtual uint32_t agora::media::IVideoFrameObserver::getObservedFramePosition ( )
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.

To observe multiple frame positions, use '|' (the OR operator). This callback observes POSITION_POST_CAPTURER(1 << 0) and POSITION_PRE_RENDERER(1 << 1) by default. To conserve the system consumption, you can reduce the number of frame positions that you want to observe.

Returns
A bit mask that controls the frame position of the video observer: VIDEO_OBSERVER_POSITION.

◆ getRotationApplied()

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

Occurs each time needs to get rotation angle.

Returns
Determines whether to rotate.
  • true: need to rotate.
  • false: no rotate.

◆ getVideoFrameProcessMode()

virtual VIDEO_FRAME_PROCESS_MODE agora::media::IVideoFrameObserver::getVideoFrameProcessMode ( )
inlinevirtual

Indicate the video frame mode of the observer.

Returns
VIDEO_FRAME_PROCESS_MODE

◆ getVideoPixelFormatPreference()

virtual base::VIDEO_PIXEL_FORMAT agora::media::IVideoFrameObserver::getVideoPixelFormatPreference ( )
inlinevirtual

◆ isExternal()

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

Indicate if the observer is for internal use. Note: Never override this function

Returns
  • true: the observer is for external use
  • false: the observer is for internal use

◆ onPreEncodeVideoFrame()

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

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.

The video data that this callback gets has been pre-processed, with its content cropped, rotated, and the image enhanced.

Parameters
videoFrameA pointer to the video frame: VideoFrame
Returns
Determines whether to ignore the current video frame if the pre-processing fails:
  • true: Do not ignore.
  • false: Ignore, in which case this method does not sent the current video frame to the SDK.

◆ onRenderVideoFrame()

virtual bool agora::media::IVideoFrameObserver::onRenderVideoFrame ( const char *  channelId,
rtc::uid_t  remoteUid,
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.

Parameters
channelIdThe channel name
remoteUidID of the remote user who sends the current video frame.
videoFrameA pointer to the video frame: VideoFrame
Returns
Determines whether to ignore the current video frame if the post-processing fails:
  • true: Do not ignore.
  • false: Ignore, in which case this method does not sent the current video frame to the SDK.

◆ onTranscodedVideoFrame()

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

The documentation for this class was generated from the following file: