FFmpeg
Data Structures | Macros | Functions
decode.h File Reference
#include "libavutil/frame.h"
#include "libavutil/hwcontext.h"
#include "avcodec.h"

Go to the source code of this file.

Data Structures

struct   FrameDecodeData
  This struct stores per-frame lavc-internal data and is attached to it via private_ref. More...
 

Macros

  the returned buffer does not need to be writable More...
 

Functions

  Called by decoders to get the next packet for decoding. More...
 
  Set various frame properties from the provided packet. More...
 
  Set various frame properties from the codec context / packet data. More...
 
  Make sure avctx.hw_frames_ctx is set. More...
 
 
int  ff_copy_palette (void *dst, const AVPacket *src, void *logctx)
  Check whether the side-data of src contains a palette of size AVPALETTE_SIZE; if so, copy it to dst and return 1; else return 0. More...
 
  Check that the provided frame dimensions are valid and set them on the codec context. More...
 
int  ff_set_sar (AVCodecContext *avctx, AVRational sar)
  Check that the provided sample aspect ratio is valid and set it on the codec context. More...
 
int  ff_get_format (AVCodecContext *avctx, const enum AVPixelFormat *fmt)
  Select the (possibly hardware accelerated) pixel format. More...
 
  Get a buffer for a frame. More...
 
  Identical in function to ff_get_buffer(), except it reuses the existing buffer if available. More...
 
  Add or update AV_FRAME_DATA_MATRIXENCODING side data. More...
 
int  ff_hwaccel_frame_priv_alloc (AVCodecContext *avctx, void **hwaccel_picture_private)
  Allocate a hwaccel frame private data if the provided avctx uses a hwaccel method that needs it. More...
 
  Get side data of the given type from a decoding context. More...
 
  Wrapper around av_frame_new_side_data, which rejects side data overridden by the demuxer. More...
 
  Similar to ff_frame_new_side_data, but using an existing buffer ref. More...
 
  Same as ff_frame_new_side_data_from_buf, but taking a AVFrameSideData array directly instead of an AVFrame. More...
 
  Wrapper around av_mastering_display_metadata_create_side_data(), which rejects side data overridden by the demuxer. More...
 
  Same as ff_decode_mastering_display_new, but taking a AVFrameSideData array directly instead of an AVFrame. More...
 
  Wrapper around av_content_light_metadata_create_side_data(), which rejects side data overridden by the demuxer. More...
 
int  ff_decode_content_light_new_ext (const AVCodecContext *avctx, AVFrameSideData ***sd, int *nb_sd, struct AVContentLightMetadata **clm)
  Same as ff_decode_content_light_new, but taking a AVFrameSideData array directly instead of an AVFrame. More...
 

Macro Definition Documentation

FF_REGET_BUFFER_FLAG_READONLY

#define FF_REGET_BUFFER_FLAG_READONLY   1

the returned buffer does not need to be writable

Definition at line 128 of file decode.h.

Function Documentation

ff_decode_get_packet()

int ff_decode_get_packet ( AVCodecContextavctx,
AVPacketpkt 
)

Called by decoders to get the next packet for decoding.

Parameters
pkt An empty packet to be filled with data.
Returns
0 if a new reference has been successfully written to pkt AVERROR(EAGAIN) if no data is currently available AVERROR_EOF if and end of stream has been reached, so no more data will be available

Definition at line 247 of file decode.c.

Referenced by av1_receive_frame(), binkaudio_receive_frame(), cuvid_output_frame(), decode_simple_internal(), ff_thread_receive_frame(), ffmmal_receive_frame(), hevc_receive_frame(), libdav1d_receive_frame_internal(), libjxl_receive_frame(), libxevd_receive_frame(), mediacodec_receive_frame(), osq_receive_frame(), rkmpp_receive_frame(), and v4l2_receive_frame().

ff_decode_frame_props_from_pkt()

int ff_decode_frame_props_from_pkt ( const AVCodecContextavctx,
AVFrameframe,
const AVPacketpkt 
)

Set various frame properties from the provided packet.

Definition at line 1511 of file decode.c.

Referenced by ff_decode_frame_props(), libdav1d_receive_frame(), and libxevd_return_frame().

ff_decode_frame_props()

int ff_decode_frame_props ( AVCodecContextavctx,
AVFrameframe 
)

Set various frame properties from the codec context / packet data.

Definition at line 1559 of file decode.c.

Referenced by cuvid_output_frame(), ff_get_buffer(), ff_h263_decode_frame(), ffmal_copy_frame(), libdav1d_receive_frame(), qsv_get_continuous_buffer(), qtrle_decode_frame(), raw_decode(), reget_buffer_internal(), vpx_decode(), and wrapped_avframe_decode().

