FFmpeg  2.8.6
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Data Fields

This structure stores compressed data. More...

#include <avcodec.h>

Data Fields

AVBufferRefbuf
 A reference to the reference-counted buffer where the packet data is stored. More...
 
int64_t pts
 Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will be presented to the user. More...
 
int64_t dts
 Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed. More...
 
uint8_t * data
 
int size
 
int stream_index
 
int flags
 A combination of AV_PKT_FLAG values. More...
 
AVPacketSideDataside_data
 Additional packet data that can be provided by the container. More...
 
int side_data_elems
 
int duration
 Duration of this packet in AVStream->time_base units, 0 if unknown. More...
 
attribute_deprecated void(* destruct )(struct AVPacket *)
 
attribute_deprecated void * priv
 
int64_t pos
 byte position in stream, -1 if unknown More...
 
int64_t convergence_duration
 Time difference in AVStream->time_base units from the pts of this packet to the point at which the output from the decoder has converged independent from the availability of previous frames. More...
 

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

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 or destruct (deprecated) fields. If either is set, the packet data is dynamically allocated and is valid indefinitely until av_free_packet() is called (which in turn calls av_buffer_unref()/the destruct callback to free the data). If neither is set, the packet data is typically backed by some static buffer somewhere and is only valid for a limited time (e.g. until the next read call when demuxing).

The side data is always allocated with av_malloc() and is freed in av_free_packet().

Examples:
decoding_encoding.c, demuxing_decoding.c, filtering_audio.c, filtering_video.c, muxing.c, remuxing.c, transcode_aac.c, and transcoding.c.

Definition at line 1400 of file avcodec.h.

Field Documentation

AVBufferRef* AVPacket::buf

A reference to the reference-counted buffer where the packet data is stored.

May be NULL, then the packet data is not reference-counted.

Definition at line 1406 of file avcodec.h.

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.

Examples:
decoding_encoding.c, muxing.c, and remuxing.c.

Definition at line 1416 of file avcodec.h.

Referenced by audio_decode_example(), log_packet(), main(), and write_video_frame().

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.

Examples:
decoding_encoding.c, muxing.c, and remuxing.c.

Definition at line 1422 of file avcodec.h.

Referenced by audio_decode_example(), log_packet(), main(), and write_video_frame().

uint8_t* AVPacket::data
int AVPacket::size
int AVPacket::stream_index
int AVPacket::flags

A combination of AV_PKT_FLAG values.

Examples:
muxing.c.

Definition at line 1429 of file avcodec.h.

Referenced by write_video_frame().

AVPacketSideData* AVPacket::side_data

Additional packet data that can be provided by the container.

Packet can contain several types of side information.

Definition at line 1434 of file avcodec.h.

int AVPacket::side_data_elems

Definition at line 1435 of file avcodec.h.

int AVPacket::duration

Duration of this packet in AVStream->time_base units, 0 if unknown.

Equals next_pts - this_pts in presentation order.

Examples:
muxing.c, and remuxing.c.

Definition at line 1441 of file avcodec.h.

Referenced by log_packet(), and main().

attribute_deprecated void(* AVPacket::destruct)(struct AVPacket *)

Definition at line 1444 of file avcodec.h.

attribute_deprecated void* AVPacket::priv

Definition at line 1446 of file avcodec.h.

int64_t AVPacket::pos

byte position in stream, -1 if unknown

Examples:
remuxing.c.

Definition at line 1448 of file avcodec.h.

Referenced by main().

int64_t AVPacket::convergence_duration

Time difference in AVStream->time_base units from the pts of this packet to the point at which the output from the decoder has converged independent from the availability of previous frames.

That is, the frames are virtually identical no matter if decoding started from the very first frame or from this keyframe. Is AV_NOPTS_VALUE if unknown. This field is not the display duration of the current packet. This field has no meaning if the packet does not have AV_PKT_FLAG_KEY set.

The purpose of this field is to allow seeking in streams that have no keyframes in the conventional sense. It corresponds to the recovery point SEI in H.264 and match_time_delta in NUT. It is also essential for some types of subtitle streams to ensure that all subtitles are correctly displayed after seeking.

Definition at line 1467 of file avcodec.h.


The documentation for this struct was generated from the following file: