FFmpeg
Modules | Files | Data Structures | Macros | Enumerations | Functions

Modules

 AV_FRAME_FLAGS
 

Files

file  frame.h
 

Data Structures

struct  AVFrameSideData
 Structure to hold side data for an AVFrame. More...
 
struct  AVSideDataDescriptor
 This struct describes the properties of a side data type. More...
 
struct  AVRegionOfInterest
 Structure describing a single Region Of Interest. More...
 
struct  AVFrame
 This structure describes decoded (raw) audio or video data. More...
 

Macros

#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE   (1 << 0)
 Remove existing entries before adding new ones. More...
 
#define AV_FRAME_SIDE_DATA_FLAG_REPLACE   (1 << 1)
 Don't add a new entry if another of the same type exists. More...
 

Enumerations

enum  AVFrameSideDataType {
  AV_FRAME_DATA_PANSCAN, AV_FRAME_DATA_A53_CC, AV_FRAME_DATA_STEREO3D, AV_FRAME_DATA_MATRIXENCODING,
  AV_FRAME_DATA_DOWNMIX_INFO, AV_FRAME_DATA_REPLAYGAIN, AV_FRAME_DATA_DISPLAYMATRIX, AV_FRAME_DATA_AFD,
  AV_FRAME_DATA_MOTION_VECTORS, AV_FRAME_DATA_SKIP_SAMPLES, AV_FRAME_DATA_AUDIO_SERVICE_TYPE, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA,
  AV_FRAME_DATA_GOP_TIMECODE, AV_FRAME_DATA_SPHERICAL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_ICC_PROFILE,
  AV_FRAME_DATA_S12M_TIMECODE, AV_FRAME_DATA_DYNAMIC_HDR_PLUS, AV_FRAME_DATA_REGIONS_OF_INTEREST, AV_FRAME_DATA_VIDEO_ENC_PARAMS,
  AV_FRAME_DATA_SEI_UNREGISTERED, AV_FRAME_DATA_FILM_GRAIN_PARAMS, AV_FRAME_DATA_DETECTION_BBOXES, AV_FRAME_DATA_DOVI_RPU_BUFFER,
  AV_FRAME_DATA_DOVI_METADATA, AV_FRAME_DATA_DYNAMIC_HDR_VIVID, AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT, AV_FRAME_DATA_VIDEO_HINT,
  AV_FRAME_DATA_LCEVC, AV_FRAME_DATA_VIEW_ID
}
 
enum  AVActiveFormatDescription {
  AV_AFD_SAME = 8, AV_AFD_4_3 = 9, AV_AFD_16_9 = 10, AV_AFD_14_9 = 11,
  AV_AFD_4_3_SP_14_9 = 13, AV_AFD_16_9_SP_14_9 = 14, AV_AFD_SP_4_3 = 15
}
 
enum  AVSideDataProps { AV_SIDE_DATA_PROP_GLOBAL = (1 << 0), AV_SIDE_DATA_PROP_MULTI = (1 << 1) }
 
enum  { AV_FRAME_CROP_UNALIGNED = 1 << 0 }
 Flags for frame cropping. More...
 

Functions

AVFrameav_frame_alloc (void)
 Allocate an AVFrame and set its fields to default values. More...
 
void av_frame_free (AVFrame **frame)
 Free the frame and any dynamically allocated objects in it, e.g. More...
 
int av_frame_ref (AVFrame *dst, const AVFrame *src)
 Set up a new reference to the data described by the source frame. More...
 
int av_frame_replace (AVFrame *dst, const AVFrame *src)
 Ensure the destination frame refers to the same data described by the source frame, either by creating a new reference for each AVBufferRef from src if they differ from those in dst, by allocating new buffers and copying data if src is not reference counted, or by unrefencing it if src is empty. More...
 
AVFrameav_frame_clone (const AVFrame *src)
 Create a new frame that references the same data as src. More...
 
void av_frame_unref (AVFrame *frame)
 Unreference all the buffers referenced by frame and reset the frame fields. More...
 
void av_frame_move_ref (AVFrame *dst, AVFrame *src)
 Move everything contained in src to dst and reset src. More...
 
int av_frame_get_buffer (AVFrame *frame, int align)
 Allocate new buffer(s) for audio or video data. More...
 
int av_frame_is_writable (AVFrame *frame)
 Check if the frame data is writable. More...
 
int av_frame_make_writable (AVFrame *frame)
 Ensure that the frame data is writable, avoiding data copy if possible. More...
 
int av_frame_copy (AVFrame *dst, const AVFrame *src)
 Copy the frame data from src to dst. More...
 
int av_frame_copy_props (AVFrame *dst, const AVFrame *src)
 Copy only "metadata" fields from src to dst. More...
 
AVBufferRefav_frame_get_plane_buffer (const AVFrame *frame, int plane)
 Get the buffer reference a given data plane is stored in. More...
 
AVFrameSideDataav_frame_new_side_data (AVFrame *frame, enum AVFrameSideDataType type, size_t size)
 Add a new side data to a frame. More...
 
AVFrameSideDataav_frame_new_side_data_from_buf (AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef *buf)
 Add a new side data to a frame from an existing AVBufferRef. More...
 
AVFrameSideDataav_frame_get_side_data (const AVFrame *frame, enum AVFrameSideDataType type)
 
void av_frame_remove_side_data (AVFrame *frame, enum AVFrameSideDataType type)
 Remove and free all side data instances of the given type. More...
 
int av_frame_apply_cropping (AVFrame *frame, int flags)
 Crop the given video AVFrame according to its crop_left/crop_top/crop_right/ crop_bottom fields. More...
 
const char * av_frame_side_data_name (enum AVFrameSideDataType type)
 
const AVSideDataDescriptorav_frame_side_data_desc (enum AVFrameSideDataType type)
 
void av_frame_side_data_free (AVFrameSideData ***sd, int *nb_sd)
 Free all side data entries and their contents, then zeroes out the values which the pointers are pointing to. More...
 
AVFrameSideDataav_frame_side_data_new (AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type, size_t size, unsigned int flags)
 Add new side data entry to an array. More...
 
AVFrameSideDataav_frame_side_data_add (AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type, AVBufferRef **buf, unsigned int flags)
 Add a new side data entry to an array from an existing AVBufferRef. More...
 
int av_frame_side_data_clone (AVFrameSideData ***sd, int *nb_sd, const AVFrameSideData *src, unsigned int flags)
 Add a new side data entry to an array based on existing side data, taking a reference towards the contained AVBufferRef. More...
 
const AVFrameSideDataav_frame_side_data_get_c (const AVFrameSideData *const *sd, const int nb_sd, enum AVFrameSideDataType type)
 Get a side data entry of a specific type from an array. More...
 
static const AVFrameSideDataav_frame_side_data_get (AVFrameSideData *const *sd, const int nb_sd, enum AVFrameSideDataType type)
 Wrapper around av_frame_side_data_get_c() to workaround the limitation that for any type T the conversion from T * const * to const T * const * is not performed automatically in C. More...
 
