PacketReader

Reads owned packets from one MediaSource cursor under the caller's control. This is the demuxing half of a player, kept separate from decoding so audio and video decoding can proceed independently and a seek can replace the caller's queued generation explicitly.

Reading, seeking and closing must be serialized by the caller. One reader may be open for a source at a time, and while it is open the source's batch decode and direct seek APIs are refused. Closing restores the source's default stream selection.

Reads owned packets from one MediaSource cursor under the caller's control. This is the demuxing half of a player, kept separate from decoding so audio and video decoding can proceed independently and a seek can replace the caller's queued generation explicitly.

Reading, seeking and closing must be serialized by the caller. One reader may be open for a source at a time, and while it is open the source's batch decode and direct seek APIs are refused. Closing restores the source's default stream selection.

Reads packets from a container, one at a time, under the caller's control.

This is the demuxing half of a player, separated from decoding. The batch API fuses the two, which is right for transcoding and wrong for playback: a player needs audio and video decoding to proceed independently, so that a slow video decoder cannot stop the audio clock, and it needs to seek while all of that is running.

One reader per MediaSource. Reading, seeking and closing must all happen from one coroutine, or be serialised by the caller. libavformat's context is a single cursor and is not thread safe.

Reads owned packets from one MediaSource cursor under the caller's control. This is the demuxing half of a player, kept separate from decoding so audio and video decoding can proceed independently and a seek can replace the caller's queued generation explicitly.

Reading, seeking and closing must be serialized by the caller. One reader may be open for a source at a time, and while it is open the source's batch decode and direct seek APIs are refused. Closing restores the source's default stream selection.

Reads owned packets from one MediaSource cursor under the caller's control. This is the demuxing half of a player, kept separate from decoding so audio and video decoding can proceed independently and a seek can replace the caller's queued generation explicitly.

Reading, seeking and closing must be serialized by the caller. One reader may be open for a source at a time, and while it is open the source's batch decode and direct seek APIs are refused. Closing restores the source's default stream selection.

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 read(): Packet?

Returns the next selected-stream packet, or null at container EOF. The returned packet is owned by the caller. Null is the signal to begin decoder drain by sending a null packet.

actual fun read(): Packet?

Returns the next selected-stream packet, or null at container EOF. The returned packet is owned by the caller. Null is the signal to begin decoder drain by sending a null packet.

actual fun read(): Packet?

Reads the next packet from a selected stream.

actual fun read(): Packet?

Returns the next selected-stream packet, or null at container EOF. The returned packet is owned by the caller. Null is the signal to begin decoder drain by sending a null packet.

actual fun read(): Packet?

Returns the next selected-stream packet, or null at container EOF. The returned packet is owned by the caller. Null is the signal to begin decoder drain by sending a null packet.

Link copied to clipboard
expect fun reselect(streams: List<StreamInfo>)

Changes which streams read delivers without reopening this reader or moving its demuxer cursor.

actual fun reselect(streams: List<StreamInfo>)

Changes which streams read delivers without reopening this reader or moving its demuxer cursor.

actual fun reselect(streams: List<StreamInfo>)

Changes which streams read delivers without reopening this reader or moving its demuxer cursor.

actual fun reselect(streams: List<StreamInfo>)

Changes which streams read delivers without reopening this reader or moving its demuxer cursor.

actual fun reselect(streams: List<StreamInfo>)

Changes which streams read delivers without reopening this reader or moving its demuxer cursor.

Link copied to clipboard
expect fun seek(micros: Long, direction: SeekDirection = SeekDirection.Backward, notEarlierThan: Long? = null)

Moves the demuxer cursor without flushing decoders or clearing caller-owned queues. The caller must discard the old packet/frame generation and flush every decoder itself.

actual fun seek(micros: Long, direction: SeekDirection, notEarlierThan: Long?)

Moves the demuxer cursor without flushing decoders or clearing caller-owned queues. The caller must discard the old packet/frame generation and flush every decoder itself.

actual fun seek(micros: Long, direction: SeekDirection, notEarlierThan: Long?)

Moves the read cursor.

actual fun seek(micros: Long, direction: SeekDirection, notEarlierThan: Long?)

Moves the demuxer cursor without flushing decoders or clearing caller-owned queues. The caller must discard the old packet/frame generation and flush every decoder itself.

actual fun seek(micros: Long, direction: SeekDirection, notEarlierThan: Long?)

Moves the demuxer cursor without flushing decoders or clearing caller-owned queues. The caller must discard the old packet/frame generation and flush every decoder itself.