Java android.media MediaCodec fields, constructors, methods, implement or subclass

Example usage for Java android.media MediaCodec fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.media MediaCodec.

The text is from its open source code.

Field

intBUFFER_FLAG_CODEC_CONFIG
This indicated that the buffer marked as such contains codec initialization / codec specific data instead of media data.
intBUFFER_FLAG_END_OF_STREAM
This signals the end of stream, i.e.
intCRYPTO_MODE_AES_CTR
intINFO_TRY_AGAIN_LATER
If a non-negative timeout had been specified in the call to #dequeueOutputBuffer , indicates that the call timed out.
intINFO_OUTPUT_FORMAT_CHANGED
The output format has changed, subsequent data will follow the new format.
intINFO_OUTPUT_BUFFERS_CHANGED
The output buffers have changed, the client must refer to the new set of output buffers returned by #getOutputBuffers from this point on.

Method

voidconfigure(@Nullable MediaFormat format, @Nullable Surface surface, @Nullable MediaCrypto crypto, @ConfigureFlag int flags)
Configures a component.
voidconfigure(@Nullable MediaFormat format, @Nullable Surface surface, @ConfigureFlag int flags, @Nullable MediaDescrambler descrambler)
Configure a component to be used with a descrambler.
MediaCodeccreateDecoderByType(@NonNull String type)
Instantiate the preferred decoder supporting input data of the given mime type.
intdequeueInputBuffer(long timeoutUs)
Returns the index of an input buffer to be filled with valid data or -1 if no such buffer is currently available.
intdequeueOutputBuffer(@NonNull BufferInfo info, long timeoutUs)
Dequeue an output buffer, block at most "timeoutUs" microseconds.
ByteBuffergetInputBuffer(int index)
Returns a java.nio.Buffer#clear cleared , writable ByteBuffer object for a dequeued input buffer index to contain the input data.
ByteBuffer[]getInputBuffers()
Retrieve the set of input buffers.
ByteBuffergetOutputBuffer(int index)
Returns a read-only ByteBuffer for a dequeued output buffer index.
ByteBuffer[]getOutputBuffers()
Retrieve the set of output buffers.
MediaFormatgetOutputFormat()
Call this after dequeueOutputBuffer signals a format change by returning #INFO_OUTPUT_FORMAT_CHANGED .
voidqueueInputBuffer(int index, int offset, int size, long presentationTimeUs, int flags)
After filling a range of the input buffer at the specified index submit it to the component.
voidrelease()
Free up resources used by the codec instance.
voidreleaseOutputBuffer(int index, boolean render)
If you are done with a buffer, use this call to return the buffer to the codec or to render it on the output surface.
voidreleaseOutputBuffer(int index, long renderTimestampNs)
If you are done with a buffer, use this call to update its surface timestamp and return it to the codec to render it on the output surface.
voidstart()
After successfully configuring the component, call start .
voidstop()
Finish the decode/encode session, note that the codec instance remains active and ready to be #start ed again.