void av_frame_side_data_remove (AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type)
 Remove and free all side data instances of the given type from an array. More...
 

Detailed Description

AVFrame is an abstraction for reference-counted raw multimedia data.

Macro Definition Documentation

◆ AV_FRAME_SIDE_DATA_FLAG_UNIQUE

#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE   (1 << 0)

Remove existing entries before adding new ones.

Definition at line 1061 of file frame.h.

◆ AV_FRAME_SIDE_DATA_FLAG_REPLACE

#define AV_FRAME_SIDE_DATA_FLAG_REPLACE   (1 << 1)

Don't add a new entry if another of the same type exists.

Applies only for side data types without the AV_SIDE_DATA_PROP_MULTI prop.

Definition at line 1066 of file frame.h.

Enumeration Type Documentation

◆ AVFrameSideDataType

Enumerator
AV_FRAME_DATA_PANSCAN 

The data is the AVPanScan struct defined in libavcodec.

AV_FRAME_DATA_A53_CC 

ATSC A53 Part 4 Closed Captions.

A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. The number of bytes of CC data is AVFrameSideData.size.

AV_FRAME_DATA_STEREO3D 

Stereoscopic 3d metadata.

The data is the AVStereo3D struct defined in libavutil/stereo3d.h.

AV_FRAME_DATA_MATRIXENCODING 

The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.

AV_FRAME_DATA_DOWNMIX_INFO 

Metadata relevant to a downmix procedure.

The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.

AV_FRAME_DATA_REPLAYGAIN 

ReplayGain information in the form of the AVReplayGain struct.

AV_FRAME_DATA_DISPLAYMATRIX 

This side data contains a 3x3 transformation matrix describing an affine transformation that needs to be applied to the frame for correct presentation.

See libavutil/display.h for a detailed description of the data.

AV_FRAME_DATA_AFD 

Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using AVActiveFormatDescription enum.

AV_FRAME_DATA_MOTION_VECTORS 

Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec AVCodecContext flags2 option).

The data is the AVMotionVector struct defined in libavutil/motion_vector.h.

AV_FRAME_DATA_SKIP_SAMPLES 

Recommmends skipping the specified number of samples.

This is exported only if the "skip_manual" AVOption is set in libavcodec. This has the same format as AV_PKT_DATA_SKIP_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_FRAME_DATA_AUDIO_SERVICE_TYPE 

This side data must be associated with an audio frame and corresponds to enum AVAudioServiceType defined in avcodec.h.

AV_FRAME_DATA_MASTERING_DISPLAY_METADATA 

Mastering display metadata associated with a video frame.

The payload is an AVMasteringDisplayMetadata type and contains information about the mastering display color volume.

AV_FRAME_DATA_GOP_TIMECODE 

The GOP timecode in 25 bit timecode format.

Data format is 64-bit integer. This is set on the first frame of a GOP that has a temporal reference of 0.

AV_FRAME_DATA_SPHERICAL 

The data represents the AVSphericalMapping structure defined in libavutil/spherical.h.

AV_FRAME_DATA_CONTENT_LIGHT_LEVEL 

Content light level (based on CTA-861.3).

This payload contains data in the form of the AVContentLightMetadata struct.

AV_FRAME_DATA_ICC_PROFILE 

The data contains an ICC profile as an opaque octet buffer following the format described by ISO 15076-1 with an optional name defined in the metadata key entry "name".

AV_FRAME_DATA_S12M_TIMECODE 

Timecode which conforms to SMPTE ST 12-1.

The data is an array of 4 uint32_t where the first uint32_t describes how many (1-3) of the other timecodes are used. The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum() function in libavutil/timecode.h.

AV_FRAME_DATA_DYNAMIC_HDR_PLUS 

HDR dynamic metadata associated with a video frame.

The payload is an AVDynamicHDRPlus type and contains information for color volume transform - application 4 of SMPTE 2094-40:2016 standard.

AV_FRAME_DATA_REGIONS_OF_INTEREST 

Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size.

AV_FRAME_DATA_VIDEO_ENC_PARAMS 

Encoding parameters for a video frame, as described by AVVideoEncParams.

AV_FRAME_DATA_SEI_UNREGISTERED 

User data unregistered metadata associated with a video frame.

This is the H.26[45] UDU SEI message, and shouldn't be used for any other purpose The data is stored as uint8_t in AVFrameSideData.data which is 16 bytes of uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of user_data_payload_byte.

AV_FRAME_DATA_FILM_GRAIN_PARAMS 

Film grain parameters for a frame, described by AVFilmGrainParams.

Must be present for every frame which should have film grain applied.

May be present multiple times, for example when there are multiple alternative parameter sets for different video signal characteristics. The user should select the most appropriate set for the application.

AV_FRAME_DATA_DETECTION_BBOXES 

Bounding boxes for object detection and classification, as described by AVDetectionBBoxHeader.

AV_FRAME_DATA_DOVI_RPU_BUFFER 

Dolby Vision RPU raw data, suitable for passing to x265 or other libraries.

Array of uint8_t, with NAL emulation bytes intact.

AV_FRAME_DATA_DOVI_METADATA 

Parsed Dolby Vision metadata, suitable for passing to a software implementation.

The payload is the AVDOVIMetadata struct defined in libavutil/dovi_meta.h.

AV_FRAME_DATA_DYNAMIC_HDR_VIVID 

HDR Vivid dynamic metadata associated with a video frame.

The payload is an AVDynamicHDRVivid type and contains information for color volume transform - CUVA 005.1-2021.

AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT 

Ambient viewing environment metadata, as defined by H.274.

AV_FRAME_DATA_VIDEO_HINT 

Provide encoder-specific hinting information about changed/unchanged portions of a frame.

It can be used to pass information about which macroblocks can be skipped because they didn't change from the corresponding ones in the previous frame. This could be useful for applications which know this information in advance to speed up encoding.

AV_FRAME_DATA_LCEVC 

Raw LCEVC payload data, as a uint8_t array, with NAL emulation bytes intact.

AV_FRAME_DATA_VIEW_ID 

This side data must be associated with a video frame.

The presence of this side data indicates that the video stream is composed of multiple views (e.g. stereoscopic 3D content, cf. H.264 Annex H or H.265 Annex G). The data is an int storing the view ID.

Definition at line 49 of file frame.h.

◆ AVActiveFormatDescription

Enumerator
AV_AFD_SAME 
AV_AFD_4_3 
AV_AFD_16_9 
AV_AFD_14_9 
AV_AFD_4_3_SP_14_9 
AV_AFD_16_9_SP_14_9 
AV_AFD_SP_4_3 

Definition at line 248 of file frame.h.

◆ AVSideDataProps

Enumerator
AV_SIDE_DATA_PROP_GLOBAL 

The side data type can be used in stream-global structures.

Side data types without this property are only meaningful on per-frame basis.

