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 or one that is not positive.

actual val durationMicros: Long?

duration converted to microseconds, or null when the container supplied none or one that is not positive.

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 or one that is not positive.

actual val durationMicros: Long?

duration converted to microseconds, or null when the container supplied none or one that is not positive.

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

The container's tags as they stand from this packet on, present only on the first packet a read hands out after FFmpeg applied new container tags during playback, and null on every other packet. A station's ICY title through FFmpeg's own http, an ID3 tag between ADTS frames and an FLV onMetaData arrive this way. It is the whole new set, which MediaSource.metadata holds from the same read on. A copy carries it too.

The container's tags as they stand from this packet on, present only on the first packet a read hands out after FFmpeg applied new container tags during playback, and null on every other packet. A station's ICY title through FFmpeg's own http, an ID3 tag between ADTS frames and an FLV onMetaData arrive this way. It is the whole new set, which MediaSource.metadata holds from the same read on. A copy carries it too.

The container's tags as they stand from this packet on, present only on the first packet a read hands out after FFmpeg applied new container tags during playback, and null on every other packet. A station's ICY title through FFmpeg's own http, an ID3 tag between ADTS frames and an FLV onMetaData arrive this way. It is the whole new set, which MediaSource.metadata holds from the same read on. A copy carries it too.

The container's tags as they stand from this packet on, present only on the first packet a read hands out after FFmpeg applied new container tags during playback, and null on every other packet. A station's ICY title through FFmpeg's own http, an ID3 tag between ADTS frames and an FLV onMetaData arrive this way. It is the whole new set, which MediaSource.metadata holds from the same read on. A copy carries it too.

The container's tags as they stand from this packet on, present only on the first packet a read hands out after FFmpeg applied new container tags during playback, and null on every other packet. A station's ICY title through FFmpeg's own http, an ID3 tag between ADTS frames and an FLV onMetaData arrive this way. It is the whole new set, which MediaSource.metadata holds from the same read on. A copy carries it too.

Link copied to clipboard
expect val newPrograms: List<Program>?

The source's MediaSource.programs as they stand from this packet on, present only on the first packet a read hands out after FFmpeg changed them, and null on every other packet (#151). A stream the container stopped carrying has left its programme here. A copy carries it too.

actual val newPrograms: List<Program>?

The source's MediaSource.programs as they stand from this packet on, present only on the first packet a read hands out after FFmpeg changed them, and null on every other packet (#151). A stream the container stopped carrying has left its programme here. A copy carries it too.

actual val newPrograms: List<Program>?

The source's MediaSource.programs as they stand from this packet on, present only on the first packet a read hands out after FFmpeg changed them, and null on every other packet (#151). A stream the container stopped carrying has left its programme here. A copy carries it too.

actual val newPrograms: List<Program>?

The source's MediaSource.programs as they stand from this packet on, present only on the first packet a read hands out after FFmpeg changed them, and null on every other packet (#151). A stream the container stopped carrying has left its programme here. A copy carries it too.

actual val newPrograms: List<Program>?

The source's MediaSource.programs as they stand from this packet on, present only on the first packet a read hands out after FFmpeg changed them, and null on every other packet (#151). A stream the container stopped carrying has left its programme here. A copy carries it too.

Link copied to clipboard
expect val newStreams: List<StreamInfo>?

The source's MediaSource.streams as they stand from this packet on, present only on the first packet a read hands out after FFmpeg added a stream or an entry was read again at its stream's first packet, and null on every other packet (#151). It is the whole list, so a stream is new when its index is past the end of the list before, and corrected when its entry differs. A change that a decode flow read, or that the reader before this one read and never handed a packet out after, rides this reader's first packet.

actual val newStreams: List<StreamInfo>?

The source's MediaSource.streams as they stand from this packet on, present only on the first packet a read hands out after FFmpeg added a stream or an entry was read again at its stream's first packet, and null on every other packet (#151). It is the whole list, so a stream is new when its index is past the end of the list before, and corrected when its entry differs. A change that a decode flow read, or that the reader before this one read and never handed a packet out after, rides this reader's first packet.

actual val newStreams: List<StreamInfo>?

The source's MediaSource.streams as they stand from this packet on, present only on the first packet a read hands out after FFmpeg added a stream or an entry was read again at its stream's first packet, and null on every other packet (#151). It is the whole list, so a stream is new when its index is past the end of the list before, and corrected when its entry differs. A change that a decode flow read, or that the reader before this one read and never handed a packet out after, rides this reader's first packet.

actual val newStreams: List<StreamInfo>?

The source's MediaSource.streams as they stand from this packet on, present only on the first packet a read hands out after FFmpeg added a stream or an entry was read again at its stream's first packet, and null on every other packet (#151). It is the whole list, so a stream is new when its index is past the end of the list before, and corrected when its entry differs. A change that a decode flow read, or that the reader before this one read and never handed a packet out after, rides this reader's first packet.

actual val newStreams: List<StreamInfo>?

The source's MediaSource.streams as they stand from this packet on, present only on the first packet a read hands out after FFmpeg added a stream or an entry was read again at its stream's first packet, and null on every other packet (#151). It is the whole list, so a stream is new when its index is past the end of the list before, and corrected when its entry differs. A change that a decode flow read, or that the reader before this one read and never handed a packet out after, rides this reader's first packet.

Link copied to clipboard

This packet's stream's tags as they stand from this packet on, present only on the first packet of that stream a read hands out after FFmpeg applied new tags to it during playback, and null on every other packet. The next song of a chained Ogg brings its comments this way, as the whole set, without the keys of the song before it, and a timed ID3 packet of an MPEG-TS or HLS data stream carries what it states on itself, so read that data stream to receive them. StreamInfo.metadata keeps what the stream said at open. A copy carries it too.

This packet's stream's tags as they stand from this packet on, present only on the first packet of that stream a read hands out after FFmpeg applied new tags to it during playback, and null on every other packet. The next song of a chained Ogg brings its comments this way, as the whole set, without the keys of the song before it, and a timed ID3 packet of an MPEG-TS or HLS data stream carries what it states on itself, so read that data stream to receive them. StreamInfo.metadata keeps what the stream said at open. A copy carries it too.

This packet's stream's tags as they stand from this packet on, present only on the first packet of that stream a read hands out after FFmpeg applied new tags to it during playback, and null on every other packet. The next song of a chained Ogg brings its comments this way, as the whole set, without the keys of the song before it, and a timed ID3 packet of an MPEG-TS or HLS data stream carries what it states on itself, so read that data stream to receive them. StreamInfo.metadata keeps what the stream said at open. A copy carries it too.

This packet's stream's tags as they stand from this packet on, present only on the first packet of that stream a read hands out after FFmpeg applied new tags to it during playback, and null on every other packet. The next song of a chained Ogg brings its comments this way, as the whole set, without the keys of the song before it, and a timed ID3 packet of an MPEG-TS or HLS data stream carries what it states on itself, so read that data stream to receive them. StreamInfo.metadata keeps what the stream said at open. A copy carries it too.

This packet's stream's tags as they stand from this packet on, present only on the first packet of that stream a read hands out after FFmpeg applied new tags to it during playback, and null on every other packet. The next song of a chained Ogg brings its comments this way, as the whole set, without the keys of the song before it, and a timed ID3 packet of an MPEG-TS or HLS data stream carries what it states on itself, so read that data stream to receive them. StreamInfo.metadata keeps what the stream said at open. A copy carries it too.

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