Skip to main content
Version: 20 Mar 2024

MLMediaCodecOutputFrameListener

Module: Media Player

Callbacks for notifying when an output frame is available for consumption or has been rendered on the output surface. More...

#include <ml_media_codec.h>

Public Attributes

TypeName
uint32_tversion
void()(MLHandle media_codec, const MLMediaCodecFrameRenderedInfo info)on_frame_rendered
This callback is invoked when an output frame has rendered on the output surface.

Detailed Description

struct MLMediaCodecOutputFrameListener;

Callbacks for notifying when an output frame is available for consumption or has been rendered on the output surface.

Deprecated

Deprecated since 1.4.0. Scheduled for removal.

API Level:

  • 20

Public Attributes Documentation

version

uint32_t version;

Version of this structure.


on_frame_rendered

void(*)(MLHandle media_codec, const MLMediaCodecFrameRenderedInfo *info) on_frame_rendered;

This callback is invoked when an output frame has rendered on the output surface.

TypeDescription
void()(MLHandle media_codec, const MLMediaCodecFrameRenderedInfo info))(MLHandle media_codec, const MLMediaCodecFrameRenderedInfo *info)

Parameters

media_codecMLMediaCodec instance for which callback was called.
presentation_time_usThe presentation time (media time) in microseconds of the frame rendered.
system_time_nanoSystem time when the frame was rendered.
infoOutput Frame rendered info as MLMediaCodecFrameRenderedInfo.

The presentation time (media time) of the frame rendered is is usually the same as specified in MLMediaCodecQueueInputBuffer(); however, some codecs may alter the media time by applying some time-based transformation, such as frame rate conversion. In that case, presentation time corresponds to the actual output frame rendered.

This callback is for informational purposes only: to get precise render timing samples, and can be significantly delayed and batched. Some frames may have been rendered even if there was no callback generated. This can be set to NULL if client is not interested in receiving this callback.

note

Client should not call MLMediaCodec APIs from within this callback.