FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions

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

Enumerations

enum  AVPacketSideDataType {
  AV_PKT_DATA_PALETTE, AV_PKT_DATA_NEW_EXTRADATA, AV_PKT_DATA_PARAM_CHANGE, AV_PKT_DATA_H263_MB_INFO,
  AV_PKT_DATA_REPLAYGAIN, AV_PKT_DATA_DISPLAYMATRIX, AV_PKT_DATA_STEREO3D, AV_PKT_DATA_AUDIO_SERVICE_TYPE,
  AV_PKT_DATA_SKIP_SAMPLES =70, AV_PKT_DATA_JP_DUALMONO, AV_PKT_DATA_STRINGS_METADATA, AV_PKT_DATA_SUBTITLE_POSITION,
  AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, AV_PKT_DATA_WEBVTT_IDENTIFIER, AV_PKT_DATA_WEBVTT_SETTINGS, AV_PKT_DATA_METADATA_UPDATE
}
 
enum  AVSideDataParamChangeFlags { AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008 }
 

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_tav_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_tav_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)
 
const char * av_packet_side_data_name (enum AVPacketSideDataType type)
 
uint8_tav_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...
 

Detailed Description

Types and functions for working with AVPacket.

Macro Definition Documentation

#define AV_PKT_FLAG_KEY   0x0001

The packet contains a keyframe.

Examples:
muxing.c.

Definition at line 1208 of file avcodec.h.

Referenced by a64multi_encode_frame(), ape_tag_read_field(), apng_read_packet(), asf_parse_packet(), asf_read_picture(), asf_read_pts(), asf_write_packet(), av_read_frame(), avcodec_encode_audio(), avcodec_encode_audio2(), avcodec_encode_video(), avf_read_packet(), avi_write_packet(), avpriv_dv_produce_packet(), avs_read_audio_packet(), avs_read_video_packet(), avui_encode_frame(), bmp_encode_frame(), cdxl_read_packet(), cine_read_packet(), cinepak_encode_frame(), compute_pkt_fields(), dash_write_packet(), dc1394_read_common(), decode_frame(), decode_frame_common(), dirac_gptopts(), dnxhd_encode_picture(), do_streamcopy(), do_video_out(), dv_extract_audio_info(), dvvideo_encode_frame(), ea_read_packet(), encode_apng(), encode_frame(), encode_picture_ls(), encode_png(), ff_flac_parse_picture(), ff_id3v2_parse_apic(), ff_img_read_packet(), ff_mov_add_hinted_packet(), ff_mov_write_packet(), ff_mpv_encode_picture(), ff_rm_parse_packet(), ff_rm_retrieve_cache(), ff_subtitles_queue_insert(), ffm_read_packet(), ffm_write_packet(), ffmmal_add_packet(), filter_packet(), flashsv2_encode_frame(), flashsv_decode_frame(), flashsv_encode_frame(), flv_data_packet(), flv_read_packet(), flv_write_packet(), framecrc_write_packet(), get_attachment(), get_needed_flags(), gif_encode_frame(), gif_read_packet(), h263_handle_packet(), hds_write_packet(), hls_read_packet(), hls_write_packet(), http_prepare_data(), idcin_read_packet(), iff_read_packet(), ism_write_packet(), libopenjpeg_encode_frame(), libschroedinger_encode_frame(), libwebp_anim_encode_frame(), libwebp_encode_frame(), libx265_encode_frame(), ljpeg_encode_frame(), lmlm4_read_packet(), lvf_read_packet(), lxf_read_packet(), main(), matroska_parse_block(), matroska_read_header(), mkv_write_packet(), mkv_write_packet_internal(), modplug_read_packet(), mov_create_chapter_track(), mov_create_timecode_track(), mov_parse_vc1_frame(), mov_read_covr(), mov_read_packet(), mov_write_single_packet(), mpeg_mux_write_packet(), mpegts_write_flush(), mpegts_write_packet_internal(), msnwc_tcp_read_packet(), mv_read_packet(), nsv_read_chunk(), nut_read_packet(), nut_write_packet(), nuv_packet(), ogg_read_packet(), ogg_read_timestamp(), ogg_validate_keyframe(), ogg_write_packet_internal(), ogm_packet(), old_dirac_gptopts(), pam_encode_frame(), parse_packet(), pcx_encode_frame(), pkt_dump_internal(), pnm_encode_frame(), process_output_surface(), prores_encode_frame(), put_payload_header(), qt_rtp_parse_packet(), qtkit_read_packet(), qtrle_encode_frame(), raw_encode(), read_frame(), read_frame_internal(), read_packet(), rm_write_audio(), rm_write_video(), roq_encode_frame(), rpl_read_packet(), sdr2_read_packet(), seek_frame_generic(), seg_write_packet(), show_packet(), siff_read_packet(), smush_read_packet(), Stagefright_decode_frame(), storeframe(), sunrast_encode_frame(), sup_read_packet(), svc_encode_frame(), svq1_encode_frame(), targa_encode_frame(), theora_gptopts(), tmv_read_packet(), utvideo_encode_frame(), v308_encode_frame(), v408_encode_frame(), v410_encode_frame(), vc1t_read_packet(), vc1test_write_packet(), vid_read_packet(), decklink_input_callback::VideoInputFrameArrived(), vp8_gptopts(), vp8_handle_packet(), webm_clusters_start_with_keyframe(), write_frame(), write_timestamp(), write_video_frame(), X264_frame(), XAVS_frame(), xbm_encode_frame(), xface_encode_frame(), xmv_fetch_video_packet(), xvid_encode_frame(), xwd_encode_frame(), y41p_encode_frame(), yop_read_packet(), yuv4_encode_frame(), and zerocodec_decode_frame().