AV_SIDE_DATA_PROP_MULTI 

Multiple instances of this side data type can be meaningfully present in a single side data array.

Definition at line 273 of file frame.h.

◆ anonymous enum

anonymous enum

Flags for frame cropping.

Enumerator
AV_FRAME_CROP_UNALIGNED 

Apply the maximum possible cropping, even if it requires setting the AVFrame.data[] entries to unaligned pointers.

Passing unaligned data to FFmpeg API is generally not allowed, and causes undefined behavior (such as crashes). You can pass unaligned data only to FFmpeg APIs that are explicitly documented to accept it. Use this flag only if you absolutely know what you are doing.

Definition at line 1006 of file frame.h.

Function Documentation

◆ av_frame_alloc()

AVFrame* av_frame_alloc ( void  )

Allocate an AVFrame and set its fields to default values.

The resulting struct must be freed using av_frame_free().

Returns
An AVFrame filled with default values or NULL on failure.
Note
this only allocates the AVFrame itself, not the data buffers. Those must be allocated through other means, e.g. with av_frame_get_buffer() or manually.

Definition at line 150 of file frame.c.

Referenced by aasc_decode_init(), alloc_audio_frame(), alloc_frame(), alloc_frame_empty(), amf_load_library(), apng_encode_frame(), audio_thread(), av_buffersrc_add_frame_flags(), av_frame_clone(), av_hwframe_get_buffer(), avcodec_open2(), avs_decode_init(), bethsoftvid_decode_init(), cdg_decode_init(), cdtoons_decode_init(), cinepak_decode_init(), cinepak_encode_init(), cinvideo_decode_init(), clv_decode_init(), cmv_decode_init(), config_input(), config_output(), config_props(), cpia_decode_init(), cri_decode_init(), cuda_bilateral_filter_frame(), cudabilateral_init(), cudachromakey_filter_frame(), cudachromakey_init(), cudacolorspace_filter_frame(), cudacolorspace_init(), cudascale_filter_frame(), cudascale_init(), cuvid_output_frame(), ddagrab_init(), ddagrab_request_frame(), dec_alloc(), dec_enc(), dec_open(), dec_thread_init(), decode_entropy_coded_image(), decode_init(), decode_write(), decoded_frames_get_free(), dirac_decode_init(), downscale(), drawbox_vaapi_filter_frame(), drm_transfer_data_from(), drm_transfer_data_to(), ds_open(), dxva2_transfer_data_from(), dxva2_transfer_data_to(), eb_enc_init(), enc_thread_init(), encode_apng(), encode_frame(), encode_init(), escape124_decode_init(), ff_cavs_init(), ff_default_get_video_buffer2(), ff_dnn_fill_gettingoutput_task(), ff_encode_preinit(), ff_frame_pool_get(), ff_frame_thread_encoder_init(), ff_hw_base_encode_init(), ff_hwframe_map_create(), ff_libwebp_get_frame(), ff_load_image(), ff_mjpeg_decode_init(), ff_mpv_encode_init(), ff_nvenc_encode_init(), ff_snow_common_init(), ff_v4l2_m2m_create_context(), ff_vp56_init_context(), ffat_init_encoder(), fg_create(), fg_thread_init(), fic_decode_init(), flashsv_decode_init(), flic_decode_init(), frame_alloc(), frame_context_init(), frame_queue_init(), ftr_init(), get_free_frame(), get_surface(), gif_decode_init(), gif_encode_frame(), h264_init_pic(), hevc_init_context(), hw_base_encode_send_frame(), hwaccel_retrieve_data(), hwframe_pool_prealloc(), hwmap_filter_frame(), hwmap_get_buffer(), ifilter_alloc(), ifilter_bind_ist(), imx_decode_init(), init(), init_axis_from_file(), init_axis_from_font(), init_filters(), init_input_frame(), init_output_frame(), ipvideo_decode_init(), ir2_decode_init(), ist_use(), kmsgrab_read_packet(), lavfi_read_packet(), libjxl_decode_init(), librav1e_encode_init(), LLVMFuzzerTestOneInput(), lscr_decode_init(), main(), mediacodec_init(), mf_init_encoder(), mm_decode_init(), mobiclip_init(), movie_common_init(), mp_decode_init(), mpv_pic_init(), msrle_decode_init(), msrle_encode_init(), mss1_decode_init(), mss2_decode_init(), mss3_decode_init(), mss4_decode_init(), msvideo1_decode_init(), multiview_setup(), mxpeg_decode_init(), nppscale_filter_frame(), nppscale_init(), nppsharpen_filter_frame(), nppsharpen_init(), npptranspose_filter_frame(), npptranspose_init(), nvenc_alloc_surface(), ofilter_bind_enc(), open_input_file(), paf_video_init(), progress_frame_pool_init_cb(), qsv_dynamic_pool_alloc(), qsv_frame_lock(), qsv_map_from(), qsv_transfer_data_child(), qtrle_decode_init(), qtrle_encode_init(), query_frame(), read_interval_packets(), read_packet_vs(), reget_buffer_internal(), roq_decode_init(), roq_encode_init(), rpza_decode_init(), rpza_encode_init(), rscc_init(), run_rct(), run_test(), rv60_decode_init(), sch_add_dec(), sch_add_sq_enc(), screenpresso_init(), seek_test(), send_frame(), sender_thread(), seqvideo_decode_init(), smc_decode_init(), smc_encode_init(), spawn_empty_frame(), sub2video_frame(), svq1_decode_init(), svq1_encode_init(), svq3_decode_init(), sws_init_context(), tdsc_init(), tgq_decode_init(), tgv_decode_init(), tiff_init(), transfer_data_alloc(), truemotion1_decode_init(), try_decode_frame(), try_push_frame(), tscc2_decode_init(), ulti_decode_init(), vaapi_av1_decode_init(), vaapi_transfer_data_from(), vaapi_transfer_data_to(), vc1_decode_frame(), video_decode(), video_decode_example(), video_thread(), vk_get_dpb_pool(), vmdvideo_decode_init(), vp8_lossy_decode_alpha(), vqa_decode_init(), vqc_decode_init(), vt_transfer_data_from(), vt_transfer_data_to(), vulkan_encode_create_dpb(), vulkan_encode_ffv1_init(), xan_decode_init(), xma_decode_init(), xvid_encode_init(), yop_decode_init(), and zerocodec_decode_init().

◆ av_frame_free()

void av_frame_free ( AVFrame **  frame)

Free the frame and any dynamically allocated objects in it, e.g.

extended_data. If the frame is reference counted, it will be unreferenced first.

Parameters
frameframe to be freed. The pointer will be set to NULL.

Definition at line 162 of file frame.c.

