Agora C++ API Reference for All Platforms
Public Member Functions | List of all members
agora::media::IVideoFrameObserverEx Class Reference

Inherits agora::media::IVideoFrameObserver.

Public Member Functions

virtual ~IVideoFrameObserverEx ()
 
bool onCaptureVideoFrame (VideoFrame &videoFrame) final
 
bool onPreEncodeVideoFrame (VideoFrame &videoFrame) final
 
bool onSecondaryCameraCaptureVideoFrame (VideoFrame &videoFrame) final
 
bool onSecondaryPreEncodeCameraVideoFrame (VideoFrame &videoFrame) final
 
bool onScreenCaptureVideoFrame (VideoFrame &videoFrame) final
 
bool onPreEncodeScreenVideoFrame (VideoFrame &videoFrame) final
 
bool onSecondaryScreenCaptureVideoFrame (VideoFrame &videoFrame) final
 
bool onSecondaryPreEncodeScreenVideoFrame (VideoFrame &videoFrame) final
 
bool onRenderVideoFrame (const char *channelId, rtc::uid_t remoteUid, VideoFrame &videoFrame) final
 
bool onTranscodedVideoFrame (VideoFrame &videoFrame) final
 
bool onMediaPlayerVideoFrame (VideoFrame &videoFrame, int mediaPlayerId) final
 
bool isExternal () final
 
virtual bool onCaptureVideoFrame (webrtc::VideoFrame &videoFrame)
 
virtual bool onPreEncodeVideoFrame (webrtc::VideoFrame &videoFrame)
 
virtual bool onSecondaryCameraCaptureVideoFrame (webrtc::VideoFrame &videoFrame)
 
virtual bool onSecondaryPreEncodeCameraVideoFrame (webrtc::VideoFrame &videoFrame)
 
virtual bool onScreenCaptureVideoFrame (webrtc::VideoFrame &videoFrame)
 
virtual bool onPreEncodeScreenVideoFrame (webrtc::VideoFrame &videoFrame)
 
virtual bool onSecondaryScreenCaptureVideoFrame (webrtc::VideoFrame &videoFrame)
 
virtual bool onSecondaryPreEncodeScreenVideoFrame (webrtc::VideoFrame &videoFrame)
 
virtual bool onRenderVideoFrame (const char *channelId, rtc::uid_t remoteUid, webrtc::VideoFrame &videoFrame)
 
virtual bool onTranscodedVideoFrame (webrtc::VideoFrame &videoFrame)
 
virtual bool onMediaPlayerVideoFrame (webrtc::VideoFrame &videoFrame, int mediaPlayerId)
 
- Public Member Functions inherited from agora::media::IVideoFrameObserver
virtual ~IVideoFrameObserver ()
 
virtual VIDEO_FRAME_PROCESS_MODE getVideoFrameProcessMode ()
 
virtual base::VIDEO_PIXEL_FORMAT getVideoFormatPreference ()
 
virtual bool getRotationApplied ()
 
virtual bool getMirrorApplied ()
 
virtual uint32_t getObservedFramePosition ()
 

Additional Inherited Members

- Public Types inherited from agora::media::IVideoFrameObserver
enum  VIDEO_FRAME_PROCESS_MODE { PROCESS_MODE_READ_ONLY, PROCESS_MODE_READ_WRITE }
 
typedef media::base::VideoFrame VideoFrame
 

Detailed Description

The IVideoFrameObserverEx class.

Constructor & Destructor Documentation

◆ ~IVideoFrameObserverEx()

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

Member Function Documentation

◆ onCaptureVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onCaptureVideoFrame ( VideoFrame videoFrame)
inlinefinalvirtual

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
  • If you get the video data in RGBA color encoding format, Agora does not support using this callback to send the processed data in RGBA color encoding format back to the SDK.
  • The video data that this callback gets has not been pre-processed, such as watermarking, cropping content, rotating, or image enhancement.
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.

Implements agora::media::IVideoFrameObserver.

◆ onPreEncodeVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onPreEncodeVideoFrame ( VideoFrame videoFrame)
inlinefinalvirtual

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
  • To get the video data captured from the second screen before encoding, you need to set (1 << 2) as a frame position through getObservedFramePosition.
  • The video data that this callback gets has been pre-processed, such as watermarking, cropping content, rotating, or image enhancement.
  • This callback does not support sending processed RGBA video data back to the SDK.
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.

Implements agora::media::IVideoFrameObserver.

◆ onSecondaryCameraCaptureVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onSecondaryCameraCaptureVideoFrame ( VideoFrame videoFrame)
inlinefinalvirtual

◆ onSecondaryPreEncodeCameraVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onSecondaryPreEncodeCameraVideoFrame ( VideoFrame videoFrame)
inlinefinalvirtual