ff_decode_get_hw_frames_ctx()

int ff_decode_get_hw_frames_ctx ( AVCodecContextavctx,
enum AVHWDeviceType  dev_type 
)

Make sure avctx.hw_frames_ctx is set.

If it's not set, the function will try to allocate it from hw_device_ctx. If that is not possible, an error message is printed, and an error code is returned.

Definition at line 1116 of file decode.c.

Referenced by ff_d3d12va_decode_init(), ff_dxva2_decode_init(), ff_vaapi_decode_init(), ff_vdpau_common_init(), and ff_vk_decode_init().

ff_attach_decode_data()

int ff_attach_decode_data ( AVFrameframe )

Definition at line 1634 of file decode.c.

Referenced by ff_get_buffer(), ff_videotoolbox_alloc_frame(), and qsv_get_continuous_buffer().

ff_copy_palette()

int ff_copy_palette ( void *  dst,
const AVPacketsrc,
void *  logctx 
)

Check whether the side-data of src contains a palette of size AVPALETTE_SIZE; if so, copy it to dst and return 1; else return 0.

Also emit an error message upon encountering a palette with invalid size.

Definition at line 2260 of file decode.c.

Referenced by cinepak_decode_frame(), decode_frame(), gdv_decode_frame(), idcin_decode_frame(), imx_decode_frame(), ipvideo_decode_frame(), msrle_decode_frame(), msvideo1_decode_frame(), qtrle_decode_frame(), raw_decode(), rscc_decode_frame(), and smc_decode_frame().

ff_set_dimensions()

int ff_set_dimensions ( AVCodecContexts,
int  width,
int  height 
)

Check that the provided frame dimensions are valid and set them on the codec context.

Definition at line 94 of file utils.c.

Referenced by alloc_buffers(), aom_decode(), apply_param_change(), avcodec_open2(), avs_decode_init(), bmp_decode_frame(), cdg_decode_init(), cdxl_decode_frame(), cfhd_decode(), clv_decode_init(), cmv_process_header(), codec_reinit(), cri_decode_frame(), dds_decode(), decode_blocks(), decode_fint(), decode_frame(), decode_frame_header(), decode_frame_headers(), decode_header(), decode_idat_chunk(), decode_init(), decode_seq_header(), dirac_decode_data_unit(), dnxhd_decode_frame(), dvbsub_parse_display_definition_segment(), dvdsub_parse_extradata(), dvvideo_decode_frame(), execute_code(), ff_h263_decode_frame(), ff_ivi_decode_frame(), ff_mjpeg_decode_sof(), ff_pnm_decode_header(), ff_rv34_decode_frame(), ff_vc1_decode_entry_point(), ff_vc1_decode_sequence_header(), ff_vp56_decode_frame(), ffmal_update_format(), fits_decode_frame(), flashsv_decode_frame(), g2m_decode_frame(), gem_decode_frame(), get_siz(), gif_decode_frame(), h261_decode_frame(), hdr_decode_frame(), hqa_decode_frame(), init_image(), libdav1d_parse_extradata(), libdav1d_receive_frame(), libjxl_receive_frame(), librsvg_decode_frame(), libuavs3d_decode_frame(), libxevd_image_copy(), magy_decode_frame(), mediacodec_dec_parse_video_format(), mimic_decode_frame(), mpeg4_decode_header(), mpeg_decode_postinit(), mpegvideo_extract_headers(), mvc_decode_init(), parse_presentation_segment(), pcx_decode_frame(), pgx_decode_frame(), photocd_decode_frame(), pix_decode_frame(), pixlet_decode_frame(), process_frame_obj(), ptx_decode_frame(), qoi_decode_frame(), rl2_decode_init(), rv20_decode_picture_header(), seqvideo_decode_init(), set_context_with_sequence(), set_output_format(), sga_decode_frame(), sunrast_decode_frame(), svc_decode_frame(), svq1_decode_frame(), svq3_decode_init(), tdsc_parse_tdsf(), tgq_decode_frame(), tgv_decode_frame(), tqi_decode_frame(), truemotion1_decode_header(), truemotion2rt_decode_header(), txd_decode_frame(), update_context_with_frame_header(), update_dimensions(), update_size(), v4l2_handle_event(), vbn_decode_frame(), vp56_size_changed(), vp5_parse_header(), vp6_parse_header(), vp8_lossless_decode_frame(), vpx_decode(), vqa_decode_init(), wbmp_decode_frame(), xbm_decode_frame(), xpm_decode_frame(), and xwd_decode_frame().

