ExternallyLoadedImageDecoder


@UnstableApi
public final class ExternallyLoadedImageDecoder implements ImageDecoder


An ImageDecoder for externally loaded images.

Summary

Nested types

The resolver that resolves an external image request to a Bitmap.

A data class providing information about the external image request.

A ImageDecoder.Factory for ExternallyLoadedImageDecoder instances.

Public methods

@Nullable DecoderInputBuffer

Dequeues the next input buffer to be filled and queued to the decoder.

@Nullable ImageOutputBuffer

Returns the next decoded Bitmap in an ImageOutputBuffer.

void

Flushes the decoder.

String

Returns the name of the decoder.

void

Queues an DecoderInputBuffer to the decoder.

void

Releases the decoder.

void
setOutputStartTimeUs(long outputStartTimeUs)

Sets the timestamp from which output buffers should be produced, in microseconds.

Inherited methods

From androidx.media3.decoder.Decoder
abstract @Nullable O

Dequeues the next output buffer from the decoder.

abstract void
queueInputBuffer(I inputBuffer)

Queues an input buffer to the decoder.

Public methods

dequeueInputBuffer

public @Nullable DecoderInputBuffer dequeueInputBuffer()

Dequeues the next input buffer to be filled and queued to the decoder.

Returns
@Nullable DecoderInputBuffer

The input buffer, which will have been cleared, or null if a buffer isn't available.

Throws
E

If a decoder error has occurred.

dequeueOutputBuffer

public @Nullable ImageOutputBuffer dequeueOutputBuffer()

Returns the next decoded Bitmap in an ImageOutputBuffer.

Returns
@Nullable ImageOutputBuffer

The output buffer, or null if an output buffer isn't available.

Throws
androidx.media3.exoplayer.image.ImageDecoderException

If a decoder error has occurred.

flush

public void flush()

Flushes the decoder. Ownership of dequeued input buffers is returned to the decoder. The caller is still responsible for releasing any dequeued output buffers.

getName

public String getName()

Returns the name of the decoder.

Returns
String

The name of the decoder.

queueInputBuffer

public void queueInputBuffer(DecoderInputBuffer inputBuffer)

Queues an DecoderInputBuffer to the decoder.

Parameters
DecoderInputBuffer inputBuffer

The input buffer containing the byte data corresponding to the image(s).

Throws
androidx.media3.exoplayer.image.ImageDecoderException

If a decoder error has occurred.

release

public void release()

Releases the decoder. Must be called when the decoder is no longer needed.

setOutputStartTimeUs

public void setOutputStartTimeUs(long outputStartTimeUs)

Sets the timestamp from which output buffers should be produced, in microseconds.

Any decoded buffer with a timestamp less than outputStartTimeUs should be skipped by the implementation and not made available via dequeueOutputBuffer.

This method must only be called before queuing the first input buffer initially or after flush.

Parameters
long outputStartTimeUs

The time from which output buffer should be produced, in microseconds.