Back to Exoplayer

Codec (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/transformer/Codec.html

latest12.0 KB
Original Source

Package com.google.android.exoplayer2.transformer

Interface Codec

  • All Known Implementing Classes:DefaultCodec

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceCodec

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Provides a layer of abstraction for interacting with decoders and encoders.

DecoderInputBuffers are used as both decoders' and encoders' input buffers.

Nested Class Summary

Nested Classes | Modifier and Type | Interface | Description | | --- | --- | --- | | static interface | Codec.DecoderFactory | Deprecated.

A factory for decoder instances. | | static interface | Codec.EncoderFactory | Deprecated.

A factory for encoder instances. |

Method Summary

All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | Format | getConfigurationFormat() | Deprecated.

Returns the Format used for configuring the Codec. | | Surface | getInputSurface() | Deprecated.

Returns the input Surface of an underlying video encoder. | | default int | getMaxPendingFrameCount() | Deprecated.

Returns the maximum number of frames that may be pending in the output Codec at a time, or 5 as a default value. | | String | getName() | Deprecated.

Returns the name of the underlying codec. | | ByteBuffer | getOutputBuffer() | Deprecated.

Returns the current output ByteBuffer, or null if unavailable. | | MediaCodec.BufferInfo | getOutputBufferInfo() | Deprecated.

Returns the MediaCodec.BufferInfo associated with the current output buffer, or null if there is no output buffer available. | | Format | getOutputFormat() | Deprecated.

Returns the current output format, or null if unavailable. | | boolean | isEnded() | Deprecated.

Returns whether the Codec's output stream has ended, and no more data can be dequeued. | | boolean | maybeDequeueInputBuffer​(DecoderInputBuffer inputBuffer) | Deprecated.

Dequeues a writable input buffer, if available. | | void | queueInputBuffer​(DecoderInputBuffer inputBuffer) | Deprecated.

Queues an input buffer to the Codec. | | void | release() | Deprecated.

Releases the Codec. | | void | releaseOutputBuffer​(boolean render) | Deprecated.

Releases the current output buffer. | | void | releaseOutputBuffer​(long renderPresentationTimeUs) | Deprecated.

Renders and releases the current output buffer. | | void | signalEndOfInputStream() | Deprecated.

Signals end-of-stream on input to a video encoder. |

Method Detail

- 

getConfigurationFormat

[Format](../Format.html "class in com.google.android.exoplayer2")getConfigurationFormat()

Deprecated.

Returns the Format used for configuring the Codec.

The configuration Format is the input Format used by the Codec.DecoderFactory or output Format used by the Codec.EncoderFactory for selecting and configuring the underlying decoder or encoder.

- 

getName

[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")getName()

Deprecated.

Returns the name of the underlying codec.

- 

getInputSurface

[Surface](https://developer.android.com/reference/android/view/Surface.html "class or interface in android.view")getInputSurface()

Deprecated.

Returns the input Surface of an underlying video encoder.

This method must only be called on video encoders because audio/video decoders and audio encoders don't use a Surface as input.

- 

getMaxPendingFrameCount

default int getMaxPendingFrameCount()

Deprecated.

Returns the maximum number of frames that may be pending in the output Codec at a time, or 5 as a default value.

- 

maybeDequeueInputBuffer

boolean maybeDequeueInputBuffer​([DecoderInputBuffer](../decoder/DecoderInputBuffer.html "class in com.google.android.exoplayer2.decoder")inputBuffer)
                         throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")

Deprecated.

Dequeues a writable input buffer, if available.

This method must not be called from video encoders because they must use a Surface to receive input.

Parameters:inputBuffer - The buffer where the dequeued buffer data is stored, at inputBuffer.data.Returns:Whether an input buffer is ready to be used.Throws:ExportException - If the underlying decoder or encoder encounters a problem.

- 

queueInputBuffer

void queueInputBuffer​([DecoderInputBuffer](../decoder/DecoderInputBuffer.html "class in com.google.android.exoplayer2.decoder")inputBuffer)
               throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")

Deprecated.

Queues an input buffer to the Codec. No buffers may be queued after end of stream buffer has been queued.

This method must not be called from video encoders because they must use a Surface to receive input.

Parameters:inputBuffer - The input buffer.Throws:ExportException - If the underlying decoder or encoder encounters a problem.

- 

signalEndOfInputStream

void signalEndOfInputStream()
                     throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")

Deprecated.

Signals end-of-stream on input to a video encoder.

This method must only be called on video encoders because they must use a Surface as input. For audio/video decoders or audio encoders, the C.BUFFER_FLAG_END_OF_STREAM flag should be set on the last input buffer queued.

Throws:ExportException - If the underlying video encoder encounters a problem.

- 

getOutputFormat

@Nullable[Format](../Format.html "class in com.google.android.exoplayer2")getOutputFormat()
                throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")

Deprecated.

Returns the current output format, or null if unavailable. Throws:ExportException - If the underlying decoder or encoder encounters a problem.

- 

getOutputBuffer

@Nullable[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer.html "class or interface in java.nio")getOutputBuffer()
                    throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")

Deprecated.

Returns the current output ByteBuffer, or null if unavailable.

This method must not be called on video decoders because they must output to a Surface.

Throws:ExportException - If the underlying decoder or encoder encounters a problem.

- 

getOutputBufferInfo

@Nullable[MediaCodec.BufferInfo](https://developer.android.com/reference/android/media/MediaCodec.BufferInfo.html "class or interface in android.media")getOutputBufferInfo()
                                   throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")

Deprecated.

Returns the MediaCodec.BufferInfo associated with the current output buffer, or null if there is no output buffer available.

This method returns null if and only if getOutputBuffer() returns null.

Throws:ExportException - If the underlying decoder or encoder encounters a problem.

- 

releaseOutputBuffer

void releaseOutputBuffer​(boolean render)
                  throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")

Deprecated.

Releases the current output buffer.

Only set render to true when the Codec is a video decoder. Setting render to true will first render the buffer to the output surface. In this case, the surface will release the buffer back to the Codec once it is no longer used/displayed.

This should be called after the buffer has been processed. The next output buffer will not be available until the current output buffer has been released.

Calling this method with render set to true is equivalent to calling releaseOutputBuffer(long) with the presentation timestamp of the output buffer info.

Parameters:render - Whether the buffer needs to be rendered to the output Surface.Throws:ExportException - If the underlying decoder or encoder encounters a problem.

- 

releaseOutputBuffer

void releaseOutputBuffer​(long renderPresentationTimeUs)
                  throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")

Deprecated.

Renders and releases the current output buffer.

This method must only be called on video decoders.

This method will first render the buffer to the output surface. The surface will then release the buffer back to the Codec once it is no longer used/displayed.

This should be called after the buffer has been processed. The next output buffer will not be available until the current output buffer has been released.

Parameters:renderPresentationTimeUs - The presentation timestamp to associate with this buffer, in microseconds.Throws:ExportException - If the underlying decoder or encoder encounters a problem.

- 

isEnded

boolean isEnded()

Deprecated.

Returns whether the Codec's output stream has ended, and no more data can be dequeued.

- 

release

void release()

Deprecated.

Releases the Codec.