Referenced by aasc_decode_end(), activate(), addroi_filter_frame(), alloc_frame(), alloc_frame_empty(), amf_release_buffer_with_frame_ref(), analyze_frame(), apng_encode_frame(), apply_palette(), audio_thread(), av_frame_clone(), av_hwframe_get_buffer(), avgblur_opencl_filter_frame(), avgblur_vulkan_filter_frame(), avs_decode_end(), base_encode_pic_free(), bethsoftvid_decode_end(), blend_frame(), blur_frame(), cdg_decode_end(), cdtoons_decode_end(), celt_frame_setup_input(), channelmap_filter_frame(), chromaber_vulkan_filter_frame(), cinepak_decode_end(), cinepak_encode_end(), cinvideo_decode_end(), clear_frame_list(), clear_unused_frames(), close_stream(), clv_decode_end(), cmv_decode_end(), common_uninit(), compand_delay(), compand_nodelay(), config_filter(), config_input(), config_output(), config_video(), config_video_output(), configure_filtergraph(), convert_coeffs(), convolution_opencl_filter_frame(), cpia_decode_end(), create_frame(), cri_decode_close(), cuda_bilateral_filter_frame(), cudabilateral_uninit(), cudachromakey_filter_frame(), cudachromakey_uninit(), cudacolorspace_filter_frame(), cudacolorspace_uninit(), cudascale_filter_frame(), cudascale_uninit(), cudaupload_filter_frame(), cuvid_output_frame(), d3d12va_encode_wait(), ddagrab_request_frame(), ddagrab_uninit(), dec_enc(), dec_free(), dec_thread_uninit(), decimate_uninit(), decklink_write_video_packet(), decode_close(), decode_end(), decode_write(), decoded_frames_free(), deint_vaapi_filter_frame(), deint_vaapi_pipeline_uninit(), dirac_decode_end(), discard_frame(), dnn_free_model_ov(), dnn_free_model_tf(), dnn_free_model_th(), do_morpho(), do_scale(), downscale(), drawbox_vaapi_filter_frame(), drawbox_vaapi_uninit(), drm_transfer_data_from(), drm_transfer_data_to(), ds_free(), dxva2_transfer_data_from(), dxva2_transfer_data_to(), eb_enc_close(), empty_buffer_done(), enc_thread_uninit(), encode_apng(), encode_end(), encode_frame(), end_last_frame(), escape124_decode_close(), ff_amf_encode_close(), ff_bufqueue_add(), ff_bufqueue_discard_all(), ff_cavs_end(), ff_codec_close(), ff_default_get_audio_buffer(), ff_default_get_video_buffer2(), ff_dnn_fill_gettingoutput_task(), ff_filter_frame(), ff_frame_pool_get(), ff_frame_thread_encoder_free(), ff_framequeue_free(), ff_framesync_dualinput_get(), ff_framesync_dualinput_get_writable(), ff_framesync_uninit(), ff_hw_base_encode_close(), ff_hwframe_map_create(), ff_hwframe_unmap(), ff_inlink_make_frame_writable(), ff_inlink_set_status(), ff_ivi_decode_close(), ff_load_image(), ff_mjpeg_decode_end(), ff_mpv_encode_end(), ff_nvenc_encode_close(), ff_qsv_enc_close(), ff_qsvvpp_filter_frame(), ff_snow_common_end(), ff_vk_decode_free_frame(), ff_vk_exec_discard_deps(), ff_vk_video_common_uninit(), ff_vp56_free_context(), ff_yadif_filter_frame(), ff_yadif_uninit(), ffat_close_encoder(), fg_free(), fg_thread_uninit(), fic_decode_close(), fic_decode_frame(), fieldmatch_uninit(), filter_frame(), filter_frame_framed(), fir_frame(), fixstride(), flashsv_decode_end(), flic_decode_end(), flip_bayer(), flush_frame(), frame_context_free(), frame_free(), frame_queue_destroy(), framepack_uninit(), framesync_advance(), free_common(), free_frame(), free_frames(), fsync_uninit(), ftr_close(), gblur_vulkan_filter_frame(), generate_output(), geq_filter_frame(), get_best_frame(), get_buffer(), get_output_ov(), get_output_tf(), get_output_th(), get_scene_score(), gif_decode_close(), gif_encode_close(), h264_free_pic(), headphone_frame(), hevc_decode_free(), hwaccel_retrieve_data(), hwdownload_filter_frame(), hwframe_pool_prealloc(), hwmap_filter_frame(), hwmap_get_buffer(), hwupload_filter_frame(), if(), image_ctx_free(), imx_decode_close(), init_axis_from_file(), init_axis_from_font(), init_output_frame(), inject_frame(), ipvideo_decode_end(), ir2_decode_end(), ist_free(), join_uninit(), kmsgrab_free_frame(), kmsgrab_read_packet(), lavfi_free_frame(), lavfi_read_packet(), libjxl_decode_close(), librav1e_encode_close(), libwebp_anim_encode_close(), libwebp_anim_encode_frame(), libwebp_encode_close(), libwebp_encode_frame(), list_remove_head(), LLVMFuzzerTestOneInput(), load_apply_palette(), load_encode_and_write(), lscr_decode_close(), main(), map_frame(), mediacodec_close(), mf_close(), misc_vaapi_filter_frame(), mm_decode_end(), mobiclip_close(), move_audio(), movie_uninit(), mp_decode_end(), mpv_pic_free(), msrle_decode_end(), msrle_encode_close(), mss1_decode_end(), mss2_decode_end(), mss3_decode_end(), mss4_decode_end(), msvideo1_decode_end(), mxpeg_decode_end(), neighbor_opencl_filter_frame(), nlmeans_opencl_filter_frame(), nppscale_filter_frame(), nppscale_uninit(), nppsharpen_filter_frame(), nppsharpen_init(), nppsharpen_uninit(), npptranspose_filter_frame(), npptranspose_uninit(), null_filter_frame(), nvenc_alloc_surface(), output_frame(), output_single_frame(), overlay_cuda_blend(), overlay_opencl_blend(), overlay_vaapi_blend(), overlay_vulkan_blend(), pad_vaapi_filter_frame(), paf_video_close(), pixscope_filter_frame(), png_enc_close(), pp_filter_frame(), procamp_vaapi_filter_frame(), process_frame(), program_opencl_run(), progress_frame_pool_free_entry_cb(), qsv_decode_close_qsvcontext(), qsv_dynamic_pool_alloc(), qsv_frame_lock(), qsv_frame_unlock(), qsv_map_from(), qsv_pool_release(), qsv_transfer_data_child(), qtrle_decode_end(), qtrle_encode_end(), query_frame(), read_decode_convert_and_store(), read_interval_packets(), read_packet_vs(), realign_frame(), receiver_thread(), reget_buffer_internal(), decklink_frame::Release(), remap_opencl_process_frame(), request_frame(), return_or_keep_frame(), roq_decode_end(), roq_encode_end(), rpza_decode_end(), rpza_encode_end(), rscc_close(), run_test(), rv60_decode_end(), scale_frame(), scale_vaapi_filter_frame(), scale_vt_filter_frame(), scale_vulkan_filter_frame(), sch_free(), screenpresso_close(), seek_test(), send_frame(), sender_thread(), seqvideo_decode_end(), shuffleplanes_filter_frame(), smc_decode_end(), smc_encode_end(), spatial_activate(), spawn_empty_frame(), sub2video_frame(), submit_frame(), svq1_decode_end(), svq1_encode_end(), svq3_decode_end(), sws_freeContext(), take_samples(), tdsc_close(), testsrc_vulkan_activate(), testsrc_vulkan_uninit(), tgq_decode_close(), tgv_decode_end(), tiff_end(), tonemap_opencl_filter_frame(), tonemap_vaapi_filter_frame(), transfer_data_alloc(), transpose_opencl_filter_frame(), transpose_vaapi_filter_frame(), transpose_vt_filter_frame(), truemotion1_decode_end(), try_decode_frame(), try_push_frame(), try_push_frames(), tscc2_decode_end(), ulti_decode_end(), uncoded_frame_free(), uninit(), uninit_segment(), unsharp_opencl_filter_frame(), v4l2_m2m_destroy_context(), vaapi_av1_decode_uninit(), vaapi_encode_wait(), vaapi_transfer_data_from(), vaapi_transfer_data_to(), vc1_decode_reset(), video_decode(), video_decode_example(), video_thread(), vk_get_dpb_pool(), vmdvideo_decode_end(), vp8_lossy_decode_alpha(), vqa_decode_end(), vqc_decode_end(), vt_transfer_data_from(), vt_transfer_data_to(), vulkan_encode_ffv1_close(), vulkan_encode_ffv1_submit_frame(), vulkan_encode_issue(), wrapped_avframe_encode(), wrapped_avframe_release_buffer(), write_frame(), write_uncoded_frame_internal(), xan_decode_end(), xfade_activate(), xfade_frame(), xfade_opencl_activate(), xma_decode_end(), xvid_encode_init(), yae_clear(), yop_decode_close(), and zerocodec_decode_close().