#define AV_PKT_FLAG_CORRUPT   0x0002

Enumeration Type Documentation

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:

u32le param_flags
s32le channel_count
u64le channel_layout
s32le width
s32le height
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:

u32le bit offset from the start of the packet
u8 current quantizer at the start of the macroblock
u8 GOB number
u16le macroblock address within the GOB
u8 horizontal MV predictor
u8 vertical MV predictor
u8 horizontal MV predictor for block number 3
u8 vertical MV predictor for block number 3
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_AUDIO_SERVICE_TYPE 

This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.

AV_PKT_DATA_SKIP_SAMPLES 

Recommmends skipping the specified number of samples.

u32le number of samples to skip from start of this packet
u32le number of samples to skip from end of this packet
u8 reason for start skip
u8 reason for end skip (0=padding silence, 1=convergence)
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.

u8 selected channels (0=mail/left, 1=sub/right, 2=both)
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.

u32le x1
u32le y1
u32le x2
u32le y2
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.

Definition at line 977 of file avcodec.h.

Enumerator
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT 
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT 
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE 
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS 

Definition at line 1211 of file avcodec.h.

Function Documentation

attribute_deprecated void av_destruct_packet ( AVPacket pkt)

Default packet destructor.

Deprecated:
use the AVBuffer API instead

Definition at line 35 of file avpacket.c.

Referenced by iec61883_parse_queue_dv(), and read_packet().

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.

Parameters
pktpacket
Examples:
decoding_encoding.c, demuxing_decoding.c, muxing.c, transcode_aac.c, and transcoding.c.

Definition at line 49 of file avpacket.c.

Referenced by audio_decode_example(), audio_encode_example(), av_get_packet(), av_interleaved_write_frame(), av_new_packet(), av_packet_move_ref(), av_packet_unref(), av_write_uncoded_frame_internal(), avcodec_encode_audio(), avcodec_encode_audio2(), avcodec_encode_video(), avcodec_encode_video2(), avformat_find_stream_info(), avpriv_dv_produce_packet(), dc1394_read_common(), do_audio_out(), do_streamcopy(), do_subtitle_out(), do_video_out(), dv_extract_audio_info(), encode_frame(), encode_write_frame(), ff_alloc_packet2(), ff_flac_parse_picture(), ff_id3v2_parse_apic(), ff_interleave_packet_per_dts(), ff_load_image(), ff_mov_add_hinted_packet(), ff_read_packet(), ff_rtp_finalize_packet(), filter(), filter_frame(), flac_read_timestamp(), flush_encoders(), hnm_read_header(), init_packet(), lavfi_read_packet(), main(), matroska_read_header(), mkv_write_header(), mov_write_subtitle_end_packet(), movie_push_frame(), mpegts_get_dts(), mpegts_write_packet_internal(), mxf_interleave_get_packet(), new_pes_packet(), packet_queue_put_nullpacket(), parse_packet(), process_input_packet(), qt_rtp_parse_packet(), read_frame_internal(), read_interval_packets(), reset_packet(), rtp_mpegts_write_packet(), run_test(), sp5x_decode_frame(), tdsc_decode_jpeg_tile(), v4l2_read_packet(), video_decode_example(), video_encode_example(), decklink_input_callback::VideoInputFrameArrived(), vp8_lossy_decode_frame(), wc3_read_header(), worker(), write_audio_frame(), write_skip_frames(), write_video_frame(), and x11grab_read_packet().