ff_set_sar()

int ff_set_sar ( AVCodecContextavctx,
AVRational  sar 
)

Check that the provided sample aspect ratio is valid and set it on the codec context.

Definition at line 109 of file utils.c.

Referenced by aom_decode(), decode_frame(), decode_sequence_header_adv(), dirac_decode_data_unit(), dvvideo_decode_frame(), export_stream_params(), ff_h263_decode_frame(), h264_slice_header_init(), libdav1d_receive_frame(), mediacodec_dec_parse_video_format(), truemotion1_decode_header(), and update_context_with_frame_header().

ff_get_format()

int ff_get_format ( AVCodecContextavctx,
const enum AVPixelFormatfmt 
)

Select the (possibly hardware accelerated) pixel format.

This is a wrapper around AVCodecContext.get_format() and should be used instead of calling get_format() directly.

The list of pixel formats must contain at least one valid entry, and is terminated with AV_PIX_FMT_NONE. If it is possible to decode to software, the last entry in the list must be the most accurate software format. If it is not possible to decode to software, AVCodecContext.sw_pix_fmt must be set before calling this function.

Definition at line 1272 of file decode.c.

Referenced by cuvid_decode_init(), decode_frame_header(), ff_mjpeg_decode_sof(), ffmmal_init_decoder(), get_format(), get_pixel_format(), h263_get_format(), mediacodec_dec_get_video_codec(), mpeg_get_pixelformat(), qsv_decode_preinit(), update_size(), and vc1_get_format().

ff_get_buffer()

int ff_get_buffer ( AVCodecContextavctx,
AVFrameframe,
int  flags 
)

Get a buffer for a frame.

This is a wrapper around AVCodecContext.get_buffer() and should be used instead calling get_buffer() directly.

Definition at line 1719 of file decode.c.

Referenced by ac3_decode_frame(), adpcm_decode_frame(), adx_decode_frame(), alloc_frame(), amrnb_decode_frame(), amrwb_decode_frame(), aom_decode(), apac_decode(), ape_decode_frame(), aptx_decode_frame(), atrac1_decode_frame(), atrac3_decode_frame(), atrac3al_decode_frame(), atrac3p_decode_frame(), atrac9_decode_frame(), aura_decode_frame(), avui_decode_frame(), bfi_decode_frame(), binkaudio_receive_frame(), bmp_decode_frame(), bmv_aud_decode_frame(), bonk_decode(), cdg_decode_frame(), cdxl_decode_frame(), cinaudio_decode_frame(), cmv_decode_frame(), cng_decode_frame(), cook_decode_frame(), copy_output(), cuvid_output_frame(), cyuv_decode_frame(), dds_decode(), decode_frame(), decode_pic(), decode_tag(), dfa_decode_frame(), dfpwm_dec_frame(), dpcm_decode_frame(), dss_sp_decode_frame(), eightsvx_decode_frame(), escape124_decode_frame(), escape130_decode_frame(), evrc_decode_frame(), execute_code(), fastaudio_decode(), fdk_aac_decode_frame(), ff_dca_lbr_filter_frame(), ff_dca_xll_filter_frame(), ff_ivi_decode_frame(), ff_mjpeg_decode_sof(), ff_thread_get_buffer(), ff_thread_get_ext_buffer(), ff_twinvq_decode_frame(), ff_vp56_decode_frame(), ffat_decode(), ffmal_copy_frame(), filter_frame(), filter_frame_fixed(), filter_frame_float(), fits_decode_frame(), frame_configure_elements(), ftr_decode_frame(), g2m_decode_frame(), g722_decode_frame(), g723_1_decode_frame(), gdv_decode_frame(), gem_decode_frame(), get_buffer(), get_buffer_with_edge(), gsm_decode_frame(), hcom_decode(), hnm_decode_frame(), hq_decode_frame(), hqa_decode_frame(), idcin_decode_frame(), ilbc_decode_frame(), imc_decode_frame(), init_frames(), ipu_decode_frame(), ipvideo_decode_frame(), lead_decode_frame(), libcelt_dec_decode(), libcodec2_decode(), libgsm_decode_frame(), libjxl_receive_frame(), liblc3_decode(), libopus_decode(), librsvg_decode_frame(), libspeex_decode_frame(), libuavs3d_decode_frame(), libxevd_image_copy(), m101_decode_frame(), mace_decode_frame(), mediacodec_wrap_sw_audio_buffer(), mediacodec_wrap_sw_video_buffer(), misc4_decode(), mp_decode_frame(), mpc7_decode_frame(), mpc8_decode_frame(), msp2_decode_frame(), mss2_decode_frame(), mvc_decode_frame(), mxpeg_decode_frame(), oggvorbis_decode_frame(), on2avc_decode_frame(), opus_decode_packet(), osq_receive_frame(), output_data(), paf_audio_decode(), pcm_bluray_decode_frame(), pcm_decode_frame(), pcm_dvd_decode_frame(), pcx_decode_frame(), pgx_decode_frame(), pix_decode_frame(), pnm_decode_frame(), ptx_decode_frame(), qcelp_decode_frame(), qdm2_decode_frame(), qdmc_decode_frame(), qoa_decode_frame(), ra144_decode_frame(), ra288_decode_frame(), reget_buffer_internal(), rka_decode_frame(), rl2_decode_frame(), s302m_decode_frame(), sbc_decode_frame(), sga_decode_frame(), sgirle_decode_frame(), shorten_decode_frame(), sipr_decode_frame(), siren_decode(), smka_decode_frame(), speex_decode_frame(), sunrast_decode_frame(), svc_decode_frame(), svq1_decode_frame(), synth_superframe(), tdsc_decode_frame(), tgq_decode_frame(), tgv_decode_frame(), thread_get_buffer_internal(), tmv_decode_frame(), tqi_decode_frame(), truemotion2rt_decode_frame(), truespeech_decode_frame(), txd_decode_frame(), v308_decode_frame(), v408_decode_frame(), vbn_decode_frame(), vcr1_decode_frame(), vmdaudio_decode_frame(), vmdvideo_decode_frame(), vorbis_decode_frame(), vpx_decode(), wavarc_decode(), wavesynth_decode(), wma_decode_superframe(), wmapro_decode_packet(), ws_snd_decode_frame(), xan_decode_frame(), xbm_decode_frame(), xface_decode_frame(), xma_decode_packet(), xpm_decode_frame(), xwd_decode_frame(), y216_decode_frame(), y41p_decode_frame(), yuv4_decode_frame(), zero12v_decode_frame(), and zerocodec_decode_frame().

