Packet

expect class Packet : AutoCloseable

A demuxed packet the caller owns.

A player queues packets independently of its decoders, so a packet must outlive the read that produced it. The compressed payload remains reference counted; taking or copying ownership is an O(1) reference operation, not a copy of the compressed bytes.

Close every packet exactly once. Reading any property, copying it or sending it after close throws rather than resolving memory or a token that the allocator is free to reuse.

actual class Packet : AutoCloseable

A demuxed packet the caller owns.

A player queues packets independently of its decoders, so a packet must outlive the read that produced it. The compressed payload remains reference counted; taking or copying ownership is an O(1) reference operation, not a copy of the compressed bytes.

Close every packet exactly once. Reading any property, copying it or sending it after close throws rather than resolving memory or a token that the allocator is free to reuse.

actual class Packet : AutoCloseable

A demuxed packet the caller owns.

A player has to queue packets: it reads ahead of its decoders so a slow disk or a network stall does not stop playback. So a packet must outlive the read that produced it, which the batch API's packets deliberately do not.

Taking ownership costs nothing. The payload is reference counted inside FFmpeg and moved rather than copied, so this is a pointer swap and not a memcpy of the compressed data.

Close it exactly once. An unclosed packet leaks its buffer, and reading anything off it after that throws rather than dereferencing memory the allocator has taken back.

actual class Packet : AutoCloseable

A demuxed packet the caller owns.

A player queues packets independently of its decoders, so a packet must outlive the read that produced it. The compressed payload remains reference counted; taking or copying ownership is an O(1) reference operation, not a copy of the compressed bytes.

Close every packet exactly once. Reading any property, copying it or sending it after close throws rather than resolving memory or a token that the allocator is free to reuse.

actual class Packet : AutoCloseable

A demuxed packet the caller owns.

A player queues packets independently of its decoders, so a packet must outlive the read that produced it. The compressed payload remains reference counted; taking or copying ownership is an O(1) reference operation, not a copy of the compressed bytes.

Close every packet exactly once. Reading any property, copying it or sending it after close throws rather than resolving memory or a token that the allocator is free to reuse.

Properties

Link copied to clipboard
expect val bytePosition: Long

Byte offset in the container, or -1 when unknown.

actual val bytePosition: Long

Byte offset in the container, or -1 when unknown.

actual val bytePosition: Long

Byte offset in the container, or -1. Useful for progress when timestamps are broken.

actual val bytePosition: Long

Byte offset in the container, or -1 when unknown.

actual val bytePosition: Long

Byte offset in the container, or -1 when unknown.

Link copied to clipboard
expect val dts: Long

Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.

actual val dts: Long

Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.

actual val dts: Long

Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.

actual val dts: Long

Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.

actual val dts: Long

Decode timestamp in timeBase units, or FrameInfo.NOPTS when absent.

Link copied to clipboard
expect val dtsMicros: Long?

dts converted to microseconds on the stream's own timeline, or null when absent.

actual val dtsMicros: Long?

dts converted to microseconds on the stream's own timeline, or null when absent.

actual val dtsMicros: Long?

dts converted to microseconds on the stream's own timeline. Null when there is no dts.

actual val dtsMicros: Long?

dts converted to microseconds on the stream's own timeline, or null when absent.

actual val dtsMicros: Long?

dts converted to microseconds on the stream's own timeline, or null when absent.

Link copied to clipboard
expect val duration: Long

Duration in timeBase units. Zero means unknown.

actual val duration: Long

Duration in timeBase units. Zero means unknown.

actual val duration: Long

Duration in timeBase units. 0 when unknown, which is common and not an error.

actual val duration: Long

Duration in timeBase units. Zero means unknown.

actual val duration: Long

Duration in timeBase units. Zero means unknown.

Link copied to clipboard
expect val durationMicros: Long?

duration converted to microseconds, or null when the container supplied none.

actual val durationMicros: Long?

duration converted to microseconds, or null when the container supplied none.

actual val durationMicros: Long?

duration converted to microseconds. Null when the container gave none.

actual val durationMicros: Long?

duration converted to microseconds, or null when the container supplied none.

actual val durationMicros: Long?

duration converted to microseconds, or null when the container supplied none.