◆ av_frame_ref()

int av_frame_ref ( AVFrame dst,
const AVFrame src 
)

Set up a new reference to the data described by the source frame.

Copy frame properties from src to dst and create a new reference for each AVBufferRef from src.

If src is not reference counted, new buffers are allocated and the data is copied.

Warning
: dst MUST have been either unreferenced with av_frame_unref(dst), or newly allocated with av_frame_alloc() before calling this function, or undefined behavior will occur.
Returns
0 on success, a negative AVERROR on error

Definition at line 400 of file frame.c.

Referenced by aasc_decode_frame(), apply_palette(), av_frame_clone(), av_frame_replace(), avs_decode_frame(), bethsoftvid_decode_frame(), cavs_decode_frame(), cdg_decode_frame(), cdtoons_decode_frame(), cinepak_decode_frame(), cinvideo_decode_frame(), clv_decode_frame(), cpia_decode_frame(), ddagrab_request_frame(), decode_frame(), decode_frame_lscr(), decode_idat_chunk(), dirac_decode_frame(), encode_send_frame_internal(), escape124_decode_frame(), ff_h263_decode_frame(), ff_h264_ref_picture(), ff_h264_replace_picture(), ff_hwframe_map_create(), ff_mjpeg_decode_frame_from_buf(), ff_rv34_decode_frame(), ff_thread_ref_frame(), ff_vp56_decode_frame(), ff_vvc_output_frame(), fg_output_frame(), fic_decode_frame(), finish_frame(), flashsv_decode_frame(), flic_decode_frame_15_16BPP(), flic_decode_frame_1BPP(), flic_decode_frame_24BPP(), flic_decode_frame_8BPP(), frame_ref(), get_delayed_pic(), gif_decode_frame(), h261_decode_frame(), hevc_ref_frame(), imx_decode_frame(), ir2_decode_frame(), load_input_picture(), mimic_decode_frame(), mm_decode_frame(), mobiclip_decode(), mp_decode_frame(), mpeg_decode_frame(), msrle_decode_frame(), mss1_decode_frame(), mss2_decode_frame(), mss3_decode_frame(), mss4_decode_frame(), msvideo1_decode_frame(), mxpeg_decode_frame(), nvenc_upload_frame(), output_frame(), packet_decode(), paf_video_decode(), qsv_decode(), qtrle_decode_frame(), receive_samples(), ref_frame(), return_or_keep_frame(), roq_decode_frame(), rpza_decode_frame(), rscc_decode_frame(), rv10_decode_frame(), rv60_decode_frame(), sch_dec_send(), screenpresso_decode_frame(), select_input_picture(), seqvideo_decode_frame(), set_output_frame(), slice_end(), smc_decode_frame(), submit_frame(), svq3_decode_frame(), sws_frame_start(), truemotion1_decode_frame(), tscc2_decode_frame(), ulti_decode_frame(), vaapi_av1_end_frame(), vc1_decode_frame(), vp78_decode_frame(), vp9_decode_frame(), vqa_decode_frame(), vqc_decode_frame(), wrapped_avframe_decode(), xan_decode_frame(), and yop_decode_frame().

◆ av_frame_replace()

int av_frame_replace ( AVFrame dst,
const AVFrame src 
)

Ensure the destination frame refers to the same data described by the source frame, either by creating a new reference for each AVBufferRef from src if they differ from those in dst, by allocating new buffers and copying data if src is not reference counted, or by unrefencing it if src is empty.

Frame properties on dst will be replaced by those from src.

Returns
0 on success, a negative AVERROR on error. On error, dst is unreferenced.

Definition at line 499 of file frame.c.

Referenced by apply_palette(), av_hwframe_map(), cdg_decode_frame(), cmv_decode_frame(), ddagrab_request_frame(), decode_frame(), encode_apng(), encode_frame(), escape124_decode_frame(), ff_hwframe_map_replace(), ff_thread_replace_frame(), ff_vp56_decode_frame(), ff_vp56_decode_mbs(), ffat_encode_callback(), gif_encode_frame(), ipvideo_decode_frame(), msrle_encode_frame(), mss2_decode_frame(), qtrle_encode_frame(), smc_encode_frame(), submit_frame(), svq1_decode_frame(), tgq_decode_frame(), tgv_decode_frame(), vmdvideo_decode_frame(), xan_decode_frame(), and zerocodec_decode_frame().

◆ av_frame_clone()

AVFrame* av_frame_clone ( const AVFrame src)

◆ av_frame_unref()

void av_frame_unref ( AVFrame frame)

Unreference all the buffers referenced by frame and reset the frame fields.

Definition at line 622 of file frame.c.

