Class SynchronousMediaCodecAdapter
- java.lang.Object
-
- com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter
-
- All Implemented Interfaces:
MediaCodecAdapter
@Deprecated public final class SynchronousMediaCodecAdapter extends Object implements MediaCodecAdapter
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.AMediaCodecAdapter
that operates the underlyingMediaCodec
in synchronous mode.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SynchronousMediaCodecAdapter.Factory
Deprecated.A factory forSynchronousMediaCodecAdapter
instances.-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.mediacodec.MediaCodecAdapter
MediaCodecAdapter.Configuration, MediaCodecAdapter.OnFrameRenderedListener
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
dequeueInputBufferIndex()
Deprecated.Returns the next available input buffer index from the underlyingMediaCodec
orMediaCodec.INFO_TRY_AGAIN_LATER
if no such buffer exists.int
dequeueOutputBufferIndex(MediaCodec.BufferInfo bufferInfo)
Deprecated.Returns the next available output buffer index from the underlyingMediaCodec
.void
flush()
Deprecated.Flushes the adapter and the underlyingMediaCodec
.ByteBuffer
getInputBuffer(int index)
Deprecated.Returns a writable ByteBuffer object for a dequeued input buffer index.PersistableBundle
getMetrics()
Deprecated.Returns metrics data about the current codec instance.ByteBuffer
getOutputBuffer(int index)
Deprecated.Returns a read-only ByteBuffer for a dequeued output buffer index.MediaFormat
getOutputFormat()
Deprecated.Gets theMediaFormat
that was output from theMediaCodec
.boolean
needsReconfiguration()
Deprecated.Whether the adapter needs to be reconfigured before it is used.void
queueInputBuffer(int index, int offset, int size, long presentationTimeUs, int flags)
Deprecated.Submit an input buffer for decoding.void
queueSecureInputBuffer(int index, int offset, CryptoInfo info, long presentationTimeUs, int flags)
Deprecated.Submit an input buffer that is potentially encrypted for decoding.void
release()
Deprecated.Releases the adapter and the underlyingMediaCodec
.void
releaseOutputBuffer(int index, boolean render)
Deprecated.Returns the buffer to theMediaCodec
.void
releaseOutputBuffer(int index, long renderTimeStampNs)
Deprecated.Updates the output buffer's surface timestamp and sends it to theMediaCodec
to render it on the output surface.void
setOnFrameRenderedListener(MediaCodecAdapter.OnFrameRenderedListener listener, Handler handler)
Deprecated.Registers a callback to be invoked when an output frame is rendered on the output surface.void
setOutputSurface(Surface surface)
Deprecated.Dynamically sets the output surface of aMediaCodec
.void
setParameters(Bundle params)
Deprecated.Communicate additional parameter changes to theMediaCodec
instance.void
setVideoScalingMode(@com.google.android.exoplayer2.C.VideoScalingMode int scalingMode)
Deprecated.Specifies the scaling mode to use, if a surface was specified when the codec was created.
-
-
-
Method Detail
-
needsReconfiguration
public boolean needsReconfiguration()
Deprecated.Description copied from interface:MediaCodecAdapter
Whether the adapter needs to be reconfigured before it is used.- Specified by:
needsReconfiguration
in interfaceMediaCodecAdapter
-
dequeueInputBufferIndex
public int dequeueInputBufferIndex()
Deprecated.Description copied from interface:MediaCodecAdapter
Returns the next available input buffer index from the underlyingMediaCodec
orMediaCodec.INFO_TRY_AGAIN_LATER
if no such buffer exists.- Specified by:
dequeueInputBufferIndex
in interfaceMediaCodecAdapter
-
dequeueOutputBufferIndex
public int dequeueOutputBufferIndex(MediaCodec.BufferInfo bufferInfo)
Deprecated.Description copied from interface:MediaCodecAdapter
Returns the next available output buffer index from the underlyingMediaCodec
. If the next available output is a MediaFormat change, it will returnMediaCodec.INFO_OUTPUT_FORMAT_CHANGED
and you should callMediaCodecAdapter.getOutputFormat()
to get the format. If there is no available output, this method will returnMediaCodec.INFO_TRY_AGAIN_LATER
.- Specified by:
dequeueOutputBufferIndex
in interfaceMediaCodecAdapter
-
getOutputFormat
public MediaFormat getOutputFormat()
Deprecated.Description copied from interface:MediaCodecAdapter
Gets theMediaFormat
that was output from theMediaCodec
.Call this method if a previous call to
MediaCodecAdapter.dequeueOutputBufferIndex(android.media.MediaCodec.BufferInfo)
returnedMediaCodec.INFO_OUTPUT_FORMAT_CHANGED
.- Specified by:
getOutputFormat
in interfaceMediaCodecAdapter
-
getInputBuffer
@Nullable public ByteBuffer getInputBuffer(int index)
Deprecated.Description copied from interface:MediaCodecAdapter
Returns a writable ByteBuffer object for a dequeued input buffer index.- Specified by:
getInputBuffer
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.getInputBuffer(int)
-
getOutputBuffer
@Nullable public ByteBuffer getOutputBuffer(int index)
Deprecated.Description copied from interface:MediaCodecAdapter
Returns a read-only ByteBuffer for a dequeued output buffer index.- Specified by:
getOutputBuffer
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.getOutputBuffer(int)
-
queueInputBuffer
public void queueInputBuffer(int index, int offset, int size, long presentationTimeUs, int flags)
Deprecated.Description copied from interface:MediaCodecAdapter
Submit an input buffer for decoding.The
index
must be an input buffer index that has been obtained from a previous call toMediaCodecAdapter.dequeueInputBufferIndex()
.- Specified by:
queueInputBuffer
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.queueInputBuffer(int, int, int, long, int)
-
queueSecureInputBuffer
public void queueSecureInputBuffer(int index, int offset, CryptoInfo info, long presentationTimeUs, int flags)
Deprecated.Description copied from interface:MediaCodecAdapter
Submit an input buffer that is potentially encrypted for decoding.The
index
must be an input buffer index that has been obtained from a previous call toMediaCodecAdapter.dequeueInputBufferIndex()
.This method behaves like
MediaCodec.queueSecureInputBuffer(int, int, android.media.MediaCodec.CryptoInfo, long, int)
, with the difference thatinfo
is of typeCryptoInfo
and notMediaCodec.CryptoInfo
.- Specified by:
queueSecureInputBuffer
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.queueSecureInputBuffer(int, int, android.media.MediaCodec.CryptoInfo, long, int)
-
releaseOutputBuffer
public void releaseOutputBuffer(int index, boolean render)
Deprecated.Description copied from interface:MediaCodecAdapter
Returns the buffer to theMediaCodec
. If theMediaCodec
was configured with an output surface, settingrender
totrue
will first send the buffer to the output surface. The surface will release the buffer back to the codec once it is no longer used/displayed.- Specified by:
releaseOutputBuffer
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.releaseOutputBuffer(int, boolean)
-
releaseOutputBuffer
@RequiresApi(21) public void releaseOutputBuffer(int index, long renderTimeStampNs)
Deprecated.Description copied from interface:MediaCodecAdapter
Updates the output buffer's surface timestamp and sends it to theMediaCodec
to render it on the output surface. If theMediaCodec
is not configured with an output surface, this call will simply return the buffer to theMediaCodec
.- Specified by:
releaseOutputBuffer
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.releaseOutputBuffer(int, long)
-
flush
public void flush()
Deprecated.Description copied from interface:MediaCodecAdapter
Flushes the adapter and the underlyingMediaCodec
.- Specified by:
flush
in interfaceMediaCodecAdapter
-
release
public void release()
Deprecated.Description copied from interface:MediaCodecAdapter
Releases the adapter and the underlyingMediaCodec
.- Specified by:
release
in interfaceMediaCodecAdapter
-
setOnFrameRenderedListener
@RequiresApi(23) public void setOnFrameRenderedListener(MediaCodecAdapter.OnFrameRenderedListener listener, Handler handler)
Deprecated.Description copied from interface:MediaCodecAdapter
Registers a callback to be invoked when an output frame is rendered on the output surface.- Specified by:
setOnFrameRenderedListener
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.setOnFrameRenderedListener(android.media.MediaCodec.OnFrameRenderedListener, android.os.Handler)
-
setOutputSurface
@RequiresApi(23) public void setOutputSurface(Surface surface)
Deprecated.Description copied from interface:MediaCodecAdapter
Dynamically sets the output surface of aMediaCodec
.- Specified by:
setOutputSurface
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.setOutputSurface(Surface)
-
setParameters
@RequiresApi(19) public void setParameters(Bundle params)
Deprecated.Description copied from interface:MediaCodecAdapter
Communicate additional parameter changes to theMediaCodec
instance.- Specified by:
setParameters
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.setParameters(Bundle)
-
setVideoScalingMode
public void setVideoScalingMode(@VideoScalingMode @com.google.android.exoplayer2.C.VideoScalingMode int scalingMode)
Deprecated.Description copied from interface:MediaCodecAdapter
Specifies the scaling mode to use, if a surface was specified when the codec was created.- Specified by:
setVideoScalingMode
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.setVideoScalingMode(int)
-
getMetrics
@RequiresApi(26) public PersistableBundle getMetrics()
Deprecated.Description copied from interface:MediaCodecAdapter
Returns metrics data about the current codec instance.- Specified by:
getMetrics
in interfaceMediaCodecAdapter
- See Also:
MediaCodec.getMetrics()
-
-