MediaSource

expect class MediaSource : AutoCloseable

An opened input: a local file or a URL. It owns the container cursor and per-stream resources, and closing it releases them all. Confine it to one coroutine context, because the underlying media objects are not safe to call concurrently.

actual class MediaSource : AutoCloseable

An opened input: a local file or a URL. It owns the container cursor and per-stream resources, and closing it releases them all. Confine it to one coroutine context, because the underlying media objects are not safe to call concurrently.

actual class MediaSource : AutoCloseable

An opened input: a local file or a URL. It owns the container cursor and per-stream resources, and closing it releases them all. Confine it to one coroutine context, because the underlying media objects are not safe to call concurrently.

actual class MediaSource : AutoCloseable

An opened input: a local file or a URL. It owns the container cursor and per-stream resources, and closing it releases them all. Confine it to one coroutine context, because the underlying media objects are not safe to call concurrently.

actual class MediaSource : AutoCloseable

An open container, over the codec module.

Opened from a MediaByteSource only. There is no filesystem in a browser, so the open(path) overloads refuse rather than pretending: whatever the caller has is already bytes.

Types

Link copied to clipboard
expect object Companion
actual object Companion
actual object Companion
actual object Companion
actual object Companion

Properties

Link copied to clipboard
expect val chapters: List<Chapter>

The container's chapter table (KD-5). Empty when the container declares none.

actual val chapters: List<Chapter>

The container's chapter table (KD-5). Empty when the container declares none.

actual val chapters: List<Chapter>

The container's chapter table (KD-5). Empty when the container declares none.

actual val chapters: List<Chapter>

The container's chapter table (KD-5). Empty when the container declares none.

actual val chapters: List<Chapter>

The container's chapter table (KD-5). Empty when the container declares none.

Link copied to clipboard

What the batch decode flows do when FFmpeg reports damaged data. CorruptData.Skip by default, which is what every backend always did, silently.

What the batch decode flows do when FFmpeg reports damaged data. CorruptData.Skip by default, which is what every backend always did, silently.

What the batch decode flows do when FFmpeg reports damaged data. CorruptData.Skip by default, which is what every backend always did, silently.

What the batch decode flows do when FFmpeg reports damaged data. CorruptData.Skip by default, which is what every backend always did, silently.

What the batch decode flows do when FFmpeg reports damaged data. CorruptData.Skip by default, which is what every backend always did, silently.

Link copied to clipboard

Packets and frames this source skipped as damaged since it was opened.

Packets and frames this source skipped as damaged since it was opened.

Packets and frames this source skipped as damaged since it was opened.

Packets and frames this source skipped as damaged since it was opened.

Summed from the decoders the batch flows built, because this backend's flows drive real StreamDecoder instances rather than a private decode loop.

Link copied to clipboard
expect val durationMicros: Long?
actual val durationMicros: Long?
actual val durationMicros: Long?
actual val durationMicros: Long?
actual val durationMicros: Long?
Link copied to clipboard
expect val formatName: String
actual val formatName: String
actual val formatName: String
actual val formatName: String
actual val formatName: String
Link copied to clipboard
expect val isSeekable: Boolean

Whether this input can seek at all, read from the input rather than assumed.

actual val isSeekable: Boolean

Whether this input can seek at all, read from the input rather than assumed.

actual val isSeekable: Boolean

Read once at open, because it cannot change afterwards and because reading it lazily would mean touching the format context, which close frees.

actual val isSeekable: Boolean

Whether this input can seek at all, read from the input rather than assumed.

actual val isSeekable: Boolean

Whether this input can seek at all, read from the input rather than assumed.

Link copied to clipboard

The assembled container-level view. Reads only members the source already exposes.

Link copied to clipboard
expect val metadata: Map<String, String>
actual val metadata: Map<String, String>
actual val metadata: Map<String, String>
actual val metadata: Map<String, String>
actual val metadata: Map<String, String>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
expect val startTimeMicros: Long

Where this container's timeline begins, in microseconds. It is 0 for most mp4 files, and commonly around 1.4s for MPEG-TS.

actual val startTimeMicros: Long

Where this container's timeline begins, in microseconds. It is 0 for most mp4 files, and commonly around 1.4s for MPEG-TS.

actual val startTimeMicros: Long

Where the container's timeline begins, in microseconds. This is the offset between the absolute timeline libavformat uses and the content-relative timeline the public API uses. The expect declaration in commonMain describes both timelines in full.

actual val startTimeMicros: Long

Where this container's timeline begins, in microseconds. It is 0 for most mp4 files, and commonly around 1.4s for MPEG-TS.

actual val startTimeMicros: Long