Referenced by aom_encode(), apply_palette(), audio_get_buffer(), av_frame_free(), av_frame_make_writable(), av_frame_ref(), av_frame_replace(), av_hwframe_map(), avcodec_flush_buffers(), avcodec_receive_frame(), cavs_decode_frame(), clear_unused_frames(), close_output(), cmv_process_header(), codec_reinit(), compute_crc_of_packets(), cri_decode_frame(), cuvid_output_frame(), decode_flush(), decode_frame(), decode_frame_ga(), decode_packet(), decode_pic(), decode_read(), decode_receive_frame_internal(), decode_simple_internal(), decode_subframe(), decoded_frames_flush(), decoder_thread(), dirac_decode_data_unit(), dirac_decode_frame(), dng_decode_jpeg(), eb_receive_packet(), encode_simple_internal(), encoder_thread(), execute_code(), ff_aac_usac_decode_frame(), ff_amf_receive_packet(), ff_decode_receive_frame(), ff_decode_receive_frame_internal(), ff_encode_alloc_frame(), ff_encode_encode_cb(), ff_encode_flush_buffers(), ff_get_buffer(), ff_h264_replace_picture(), ff_h264_unref_picture(), ff_hevc_unref_frame(), ff_ivi_decode_frame(), ff_mjpeg_decode_end(), ff_mjpeg_decode_sof(), ff_nvenc_receive_packet(), ff_snow_release_buffer(), ff_thread_release_ext_buffer(), ff_v4l2_buffer_buf_to_avframe(), ff_vp56_decode_frame(), ff_vp56_decode_mbs(), ff_vvc_unref_frame(), fg_output_frame(), fg_output_step(), filter_encode_write_frame(), filter_thread(), fix_sub_duration_heartbeat(), fixstride(), flashsv_decode_frame(), frame_configure_elements(), frame_queue_unref_item(), frame_reset(), frame_start(), frame_worker_thread(), free_picture(), free_sequence_buffers(), fuzz_video_get_buffer(), get_audio_buffer(), get_buffer(), get_video_buffer(), get_video_frame(), gif_decode_frame(), hwaccel_retrieve_data(), imx_decode_flush(), init_frames(), init_hwframe_ctx(), init_stage(), ipvideo_decode_frame(), lavfi_read_packet(), libdav1d_receive_frame(), librav1e_receive_packet(), libuavs3d_decode_frame(), libxevd_return_frame(), LLVMFuzzerTestOneInput(), lscr_decode_flush(), main(), mediacodec_encode(), mediacodec_flush(), mediacodec_send_dummy_frame(), mf_receive_packet(), mobiclip_flush(), mpeg_decode_frame(), mpv_pic_reset(), msrle_decode_flush(), mss2_decode_frame(), mxpeg_decode_frame(), nvenc_upload_frame(), output_frame(), packet_decode(), pad_last_frame(), process_frame(), process_output_surface(), process_subtitle(), progress_frame_pool_reset_cb(), qsv_clear_unused_frames(), qsv_frames_uninit(), qsv_transfer_data_from(), qsv_transfer_data_to(), qtrle_decode_flush(), receive_samples(), recon_frame_process(), reget_buffer_internal(), reset_frame(), rkmpp_retrieve_frame(), rv60_decode_frame(), rv60_flush(), sch_dec_send(), decklink_output_callback::ScheduledFrameCompleted(), select_input_picture(), send_frame(), send_to_enc(), send_to_enc_sq(), set_output_frame(), sub2video_get_blank_frame(), submit_frame(), svq1_flush(), svq3_decode_frame(), sws_frame_end(), sws_frame_start(), synth_superframe(), tdsc_decode_jpeg_tile(), tgq_decode_frame(), tgv_decode_frame(), truemotion1_decode_header(), update_dimensions_clear_info(), v4l2_receive_packet(), vaapi_av1_end_frame(), video_decode(), video_decode_example(), video_get_buffer(), video_thread(), videotoolbox_postproc_frame(), vulkan_encode_ffv1_receive_packet(), X264_frame(), xma_decode_packet(), and zerocodec_decode_flush().

◆ av_frame_move_ref()

void av_frame_move_ref ( AVFrame dst,
AVFrame src 
)

◆ av_frame_get_buffer()

int av_frame_get_buffer ( AVFrame frame,
int  align 
)

Allocate new buffer(s) for audio or video data.

The following fields must be set on frame before calling this function:

  • format (pixel format for video, sample format for audio)
  • width and height for video
  • nb_samples and ch_layout for audio

This function will fill AVFrame.data and AVFrame.buf arrays and, if necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. For planar formats, one buffer will be allocated for each plane.

Warning
: if frame already has been allocated, calling this function will leak memory. In addition, undefined behavior can occur in certain cases.
Parameters
frameframe in which to store the new buffers.
alignRequired buffer size and data pointer alignment. If equal to 0, alignment will be chosen automatically for the current CPU. It is highly recommended to pass 0 here unless you know what you are doing.
Returns
0 on success, a negative AVERROR on error.

Definition at line 304 of file frame.c.

Referenced by alloc_audio_frame(), alloc_frame(), alloc_frame_empty(), aom_encode(), apng_encode_frame(), av_frame_make_writable(), av_frame_ref(), config_output(), decode_entropy_coded_image(), downscale(), encode_apng(), encode_frame(), ff_libwebp_get_frame(), ff_mpv_encode_init(), get_input(), init_output_frame(), LLVMFuzzerTestOneInput(), main(), mediacodec_send_dummy_frame(), pad_last_frame(), qsv_transfer_data_from(), qsv_transfer_data_to(), receive_samples(), rpza_encode_frame(), run_test(), sender_thread(), spawn_empty_frame(), sub2video_get_blank_frame(), swr_convert_frame(), sws_frame_start(), sws_scale_frame(), tdsc_parse_tdsf(), and transfer_data_alloc().

◆ av_frame_is_writable()

int av_frame_is_writable ( AVFrame frame)

Check if the frame data is writable.

Returns
A positive value if the frame data is writable (which is true if and only if each of the underlying buffers has only one reference, namely the one stored in this frame). Return 0 otherwise.

If 1 is returned the answer is valid until av_buffer_ref() is called on any of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).

See also
av_frame_make_writable(), av_buffer_is_writable()

Definition at line 661 of file frame.c.

Referenced by activate(), analyze_frame(), av_frame_make_writable(), blur_frame(), compand_nodelay(), ff_inlink_make_frame_writable(), filter_frame(), frame_needs_copy(), output_frame(), process_frame(), and reget_buffer_internal().

◆ av_frame_make_writable()

int av_frame_make_writable ( AVFrame frame)

Ensure that the frame data is writable, avoiding data copy if possible.

Do nothing if the frame is writable, allocate new buffers and copy the data if it is not. Non-refcounted frames behave as non-writable, i.e. a copy is always made.

Returns
0 on success, a negative AVERROR on error.
See also
av_frame_is_writable(), av_buffer_is_writable(), av_buffer_make_writable()

Definition at line 678 of file frame.c.

Referenced by get_video_frame(), main(), run_test(), write_audio_frame(), and X264_frame().

◆ av_frame_copy()

int av_frame_copy ( AVFrame dst,
const AVFrame src 
)

Copy the frame data from src to dst.

This function does not allocate anything, dst must be already initialized and allocated with the same parameters as src.

