# ImageDecoder

Artifact: [androidx.media3:media3-exoplayer](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/exoplayer/image/ImageDecoder.java+class:androidx.media3.exoplayer.image.ImageDecoder)

*** ** * ** ***


```
@UnstableApi
interface ImageDecoder : Decoder<DecoderInputBuffer!, ImageOutputBuffer!, ImageDecoderException!>
```

<br />

Known direct subclasses [BitmapFactoryImageDecoder](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/BitmapFactoryImageDecoder), [ExternallyLoadedImageDecoder](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ExternallyLoadedImageDecoder)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/BitmapFactoryImageDecoder` | An image decoder that uses `https://developer.android.com/reference/android/graphics/BitmapFactory.html` to decode images. |
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ExternallyLoadedImageDecoder` | An `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageDecoder` for externally loaded images. |

*** ** * ** ***

A `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder` implementation for images.

## Summary

| ### Nested types |
|---|
| `interface https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageDecoder.Factory` A factory for image decoders. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageOutputBuffer?` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageDecoder#dequeueOutputBuffer()()` Returns the next decoded `https://developer.android.com/reference/android/graphics/Bitmap.html` in an `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageOutputBuffer`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageDecoder#queueInputBuffer(androidx.media3.decoder.DecoderInputBuffer)(inputBuffer: https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderInputBuffer!)` Queues an `https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderInputBuffer` to the decoder. |

### Inherited functions

From [androidx.media3.decoder.Decoder](https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder) `I?` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#dequeueInputBuffer()()`

Dequeues the next input buffer to be filled and queued to the decoder.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#flush()()`

Flushes the decoder.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#getName()()`

Returns the name of the decoder.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#release()()`

Releases the decoder.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#setCallback(androidx.media3.decoder.Decoder.Callback,java.util.concurrent.Executor)(callback: https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder.Callback!, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html!)`

Sets the callback and executor.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/decoder/Decoder#setOutputStartTimeUs(long)(outputStartTimeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

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

## Public functions

### dequeueOutputBuffer

```
fun dequeueOutputBuffer(): ImageOutputBuffer?
```

Returns the next decoded `https://developer.android.com/reference/android/graphics/Bitmap.html` in an `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageOutputBuffer`.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageOutputBuffer?` | The output buffer, or `null` if an output buffer isn't available. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageDecoderException` | If a decoder error has occurred. |

### queueInputBuffer

```
fun queueInputBuffer(inputBuffer: DecoderInputBuffer!): Unit
```

Queues an `https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderInputBuffer` to the decoder.

| Parameters |
|---|---|
| `inputBuffer: https://developer.android.com/reference/kotlin/androidx/media3/decoder/DecoderInputBuffer!` | The input buffer containing the byte data corresponding to the image(s). |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/image/ImageDecoderException` | If a decoder error has occurred. |