Link copied to clipboard
expect val hasPts: Boolean
actual val hasPts: Boolean
actual val hasPts: Boolean
actual val hasPts: Boolean
actual val hasPts: Boolean
Link copied to clipboard
expect val isKeyframe: Boolean
actual val isKeyframe: Boolean
actual val isKeyframe: Boolean
actual val isKeyframe: Boolean
actual val isKeyframe: Boolean
Link copied to clipboard
expect val pts: Long

Presentation timestamp in timeBase units, or FrameInfo.NOPTS when absent.

actual val pts: Long

Presentation timestamp in timeBase units, or FrameInfo.NOPTS when absent.

actual val pts: Long

Presentation timestamp in timeBase units, or FrameInfo.NOPTS when the container gave none.

actual val pts: Long

Presentation timestamp in timeBase units, or FrameInfo.NOPTS when absent.

actual val pts: Long

Presentation timestamp in timeBase units, or FrameInfo.NOPTS when absent.

Link copied to clipboard
expect val ptsMicros: Long?

pts converted to microseconds on the stream's own timeline, or null when absent.

actual val ptsMicros: Long?

pts converted to microseconds on the stream's own timeline, or null when absent.

actual val ptsMicros: Long?

pts converted to microseconds on the stream's own timeline. Null when there is no pts.

actual val ptsMicros: Long?

pts converted to microseconds on the stream's own timeline, or null when absent.

actual val ptsMicros: Long?

pts converted to microseconds on the stream's own timeline, or null when absent.

Link copied to clipboard
expect val sizeBytes: Int
actual val sizeBytes: Int
actual val sizeBytes: Int
actual val sizeBytes: Int
actual val sizeBytes: Int
Link copied to clipboard
expect val streamIndex: Int
actual val streamIndex: Int
actual val streamIndex: Int
actual val streamIndex: Int
actual val streamIndex: Int
Link copied to clipboard
expect val timeBase: Rational

The stream's time base, used by the raw timestamp properties below.

actual val timeBase: Rational

The stream's time base, used by the raw timestamp properties below.

actual val timeBase: Rational

The stream's time base, so the caller can convert pts without looking the stream up.

actual val timeBase: Rational

The stream's time base, used by the raw timestamp properties below.

actual val timeBase: Rational

The stream's time base, used by the raw timestamp properties below.

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

Returns a separately owned O(1) reference to this packet's compressed payload and metadata. The two packets may be closed independently, in either order.

actual fun copy(): Packet

Returns a separately owned O(1) reference to this packet's compressed payload and metadata. The two packets may be closed independently, in either order.

actual fun copy(): Packet

Returns a separately owned O(1) reference to this packet's compressed payload and metadata. The two packets may be closed independently, in either order.

actual fun copy(): Packet

Returns a separately owned O(1) reference to this packet's compressed payload and metadata. The two packets may be closed independently, in either order.

actual fun copy(): Packet

Returns a separately owned O(1) reference to this packet's compressed payload and metadata. The two packets may be closed independently, in either order.

Link copied to clipboard
expect fun copyBytes(): ByteArray

The packet's compressed payload, copied (S4.c). For TEXT subtitle streams this is the cue body itself, which is why a subtitle decoder can be pure Kotlin. A copy per call: subtitle packets are tiny and rare; never call this per video packet.

actual fun copyBytes(): ByteArray

The packet's compressed payload, copied (S4.c). For TEXT subtitle streams this is the cue body itself, which is why a subtitle decoder can be pure Kotlin. A copy per call: subtitle packets are tiny and rare; never call this per video packet.

actual fun copyBytes(): ByteArray

The packet's compressed payload, copied (S4.c). For TEXT subtitle streams this is the cue body itself, which is why a subtitle decoder can be pure Kotlin. A copy per call: subtitle packets are tiny and rare; never call this per video packet.

actual fun copyBytes(): ByteArray

The packet's compressed payload, copied (S4.c). For TEXT subtitle streams this is the cue body itself, which is why a subtitle decoder can be pure Kotlin. A copy per call: subtitle packets are tiny and rare; never call this per video packet.

actual fun copyBytes(): ByteArray

The packet's compressed payload, copied (S4.c). For TEXT subtitle streams this is the cue body itself, which is why a subtitle decoder can be pure Kotlin. A copy per call: subtitle packets are tiny and rare; never call this per video packet.