This function only copies the frame data (i.e. the contents of the data / extended data arrays), not any other properties.

Returns
>= 0 on success, a negative AVERROR on error.

Definition at line 1015 of file frame.c.

Referenced by activate(), analyze_frame(), apng_encode_frame(), apng_reset_background(), av_frame_make_writable(), av_frame_ref(), clv_decode_frame(), decode_frame(), decompress_p(), decompress_p3(), drm_transfer_data_from(), drm_transfer_data_to(), encode_apng(), encode_frame(), ff_inlink_make_frame_writable(), ff_libwebp_get_frame(), filter_frame(), interpolate(), output_frame(), pixscope_filter_frame(), qsv_transfer_data_from(), qsv_transfer_data_to(), realign_frame(), reget_buffer_internal(), roq_decode_frame(), shuffleplanes_filter_frame(), submit_frame(), tdsc_decode_frame(), vaapi_transfer_data_from(), vaapi_transfer_data_to(), vt_transfer_data_from(), and vt_transfer_data_to().

◆ av_frame_copy_props()

int av_frame_copy_props ( AVFrame dst,
const AVFrame src 
)

Copy only "metadata" fields from src to dst.

Metadata for the purpose of this function are those fields that do not affect the data layout in the buffers. E.g. pts, sample rate (for audio) or sample aspect ratio (for video), but not width/height or channel layout. Side data is also copied.

Definition at line 725 of file frame.c.

Referenced by activate(), analyze_frame(), apply_palette(), av_frame_make_writable(), avgblur_opencl_filter_frame(), avgblur_vulkan_filter_frame(), blend_frame(), blend_frames(), blur_frame(), chromaber_vulkan_filter_frame(), compand_delay(), compand_nodelay(), convolution_opencl_filter_frame(), create_weave_frame(), cuda_bilateral_process(), cudachromakey_process(), cudacolorspace_conv(), cudascale_scale(), cudaupload_filter_frame(), deint_vaapi_filter_frame(), do_morpho(), drawbox_vaapi_filter_frame(), drm_map_from(), dxva2_map_from(), extract_plane(), ff_inlink_make_frame_writable(), ff_yadif_filter_frame(), filter(), filter_frame(), fir_frame(), fixstride(), flip_bayer(), gblur_vulkan_filter_frame(), generate_output(), geq_filter_frame(), get_buffer(), get_frame(), hevc_frame_start(), hwaccel_retrieve_data(), hwdownload_filter_frame(), hwmap_filter_frame(), hwupload_filter_frame(), ist_filter_add(), misc_vaapi_filter_frame(), neighbor_opencl_filter_frame(), nlmeans_opencl_filter_frame(), nppscale_scale(), nppsharpen_filter_frame(), npptranspose_filter(), output_frame(), overlay_opencl_blend(), overlay_vaapi_blend(), overlay_vulkan_blend(), pad_last_frame(), pad_vaapi_filter_frame(), pixscope_filter_frame(), pp_filter_frame(), prepare_picture(), procamp_vaapi_filter_frame(), process_frame(), program_opencl_run(), query_frame(), realign_frame(), receive_samples(), remap_opencl_process_frame(), return_frame(), run_test(), scale_frame(), scale_vaapi_filter_frame(), scale_vt_filter_frame(), scale_vulkan_filter_frame(), sch_dec_send(), shuffleplanes_filter_frame(), take_samples(), tonemap_opencl_filter_frame(), tonemap_vaapi_filter_frame(), transpose_opencl_filter_frame(), transpose_vaapi_filter_frame(), transpose_vt_filter_frame(), try_push_frame(), unsharp_opencl_filter_frame(), vaapi_map_to_memory(), vt_map_from(), and xfade_frame().

◆ av_frame_get_plane_buffer()

AVBufferRef* av_frame_get_plane_buffer ( const AVFrame frame,
int  plane 
)

Get the buffer reference a given data plane is stored in.

Parameters
framethe frame to get the plane's buffer from
planeindex of the data plane of interest in frame->extended_data.
Returns
the buffer reference that contains the plane or NULL if the input frame is not valid.

Definition at line 730 of file frame.c.

Referenced by buffer_needs_copy(), and try_push_frame().

◆ av_frame_new_side_data()

AVFrameSideData* av_frame_new_side_data ( AVFrame frame,
enum AVFrameSideDataType  type,
size_t  size 
)

◆ av_frame_new_side_data_from_buf()

AVFrameSideData* av_frame_new_side_data_from_buf ( AVFrame frame,
enum AVFrameSideDataType  type,
AVBufferRef buf 
)

Add a new side data to a frame from an existing AVBufferRef.

Parameters
framea frame to which the side data should be added
typethe type of the added side data
bufan AVBufferRef to add as side data. The ownership of the reference is transferred to the frame.
Returns
newly added side data on success, NULL on error. On failure the frame is unchanged and the AVBufferRef remains owned by the caller.

Definition at line 802 of file frame.c.

Referenced by addroi_filter_frame(), av_detection_bbox_create_side_data(), av_frame_new_side_data(), av_video_enc_params_create_side_data(), av_video_hint_create_side_data(), ff_aom_attach_film_grain_sets(), ff_dovi_attach_side_data(), ff_h2645_sei_to_frame(), ff_icc_profile_attach(), frame_copy_props(), and set_side_data().

◆ av_frame_get_side_data()

AVFrameSideData* av_frame_get_side_data ( const AVFrame frame,
enum AVFrameSideDataType  type 
)
Returns
a pointer to the side data of a given type on success, NULL if there is no side data with such type in this frame.

Definition at line 963 of file frame.c.

Referenced by add_icc_profile_size(), addroi_filter_frame(), amf_save_hdr_metadata(), aom_encode(), av_downmix_info_update_side_data(), configure_video_filters(), contain_valid_detection_bbox(), create_subcc_packet(), decode_packet(), discard_samples(), dnn_classify_post_proc(), dnn_detect_post_proc_ov(), dnn_detect_post_proc_tf(), eb_send_frame(), encode_frame(), encode_headers(), encode_send_frame_internal(), extract_lltask_from_task(), ff_alloc_a53_sei(), ff_alloc_timecode_sei(), ff_ccfifo_extract(), ff_determine_signal_peak(), ff_frame_to_dnn_classify(), ff_h264_field_end(), ff_mjpeg_add_icc_profile_size(), ff_qp_table_extract(), ff_side_data_update_matrix_encoding(), ff_update_hdr_metadata(), filter_frame(), frame_data_submit(), get_buffer(), hw_base_encode_check_frame(), iccdetect_filter_frame(), iccgen_filter_frame(), ifilter_parameters_from_frame(), jpeg_put_comments(), libjxl_encode_frame(), libx265_encode_frame(), libx265_encode_set_roi(), output_frame(), prepare_sei_data_array(), process_frame(), qsv_av1_set_encode_ctrl(), qsv_hevc_set_encode_ctrl(), reconfig_encoder(), send_frame(), set_roi_encode_ctrl(), setup_frame(), side_data_map(), tonemap_vaapi_save_metadata(), update_frame_props(), vaapi_encode_av1_init_picture_params(), vaapi_encode_h265_init_picture_params(), vaapi_encode_issue(), vk_enc_h265_update_pic_info(), vpp_set_frame_ext_params(), vpx_encode(), and vtenc_send_frame().

