Package io.agora.rtc2.video
Interface IVideoFrameObserver
public interface IVideoFrameObserver
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe position after capturing the video data, which corresponds to the onCaptureVideoFrame callback.static final intThe position before encoding the video data, which corresponds to the onPreEncodeVideoFrame callback.static final intThe position before receiving the remote video data, which corresponds to the onRenderVideoFrame callback.static final intObserver works as a pure renderer and will not modify the original frame.static final intObserver works as a filter that will process the video frame and affect the following frame processing in SDK.static final int2: BGRA.static final int0: Default format.static final int18: I010.static final int1: I420.static final int16: I422.static final int8: NV12.static final int3: NV21.static final int4: RGBA.static final int10: GL_TEXTURE_2Dstatic final int11: GL_TEXTURE_OES -
Method Summary
Modifier and TypeMethodDescriptionbooleanintbooleanintintbooleanonCaptureVideoFrame(int sourceType, VideoFrame videoFrame) booleanonMediaPlayerVideoFrame(VideoFrame videoFrame, int mediaPlayerId) Occurs each time the SDK receives a video frame decoded by the MediaPlayer.booleanonPreEncodeVideoFrame(int sourceType, VideoFrame videoFrame) booleanonRenderVideoFrame(String channelId, int uid, VideoFrame videoFrame)
-
Field Details
-
PROCESS_MODE_READ_ONLY
static final int PROCESS_MODE_READ_ONLYObserver works as a pure renderer and will not modify the original frame.- See Also:
-
PROCESS_MODE_READ_WRITE
static final int PROCESS_MODE_READ_WRITEObserver works as a filter that will process the video frame and affect the following frame processing in SDK.- See Also:
-
POSITION_POST_CAPTURER
static final int POSITION_POST_CAPTURERThe position after capturing the video data, which corresponds to the onCaptureVideoFrame callback.- See Also:
-
POSITION_PRE_RENDERER
static final int POSITION_PRE_RENDERERThe position before receiving the remote video data, which corresponds to the onRenderVideoFrame callback.- See Also:
-
POSITION_PRE_ENCODER
static final int POSITION_PRE_ENCODERThe position before encoding the video data, which corresponds to the onPreEncodeVideoFrame callback.- See Also:
-
VIDEO_PIXEL_DEFAULT
static final int VIDEO_PIXEL_DEFAULT0: Default format.- See Also:
-
VIDEO_PIXEL_I420
static final int VIDEO_PIXEL_I4201: I420.- See Also:
-
VIDEO_PIXEL_BGRA
static final int VIDEO_PIXEL_BGRA2: BGRA.- See Also:
-
VIDEO_PIXEL_NV21
static final int VIDEO_PIXEL_NV213: NV21.- See Also:
-
VIDEO_PIXEL_RGBA
static final int VIDEO_PIXEL_RGBA4: RGBA.- See Also:
-
VIDEO_PIXEL_NV12
static final int VIDEO_PIXEL_NV128: NV12.- See Also:
-
VIDEO_TEXTURE_2D
static final int VIDEO_TEXTURE_2D10: GL_TEXTURE_2D- See Also:
-
VIDEO_TEXTURE_OES
static final int VIDEO_TEXTURE_OES11: GL_TEXTURE_OES- See Also:
-
VIDEO_PIXEL_I422
static final int VIDEO_PIXEL_I42216: I422.- See Also:
-
VIDEO_PIXEL_I010
static final int VIDEO_PIXEL_I01018: I010. 10bit I420 data.- See Also:
-
-
Method Details
-
onCaptureVideoFrame
boolean onCaptureVideoFrame(int sourceType, VideoFrame videoFrame) - Parameters:
sourceType- Video source types, including cameras, screens, or media player. See `VideoSourceType`.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)- 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.
-
onPreEncodeVideoFrame
boolean onPreEncodeVideoFrame(int sourceType, VideoFrame videoFrame) - Parameters:
sourceType- The type of the video source. See `VideoSourceType`.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)- 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.
-
onMediaPlayerVideoFrame
boolean onMediaPlayerVideoFrame(VideoFrame videoFrame, int mediaPlayerId) 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:
videoFrame- A pointer to the video frame: VideoFramemediaPlayerId- 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.
-
getVideoFrameProcessMode
int getVideoFrameProcessMode()- Returns:
- The process mode of the video frame: - PROCESS_MODE_READ_ONLY (0): (Default) Only reads the video frame. - PROCESS_MODE_READ_WRITE (1): Reads and writes the video frame.
-
getVideoFormatPreference
int getVideoFormatPreference()- Returns:
- Sets the raw data format of the SDK output. - VIDEO_PIXEL_DEFAULT (0): Raw video. - VIDEO_PIXEL_I420 (1): I420. - VIDEO_PIXEL_RGBA (4): RGBA. - VIDEO_PIXEL_I422 (16): I422.
-
getRotationApplied
boolean getRotationApplied()- Returns:
- Sets whether to rotate the captured video: - `true`: Rotate the captured video. - `false`: (Default) Do not rotate the captured video.
-
getMirrorApplied
boolean getMirrorApplied()- Returns:
- Sets whether or not to mirror the captured video: - `true`: Mirror the captured video. - `false`: (Default) Do not mirror the captured video.
-
getObservedFramePosition
int getObservedFramePosition()- Returns:
- A bit mask that controls the frame position of the video observer. - `VIDEO_MODULE_POSITION_POST_CAPTURER` (1 << 0): The position after capturing the video data, which corresponds to the `onCaptureVideoFrame` callback. - `VIDEO_MODULE_POSITION_PRE_RENDERER` (1 << 1): The position of the received remote video data before rendering, which corresponds to the `onRenderVideoFrame` callback. - `VIDEO_MODULE_POSITION_PRE_ENCODER` (1 << 2): The position before encoding the video data, which corresponds to the `onPreEncodeVideoFrame` callback.
-
onRenderVideoFrame
- Parameters:
uid- 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)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.
-