int av_new_packet ( AVPacket pkt,
int  size 
)

Allocate the payload of a packet and initialize its fields with default values.

Parameters
pktpacket
sizewanted payload size
Returns
0 if OK, AVERROR_xxx otherwise

Definition at line 83 of file avpacket.c.

Referenced by aac_parse_packet(), ac3_handle_packet(), amr_handle_packet(), amr_read_packet(), ape_read_packet(), asf_parse_packet(), audio_read_packet(), av_grow_packet(), avf_read_packet(), avisynth_read_packet_audio(), avisynth_read_packet_video(), avs_read_video_packet(), bmv_read_packet(), callback(), cdxl_read_packet(), cin_read_packet(), create_subcc_packet(), decode_frame(), dss_723_1_read_packet(), dss_sp_read_packet(), dxa_read_packet(), fbdev_read_packet(), ff_alloc_packet2(), ff_h263_handle_packet(), ff_h264_handle_aggregated_packet(), ff_h264_handle_frag_packet(), ff_img_read_packet(), ff_raw_read_partial_packet(), ff_rm_retrieve_cache(), ff_spdif_read_packet(), ff_subtitles_queue_insert(), ffm_read_packet(), flic_read_packet(), fourxm_read_packet(), g723_1_read_packet(), gdigrab_read_packet(), grab_read_packet(), h264_handle_packet(), hevc_handle_packet(), iff_read_packet(), ilbc_read_packet(), interleave_new_audio_packet(), latm_parse_packet(), lavfi_read_packet(), load_ipmovie_packet(), lxf_read_packet(), matroska_parse_frame(), matroska_parse_rm_audio(), matroska_parse_webvtt(), matroska_read_header(), mmap_read_frame(), modplug_read_packet(), mpa_robust_parse_packet(), mpc_read_packet(), mpeg_parse_packet(), mpegts_raw_read_packet(), nut_read_packet(), nuv_packet(), ogg_read_packet(), pulse_read_packet(), qdm2_restore_block(), qt_rtp_parse_packet(), qtkit_read_packet(), read_frame(), read_packet(), read_packet_gme(), recode_subtitle(), return_stored_frame(), rm_assemble_video_frame(), rm_read_audio_stream_info(), roq_read_packet(), rtp_parse_packet_internal(), sbg_read_packet(), sdr2_read_packet(), seq_read_packet(), siff_read_packet(), smacker_read_packet(), store_packet(), str_read_packet(), supply_new_packets(), swf_read_packet(), videostream_cb(), vmd_read_packet(), vqf_read_packet(), wsaud_read_packet(), wv_read_packet(), xcbgrab_frame(), xiph_handle_packet(), and yop_read_packet().

void av_shrink_packet ( AVPacket pkt,
int  size 
)
int av_grow_packet ( AVPacket pkt,
int  grow_by 
)

Increase packet size, correctly zeroing padding.

Parameters
pktpacket
grow_bynumber of bytes by which to increase the size of the packet

Definition at line 111 of file avpacket.c.

Referenced by append_packet_chunked(), encode_callback(), encode_frame(), ff_subtitles_queue_insert(), and wv_read_packet().

int av_packet_from_data ( AVPacket pkt,
uint8_t data,
int  size 
)

Initialize a reference-counted packet from av_malloc()ed data.

Parameters
pktpacket to be initialized. This function will set the data, size, buf and destruct fields, all others are left untouched.
dataData 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.
sizesize of data in bytes, without the padding. I.e. the full buffer size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE.
Returns
0 on success, a negative AVERROR on error

Definition at line 144 of file avpacket.c.

Referenced by ff_rtp_finalize_packet(), and qt_rtp_parse_packet().

int av_dup_packet ( AVPacket pkt)
Warning
This is a hack - the packet memory allocation stuff is broken. The packet is allocated if it was not really allocated.