Gets the video data captured from the second camera 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
  • This callback is for Windows.
  • You need to set (1 << 2) as a frame position by getObservedFramePosition before you can use this callback to get the video data captured from the second screen and before encoding.
  • The video data that this callback gets has been pre-processed, such as watermarking, cropping content, rotating, or image enhancement.
  • This callback does not support sending processed RGBA video data back to the SDK.
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.

Implements agora::media::IVideoFrameObserver.

◆ onScreenCaptureVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onScreenCaptureVideoFrame ( VideoFrame videoFrame)
inlinefinalvirtual

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

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 screen. 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
  • If you get the video data in RGBA color encoding format, Agora does not support using this callback to send the processed data in RGBA color encoding format back to the SDK.
  • The video data obtained through this callback has not undergone preprocessing, such as watermarking, cropping content, rotating, or image enhancement.
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.

Implements agora::media::IVideoFrameObserver.

◆ onPreEncodeScreenVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onPreEncodeScreenVideoFrame ( VideoFrame videoFrame)
inlinefinalvirtual

Gets the video data captured from the screen before encoding.

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

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

Note
  • To get the video data captured from the second screen before encoding, you need to set (1 << 2) as a frame position through getObservedFramePosition.
  • The video data that this callback gets has been preprocessed, such as watermarking, cropping content, rotating, or image enhancement.
  • This callback does not support sending processed RGBA video data back to the SDK.
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.

Implements agora::media::IVideoFrameObserver.

◆ onSecondaryScreenCaptureVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onSecondaryScreenCaptureVideoFrame ( VideoFrame videoFrame)
inlinefinalvirtual

◆ onSecondaryPreEncodeScreenVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onSecondaryPreEncodeScreenVideoFrame ( VideoFrame videoFrame)
inlinefinalvirtual

Gets the video data captured from the second camera before encoding.

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

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

Note
  • This callback is for Windows.
  • You need to set (1 << 2) as a frame position by getObservedFramePosition before you can use this callback to get the video data captured from the second screen and before encoding.
  • The video data that this callback gets has been preprocessed, such as watermarking, cropping content, rotating, or image enhancement.
  • This callback does not support sending processed RGBA video data back to the SDK.
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.

Implements agora::media::IVideoFrameObserver.

◆ onRenderVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onRenderVideoFrame ( const char *  channelId,
rtc::uid_t  remoteUid,
VideoFrame videoFrame 
)
inlinefinalvirtual

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
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.

Implements agora::media::IVideoFrameObserver.

◆ onTranscodedVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onTranscodedVideoFrame ( VideoFrame videoFrame)
inlinefinalvirtual

◆ onMediaPlayerVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onMediaPlayerVideoFrame ( VideoFrame videoFrame,
int  mediaPlayerId 
)
inlinefinalvirtual

Occurs each time the SDK receives a video frame decoded by the MediaPlayer.

After you successfully register the video frame observer, the SDK triggers this callback each time a video frame is decoded. In this callback, you can get the video data decoded by the MediaPlayer. 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.

Parameters
videoFrameA pointer to the video frame: VideoFrame
mediaPlayerIdID of the mediaPlayer.
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.

Implements agora::media::IVideoFrameObserver.

◆ isExternal()

bool agora::media::IVideoFrameObserverEx::isExternal ( )
inlinefinalvirtual

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

Reimplemented from agora::media::IVideoFrameObserver.

◆ onCaptureVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onCaptureVideoFrame ( webrtc::VideoFrame &  videoFrame)
inlinevirtual

◆ onPreEncodeVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onPreEncodeVideoFrame ( webrtc::VideoFrame &  videoFrame)
inlinevirtual

◆ onSecondaryCameraCaptureVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onSecondaryCameraCaptureVideoFrame ( webrtc::VideoFrame &  videoFrame)
inlinevirtual

◆ onSecondaryPreEncodeCameraVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onSecondaryPreEncodeCameraVideoFrame ( webrtc::VideoFrame &  videoFrame)
inlinevirtual

◆ onScreenCaptureVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onScreenCaptureVideoFrame ( webrtc::VideoFrame &  videoFrame)
inlinevirtual

◆ onPreEncodeScreenVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onPreEncodeScreenVideoFrame ( webrtc::VideoFrame &  videoFrame)
inlinevirtual

◆ onSecondaryScreenCaptureVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onSecondaryScreenCaptureVideoFrame ( webrtc::VideoFrame &  videoFrame)
inlinevirtual

◆ onSecondaryPreEncodeScreenVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onSecondaryPreEncodeScreenVideoFrame ( webrtc::VideoFrame &  videoFrame)
inlinevirtual

◆ onRenderVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onRenderVideoFrame ( const char *  channelId,
rtc::uid_t  remoteUid,
webrtc::VideoFrame &  videoFrame 
)
inlinevirtual

◆ onTranscodedVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onTranscodedVideoFrame ( webrtc::VideoFrame &  videoFrame)
inlinevirtual

◆ onMediaPlayerVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onMediaPlayerVideoFrame ( webrtc::VideoFrame &  videoFrame,
int  mediaPlayerId 
)
inlinevirtual