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 (agora::rtc::VIDEO_SOURCE_TYPE type, VideoFrame &videoFrame) final
bool | onPreEncodeVideoFrame (agora::rtc::VIDEO_SOURCE_TYPE type, 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 (agora::rtc::VIDEO_SOURCE_TYPE type, webrtc::VideoFrame &videoFrame)
virtual bool | onPreEncodeVideoFrame (agora::rtc::VIDEO_SOURCE_TYPE type, 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 | ( |  | ) |
| inline virtual

## Member Function Documentation

## ◆ onCaptureVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onCaptureVideoFrame | ( | agora::rtc::VIDEO_SOURCE_TYPE | sourceType,
|  | VideoFrame & | videoFrame
| ) |  |
| inline final 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
  - 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

  videoFrame | A pointer to the video frame: VideoFrame
  sourceType | source type of video frame. See #VIDEO_SOURCE_TYPE.

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 | ( | agora::rtc::VIDEO_SOURCE_TYPE | sourceType,
|  | VideoFrame & | videoFrame
| ) |  |
| inline final 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.

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

  videoFrame | A pointer to the video frame: VideoFrame
  sourceType | source type of video frame. See #VIDEO_SOURCE_TYPE.

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
| ) |  |
| inline final 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

  channelId | The channel name
  remoteUid | ID of the remote user who sends the current video frame.
  videoFrame | A 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 | ) |
| inline final virtual

Implements agora::media::IVideoFrameObserver.

## ◆ onMediaPlayerVideoFrame() [1/2]

bool agora::media::IVideoFrameObserverEx::onMediaPlayerVideoFrame | ( | VideoFrame & | videoFrame,
|  | int | mediaPlayerId
| ) |  |
| inline final virtual

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.

Note
  - This callback will not be affected by the return values of getVideoFrameProcessMode, getRotationApplied, getMirrorApplied, getObservedFramePosition.
  - On Android, this callback is not affected by the return value of getVideoFormatPreference

Parameters

  videoFrame | A pointer to the video frame: VideoFrame
  mediaPlayerId | ID 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 | ( |  | ) |
| inline final virtual

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 | ( | agora::rtc::VIDEO_SOURCE_TYPE | type,
|  | webrtc::VideoFrame & | videoFrame
| ) |  |
| inline virtual

## ◆ onPreEncodeVideoFrame() [2/2]

virtual bool agora::media::IVideoFrameObserverEx::onPreEncodeVideoFrame | ( | agora::rtc::VIDEO_SOURCE_TYPE | type,
|  | webrtc::VideoFrame & | videoFrame
| ) |  |
| inline virtual

## ◆ onRenderVideoFrame() [2/2]

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

## ◆ onTranscodedVideoFrame() [2/2]

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

## ◆ onMediaPlayerVideoFrame() [2/2]

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