Package com.google.android.exoplayer2.ext.flac

## Class FlacDecoder

- java.lang.Object
- - com.google.android.exoplayer2.decoder.SimpleDecoder<DecoderInputBuffer,​SimpleOutputBuffer,​FlacDecoderException>
  - - com.google.android.exoplayer2.ext.flac.FlacDecoder

- All Implemented Interfaces:
    `Decoder<DecoderInputBuffer,​SimpleOutputBuffer,​FlacDecoderException>`

      public final class FlacDecoder
      extends SimpleDecoder<DecoderInputBuffer,​SimpleOutputBuffer,​FlacDecoderException>

  Flac decoder.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `FlacDecoder​(int numInputBuffers, int numOutputBuffers, int maxInputBufferSize, List<byte[]> initializationData)` | Creates a Flac decoder.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected DecoderInputBuffer` | `createInputBuffer()` | Creates a new input buffer.
    `protected SimpleOutputBuffer` | `createOutputBuffer()` | Creates a new output buffer.
    `protected FlacDecoderException` | `createUnexpectedDecodeException​(Throwable error)` | Creates an exception to propagate for an unexpected decode error.
    `protected FlacDecoderException` | `decode​(DecoderInputBuffer inputBuffer, SimpleOutputBuffer outputBuffer, boolean reset)` | Decodes the `inputBuffer` and stores any decoded output in `outputBuffer`.
    `String` | `getName()` | Returns the name of the decoder.
    `FlacStreamMetadata` | `getStreamMetadata()` | Returns the `FlacStreamMetadata` decoded from the initialization data.
    `void` | `release()` | Releases the decoder.

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

      `dequeueInputBuffer, dequeueOutputBuffer, flush, queueInputBuffer, releaseOutputBuffer, setInitialInputBufferSize`

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

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

- - ### Constructor Detail

    - #### FlacDecoder

          public FlacDecoder​(int numInputBuffers,
                             int numOutputBuffers,
                             int maxInputBufferSize,
                             List<byte[]> initializationData)
                      throws FlacDecoderException

      Creates a Flac decoder.
      Parameters:
        `numInputBuffers` - The number of input buffers.
        `numOutputBuffers` - The number of output buffers.
        `maxInputBufferSize` - The maximum required input buffer size if known, or `Format.NO_VALUE` otherwise.
        `initializationData` - Codec-specific initialization data. It should contain only one entry which is the flac file header.
      Throws:
        `FlacDecoderException` - 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,​SimpleOutputBuffer,​FlacDecoderException>`

    - #### createOutputBuffer

          protected SimpleOutputBuffer createOutputBuffer()

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

    - #### createUnexpectedDecodeException

          protected FlacDecoderException 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,​SimpleOutputBuffer,​FlacDecoderException>`
      Parameters:
        `error` - The unexpected decode error.
      Returns:
        The exception to propagate.

    - #### decode

          @Nullable
          protected FlacDecoderException decode​(DecoderInputBuffer inputBuffer,
                                                SimpleOutputBuffer 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,​SimpleOutputBuffer,​FlacDecoderException>`
      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.

    - #### 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,​SimpleOutputBuffer,​FlacDecoderException>`
      Overrides:
        `release` in class `SimpleDecoder<DecoderInputBuffer,​SimpleOutputBuffer,​FlacDecoderException>`

    - #### getStreamMetadata

          public FlacStreamMetadata getStreamMetadata()

      Returns the `FlacStreamMetadata` decoded from the initialization data.