DefaultDecoderFactory


@UnstableApi
public final class DefaultDecoderFactory implements Codec.DecoderFactory


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

Summary

Nested types

A builder for DefaultDecoderFactory instances.

Listener for decoder factory events.

Public methods

DefaultCodec
createForAudioDecoding(
    Format format,
    @Nullable LogSessionId logSessionId
)

Returns a Codec for audio decoding.

DefaultCodec
createForVideoDecoding(
    Format format,
    Surface outputSurface,
    boolean requestSdrToneMapping,
    @Nullable LogSessionId logSessionId
)

Returns a Codec for video decoding.

Public methods

createForAudioDecoding

public DefaultCodec createForAudioDecoding(
    Format format,
    @Nullable LogSessionId logSessionId
)

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.

@Nullable LogSessionId logSessionId

The optional LogSessionId of the android.media.metrics.EditingSession.

Returns
DefaultCodec

A Codec for audio decoding.

Throws
androidx.media3.transformer.ExportException

If no suitable Codec can be created.

createForVideoDecoding

public DefaultCodec createForVideoDecoding(
    Format format,
    Surface outputSurface,
    boolean requestSdrToneMapping,
    @Nullable LogSessionId logSessionId
)

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.

@Nullable LogSessionId logSessionId

The optional LogSessionId of the android.media.metrics.EditingSession.

Returns
DefaultCodec

A Codec for video decoding.

Throws
androidx.media3.transformer.ExportException

If no suitable Codec can be created.