Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | List of all members
agora::media::base::IVideoFrameObserver Class Referenceabstract

`#include <AgoraMediaBase.h>`

Inherited by agora::media::base::IVideoFrameObserverEx, and agora::rtc::IMediaPlayerVideoFrameObserverEx.

## Public Member Functions
virtual void | onFrame (const VideoFrame *frame)=0
virtual | ~IVideoFrameObserver ()
virtual bool | isExternal ()
virtual VIDEO_PIXEL_FORMAT | getVideoFormatPreference ()

## Detailed Description

The IVideoFrameObserver class.

## Constructor & Destructor Documentation

## ◆ ~IVideoFrameObserver()

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

## Member Function Documentation

## ◆ onFrame()

virtual void agora::media::base::IVideoFrameObserver::onFrame | ( | const VideoFrame * | frame | ) |
| pure virtual

Occurs each time the player receives a video frame.

After registering the video frame observer, the callback occurs every time the player receives a video frame, reporting the detailed information of the video frame.

Parameters

  frame | The video frame information. See VideoFrame.

Implemented in agora::media::base::IVideoFrameObserverEx, and agora::rtc::IMediaPlayerVideoFrameObserverEx.

## ◆ isExternal()

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

Reimplemented in agora::media::base::IVideoFrameObserverEx, and agora::rtc::IMediaPlayerVideoFrameObserverEx.

## ◆ getVideoFormatPreference()

virtual VIDEO_PIXEL_FORMAT agora::media::base::IVideoFrameObserver::getVideoFormatPreference | ( |  | ) |
| inlinevirtual

Sets the format of the raw video data output by the SDK.

You need to register the callback when calling the `registerVideoFrameObserver` method. 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.

Note
  The default types of pixel format ( VIDEO_PIXEL_DEFAULT ) for the raw video are as follows:
  - On the Android platform, the default video frame type may be I420Buffer or TextureBuffer. The texture format of TextureBuffer type may be OES or RGB. If the returned video frame type is VIDEO_PIXEL_DEFAULT when you call `getVideoFormatPreference`, you need to adapt to I420Buffer or TextureBuffer when processing video data. The cases where the video frame type is fixed as I420Buffer include but are not limited to:
    - Specific devices, such as: LG G5 SE (H848), Google Pixel 4a, Samsung Galaxy A7, or Xiaomi Mi Max.
    - Image enhancement extension has been integrated and video noise reduction or low-light enhancement function has been enabled.
  - On iOS and macOS platforms, the default video frame type may be I420 or CVPixelBufferRef.
  - On Windows platforms, the default video frame type is YUV420.

Returns
  Sets the raw data format of the SDK output. See `VIDEO_PIXEL_FORMAT`.