#include <media_engine_i.h>
Inherits agora::media::IVideoFrameObserver.
|
| 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) |
| |
| virtual | ~IVideoFrameObserver () |
| |
| virtual VIDEO_FRAME_PROCESS_MODE | getVideoFrameProcessMode () |
| |
| virtual base::VIDEO_PIXEL_FORMAT | getVideoFormatPreference () |
| |
| virtual bool | getRotationApplied () |
| |
| virtual bool | getMirrorApplied () |
| |
| virtual uint32_t | getObservedFramePosition () |
| |
◆ ~IVideoFrameObserverEx()
| virtual agora::media::IVideoFrameObserverEx::~IVideoFrameObserverEx |
( |
| ) |
|
|
inlinevirtual |
◆ onCaptureVideoFrame() [1/2]
Occurs each time the SDK receives a video frame captured by local devices.
You can get raw video data collected by the local device through this callback and preprocess it as needed. Once the preprocessing is complete, you can directly modify videoFrame in this callback, and set the return value to true to send the modified video data to the SDK. If you need to send the preprocessed data to the SDK, you need to call getVideoFrameProcessMode first to set the video processing mode to read and write mode ( PROCESS_MODE_READ_WRITE ). Applicable scenarios: - Preprocess the locally collected video data before it is processed by the SDK. For example, get video data through this callback and process it with filters, watermarks, cropping, rotation, etc.
- Get information about the locally collected video data before it is processed by the SDK. For example, the original width, height, frame rate of the video frame, etc. Call timing: After the successful registration of the video data observer, each time the SDK captures a video frame.
- Note
- If the video data type you get is RGBA, the SDK does not support processing the data of the alpha channel.
- It is recommended that you ensure the modified parameters in
videoFrame are consistent with the actual situation of the video frames in the video frame buffer. Otherwise, it may cause unexpected rotation, distortion, and other issues in the local preview and remote video display. The default video format that you get from this callback is YUV420. If you need other formats, you can set the expected data format in the getVideoFormatPreference callback.
- Parameters
-
| sourceType | Video source types, including cameras, screens, or media player. See VIDEO_SOURCE_TYPE. |
| videoFrame | The video frame. See VideoFrame.Note: The default value of the video frame data format obtained through this callback is as follows:
- Android: I420 or RGB (GLES20.GL_TEXTURE_2D)
- iOS: I420 or CVPixelBufferRef
- macOS: I420 or CVPixelBufferRef
- Windows: YUV420
|
- Returns
- When the video processing mode is
PROCESS_MODE_READ_ONLY:
true: Reserved for future use.
false: Reserved for future use.
- When the video processing mode is
PROCESS_MODE_READ_WRITE:
true: Sets the SDK to receive the video frame.
false: Sets the SDK to discard the video frame.
Implements agora::media::IVideoFrameObserver.
◆ onPreEncodeVideoFrame() [1/2]
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 it receives a video frame. In this callback, you can get the video data 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
- If you need to send the preprocessed data to the SDK, you need to call
getVideoFrameProcessMode first to set the video processing mode to read and write mode ( PROCESS_MODE_READ_WRITE ).
- To get the video data captured from the second screen before encoding, you need to set
POSITION_PRE_ENCODER (1 << 2) as a frame position through getObservedFramePosition.
- The video data that this callback gets has been preprocessed, with its content cropped and rotated, and the image enhanced.
- It is recommended that you ensure the modified parameters in
videoFrame are consistent with the actual situation of the video frames in the video frame buffer. Otherwise, it may cause unexpected rotation, distortion, and other issues in the local preview and remote video display.
- Parameters
-
| sourceType | The type of the video source. See VIDEO_SOURCE_TYPE. |
| videoFrame | The video frame. See VideoFrame.Note: The default value of the video frame data format obtained through this callback is as follows:
- Android: I420 or RGB (GLES20.GL_TEXTURE_2D)
- iOS: I420 or CVPixelBufferRef
- macOS: I420 or CVPixelBufferRef
- Windows: YUV420
|
- Returns
- When the video processing mode is
PROCESS_MODE_READ_ONLY:
true: Reserved for future use.
false: Reserved for future use.
- When the video processing mode is
PROCESS_MODE_READ_WRITE:
true: Sets the SDK to receive the video frame.
false: Sets the SDK to discard the video frame.
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 it receives a video frame. In this callback, you can get the video data sent from the remote end before rendering, and then process it according to the particular scenarios. The default video format that you get from this callback is YUV420. If you need other formats, you can set the expected data format in the getVideoFormatPreference callback.
- Note
- If you need to send the preprocessed data to the SDK, you need to call
getVideoFrameProcessMode first to set the video processing mode to read and write mode ( PROCESS_MODE_READ_WRITE ).
- If the video data type you get is RGBA, the SDK does not support processing the data of the alpha channel.
- It is recommended that you ensure the modified parameters in
videoFrame are consistent with the actual situation of the video frames in the video frame buffer. Otherwise, it may cause unexpected rotation, distortion, and other issues in the local preview and remote video display.
- Parameters
-
| remoteUid | The user ID of the remote user who sends the current video frame. |
| videoFrame | The video frame. See VideoFrame.Note: The default value of the video frame data format obtained through this callback is as follows:
- Android: I420 or RGB (GLES20.GL_TEXTURE_2D)
- iOS: I420 or CVPixelBufferRef
- macOS: I420 or CVPixelBufferRef
- Windows: YUV420
|
| channelId | The channel ID. |
- Returns
- When the video processing mode is
PROCESS_MODE_READ_ONLY:
true: Reserved for future use.
false: Reserved for future use.
- When the video processing mode is
PROCESS_MODE_READ_WRITE:
true: Sets the SDK to receive the video frame.
false: Sets the SDK to discard the video frame.
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.
- Note
-
- 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 |
( |
| ) |
|
|
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]
◆ onPreEncodeVideoFrame() [2/2]
◆ 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 |