FFmpeg 4.4.5
|
This structure stores compressed data. More...
#include <libavcodec/packet.h>
Data Fields | |
AVBufferRef * | buf |
A reference to the reference-counted buffer where the packet data is stored. | |
int64_t | pts |
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will be presented to the user. | |
int64_t | dts |
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed. | |
uint8_t * | data |
int | size |
int | stream_index |
int | flags |
A combination of AV_PKT_FLAG values. | |
AVPacketSideData * | side_data |
Additional packet data that can be provided by the container. | |
int | side_data_elems |
int64_t | duration |
Duration of this packet in AVStream->time_base units, 0 if unknown. | |
int64_t | pos |
byte position in stream, -1 if unknown | |
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).
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().
sizeof(AVPacket) being a part of the public ABI is deprecated. once av_init_packet() is removed, new packets will only be able to be allocated with av_packet_alloc(), and new fields may be added to the end of the struct with a minor bump.
AVBufferRef* AVPacket::buf |
int64_t AVPacket::pts |
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.
Definition at line 362 of file packet.h.
Referenced by encode(), log_packet(), log_packet(), and main().
int64_t AVPacket::dts |
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.
Definition at line 368 of file packet.h.
Referenced by log_packet(), log_packet(), and main().
uint8_t* AVPacket::data |
int AVPacket::size |
int AVPacket::stream_index |
Definition at line 371 of file packet.h.
Referenced by encode_write_frame(), log_packet(), log_packet(), main(), main(), and write_frame().
AVPacketSideData* AVPacket::side_data |
int64_t AVPacket::duration |
Duration of this packet in AVStream->time_base units, 0 if unknown.
Equals next_pts - this_pts in presentation order.
Definition at line 387 of file packet.h.
Referenced by log_packet(), log_packet(), and main().
int64_t AVPacket::pos |
byte position in stream, -1 if unknown
Definition at line 389 of file packet.h.
Referenced by main().