Where this container's timeline begins, in microseconds. It is 0 for most mp4 files, and commonly around 1.4s for MPEG-TS.

Link copied to clipboard
expect val streams: List<StreamInfo>
actual val streams: List<StreamInfo>
actual val streams: List<StreamInfo>
actual val streams: List<StreamInfo>
actual val streams: List<StreamInfo>
Link copied to clipboard

The pre-open option keys FFmpeg did NOT consume on this open (KD-4). Always empty for the plain open; a non-empty list after an options open is a caller mistake worth reading back, and the S4 diagnostics dump prints it.

The pre-open option keys FFmpeg did NOT consume on this open (KD-4). Always empty for the plain open; a non-empty list after an options open is a caller mistake worth reading back, and the S4 diagnostics dump prints it.

The pre-open option keys FFmpeg did NOT consume on this open (KD-4). Always empty for the plain open; a non-empty list after an options open is a caller mistake worth reading back, and the S4 diagnostics dump prints it.

The pre-open option keys FFmpeg did NOT consume on this open (KD-4). Always empty for the plain open; a non-empty list after an options open is a caller mistake worth reading back, and the S4 diagnostics dump prints it.

The keys FFmpeg did not consume, which is a real answer now.

Functions

Link copied to clipboard
expect open override fun close()
actual open override fun close()
actual open override fun close()
actual open override fun close()
actual open override fun close()
Link copied to clipboard
expect fun decodedFrames(stream: StreamInfo): Flow<Frame>

Decode this stream and emit each decoded frame, owned by the collector.

actual fun decodedFrames(stream: StreamInfo): Flow<Frame>

Decode this stream and emit each decoded frame, owned by the collector.

actual fun decodedFrames(stream: StreamInfo): Flow<Frame>

Decode this stream and emit each decoded frame, owned by the collector.

actual fun decodedFrames(stream: StreamInfo): Flow<Frame>

Decode this stream and emit each decoded frame, owned by the collector.

actual fun decodedFrames(stream: StreamInfo): Flow<Frame>

Decode this stream and emit each decoded frame, owned by the collector.

Link copied to clipboard
expect fun decodeStreams(streams: List<StreamInfo>): Flow<Frame>

Decode several streams in one demuxer pass, emitting frames interleaved in container order and tagged by FrameInfo.streamIndex. This is the only correct way to transcode video and audio together: two concurrent decodedFrames flows would race the underlying demuxer, so that is rejected with IllegalStateException.

actual fun decodeStreams(streams: List<StreamInfo>): Flow<Frame>

Decode several streams in one demuxer pass, emitting frames interleaved in container order and tagged by FrameInfo.streamIndex. This is the only correct way to transcode video and audio together: two concurrent decodedFrames flows would race the underlying demuxer, so that is rejected with IllegalStateException.

actual fun decodeStreams(streams: List<StreamInfo>): Flow<Frame>

Decode several streams in one demuxer pass, emitting frames interleaved in container order and tagged by FrameInfo.streamIndex. This is the only correct way to transcode video and audio together: two concurrent decodedFrames flows would race the underlying demuxer, so that is rejected with IllegalStateException.

actual fun decodeStreams(streams: List<StreamInfo>): Flow<Frame>

Decode several streams in one demuxer pass, emitting frames interleaved in container order and tagged by FrameInfo.streamIndex. This is the only correct way to transcode video and audio together: two concurrent decodedFrames flows would race the underlying demuxer, so that is rejected with IllegalStateException.

actual fun decodeStreams(streams: List<StreamInfo>): Flow<Frame>

Decode several streams in one demuxer pass, emitting frames interleaved in container order and tagged by FrameInfo.streamIndex. This is the only correct way to transcode video and audio together: two concurrent decodedFrames flows would race the underlying demuxer, so that is rejected with IllegalStateException.

Link copied to clipboard
expect suspend fun extractFrame(atMicros: Long, stream: StreamInfo? = null): Frame

Decode and return the frame at (or first after) atMicros. Use this to extract a thumbnail. It seeks to the preceding keyframe and decodes forward to the exact target. Pair with Frame.encodeImage for jpg/png bytes.

actual suspend fun extractFrame(atMicros: Long, stream: StreamInfo?): Frame

Decode and return the frame at (or first after) atMicros. Use this to extract a thumbnail. It seeks to the preceding keyframe and decodes forward to the exact target. Pair with Frame.encodeImage for jpg/png bytes.

actual suspend fun extractFrame(atMicros: Long, stream: StreamInfo?): Frame

Decode and return the frame at (or first after) atMicros. Use this to extract a thumbnail. It seeks to the preceding keyframe and decodes forward to the exact target. Pair with Frame.encodeImage for jpg/png bytes.

