Libav
|
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 | |
AVPacket * | av_packet_alloc (void) |
Allocate an AVPacket and set its fields to default values. More... | |
AVPacket * | av_packet_clone (AVPacket *src) |
Create a new packet that references the same data as src. More... | |
void | av_packet_free (AVPacket **pkt) |
Free the packet, if the packet is reference counted, it will be unreferenced first. 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... | |
attribute_deprecated int | av_dup_packet (AVPacket *pkt) |
attribute_deprecated 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_add_side_data (AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size) |
Wrap an existing array as a packet side data. 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... | |
void | av_packet_free_side_data (AVPacket *pkt) |
Convenience function to free all the side data stored. More... | |
int | av_packet_ref (AVPacket *dst, 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 1378 of file avcodec.h.
Referenced by a64multi_encode_frame(), ape_tag_read_field(), asf_read_payload(), asf_read_picture(), asf_read_timestamp(), asf_write_packet(), avcodec_encode_audio2(), avfoundation_read_packet(), avi_read_packet(), avi_write_packet(), avpriv_dv_produce_packet(), avs_read_audio_packet(), avs_read_video_packet(), bmp_encode_frame(), cdxl_read_packet(), compute_pkt_fields(), dash_write_packet(), dc1394_read_common(), decode_frame(), dirac_gptopts(), dnxhd_encode_picture(), do_streamcopy(), dump_extradata(), dv_extract_audio_info(), dvvideo_encode_frame(), ea_read_packet(), encode_frame(), encode_picture_ls(), ff_flac_parse_picture(), ff_id3v2_parse_apic(), ff_mov_add_hinted_packet(), ff_mov_write_packet(), ff_mpv_encode_picture(), ff_qsv_encode(), ff_rm_parse_packet(), ff_rm_retrieve_cache(), ffv1_encode_frame(), flashsv_decode_frame(), flashsv_encode_frame(), flv_data_packet(), flv_read_packet(), flv_write_packet(), get_needed_flags(), gif_encode_frame(), h263_handle_packet(), hap_encode(), hds_write_packet(), hls_read_packet(), hls_write_packet(), idcin_read_packet(), iff_read_packet(), img_read_packet(), ism_write_packet(), libkvazaar_encode(), libopenjpeg_encode_frame(), libschroedinger_encode_frame(), libwebp_encode_frame(), libx265_encode_frame(), ljpeg_encode_frame(), lmlm4_read_packet(), lxf_read_packet(), main(), matroska_parse_block(), matroska_read_header(), mkv_write_packet(), mkv_write_packet_internal(), mov_create_chapter_track(), mov_parse_vc1_frame(), mov_read_covr(), mov_read_packet(), mov_write_packet(), mpeg_mux_write_packet(), mpegts_write_flush(), mpegts_write_packet_internal(), msnwc_tcp_read_packet(), mux_frames(), mv_read_packet(), nsv_read_chunk(), nut_write_packet(), nuv_packet(), nvenc_get_output(), ogg_read_packet(), ogg_read_timestamp(), ogg_write_packet_internal(), ogm_packet(), old_dirac_gptopts(), omx_encode_frame(), pam_encode_frame(), parse_packet(), pcx_encode_frame(), pkt_dump_internal(), pnm_encode_frame(), put_payload_header(), qt_rtp_parse_packet(), qtrle_encode_frame(), raw_encode(), read_frame(), read_frame_internal(), read_packet(), remove_extradata(), rm_write_audio(), rm_write_video(), roq_encode_frame(), rpl_read_packet(), seek_frame_generic(), seg_write_packet(), show_packet(), siff_read_packet(), smush_read_packet(), srt_read_packet(), storeframe(), sunrast_encode_frame(), svc_encode_frame(), svq1_encode_frame(), targa_encode_frame(), theora_gptopts(), tmv_read_packet(), utvideo_encode_frame(), v410_encode_frame(), vaapi_encode_output(), vc1t_read_packet(), vc1test_write_packet(), vid_read_packet(), vp8_gptopts(), vp8_handle_packet(), wrapped_avframe_encode(), X264_frame(), XAVS_frame(), xbm_encode_frame(), xmv_fetch_video_packet(), xvid_encode_frame(), xwd_encode_frame(), yop_read_packet(), and zerocodec_decode_frame().
#define AV_PKT_FLAG_CORRUPT 0x0002 |
The packet content is corrupted.
Definition at line 1379 of file avcodec.h.
Referenced by ff_read_packet(), handle_packet(), matroska_read_packet(), new_pes_packet(), oma_read_packet(), read_packet(), vorbis_packet(), and vp8_handle_packet().
enum AVPacketSideDataType |
Enumerator | |
---|---|
AV_PKT_DATA_PALETTE | |
AV_PKT_DATA_NEW_EXTRADATA | The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was changed and the receiving side should act upon it appropriately. The new extradata is embedded in the side data buffer and should be immediately used for processing the current frame or packet. |
AV_PKT_DATA_PARAM_CHANGE | An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: u32le param_flags if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) s32le channel_count if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) u64le channel_layout if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) s32le sample_rate if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) 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_QUALITY_FACTOR | This side data contains an integer value representing the quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad). |
AV_PKT_DATA_FALLBACK_TRACK | This side data contains an integer value representing the stream index of a "fallback" track. A fallback track indicates an alternate track to use when the current track can not be decoded for some reason. e.g. no decoder available for codec. |
AV_PKT_DATA_CPB_PROPERTIES | This side data corresponds to the AVCPBProperties struct. |
Allocate an AVPacket and set its fields to default values.
The resulting struct must be freed using av_packet_free().
Definition at line 49 of file avpacket.c.
Referenced by av_bsf_alloc(), av_packet_clone(), avcodec_open2(), and ff_bsf_get_packet().
Create a new packet that references the same data as src.
This is a shortcut for av_packet_alloc()+av_packet_ref().
Definition at line 388 of file avpacket.c.
Free the packet, if the packet is reference counted, it will be unreferenced first.
packet | packet to be freed. The pointer will be set to NULL. |
Definition at line 60 of file avpacket.c.
Referenced by aac_adtstoasc_filter(), av_bsf_free(), av_packet_clone(), avcodec_close(), avcodec_open2(), chomp_filter(), dump_extradata(), h264_mp4toannexb_filter(), hevc_mp4toannexb_filter(), imx_dump_header(), mjpeg2jpeg_filter(), mjpega_dump_header(), mov2textsub(), noise(), remove_extradata(), and text2movsub().
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 |
Definition at line 31 of file avpacket.c.
Referenced by asf_read_stream_properties(), asf_read_timestamp(), audio_decode_example(), audio_encode_example(), av_get_packet(), av_interleaved_write_frame(), av_new_packet(), av_packet_move_ref(), av_packet_unref(), avcodec_encode_audio2(), avcodec_encode_video2(), avformat_find_stream_info(), avi_write_packet(), avpriv_dv_produce_packet(), decode_thread(), do_audio_out(), do_streamcopy(), do_subtitle_out(), do_video_out(), dv_extract_audio_info(), encode_audio_frame(), encode_frame(), ff_alloc_packet(), ff_flac_parse_picture(), ff_id3v2_parse_apic(), ff_interleave_packet_per_dts(), ff_mov_add_hinted_packet(), ff_read_packet(), ff_rtp_finalize_packet(), ffmmal_decode(), flush_encoders(), hnm_read_header(), init_packet(), main(), matroska_read_header(), mkv_write_header(), mpegts_write_packet_internal(), mux_frames(), mxf_interleave_get_packet(), new_pes_packet(), parse_packet(), process_input_packet(), qt_rtp_parse_packet(), read_frame_internal(), reset_packet(), reset_packet_state(), rtp_mpegts_write_packet(), show_packets(), signal_init_ts(), sp5x_decode_frame(), tdsc_decode_jpeg_tile(), video_decode_example(), video_encode_example(), vp8_lossy_decode_frame(), wc3_read_header(), write_video_frame(), and xvid_encode_init().
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 |
Definition at line 84 of file avpacket.c.
Referenced by aac_parse_packet(), ac3_handle_packet(), amr_handle_packet(), amr_read_packet(), ape_read_packet(), asf_deinterleave(), asf_read_replicated_data(), asf_read_single_payload(), audio_read_packet(), av_grow_packet(), avfoundation_read_packet(), avisynth_read_packet_audio(), avisynth_read_packet_video(), avs_read_video_packet(), bmv_read_packet(), cdxl_read_packet(), cin_read_packet(), decode_frame(), dss_723_1_read_packet(), dss_sp_read_packet(), dump_extradata(), dxa_read_packet(), encode_frame(), fbdev_read_packet(), ff_alloc_packet(), ff_h263_handle_packet(), ff_h264_handle_aggregated_packet(), ff_h264_handle_frag_packet(), ff_raw_read_partial_packet(), ff_rm_retrieve_cache(), flic_read_packet(), fourxm_read_packet(), g723_1_read_packet(), grab_read_packet(), h264_handle_packet(), hevc_handle_packet(), ilbc_read_packet(), img_read_packet(), imx_dump_header(), ingenient_read_packet(), interleave_new_audio_packet(), latm_parse_packet(), load_ipmovie_packet(), lxf_read_packet(), matroska_parse_frame(), matroska_parse_rm_audio(), matroska_read_header(), mjpeg2jpeg_filter(), mjpega_dump_header(), mmap_read_frame(), mmf_read_packet(), mov2textsub(), mpa_robust_parse_packet(), mpc_read_packet(), mpeg_parse_packet(), mpegts_raw_read_packet(), noise(), nuv_packet(), ogg_read_packet(), pulse_read_packet(), qdm2_restore_block(), qt_rtp_parse_packet(), read_frame(), read_packet(), return_stored_frame(), rm_assemble_video_frame(), rm_read_audio_stream_info(), roq_read_packet(), rtp_parse_packet_internal(), seq_read_packet(), siff_read_packet(), smacker_read_packet(), spdif_read_packet(), srt_read_packet(), store_packet(), str_read_packet(), supply_new_packets(), svq1_encode_frame(), swf_read_packet(), text2movsub(), vaapi_encode_output(), videostream_cb(), vmd_read_packet(), vqf_read_packet(), wsaud_read_packet(), wsvqa_read_packet(), wv_read_packet(), xcbgrab_frame(), xiph_handle_packet(), xmv_fetch_video_packet(), xvid_encode_frame(), and yop_read_packet().
Reduce packet size, correctly zeroing padding.
pkt | packet |
size | new size |
Definition at line 99 of file avpacket.c.
Referenced by append_packet_chunked(), cdxl_read_packet(), cin_read_packet(), encode_frame(), hap_encode(), libopus_encode(), mxf_decrypt_triplet(), mxf_get_d10_aes3_packet(), nuv_packet(), twolame_encode_frame(), and yop_read_packet().
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 |
Definition at line 107 of file avpacket.c.
Referenced by alloc_and_copy(), append_packet_chunked(), encode_callback(), encode_frame(), hevc_mp4toannexb_filter(), matroska_merge_packets(), and wv_read_packet().
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 + AV_INPUT_BUFFER_PADDING_SIZE. |
Definition at line 135 of file avpacket.c.
Referenced by ff_rtp_finalize_packet(), omx_encode_frame(), and qt_rtp_parse_packet().
attribute_deprecated int av_dup_packet | ( | AVPacket * | pkt | ) |
Definition at line 180 of file avpacket.c.
attribute_deprecated void av_free_packet | ( | AVPacket * | pkt | ) |
Free a packet.
pkt | packet to free |
Definition at line 226 of file avpacket.c.
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 |
Definition at line 263 of file avpacket.c.
Referenced by aac_adtstoasc_filter(), av_packet_copy_props(), avi_read_packet(), dnxhd_encode_picture(), ff_add_param_change(), ff_mpv_encode_picture(), flac_encode_frame(), flv_read_packet(), idcin_read_packet(), load_ipmovie_packet(), mov_change_extradata(), mov_read_packet(), process_input(), read_frame(), svq1_encode_frame(), X264_frame(), XAVS_frame(), and xvid_encode_frame().
int av_packet_add_side_data | ( | AVPacket * | pkt, |
enum AVPacketSideDataType | type, | ||
uint8_t * | data, | ||
size_t | size | ||
) |
Wrap an existing array as a packet side data.
pkt | packet |
type | side information type |
data | the side data array. It must be allocated with the av_malloc() family of functions. The ownership of the data is transferred to pkt. |
size | side information size |
Definition at line 240 of file avpacket.c.
Referenced by av_packet_new_side_data(), and ff_mpv_encode_picture().
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 |
Definition at line 299 of file avpacket.c.
Referenced by ff_mpv_encode_picture().
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) |
Definition at line 284 of file avpacket.c.
Referenced by aac_decode_frame(), apply_param_change(), cinepak_decode_frame(), decode_frame(), ff_decode_frame_props(), flac_write_packet(), h264_decode_frame(), idcin_decode_frame(), ipvideo_decode_frame(), msrle_decode_frame(), msvideo1_decode_frame(), process_input(), qtrle_decode_frame(), raw_decode(), rtp_write_packet(), smc_decode_frame(), and write_packet().
Convenience function to free all the side data stored.
All the other fields stay untouched.
pkt | packet |
Definition at line 215 of file avpacket.c.
Referenced by av_free_packet(), av_packet_copy_props(), av_packet_ref(), and av_packet_unref().
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 |
Definition at line 356 of file avpacket.c.
Referenced by add_to_pktbuf(), av_packet_clone(), do_decode(), ff_interleave_add_packet(), ff_read_packet(), mkv_write_packet(), qsv_decode_frame(), submit_packet(), and svc_decode_frame().
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. |
Definition at line 347 of file avpacket.c.
Referenced by adx_read_packet(), amr_read_packet(), append_packet_chunked(), asf_deinterleave(), asf_read_close(), asf_read_picture(), asf_read_timestamp(), asfrtp_parse_packet(), audio_decode_frame(), audio_encode_example(), audio_read_packet(), av_bitstream_filter_filter(), av_dup_packet(), av_interleaved_write_frame(), av_packet_alloc(), av_packet_free(), av_write_trailer(), avcodec_encode_audio2(), avcodec_encode_video2(), avcodec_flush_buffers(), avcodec_receive_frame(), avcodec_receive_packet(), avconv_cleanup(), avformat_find_stream_info(), avi_read_close(), avi_read_packet(), avisynth_read_packet_audio(), avisynth_read_packet_video(), avs_read_video_packet(), cdxl_read_packet(), cin_read_packet(), decode_audio_frame(), decode_thread(), dfa_read_packet(), do_decode(), do_encode(), dss_723_1_read_packet(), dss_sp_read_packet(), dump_extradata(), dxa_read_packet(), ea_read_packet(), encode_audio_frame(), encode_frame(), encode_picture_ls(), estimate_timings_from_pts(), ff_frame_thread_free(), ff_interleave_add_packet(), ff_qsv_enc_close(), ff_qsv_encode(), ff_raw_read_partial_packet(), ff_read_packet(), ff_rm_free_rmstream(), flic_read_packet(), fourxm_read_packet(), free_input_threads(), free_packet_buffer(), free_pkt_fifo(), free_stream(), free_variant_list(), g723_1_read_packet(), gsm_read_packet(), h264_mp4toannexb_filter(), hevc_mp4toannexb_filter(), hls_read_packet(), hls_read_seek(), hnm_read_close(), idcin_read_packet(), ilbc_read_packet(), img_read_packet(), imx_dump_header(), ingenient_read_packet(), interleave_packet(), load_ipmovie_packet(), lxf_read_packet(), main(), matroska_clear_queue(), matroska_merge_packets(), mjpeg2jpeg_filter(), mjpega_dump_header(), mkv_write_packet(), mkv_write_trailer(), mmap_read_frame(), mmf_read_packet(), mov2textsub(), movie_get_frame(), mp3_queue_flush(), mpa_robust_parse_packet(), mpc_read_packet(), mpc_read_seek(), mpegts_raw_read_packet(), mxf_interleave_get_packet(), nc_read_packet(), noise(), nsv_read_close(), nuv_packet(), packet_queue_flush(), parse_packet(), process_input(), pulse_read_packet(), qsv_clear_buffers(), qsv_decode_frame(), qt_rtp_parse_packet(), read_frame_internal(), read_packet(), reset_packet(), reset_packet_state(), rl2_read_packet(), rm_assemble_video_frame(), rm_read_packet(), rpl_read_packet(), sap_fetch_packet(), seek_frame_generic(), seek_subtitle(), show_packets(), spdif_read_packet(), str_read_close(), str_read_packet(), stream_component_close(), submit_packet(), subtitle_thread(), svc_decode_close(), svc_decode_frame(), text2movsub(), thp_read_packet(), vfw_read_close(), video_encode_example(), video_thread(), vmd_read_packet(), vqf_read_packet(), wc3_read_close(), write_packet(), wsvqa_read_packet(), wv_read_packet(), wv_read_seek(), xiph_handle_packet(), xvid_encode_frame(), xvid_encode_init(), yop_read_close(), yop_read_packet(), and yop_read_seek().
Move every field in src to dst and reset src.
src | Source packet, will be reset |
dst | Destination packet |
Definition at line 401 of file avpacket.c.
Referenced by aac_adtstoasc_filter(), asf_read_packet(), av_bsf_send_packet(), avcodec_receive_packet(), chomp_filter(), dump_extradata(), h264_mp4toannexb_filter(), hevc_mp4toannexb_filter(), mjpega_dump_header(), qsv_decode_frame(), remove_extradata(), svc_decode_frame(), and write_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 |
Definition at line 315 of file avpacket.c.
Referenced by av_packet_ref(), dump_extradata(), ff_qsv_encode(), h264_mp4toannexb_filter(), hevc_mp4toannexb_filter(), imx_dump_header(), mjpeg2jpeg_filter(), mjpega_dump_header(), mov2textsub(), noise(), and text2movsub().
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 |
Definition at line 409 of file avpacket.c.
Referenced by encode_audio_frame(), write_packet(), and write_video_frame().