ff_reget_buffer()

int ff_reget_buffer ( AVCodecContextavctx,
AVFrameframe,
int  flags 
)

Identical in function to ff_get_buffer(), except it reuses the existing buffer if available.

Definition at line 1839 of file decode.c.

Referenced by aasc_decode_frame(), avs_decode_frame(), bethsoftvid_decode_frame(), cdg_decode_frame(), cdtoons_decode_frame(), cinepak_decode_frame(), cinvideo_decode_frame(), clv_decode_frame(), cpia_decode_frame(), decode_frame(), decode_frame_lscr(), fic_decode_frame(), flashsv_decode_frame(), flic_decode_frame_15_16BPP(), flic_decode_frame_1BPP(), flic_decode_frame_24BPP(), flic_decode_frame_8BPP(), gif_decode_frame(), imx_decode_frame(), ir2_decode_frame(), mm_decode_frame(), mobiclip_decode(), mp_decode_frame(), msrle_decode_frame(), mss1_decode_frame(), mss2_decode_frame(), mss3_decode_frame(), mss4_decode_frame(), msvideo1_decode_frame(), paf_video_decode(), qtrle_decode_frame(), roq_decode_frame(), rpza_decode_stream(), rscc_decode_frame(), screenpresso_decode_frame(), seqvideo_decode_frame(), smc_decode_frame(), truemotion1_decode_frame(), tscc2_decode_frame(), ulti_decode_frame(), vqa_decode_frame(), vqc_decode_frame(), xan_decode_frame(), and yop_decode_frame().

ff_side_data_update_matrix_encoding()

int ff_side_data_update_matrix_encoding ( AVFrameframe,
enum AVMatrixEncoding  matrix_encoding 
)

Add or update AV_FRAME_DATA_MATRIXENCODING side data.

Definition at line 124 of file utils.c.

Referenced by ac3_decode_frame(), ff_dca_core_filter_frame(), ff_dca_lbr_filter_frame(), ff_dca_xll_filter_frame(), and output_data().

ff_hwaccel_frame_priv_alloc()

int ff_hwaccel_frame_priv_alloc ( AVCodecContextavctx,
void **  hwaccel_picture_private 
)

Allocate a hwaccel frame private data if the provided avctx uses a hwaccel method that needs it.

The returned data is a RefStruct reference (if allocated).

Parameters
avctx The codec context
hwaccel_picture_private Pointer to return hwaccel_picture_private
Returns
0 on success, < 0 on error

Definition at line 2275 of file decode.c.

