Class DefaultCodec
- java.lang.Object
-
- com.google.android.exoplayer2.transformer.DefaultCodec
-
- All Implemented Interfaces:
Codec
@Deprecated public final class DefaultCodec extends Object implements Codec
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 defaultCodecimplementation that usesMediaCodec.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.transformer.Codec
Codec.DecoderFactory, Codec.EncoderFactory
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_PCM_ENCODINGDeprecated.
-
Constructor Summary
Constructors Constructor Description DefaultCodec(Context context, Format configurationFormat, MediaFormat configurationMediaFormat, String mediaCodecName, boolean isDecoder, Surface outputSurface)Deprecated.Creates aDefaultCodec.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description FormatgetConfigurationFormat()Deprecated.Returns theFormatused for configuring theCodec.SurfacegetInputSurface()Deprecated.Returns the inputSurfaceof an underlying video encoder.intgetMaxPendingFrameCount()Deprecated.Returns the maximum number of frames that may be pending in the outputCodecat a time, or5as a default value.StringgetName()Deprecated.Returns the name of the underlying codec.ByteBuffergetOutputBuffer()Deprecated.Returns the current outputByteBuffer, ornullif unavailable.MediaCodec.BufferInfogetOutputBufferInfo()Deprecated.Returns theMediaCodec.BufferInfoassociated with the current output buffer, ornullif there is no output buffer available.FormatgetOutputFormat()Deprecated.Returns the current output format, ornullif unavailable.booleanisEnded()Deprecated.Returns whether theCodec's output stream has ended, and no more data can be dequeued.booleanmaybeDequeueInputBuffer(DecoderInputBuffer inputBuffer)Deprecated.Dequeues a writable input buffer, if available.voidqueueInputBuffer(DecoderInputBuffer inputBuffer)Deprecated.Queues an input buffer to theCodec.voidrelease()Deprecated.Releases theCodec.voidreleaseOutputBuffer(boolean render)Deprecated.Releases the current output buffer.voidreleaseOutputBuffer(long renderPresentationTimeUs)Deprecated.Renders and releases the current output buffer.voidsignalEndOfInputStream()Deprecated.Signals end-of-stream on input to a video encoder.
-
-
-
Field Detail
-
DEFAULT_PCM_ENCODING
public static final int DEFAULT_PCM_ENCODING
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DefaultCodec
public DefaultCodec(Context context, Format configurationFormat, MediaFormat configurationMediaFormat, String mediaCodecName, boolean isDecoder, @Nullable Surface outputSurface) throws ExportException
Deprecated.Creates aDefaultCodec.- Parameters:
context- TheContext.configurationFormat- TheFormatto configure theDefaultCodec. SeegetConfigurationFormat(). ThesampleMimeTypemust not benull.configurationMediaFormat- TheMediaFormatto configure the underlyingMediaCodec.mediaCodecName- The name of a specificMediaCodecto instantiate.isDecoder- Whether theDefaultCodecis intended as a decoder.outputSurface- The outputSurfaceif theMediaCodecoutputs to a surface.- Throws:
ExportException
-
-
Method Detail
-
getConfigurationFormat
public Format getConfigurationFormat()
Deprecated.Description copied from interface:CodecReturns theFormatused for configuring theCodec.The configuration
Formatis the inputFormatused by theCodec.DecoderFactoryor outputFormatused by theCodec.EncoderFactoryfor selecting and configuring the underlying decoder or encoder.- Specified by:
getConfigurationFormatin interfaceCodec
-
getInputSurface
public Surface getInputSurface()
Deprecated.Description copied from interface:CodecReturns the inputSurfaceof an underlying video encoder.This method must only be called on video encoders because audio/video decoders and audio encoders don't use a
Surfaceas input.- Specified by:
getInputSurfacein interfaceCodec
-
getMaxPendingFrameCount
public int getMaxPendingFrameCount()
Deprecated.Description copied from interface:CodecReturns the maximum number of frames that may be pending in the outputCodecat a time, or5as a default value.- Specified by:
getMaxPendingFrameCountin interfaceCodec
-
maybeDequeueInputBuffer
@EnsuresNonNullIf(expression="#1.data", result=true) public boolean maybeDequeueInputBuffer(DecoderInputBuffer inputBuffer) throws ExportExceptionDeprecated.Description copied from interface:CodecDequeues a writable input buffer, if available.This method must not be called from video encoders because they must use a
Surfaceto receive input.- Specified by:
maybeDequeueInputBufferin interfaceCodec- Parameters:
inputBuffer- The buffer where the dequeued buffer data is stored, atinputBuffer.data.- Returns:
- Whether an input buffer is ready to be used.
- Throws:
ExportException- If the underlying decoder or encoder encounters a problem.
-
queueInputBuffer
public void queueInputBuffer(DecoderInputBuffer inputBuffer) throws ExportException
Deprecated.Description copied from interface:CodecQueues an input buffer to theCodec. 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
Surfaceto receive input.- Specified by:
queueInputBufferin interfaceCodec- Parameters:
inputBuffer- The input buffer.- Throws:
ExportException- If the underlying decoder or encoder encounters a problem.
-
signalEndOfInputStream
public void signalEndOfInputStream() throws ExportExceptionDeprecated.Description copied from interface:CodecSignals end-of-stream on input to a video encoder.This method must only be called on video encoders because they must use a
Surfaceas input. For audio/video decoders or audio encoders, theC.BUFFER_FLAG_END_OF_STREAMflag should be set on the last input buffer queued.- Specified by:
signalEndOfInputStreamin interfaceCodec- Throws:
ExportException- If the underlying video encoder encounters a problem.
-
getOutputFormat
@Nullable public Format getOutputFormat() throws ExportException
Deprecated.Description copied from interface:CodecReturns the current output format, ornullif unavailable.- Specified by:
getOutputFormatin interfaceCodec- Throws:
ExportException- If the underlying decoder or encoder encounters a problem.
-
getOutputBuffer
@Nullable public ByteBuffer getOutputBuffer() throws ExportException
Deprecated.Description copied from interface:CodecReturns the current outputByteBuffer, ornullif unavailable.This method must not be called on video decoders because they must output to a
Surface.- Specified by:
getOutputBufferin interfaceCodec- Throws:
ExportException- If the underlying decoder or encoder encounters a problem.
-
getOutputBufferInfo
@Nullable public MediaCodec.BufferInfo getOutputBufferInfo() throws ExportException
Deprecated.Description copied from interface:CodecReturns theMediaCodec.BufferInfoassociated with the current output buffer, ornullif there is no output buffer available.This method returns
nullif and only ifCodec.getOutputBuffer()returns null.- Specified by:
getOutputBufferInfoin interfaceCodec- Throws:
ExportException- If the underlying decoder or encoder encounters a problem.
-
releaseOutputBuffer
public void releaseOutputBuffer(boolean render) throws ExportExceptionDeprecated.Description copied from interface:CodecReleases the current output buffer.Only set
rendertotruewhen theCodecis a video decoder. Settingrendertotruewill first render the buffer to the output surface. In this case, the surface will release the buffer back to theCodeconce 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
renderset totrueis equivalent to callingCodec.releaseOutputBuffer(long)with the presentation timestamp of theoutput buffer info.- Specified by:
releaseOutputBufferin interfaceCodec- Parameters:
render- Whether the buffer needs to be rendered to the outputSurface.- Throws:
ExportException- If the underlying decoder or encoder encounters a problem.
-
releaseOutputBuffer
public void releaseOutputBuffer(long renderPresentationTimeUs) throws ExportExceptionDeprecated.Description copied from interface:CodecRenders 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
Codeconce 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:
releaseOutputBufferin interfaceCodec- Parameters:
renderPresentationTimeUs- The presentation timestamp to associate with this buffer, in microseconds.- Throws:
ExportException- If the underlying decoder or encoder encounters a problem.
-
isEnded
public boolean isEnded()
Deprecated.Description copied from interface:CodecReturns whether theCodec's output stream has ended, and no more data can be dequeued.
-
release
public void release()
Deprecated.Description copied from interface:CodecReleases theCodec.
-
getName
public String getName()
Deprecated.Returns the name of the underlying codec.This name is of the actual codec, which may not be the same as the
mediaCodecNamepassed toDefaultCodec(Context, Format, MediaFormat, String, boolean, Surface).- Specified by:
getNamein interfaceCodec- See Also:
MediaCodec.getCanonicalName()
-
-