AudioCodec

Encodes and decodes audio using Android media codecs.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Setting(codec: AudioCodec? = null) : Codec.Setting

Audio encoder settings. Changes are forwarded to the associated codec when one is supplied.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open var codec: MediaCodec?

The android.media.MediaCodec instance.

Link copied to clipboard
open override var inputMimeType: String

Specifies the input mime type.

Link copied to clipboard
open override val isRunning: AtomicBoolean

Indicates whether the receiver is running.

Link copied to clipboard

The listener for codec buffer and format callbacks, or null.

Link copied to clipboard
var mode: Int

The processing mode: MODE_ENCODE or MODE_DECODE. Set before starting the codec.

Link copied to clipboard

Additional media format options applied during configure.

Link copied to clipboard
open override var outputMimeType: String

Specifies the output mime type.

Link copied to clipboard
Link copied to clipboard

The surface for a video media codec.

Functions

Link copied to clipboard
fun append(byteBuffer: ByteBuffer)
Link copied to clipboard
open fun configure(codec: MediaCodec)

Installs callbacks and configures the codec with its media format, options, surface, and processing mode.

Link copied to clipboard
open fun dispose()

Releases the Android codec, callback thread, and cached output format.

Link copied to clipboard
Link copied to clipboard
open override fun onError(codec: MediaCodec, e: MediaCodec.CodecException)
Link copied to clipboard
open override fun onInputBufferAvailable(codec: MediaCodec, index: Int)
Link copied to clipboard
open fun onMetricsFlushed(codec: MediaCodec, metrics: PersistableBundle)
Link copied to clipboard
open override fun onOutputBufferAvailable(codec: MediaCodec, index: Int, info: MediaCodec.BufferInfo)
Link copied to clipboard
Link copied to clipboard
open override fun onOutputFormatChanged(codec: MediaCodec, format: MediaFormat)
Link copied to clipboard
override fun startRunning()

Tells the receiver to start running.

Link copied to clipboard
override fun stopRunning()

Tells the receiver to stop running.

Link copied to clipboard
fun withCurrentCodec(instance: MediaCodec, operation: () -> Unit): Boolean

Runs a short, nonblocking operation only while instance is the running codec. Use after waiting for input outside the codec's lifetime lock.