Codec.DecoderFactory


public interface Codec.DecoderFactory

DefaultDecoderFactory

Default implementation of Codec.DecoderFactory that uses MediaCodec for decoding.


A factory for decoder instances.

Summary

Public methods

abstract Codec

Returns a Codec for audio decoding.

abstract Codec
createForVideoDecoding(
    Format format,
    Surface outputSurface,
    boolean requestSdrToneMapping
)

Returns a Codec for video decoding.

Public methods

createForAudioDecoding

abstract Codec createForAudioDecoding(Format format)

Returns a Codec for audio decoding.

Parameters
Format format

The Format (of the input data) used to determine the underlying decoder and its configuration values.

Returns
Codec

A Codec for audio decoding.

Throws
androidx.media3.transformer.ExportException

If no suitable Codec can be created.

createForVideoDecoding

abstract Codec createForVideoDecoding(
    Format format,
    Surface outputSurface,
    boolean requestSdrToneMapping
)

Returns a Codec for video decoding.

Parameters
Format format

The Format (of the input data) used to determine the underlying decoder and its configuration values.

Surface outputSurface

The Surface to which the decoder output is rendered.

boolean requestSdrToneMapping

Whether to request tone-mapping to SDR.

Returns
Codec

A Codec for video decoding.

Throws
androidx.media3.transformer.ExportException

If no suitable Codec can be created.

Follow best practices, eliminate boilerplate code, and reduce fragmentation

Updated Oct 28, 2024

Discover the latest app development tools, platform updates, training, and documentation for developers across every Android device.

Updated Apr 4, 2024

Discover the latest app development tools, platform updates, training, and documentation for developers across every Android device.

Updated Feb 16, 2024