Struct ffmpeg_sys::AVPacket[][src]

#[repr(C)]
pub struct AVPacket { pub buf: *mut AVBufferRef, pub pts: i64, pub dts: i64, pub data: *mut u8, pub size: c_int, pub stream_index: c_int, pub flags: c_int, pub side_data: *mut AVPacketSideData, pub side_data_elems: c_int, pub duration: i64, pub pos: i64, pub convergence_duration: i64, }
Expand description

This structure stores compressed data. It is typically exported by demuxers and then passed as input to decoders, or received as output from encoders and then passed to muxers.

For video, it should typically contain one compressed frame. For audio it may contain several compressed frames. Encoders are allowed to output empty packets, with no compressed data, containing only side data (e.g. to update some stream parameters at the end of encoding).

AVPacket is one of the few structs in FFmpeg, whose size is a part of public ABI. Thus it may be allocated on stack and no new fields can be added to it without libavcodec and libavformat major bump.

The semantics of data ownership depends on the buf field. If it is set, the packet data is dynamically allocated and is valid indefinitely until a call to av_packet_unref() reduces the reference count to 0.

If the buf field is not set av_packet_ref() would make a copy instead of increasing the reference count.

The side data is always allocated with av_malloc(), copied by av_packet_ref() and freed by av_packet_unref().

@see av_packet_ref @see av_packet_unref

Fields

buf: *mut AVBufferRef

A reference to the reference-counted buffer where the packet data is stored. May be NULL, then the packet data is not reference-counted.

pts: i64

Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will be presented to the user. Can be AV_NOPTS_VALUE if it is not stored in the file. pts MUST be larger or equal to dts as presentation cannot happen before decompression, unless one wants to view hex dumps. Some formats misuse the terms dts and pts/cts to mean something different. Such timestamps must be converted to true pts/dts before they are stored in AVPacket.

dts: i64

Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed. Can be AV_NOPTS_VALUE if it is not stored in the file.

data: *mut u8size: c_intstream_index: c_intflags: c_int

A combination of AV_PKT_FLAG values

side_data: *mut AVPacketSideData

Additional packet data that can be provided by the container. Packet can contain several types of side information.

side_data_elems: c_intduration: i64

Duration of this packet in AVStream->time_base units, 0 if unknown. Equals next_pts - this_pts in presentation order.

pos: i64

< byte position in stream, -1 if unknown

convergence_duration: i64

@deprecated Same as the duration field, but as int64_t. This was required for Matroska subtitles, whose duration values could overflow when the duration field was still an int.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.