PlayerPacket

One compressed packet.

The source-to-decoder handoff keeps the payload opaque so native backends can pass a referenced packet through without copying it. Platform decoders that require Kotlin-visible bytes may opt into the explicit copy provided by copyBytes.

Properties

Link copied to clipboard
abstract val bytePosition: Long?

Byte offset in the container, when known. Used for progress on streams with broken times.

Link copied to clipboard
abstract val dts: Pts?

The decode time. Null when the container gave none.

Link copied to clipboard
abstract val duration: Pts?

Null when the container gave none.

Link copied to clipboard
abstract val isKeyframe: Boolean

True when a decoder can start at this packet.

Link copied to clipboard

The source's PlayerMediaSource.metadata as it stands from this packet on, present only on the first packet a source hands out after its tags changed, and null on every other packet (#423): a radio station's next song, the comments of a chained Ogg's next song, an ID3 tag between ADTS frames. The engine shows them when this packet is heard, not when it is read, since a stream is read seconds ahead. Null for a source whose tags never change.

Link copied to clipboard

The source's PlayerMediaSource.programs as they stand from this packet on, present only on the first packet a source hands out after they changed, and null on every other packet (#509). A stream the container stopped carrying has left its programme here.

Link copied to clipboard

The source's PlayerMediaSource.streams as they stand from this packet on, present only on the first packet a source hands out after its list changed, and null on every other packet (#509). It is the whole list: a stream is new when its index was not in the list before, and an entry that differs from the one before was corrected, as FFmpeg corrects a sound's sample rate at its first packet. Null for a source whose streams never change.

Link copied to clipboard
abstract val pts: Pts?

Null when the container gave none, which is normal and not an error.

Link copied to clipboard
abstract val sizeBytes: Int

The size of the compressed payload.

Link copied to clipboard
abstract val streamIndex: Int

The stream this packet belongs to, as PlayerStreamInfo.index.

Functions

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
abstract fun copyBytes(): ByteArray

Returns a new, caller-owned copy of the compressed payload.