docs/doc/reference/com/google/android/exoplayer2/transformer/DefaultCodec.html
Package com.google.android.exoplayer2.transformer
All Implemented Interfaces:Codec
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classDefaultCodecextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[Codec](Codec.html "interface in com.google.android.exoplayer2.transformer")
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.
A default Codec implementation that uses MediaCodec.
-
Codec.DecoderFactory, Codec.EncoderFactory
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static int | DEFAULT_PCM_ENCODING |
Deprecated.
|
Constructors | Constructor | Description |
| --- | --- |
| DefaultCodec(Context context, Format configurationFormat, MediaFormat configurationMediaFormat, String mediaCodecName, boolean isDecoder, Surface outputSurface) |
Deprecated.
Creates a DefaultCodec.
|
All Methods Instance Methods Concrete 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.
|
| 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. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final int DEFAULT_PCM_ENCODING
Deprecated. See Also:Constant Field Values
-
public DefaultCodec([Context](https://developer.android.com/reference/android/content/Context.html "class or interface in android.content")context,[Format](../Format.html "class in com.google.android.exoplayer2")configurationFormat,[MediaFormat](https://developer.android.com/reference/android/media/MediaFormat.html "class or interface in android.media")configurationMediaFormat,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mediaCodecName,
boolean isDecoder,
@Nullable[Surface](https://developer.android.com/reference/android/view/Surface.html "class or interface in android.view")outputSurface)
throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")
Deprecated.
Creates a DefaultCodec.
Parameters:context - The Context.configurationFormat - The Format to configure the DefaultCodec. See getConfigurationFormat(). The sampleMimeType must not be null.configurationMediaFormat - The MediaFormat to configure the underlying MediaCodec.mediaCodecName - The name of a specific MediaCodec to instantiate.isDecoder - Whether the DefaultCodec is intended as a decoder.outputSurface - The output Surface if the MediaCodec outputs to a surface.Throws:ExportException
-
public[Format](../Format.html "class in com.google.android.exoplayer2")getConfigurationFormat()
Deprecated.
Description copied from interface: Codec
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.
Specified by:getConfigurationFormat in interface Codec
-
public[Surface](https://developer.android.com/reference/android/view/Surface.html "class or interface in android.view")getInputSurface()
Deprecated.
Description copied from interface: Codec
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.
Specified by:getInputSurface in interface Codec
-
public int getMaxPendingFrameCount()
Deprecated.
Description copied from interface: Codec
Returns the maximum number of frames that may be pending in the output Codec at a time, or 5 as a default value.
Specified by:getMaxPendingFrameCount in interface Codec
-
@EnsuresNonNullIf(expression="#1.data",
result=true)
public 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.
Description copied from interface: Codec
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.
Specified by:maybeDequeueInputBuffer in interface CodecParameters: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.
-
public 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.
Description copied from interface: Codec
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.
Specified by:queueInputBuffer in interface CodecParameters:inputBuffer - The input buffer.Throws:ExportException - If the underlying decoder or encoder encounters a problem.
-
public void signalEndOfInputStream()
throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")
Deprecated.
Description copied from interface: Codec
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.
Specified by:signalEndOfInputStream in interface CodecThrows:ExportException - If the underlying video encoder encounters a problem.
-
@Nullable
public[Format](../Format.html "class in com.google.android.exoplayer2")getOutputFormat()
throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")
Deprecated.
Description copied from interface: Codec
Returns the current output format, or null if unavailable.
Specified by:getOutputFormat in interface CodecThrows:ExportException - If the underlying decoder or encoder encounters a problem.
-
@Nullable
public[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.
Description copied from interface: Codec
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.
Specified by:getOutputBuffer in interface CodecThrows:ExportException - If the underlying decoder or encoder encounters a problem.
-
@Nullable
public[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.
Description copied from interface: Codec
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 Codec.getOutputBuffer() returns null.
Specified by:getOutputBufferInfo in interface CodecThrows:ExportException - If the underlying decoder or encoder encounters a problem.
-
public void releaseOutputBuffer(boolean render)
throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")
Deprecated.
Description copied from interface: Codec
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 Codec.releaseOutputBuffer(long) with the presentation timestamp of the output buffer info.
Specified by:releaseOutputBuffer in interface CodecParameters:render - Whether the buffer needs to be rendered to the output Surface.Throws:ExportException - If the underlying decoder or encoder encounters a problem.
-
public void releaseOutputBuffer(long renderPresentationTimeUs)
throws[ExportException](ExportException.html "class in com.google.android.exoplayer2.transformer")
Deprecated.
Description copied from interface: Codec
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.
Specified by:releaseOutputBuffer in interface CodecParameters:renderPresentationTimeUs - The presentation timestamp to associate with this buffer, in microseconds.Throws:ExportException - If the underlying decoder or encoder encounters a problem.
-
public boolean isEnded()
Deprecated.
Description copied from interface: Codec
Returns whether the Codec's output stream has ended, and no more data can be dequeued.
Specified by:isEnded in interface Codec
-
public void release()
Deprecated.
Description copied from interface: Codec
Releases the Codec.
Specified by:release in interface Codec
-
public[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.
This name is of the actual codec, which may not be the same as the mediaCodecName passed to DefaultCodec(Context, Format, MediaFormat, String, boolean, Surface).
Specified by:getName in interface CodecSee Also:MediaCodec.getCanonicalName()