FFmpeg
2.5.7
|
Types and functions for working with AVPacket. More...
Data Structures | |
struct | AVPacketSideData |
struct | AVPacket |
This structure stores compressed data. More... | |
Macros | |
#define | AV_PKT_FLAG_KEY 0x0001 |
The packet contains a keyframe. More... | |
#define | AV_PKT_FLAG_CORRUPT 0x0002 |
The packet content is corrupted. More... | |
Functions | |
attribute_deprecated void | av_destruct_packet (AVPacket *pkt) |
Default packet destructor. More... | |
void | av_init_packet (AVPacket *pkt) |
Initialize optional fields of a packet with default values. More... | |
int | av_new_packet (AVPacket *pkt, int size) |
Allocate the payload of a packet and initialize its fields with default values. More... | |
void | av_shrink_packet (AVPacket *pkt, int size) |
Reduce packet size, correctly zeroing padding. More... | |
int | av_grow_packet (AVPacket *pkt, int grow_by) |
Increase packet size, correctly zeroing padding. More... | |
int | av_packet_from_data (AVPacket *pkt, uint8_t *data, int size) |
Initialize a reference-counted packet from av_malloc()ed data. More... | |
int | av_dup_packet (AVPacket *pkt) |
int | av_copy_packet (AVPacket *dst, const AVPacket *src) |
Copy packet, including contents. More... | |
int | av_copy_packet_side_data (AVPacket *dst, const AVPacket *src) |
Copy packet side data. More... | |
void | av_free_packet (AVPacket *pkt) |
Free a packet. More... | |
uint8_t * | av_packet_new_side_data (AVPacket *pkt, enum AVPacketSideDataType type, int size) |
Allocate new information of a packet. More... | |
int | av_packet_shrink_side_data (AVPacket *pkt, enum AVPacketSideDataType type, int size) |
Shrink the already allocated side data buffer. More... | |
uint8_t * | av_packet_get_side_data (AVPacket *pkt, enum AVPacketSideDataType type, int *size) |
Get side information from packet. More... | |
int | av_packet_merge_side_data (AVPacket *pkt) |
int | av_packet_split_side_data (AVPacket *pkt) |
uint8_t * | av_packet_pack_dictionary (AVDictionary *dict, int *size) |
Pack a dictionary for use in side_data. More... | |
int | av_packet_unpack_dictionary (const uint8_t *data, int size, AVDictionary **dict) |
Unpack a dictionary from side_data. More... | |
void | av_packet_free_side_data (AVPacket *pkt) |
Convenience function to free all the side data stored. More... | |
int | av_packet_ref (AVPacket *dst, const AVPacket *src) |
Setup a new reference to the data described by a given packet. More... | |
void | av_packet_unref (AVPacket *pkt) |
Wipe the packet. More... | |
void | av_packet_move_ref (AVPacket *dst, AVPacket *src) |
Move every field in src to dst and reset src. More... | |
int | av_packet_copy_props (AVPacket *dst, const AVPacket *src) |
Copy only "properties" fields from src to dst. More... | |
void | av_packet_rescale_ts (AVPacket *pkt, AVRational tb_src, AVRational tb_dst) |
Convert valid timing fields (timestamps / durations) in a packet from one timebase to another. More... | |
Types and functions for working with AVPacket.
#define AV_PKT_FLAG_KEY 0x0001 |
The packet contains a keyframe.
Definition at line 1196 of file avcodec.h.
Referenced by write_video_frame().
#define AV_PKT_FLAG_CORRUPT 0x0002 |
enum AVPacketSideDataType |
Enumerator | |
---|---|
AV_PKT_DATA_PALETTE | |
AV_PKT_DATA_NEW_EXTRADATA | |
AV_PKT_DATA_PARAM_CHANGE |
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: |
AV_PKT_DATA_H263_MB_INFO |
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblocks relevant to splitting the packet into smaller packets on macroblock edges (e.g. as for RFC 2190). That is, it does not necessarily contain info about all macroblocks, as long as the distance between macroblocks in the info is smaller than the target payload size. Each MB info structure is 12 bytes, and is laid out as follows: |
AV_PKT_DATA_REPLAYGAIN |
This side data should be associated with an audio stream and contains ReplayGain information in form of the AVReplayGain struct. |
AV_PKT_DATA_DISPLAYMATRIX |
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to be applied to the decoded video frames for correct presentation. See libavutil/display.h for a detailed description of the data. |
AV_PKT_DATA_STEREO3D |
This side data should be associated with a video stream and contains Stereoscopic 3D information in form of the AVStereo3D struct. |
AV_PKT_DATA_SKIP_SAMPLES |
Recommmends skipping the specified number of samples. |
AV_PKT_DATA_JP_DUALMONO |
An AV_PKT_DATA_JP_DUALMONO side data packet indicates that the packet may contain "dual mono" audio specific to Japanese DTV and if it is true, recommends only the selected channel to be used. |
AV_PKT_DATA_STRINGS_METADATA |
A list of zero terminated key/value strings. There is no end marker for the list, so it is required to rely on the side data size to stop. |
AV_PKT_DATA_SUBTITLE_POSITION |
Subtitle event position. |
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL |
Data found in BlockAdditional element of matroska container. There is no end marker for the data, so it is required to rely on the side data size to recognize the end. 8 byte id (as found in BlockAddId) followed by data. |
AV_PKT_DATA_WEBVTT_IDENTIFIER |
The optional first identifier line of a WebVTT cue. |
AV_PKT_DATA_WEBVTT_SETTINGS |
The optional settings (rendering instructions) that immediately follow the timestamp specifier of a WebVTT cue. |
AV_PKT_DATA_METADATA_UPDATE |
A list of zero terminated key/value strings. There is no end marker for the list, so it is required to rely on the side data size to stop. This side data includes updated metadata which appeared in the stream. |
attribute_deprecated void av_destruct_packet | ( | AVPacket * | pkt | ) |
Default packet destructor.
void av_init_packet | ( | AVPacket * | pkt | ) |
Initialize optional fields of a packet with default values.
Note, this does not touch the data and size members, which have to be initialized separately.
pkt | packet |
Referenced by audio_decode_example(), audio_encode_example(), encode_write_frame(), init_packet(), main(), video_decode_example(), video_encode_example(), write_audio_frame(), and write_video_frame().
int av_new_packet | ( | AVPacket * | pkt, |
int | size | ||
) |
Allocate the payload of a packet and initialize its fields with default values.
pkt | packet |
size | wanted payload size |
void av_shrink_packet | ( | AVPacket * | pkt, |
int | size | ||
) |
Reduce packet size, correctly zeroing padding.
pkt | packet |
size | new size |
int av_grow_packet | ( | AVPacket * | pkt, |
int | grow_by | ||
) |
Increase packet size, correctly zeroing padding.
pkt | packet |
grow_by | number of bytes by which to increase the size of the packet |
int av_packet_from_data | ( | AVPacket * | pkt, |
uint8_t * | data, | ||
int | size | ||
) |
Initialize a reference-counted packet from av_malloc()ed data.
pkt | packet to be initialized. This function will set the data, size, buf and destruct fields, all others are left untouched. |
data | Data allocated by av_malloc() to be used as packet data. If this function returns successfully, the data is owned by the underlying AVBuffer. The caller may not access the data through other means. |
size | size of data in bytes, without the padding. I.e. the full buffer size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE. |
int av_dup_packet | ( | AVPacket * | pkt | ) |
Copy packet, including contents.
Copy packet side data.
void av_free_packet | ( | AVPacket * | pkt | ) |
Free a packet.
pkt | packet to free |
Referenced by audio_encode_example(), decode_audio_frame(), encode_audio_frame(), main(), and video_encode_example().
uint8_t* av_packet_new_side_data | ( | AVPacket * | pkt, |
enum AVPacketSideDataType | type, | ||
int | size | ||
) |
Allocate new information of a packet.
pkt | packet |
type | side information type |
size | side information size |
int av_packet_shrink_side_data | ( | AVPacket * | pkt, |
enum AVPacketSideDataType | type, | ||
int | size | ||
) |
Shrink the already allocated side data buffer.
pkt | packet |
type | side information type |
size | new side information size |
uint8_t* av_packet_get_side_data | ( | AVPacket * | pkt, |
enum AVPacketSideDataType | type, | ||
int * | size | ||
) |
Get side information from packet.
pkt | packet |
type | desired side information type |
size | pointer for side information size to store (optional) |
int av_packet_merge_side_data | ( | AVPacket * | pkt | ) |
int av_packet_split_side_data | ( | AVPacket * | pkt | ) |
uint8_t* av_packet_pack_dictionary | ( | AVDictionary * | dict, |
int * | size | ||
) |
Pack a dictionary for use in side_data.
dict | The dictionary to pack. |
size | pointer to store the size of the returned data |
int av_packet_unpack_dictionary | ( | const uint8_t * | data, |
int | size, | ||
AVDictionary ** | dict | ||
) |
Unpack a dictionary from side_data.
data | data from side_data |
size | size of the data |
dict | the metadata storage dictionary |
void av_packet_free_side_data | ( | AVPacket * | pkt | ) |
Convenience function to free all the side data stored.
All the other fields stay untouched.
pkt | packet |
Setup a new reference to the data described by a given packet.
If src is reference-counted, setup dst as a new reference to the buffer in src. Otherwise allocate a new buffer in dst and copy the data from src into it.
All the other fields are copied from src.
dst | Destination packet |
src | Source packet |
void av_packet_unref | ( | AVPacket * | pkt | ) |
Wipe the packet.
Unreference the buffer referenced by the packet and reset the remaining packet fields to their default values.
pkt | The packet to be unreferenced. |
Move every field in src to dst and reset src.
src | Source packet, will be reset |
dst | Destination packet |
Copy only "properties" fields from src to dst.
Properties for the purpose of this function are all the fields beside those related to the packet data (buf, data, size)
dst | Destination packet |
src | Source packet |
void av_packet_rescale_ts | ( | AVPacket * | pkt, |
AVRational | tb_src, | ||
AVRational | tb_dst | ||
) |
Convert valid timing fields (timestamps / durations) in a packet from one timebase to another.
Timestamps with unknown values (AV_NOPTS_VALUE) will be ignored.
pkt | packet on which the conversion will be performed |
tb_src | source timebase, in which the timing fields in pkt are expressed |
tb_dst | destination timebase, to which the timing fields will be converted |
Referenced by encode_write_frame(), main(), write_frame(), and write_video_frame().