actual suspend fun extractFrame(atMicros: Long, stream: StreamInfo?): Frame

Decode and return the frame at (or first after) atMicros. Use this to extract a thumbnail. It seeks to the preceding keyframe and decodes forward to the exact target. Pair with Frame.encodeImage for jpg/png bytes.

actual suspend fun extractFrame(atMicros: Long, stream: StreamInfo?): Frame

Decode and return the frame at (or first after) atMicros. Use this to extract a thumbnail. It seeks to the preceding keyframe and decodes forward to the exact target. Pair with Frame.encodeImage for jpg/png bytes.

Link copied to clipboard
expect fun interrupt()

Requests that every current and future blocking call on this source return with a typed FFmpegError.Interrupted failure.

actual fun interrupt()

Requests that every current and future blocking call on this source return with a typed FFmpegError.Interrupted failure.

actual fun interrupt()

Requests that every current and future blocking call on this source return with a typed FFmpegError.Interrupted failure.

actual fun interrupt()

Requests that every current and future blocking call on this source return with a typed FFmpegError.Interrupted failure.

actual fun interrupt()

Requests that every current and future blocking call on this source return with a typed FFmpegError.Interrupted failure.

Link copied to clipboard
expect fun openDecoder(stream: StreamInfo, threadCount: Int = 0, lowDelay: Boolean = false, decoder: CodecId? = null, options: DecoderOptions? = null, hardware: HardwareAccel? = null, corruptData: CorruptData = CorruptData.Skip): StreamDecoder

Opens one independently driven decoder for stream.

actual fun openDecoder(stream: StreamInfo, threadCount: Int, lowDelay: Boolean, decoder: CodecId?, options: DecoderOptions?, hardware: HardwareAccel?, corruptData: CorruptData): StreamDecoder

Opens one independently driven decoder for stream.

actual fun openDecoder(stream: StreamInfo, threadCount: Int, lowDelay: Boolean, decoder: CodecId?, options: DecoderOptions?, hardware: HardwareAccel?, corruptData: CorruptData): StreamDecoder

Opens one decoder for one stream, for you to drive.

actual fun openDecoder(stream: StreamInfo, threadCount: Int, lowDelay: Boolean, decoder: CodecId?, options: DecoderOptions?, hardware: HardwareAccel?, corruptData: CorruptData): StreamDecoder

Opens one independently driven decoder for stream.

actual fun openDecoder(stream: StreamInfo, threadCount: Int, lowDelay: Boolean, decoder: CodecId?, options: DecoderOptions?, hardware: HardwareAccel?, corruptData: CorruptData): StreamDecoder

Opens one independently driven decoder for stream.

Link copied to clipboard

Opens the low-level demux cursor for exactly streams. The returned reader owns the source's cursor until it is closed; no batch decode or source-level seek may run concurrently.

Opens the low-level demux cursor for exactly streams. The returned reader owns the source's cursor until it is closed; no batch decode or source-level seek may run concurrently.

Opens a reader that hands out owned packets, one at a time, under your control.

Opens the low-level demux cursor for exactly streams. The returned reader owns the source's cursor until it is closed; no batch decode or source-level seek may run concurrently.

Opens the low-level demux cursor for exactly streams. The returned reader owns the source's cursor until it is closed; no batch decode or source-level seek may run concurrently.

Link copied to clipboard
expect suspend fun seekMicros(micros: Long)

Seek the demuxer to micros, measured from the start of the content. Lands on the keyframe at or before that point, so the next decode flow resumes from there. Not allowed while a decode flow is collecting, since the demuxer cursor is shared.

actual suspend fun seekMicros(micros: Long)

Seek the demuxer to micros, measured from the start of the content. Lands on the keyframe at or before that point, so the next decode flow resumes from there. Not allowed while a decode flow is collecting, since the demuxer cursor is shared.

actual suspend fun seekMicros(micros: Long)

Seek the demuxer to micros, measured from the start of the content. Lands on the keyframe at or before that point, so the next decode flow resumes from there. Not allowed while a decode flow is collecting, since the demuxer cursor is shared.

actual suspend fun seekMicros(micros: Long)

Seek the demuxer to micros, measured from the start of the content. Lands on the keyframe at or before that point, so the next decode flow resumes from there. Not allowed while a decode flow is collecting, since the demuxer cursor is shared.

actual suspend fun seekMicros(micros: Long)

Seek the demuxer to micros, measured from the start of the content. Lands on the keyframe at or before that point, so the next decode flow resumes from there. Not allowed while a decode flow is collecting, since the demuxer cursor is shared.