Definition at line 248 of file avpacket.c.

Referenced by av_read_frame(), avcodec_encode_audio2(), avcodec_encode_video2(), avformat_find_stream_info(), avpacket_queue_put(), ff_interleave_add_packet(), mkv_write_packet(), packet_queue_put(), parse_packet(), tee_write_packet(), worker(), and write_packet().

int av_copy_packet ( AVPacket dst,
const AVPacket src 
)

Copy packet, including contents.

Returns
0 on success, negative AVERROR on fail

Definition at line 265 of file avpacket.c.

Referenced by aiff_write_packet(), apng_write_packet(), ff_subtitles_queue_read_packet(), filter_packet(), flush_packet(), gif_write_packet(), read_thread(), tee_write_packet(), webp_write_packet(), and write_packet().

int av_copy_packet_side_data ( AVPacket dst,
const AVPacket src 
)

Copy packet side data.

Returns
0 on success, negative AVERROR on fail

Definition at line 223 of file avpacket.c.

Referenced by copy_packet_data(), and mkv_write_packet().

void av_free_packet ( AVPacket pkt)

Free a packet.

Parameters
pktpacket to free
Examples:
decoding_encoding.c, demuxing_decoding.c, filtering_audio.c, filtering_video.c, remuxing.c, transcode_aac.c, and transcoding.c.

Definition at line 280 of file avpacket.c.

Referenced by adp_read_packet(), adx_read_packet(), aiff_write_trailer(), amr_read_packet(), ape_read_packet(), append_packet_chunked(), asf_parse_packet(), asf_read_header(), asf_read_picture(), asf_read_pts(), asf_reset_header(), asfrtp_parse_packet(), audio_encode_example(), audio_read_packet(), av_copy_packet_side_data(), av_interleaved_write_frame(), av_packet_merge_side_data(), av_write_trailer(), avcodec_decode_subtitle2(), avcodec_encode_audio2(), avcodec_encode_video2(), avi_read_close(), avpacket_queue_flush(), avs_read_video_packet(), cdxl_read_packet(), cin_read_packet(), copy_packet_data(), decode_audio_frame(), decode_frame(), decoder_decode_frame(), decoder_destroy(), dfa_read_packet(), dshow_read_close(), dss_723_1_read_packet(), dss_sp_read_packet(), dxa_read_packet(), ea_read_packet(), encode_audio_frame(), encode_frame(), encode_picture_ls(), estimate_timings_from_pts(), extract_mpeg4_header(), ff_free_stream(), ff_img_read_packet(), ff_load_image(), ff_raw_read_partial_packet(), ff_read_packet(), ff_rm_free_rmstream(), ff_spdif_read_packet(), ff_subtitles_queue_clean(), ffm_read_packet(), filter_packet(), flac_read_timestamp(), flic_read_packet(), flush(), flush_encoders(), flush_packet(), fourxm_read_packet(), free_packet_buffer(), free_pkt_fifo(), free_playlist_list(), g723_1_read_packet(), gsm_read_packet(), hls_read_packet(), hls_read_seek(), hnm_read_close(), http_prepare_data(), idcin_read_packet(), iff_read_packet(), ilbc_read_packet(), interleave_packet(), libopus_encode(), load_ipmovie_packet(), lxf_read_packet(), main(), matroska_clear_queue(), matroska_parse_frame(), mkv_write_packet(), mkv_write_trailer(), mmap_read_frame(), modplug_read_packet(), mov_write_eac3_tag(), mov_write_subtitle_end_packet(), movie_push_frame(), mp3_queue_flush(), mpa_robust_parse_packet(), mpc_read_packet(), mpc_read_seek(), mpegts_get_dts(), mpegts_raw_read_packet(), mpegts_read_packet(), mxf_interleave_get_packet(), nc_read_packet(), nsv_read_close(), nuv_packet(), ogg_read_packet(), packet_queue_flush(), packet_queue_put(), parse_packet(), process_input(), qt_rtp_parse_packet(), read_frame_internal(), read_interval_packets(), read_packet(), read_thread(), recode_subtitle(), redspark_read_packet(), rl2_read_packet(), rm_assemble_video_frame(), rm_read_packet(), rpl_read_packet(), rsd_read_packet(), run_test(), sap_fetch_packet(), sdr2_read_packet(), seek_frame_generic(), seek_subtitle(), siff_read_packet(), storeframe(), str_read_close(), str_read_packet(), swf_read_packet(), thp_read_packet(), vfw_read_close(), video_encode_example(), vivo_read_packet(), vmd_read_packet(), vqf_read_packet(), wc3_read_close(), write_frame(), write_packet(), write_trailer(), wv_read_packet(), xiph_handle_packet(), xvid_encode_frame(), yop_read_close(), yop_read_packet(), and yop_read_seek().