◆ av_frame_remove_side_data()

void av_frame_remove_side_data ( AVFrame frame,
enum AVFrameSideDataType  type 
)

◆ av_frame_apply_cropping()

int av_frame_apply_cropping ( AVFrame frame,
int  flags 
)

Crop the given video AVFrame according to its crop_left/crop_top/crop_right/ crop_bottom fields.

If cropping is successful, the function will adjust the data pointers and the width/height fields, and set the crop fields to 0.

In all cases, the cropping boundaries will be rounded to the inherent alignment of the pixel format. In some cases, such as for opaque hwaccel formats, the left/top cropping is ignored. The crop fields are set to 0 even if the cropping was rounded or ignored.

Parameters
framethe frame which should be cropped
flagsSome combination of AV_FRAME_CROP_* flags, or 0.
Returns
>= 0 on success, a negative AVERROR on error. If the cropping fields were invalid, AVERROR(ERANGE) is returned, and nothing is changed.

Definition at line 1078 of file frame.c.

Referenced by apply_cropping(), and video_frame_process().

◆ av_frame_side_data_name()

const char* av_frame_side_data_name ( enum AVFrameSideDataType  type)
Returns
a string identifying the side data type

Definition at line 1042 of file frame.c.

Referenced by filter_frame(), get_frame_side_data_type(), print_entries(), and print_frame_side_data().

◆ av_frame_side_data_desc()

const AVSideDataDescriptor* av_frame_side_data_desc ( enum AVFrameSideDataType  type)
Returns
side data descriptor corresponding to a given side data type, NULL when not available.

Definition at line 1034 of file frame.c.

Referenced by av_frame_side_data_add(), av_frame_side_data_clone(), av_frame_side_data_name(), av_frame_side_data_new(), and enc_open().

◆ av_frame_side_data_free()

void av_frame_side_data_free ( AVFrameSideData ***  sd,
int *  nb_sd 
)

Free all side data entries and their contents, then zeroes out the values which the pointers are pointing to.

Parameters
sdpointer to array of side data to free. Will be set to NULL upon return.
nb_sdpointer to an integer containing the number of entries in the array. Will be set to 0 upon return.

Definition at line 113 of file frame.c.

Referenced by ff_codec_close(), ff_frame_thread_free(), init_thread(), main(), and reget_buffer_internal().

◆ av_frame_side_data_new()

AVFrameSideData* av_frame_side_data_new ( AVFrameSideData ***  sd,
int *  nb_sd,
enum AVFrameSideDataType  type,
size_t  size,
unsigned int  flags 
)

Add new side data entry to an array.

Parameters
sdpointer to array of side data to which to add another entry, or to NULL in order to start a new array.
nb_sdpointer to an integer containing the number of entries in the array.
typetype of the added side data
sizesize of the side data
flagsSome combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
Returns
newly added side data on success, NULL on error.
Note
In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching AVFrameSideDataType will be removed before the addition is attempted.
In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an entry of the same type already exists, it will be replaced instead.

Definition at line 837 of file frame.c.

Referenced by alloc_frame(), and main().

◆ av_frame_side_data_add()

AVFrameSideData* av_frame_side_data_add ( AVFrameSideData ***  sd,
int *  nb_sd,
enum AVFrameSideDataType  type,
AVBufferRef **  buf,
unsigned int  flags 
)

Add a new side data entry to an array from an existing AVBufferRef.

Parameters
sdpointer to array of side data to which to add another entry, or to NULL in order to start a new array.
nb_sdpointer to an integer containing the number of entries in the array.
typetype of the added side data
bufPointer to AVBufferRef to add to the array. On success, the function takes ownership of the AVBufferRef and *buf is set to NULL, unless AV_FRAME_SIDE_DATA_FLAG_NEW_REF is set in which case the ownership will remain with the caller.
flagsSome combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
Returns
newly added side data on success, NULL on error.
Note
In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching AVFrameSideDataType will be removed before the addition is attempted.
In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an entry of the same type already exists, it will be replaced instead.

Definition at line 862 of file frame.c.

Referenced by ff_decode_content_light_new_ext(), ff_decode_mastering_display_new_ext(), ff_frame_new_side_data_from_buf_ext(), and h2645_sei_to_side_data().

◆ av_frame_side_data_clone()

int av_frame_side_data_clone ( AVFrameSideData ***  sd,
int *  nb_sd,
const AVFrameSideData src,
unsigned int  flags 
)

Add a new side data entry to an array based on existing side data, taking a reference towards the contained AVBufferRef.

Parameters
sdpointer to array of side data to which to add another entry, or to NULL in order to start a new array.
nb_sdpointer to an integer containing the number of entries in the array.
srcside data to be cloned, with a new reference utilized for the buffer.
flagsSome combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0.
Returns
negative error code on failure, >=0 on success.
Note
In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of matching AVFrameSideDataType will be removed before the addition is attempted.
In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an entry of the same type already exists, it will be replaced instead.

Definition at line 888 of file frame.c.

Referenced by enc_open(), and init_thread().

◆ av_frame_side_data_get_c()

const AVFrameSideData* av_frame_side_data_get_c ( const AVFrameSideData *const *  sd,
const int  nb_sd,
enum AVFrameSideDataType  type 
)

Get a side data entry of a specific type from an array.

Parameters
sdarray of side data.
nb_sdinteger containing the number of entries in the array.
typetype of side data to be queried
Returns
a pointer to the side data of a given type on success, NULL if there is no side data with such type in this set.

Definition at line 946 of file frame.c.

Referenced by av_frame_side_data_get().

◆ av_frame_side_data_get()

static const AVFrameSideData* av_frame_side_data_get ( AVFrameSideData *const *  sd,
const int  nb_sd,
enum AVFrameSideDataType  type 
)
inlinestatic

Wrapper around av_frame_side_data_get_c() to workaround the limitation that for any type T the conversion from T * const * to const T * const * is not performed automatically in C.

See also
av_frame_side_data_get_c()

Definition at line 1159 of file frame.h.

Referenced by av_frame_get_side_data(), av_frame_side_data_add(), av_frame_side_data_clone(), av_frame_side_data_new(), ff_dovi_configure(), ff_encode_preinit(), handle_side_data(), select_frame(), and side_data_pref().

◆ av_frame_side_data_remove()

void av_frame_side_data_remove ( AVFrameSideData ***  sd,
int *  nb_sd,
enum AVFrameSideDataType  type 
)

Remove and free all side data instances of the given type from an array.

Definition at line 957 of file frame.c.

Referenced by side_data_pref().