VideoCodec

class VideoCodec(context: Context) : Codec

Encodes and decodes video using Android media codecs.

Constructors

Link copied to clipboard
constructor(context: Context)

Types

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

Video encoder settings. Configure dimensions and profile before starting encoding.

Properties

Link copied to clipboard

The target video bit rate, in bits per second.

Link copied to clipboard
open override var codec: MediaCodec?

The android.media.MediaCodec instance.

Link copied to clipboard

The target video frame rate, in frames per second.

Link copied to clipboard
var height: Int

The output video height, in pixels.

Link copied to clipboard

The interval between keyframes, in seconds.

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

The pixel transform instance.

Link copied to clipboard

Specifies the profile for a video output.

Link copied to clipboard

The surface for a video media codec.

Link copied to clipboard
var width: Int

The output video width, in pixels.

Functions

Link copied to clipboard
open override fun configure(codec: MediaCodec)

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

Link copied to clipboard

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
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.