uint8_t* av_packet_new_side_data ( AVPacket pkt,
enum AVPacketSideDataType  type,
int  size 
)
int av_packet_shrink_side_data ( AVPacket pkt,
enum AVPacketSideDataType  type,
int  size 
)

Shrink the already allocated side data buffer.

Parameters
pktpacket
typeside information type
sizenew side information size
Returns
0 on success, < 0 on failure

Definition at line 506 of file avpacket.c.

Referenced by ff_mpv_encode_picture().

uint8_t* av_packet_get_side_data ( AVPacket pkt,
enum AVPacketSideDataType  type,
int *  size 
)
int av_packet_merge_side_data ( AVPacket pkt)

Definition at line 364 of file avpacket.c.

Referenced by avcodec_encode_video2(), read_frame_internal(), and write_packet().

int av_packet_split_side_data ( AVPacket pkt)
const char* av_packet_side_data_name ( enum AVPacketSideDataType  type)

Definition at line 339 of file avpacket.c.

Referenced by show_packet(), and show_stream().

uint8_t* av_packet_pack_dictionary ( AVDictionary dict,
int *  size 
)

Pack a dictionary for use in side_data.

Parameters
dictThe dictionary to pack.
sizepointer to store the size of the returned data
Returns
pointer to data if successful, NULL otherwise

Definition at line 446 of file avpacket.c.

Referenced by vorbis_update_metadata().

int av_packet_unpack_dictionary ( const uint8_t data,
int  size,
AVDictionary **  dict 
)

Unpack a dictionary from side_data.

Parameters
datadata from side_data
sizesize of the data
dictthe metadata storage dictionary
Returns
0 on success, < 0 on failure

Definition at line 481 of file avpacket.c.

Referenced by add_metadata_from_side_data().

void av_packet_free_side_data ( AVPacket pkt)

Convenience function to free all the side data stored.

All the other fields stay untouched.

Parameters
pktpacket

Definition at line 271 of file avpacket.c.

Referenced by av_free_packet(), av_packet_copy_props(), av_packet_ref(), av_packet_unref(), avcodec_decode_subtitle2(), avcodec_decode_video2(), and avcodec_encode_audio().

int av_packet_ref ( AVPacket dst,
const AVPacket src 
)

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.

See Also
av_packet_unref
Parameters
dstDestination packet
srcSource packet
Returns
0 on success, a negative AVERROR on error.

Definition at line 559 of file avpacket.c.

Referenced by qsv_decode_frame(), and submit_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.

Parameters
pktThe packet to be unreferenced.
Examples:
qsvdec.c.

Definition at line 550 of file avpacket.c.

Referenced by av_interleaved_write_frame(), avformat_find_stream_info(), avisynth_read_packet_audio(), avisynth_read_packet_video(), concat_read_packet(), ff_frame_thread_free(), filter_packet(), lavfi_read_packet(), main(), qsv_clear_buffers(), qsv_decode_frame(), and submit_packet().

void av_packet_move_ref ( AVPacket dst,
AVPacket src 
)

Move every field in src to dst and reset src.

See Also
av_packet_unref
Parameters
srcSource packet, will be reset
dstDestination packet

Definition at line 588 of file avpacket.c.

int av_packet_copy_props ( AVPacket dst,
const AVPacket src 
)

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)

Parameters
dstDestination packet
srcSource packet
Returns
0 on success AVERROR on failure.

Definition at line 522 of file avpacket.c.

Referenced by av_packet_ref().

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.

Parameters
pktpacket on which the conversion will be performed
tb_srcsource timebase, in which the timing fields in pkt are expressed
tb_dstdestination timebase, to which the timing fields will be converted
Examples:
muxing.c, and transcoding.c.

Definition at line 594 of file avpacket.c.

Referenced by do_audio_out(), do_video_out(), encode_write_frame(), flush_encoders(), main(), write_frame(), and write_video_frame().