Package com.google.android.exoplayer2.ext.av1

## Class Gav1Decoder

- java.lang.Object
- - com.google.android.exoplayer2.decoder.SimpleDecoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>
  - - com.google.android.exoplayer2.ext.av1.Gav1Decoder

- All Implemented Interfaces:
    `Decoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>`

      public final class Gav1Decoder
      extends SimpleDecoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>

  Gav1 decoder.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Gav1Decoder​(int numInputBuffers, int numOutputBuffers, int initialInputBufferSize, int threads)` | Creates a Gav1Decoder.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected DecoderInputBuffer` | `createInputBuffer()` | Creates a new input buffer.
    `protected VideoDecoderOutputBuffer` | `createOutputBuffer()` | Creates a new output buffer.
    `protected Gav1DecoderException` | `createUnexpectedDecodeException​(Throwable error)` | Creates an exception to propagate for an unexpected decode error.
    `protected Gav1DecoderException` | `decode​(DecoderInputBuffer inputBuffer, VideoDecoderOutputBuffer outputBuffer, boolean reset)` | Decodes the `inputBuffer` and stores any decoded output in `outputBuffer`.
    `String` | `getName()` | Returns the name of the decoder.
    `void` | `release()` | Releases the decoder.
    `protected void` | `releaseOutputBuffer​(VideoDecoderOutputBuffer outputBuffer)` | Releases an output buffer back to the decoder.
    `void` | `renderToSurface​(VideoDecoderOutputBuffer outputBuffer, Surface surface)` | Renders output buffer to the given surface.
    `void` | `setOutputMode​(@com.google.android.exoplayer2.C.VideoOutputMode int outputMode)` | Sets the output mode for frames rendered by the decoder.

    - ### Methods inherited from class com.google.android.exoplayer2.decoder.SimpleDecoder

      `dequeueInputBuffer, dequeueOutputBuffer, flush, queueInputBuffer, setInitialInputBufferSize`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Gav1Decoder

          public Gav1Decoder​(int numInputBuffers,
                             int numOutputBuffers,
                             int initialInputBufferSize,
                             int threads)
                      throws Gav1DecoderException

      Creates a Gav1Decoder.
      Parameters:
        `numInputBuffers` - Number of input buffers.
        `numOutputBuffers` - Number of output buffers.
        `initialInputBufferSize` - The initial size of each input buffer, in bytes.
        `threads` - Number of threads libgav1 will use to decode. If `Libgav1VideoRenderer.THREAD_COUNT_AUTODETECT` is passed, then this class will auto detect the number of threads to be used.
      Throws:
        `Gav1DecoderException` - Thrown if an exception occurs when initializing the decoder.

  - ### Method Detail

    - #### getName

          public String getName()

      Description copied from interface: `Decoder`
      Returns the name of the decoder.
      Returns:
        The name of the decoder.

    - #### createInputBuffer

          protected DecoderInputBuffer createInputBuffer()

      Description copied from class: `SimpleDecoder`
      Creates a new input buffer.
      Specified by:
        `createInputBuffer` in class `SimpleDecoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>`

    - #### createOutputBuffer

          protected VideoDecoderOutputBuffer createOutputBuffer()

      Description copied from class: `SimpleDecoder`
      Creates a new output buffer.
      Specified by:
        `createOutputBuffer` in class `SimpleDecoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>`

    - #### decode

          @Nullable
          protected Gav1DecoderException decode​(DecoderInputBuffer inputBuffer,
                                                VideoDecoderOutputBuffer outputBuffer,
                                                boolean reset)

      Description copied from class: `SimpleDecoder`
      Decodes the `inputBuffer` and stores any decoded output in `outputBuffer`.
      Specified by:
        `decode` in class `SimpleDecoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>`
      Parameters:
        `inputBuffer` - The buffer to decode.
        `outputBuffer` - The output buffer to store decoded data. The flag `C.BUFFER_FLAG_DECODE_ONLY` will be set if the same flag is set on `inputBuffer`, but may be set/unset as required. If the flag is set when the call returns then the output buffer will not be made available to dequeue. The output buffer may not have been populated in this case.
        `reset` - Whether the decoder must be reset before decoding.
      Returns:
        A decoder exception if an error occurred, or null if decoding was successful.

    - #### createUnexpectedDecodeException

          protected Gav1DecoderException createUnexpectedDecodeException​(Throwable error)

      Description copied from class: `SimpleDecoder`
      Creates an exception to propagate for an unexpected decode error.
      Specified by:
        `createUnexpectedDecodeException` in class `SimpleDecoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>`
      Parameters:
        `error` - The unexpected decode error.
      Returns:
        The exception to propagate.

    - #### release

          public void release()

      Description copied from interface: `Decoder`
      Releases the decoder. Must be called when the decoder is no longer needed.
      Specified by:
        `release` in interface `Decoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>`
      Overrides:
        `release` in class `SimpleDecoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>`

    - #### releaseOutputBuffer

          protected void releaseOutputBuffer​(VideoDecoderOutputBuffer outputBuffer)

      Description copied from class: `SimpleDecoder`
      Releases an output buffer back to the decoder.
      Overrides:
        `releaseOutputBuffer` in class `SimpleDecoder<DecoderInputBuffer,​VideoDecoderOutputBuffer,​Gav1DecoderException>`
      Parameters:
        `outputBuffer` - The output buffer being released.

    - #### setOutputMode

          public void setOutputMode​(@com.google.android.exoplayer2.C.VideoOutputMode int outputMode)

      Sets the output mode for frames rendered by the decoder.
      Parameters:
        `outputMode` - The output mode.

    - #### renderToSurface

          public void renderToSurface​(VideoDecoderOutputBuffer outputBuffer,
                                      Surface surface)
                               throws Gav1DecoderException

      Renders output buffer to the given surface. Must only be called when in `C.VIDEO_OUTPUT_MODE_SURFACE_YUV` mode.
      Parameters:
        `outputBuffer` - Output buffer.
        `surface` - Output surface.
      Throws:
        `Gav1DecoderException` - Thrown if called with invalid output mode or frame rendering fails.