Referenced by alloc_frame(), alloc_picture(), av1_frame_alloc(), vp8_alloc_frame(), and vp9_frame_alloc().

ff_get_coded_side_data()

const AVPacketSideData* ff_get_coded_side_data ( const AVCodecContextavctx,
enum AVPacketSideDataType  type 
)

Get side data of the given type from a decoding context.

Definition at line 1421 of file decode.c.

Referenced by av1_decode_init(), hevc_decode_init(), and libdav1d_init().

ff_frame_new_side_data()

int ff_frame_new_side_data ( const AVCodecContextavctx,
AVFrameframe,
enum AVFrameSideDataType  type,
size_t  size,
AVFrameSideData **  sd 
)

Wrapper around av_frame_new_side_data, which rejects side data overridden by the demuxer.

Returns 0 on success, and a negative error code otherwise. If successful and sd is not NULL, *sd may either contain a pointer to the new side data, or NULL in case the side data was already present.

Definition at line 2123 of file decode.c.

Referenced by cri_decode_frame(), decode_frame(), ff_mjpeg_decode_frame_from_buf(), h264_export_frame_props(), mpeg_field_start(), populate_avctx_color_fields(), set_side_data(), tiff_decode_tag(), and webp_decode_frame().

ff_frame_new_side_data_from_buf()

int ff_frame_new_side_data_from_buf ( const AVCodecContextavctx,
AVFrameframe,
enum AVFrameSideDataType  type,
AVBufferRef **  buf 
)

Similar to ff_frame_new_side_data, but using an existing buffer ref.

*buf is ALWAYS consumed by this function and NULL written in its place, even on failure.

Definition at line 2161 of file decode.c.

Referenced by alloc_frame(), alloc_picture(), export_itut_t35(), ff_h2645_sei_to_frame(), libdav1d_receive_frame(), libjxl_receive_frame(), mpeg_field_start(), and set_side_data().

ff_frame_new_side_data_from_buf_ext()

int ff_frame_new_side_data_from_buf_ext ( const AVCodecContextavctx,
AVFrameSideData ***  sd,
int *  nb_sd,
enum AVFrameSideDataType  type,
AVBufferRef **  buf 
)

Same as ff_frame_new_side_data_from_buf, but taking a AVFrameSideData array directly instead of an AVFrame.

Definition at line 2142 of file decode.c.

Referenced by ff_frame_new_side_data_from_buf(), and h2645_sei_to_side_data().

ff_decode_mastering_display_new()

int ff_decode_mastering_display_new ( const AVCodecContextavctx,
AVFrameframe,
struct AVMasteringDisplayMetadata **  mdm 
)

Wrapper around av_mastering_display_metadata_create_side_data(), which rejects side data overridden by the demuxer.

Returns 0 on success, and a negative error code otherwise. If successful, *mdm may either be a pointer to the new side data, or NULL in case the side data was already present.

Definition at line 2202 of file decode.c.

Referenced by export_metadata(), libdav1d_receive_frame(), and populate_avctx_color_fields().

ff_decode_mastering_display_new_ext()

int ff_decode_mastering_display_new_ext ( const AVCodecContextavctx,
AVFrameSideData ***  sd,
int *  nb_sd,
struct AVMasteringDisplayMetadata **  mdm 
)

Same as ff_decode_mastering_display_new, but taking a AVFrameSideData array directly instead of an AVFrame.

Definition at line 2170 of file decode.c.

Referenced by h2645_sei_to_side_data().

ff_decode_content_light_new()

int ff_decode_content_light_new ( const AVCodecContextavctx,
AVFrameframe,
struct AVContentLightMetadata **  clm 
)

Wrapper around av_content_light_metadata_create_side_data(), which rejects side data overridden by the demuxer.

Returns 0 on success, and a negative error code otherwise. If successful, *clm may either be a pointer to the new side data, or NULL in case the side data was already present.

Definition at line 2247 of file decode.c.

Referenced by export_metadata(), libdav1d_receive_frame(), and populate_avctx_color_fields().

ff_decode_content_light_new_ext()

int ff_decode_content_light_new_ext ( const AVCodecContextavctx,
AVFrameSideData ***  sd,
int *  nb_sd,
struct AVContentLightMetadata **  clm 
)

Same as ff_decode_content_light_new, but taking a AVFrameSideData array directly instead of an AVFrame.

Definition at line 2215 of file decode.c.

Referenced by h2645_sei_to_side_data().


Generated on Fri Aug 22 2025 13:59:51 for FFmpeg by   doxygen 1.8.17

AltStyle によって変換されたページ (->オリジナル) /