FFmpeg  4.0
Data Fields
AVHWAccel Struct Reference

#include <libavcodec/avcodec.h>

Data Fields

const char * name
 Name of the hardware accelerated codec. More...
 
enum AVMediaType type
 Type of codec implemented by the hardware accelerator. More...
 
enum AVCodecID id
 Codec implemented by the hardware accelerator. More...
 
enum AVPixelFormat pix_fmt
 Supported pixel format. More...
 
int capabilities
 Hardware accelerated codec capabilities. More...
 
int(* alloc_frame )(AVCodecContext *avctx, AVFrame *frame)
 Allocate a custom buffer. More...
 
int(* start_frame )(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
 Called at the beginning of each frame or field picture. More...
 
int(* decode_params )(AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size)
 Callback for parameter data (SPS/PPS/VPS etc). More...
 
int(* decode_slice )(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)
 Callback for each slice. More...
 
int(* end_frame )(AVCodecContext *avctx)
 Called at the end of each frame or field picture. More...
 
int frame_priv_data_size
 Size of per-frame hardware accelerator private data. More...
 
void(* decode_mb )(struct MpegEncContext *s)
 Called for every Macroblock in a slice. More...
 
int(* init )(AVCodecContext *avctx)
 Initialize the hwaccel private data. More...
 
int(* uninit )(AVCodecContext *avctx)
 Uninitialize the hwaccel private data. More...
 
int priv_data_size
 Size of the private data to allocate in AVCodecInternal.hwaccel_priv_data. More...
 
int caps_internal
 Internal hwaccel capabilities. More...
 
int(* frame_params )(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
 Fill the given hw_frames context with current codec parameters. More...
 

Detailed Description

Definition at line 3576 of file avcodec.h.

Field Documentation

◆ name

const char* AVHWAccel::name

Name of the hardware accelerated codec.

The name is globally unique among encoders and among decoders (but an encoder and a decoder can share the same name).

Definition at line 3582 of file avcodec.h.

Referenced by dxva2_h264_end_frame(), dxva2_hevc_end_frame(), dxva2_mpeg2_end_frame(), dxva2_vc1_end_frame(), dxva2_vp9_end_frame(), ff_videotoolbox_uninit(), ff_xvmc_decode_mb(), hwaccel_init(), nvdec_mjpeg_frame_params(), nvdec_mpeg12_frame_params(), vaapi_mpeg4_decode_slice(), vaapi_vc1_decode_slice(), vdpau_mpeg_decode_slice(), and vdpau_vc1_init().

◆ type

enum AVMediaType AVHWAccel::type

Type of codec implemented by the hardware accelerator.

See AVMEDIA_TYPE_xxx

Definition at line 3589 of file avcodec.h.

◆ id

enum AVCodecID AVHWAccel::id

Codec implemented by the hardware accelerator.

See AV_CODEC_ID_xxx

Definition at line 3596 of file avcodec.h.

◆ pix_fmt

enum AVPixelFormat AVHWAccel::pix_fmt

Supported pixel format.

Only hardware accelerated formats are supported here.

Definition at line 3603 of file avcodec.h.

Referenced by ff_decode_get_hw_frames_ctx(), and ff_dxva2_decode_init().

◆ capabilities

int AVHWAccel::capabilities

Hardware accelerated codec capabilities.

see AV_HWACCEL_CODEC_CAP_*

Definition at line 3609 of file avcodec.h.

Referenced by hwaccel_init().

◆ alloc_frame

int(* AVHWAccel::alloc_frame) (AVCodecContext *avctx, AVFrame *frame)

Allocate a custom buffer.

Definition at line 3622 of file avcodec.h.

Referenced by get_buffer_internal().

◆ start_frame

int(* AVHWAccel::start_frame) (AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)

Called at the beginning of each frame or field picture.

Meaningful frame information (codec specific) is guaranteed to be parsed at this point. This function is mandatory.

Note that buf can be NULL along with buf_size set to 0. Otherwise, this means the whole frame is available at this point.

Parameters
avctxthe codec context
bufthe frame data buffer base
buf_sizethe size of the frame in bytes
Returns
zero if successful, a negative value otherwise

Definition at line 3638 of file avcodec.h.

Referenced by decode_nal_unit(), decode_nal_units(), ff_h263_decode_frame(), ff_mjpeg_decode_sof(), mpeg_field_start(), vc1_decode_frame(), vp78_decode_frame(), and vp9_decode_frame().

◆ decode_params

int(* AVHWAccel::decode_params) (AVCodecContext *avctx, int type, const uint8_t *buf, uint32_t buf_size)

Callback for parameter data (SPS/PPS/VPS etc).

Useful for hardware decoders which keep persistent state about the video parameters, and need to receive any changes to update that state.

Parameters
avctxthe codec context
typethe nal unit type
bufthe nal unit data buffer
buf_sizethe size of the nal unit in bytes
Returns
zero if successful, a negative value otherwise

Definition at line 3652 of file avcodec.h.

Referenced by decode_nal_unit(), and decode_nal_units().

◆ decode_slice

int(* AVHWAccel::decode_slice) (AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size)

Callback for each slice.

Meaningful slice information (codec specific) is guaranteed to be parsed at this point. This function is mandatory. The only exception is XvMC, that works on MB level.

Parameters
avctxthe codec context
bufthe slice data buffer base
buf_sizethe size of the slice in bytes
Returns
zero if successful, a negative value otherwise

Definition at line 3666 of file avcodec.h.

Referenced by decode_nal_unit(), decode_nal_units(), decode_slice(), er_supported(), ff_er_add_slice(), ff_mjpeg_decode_sos(), mpeg_decode_slice(), vc1_decode_frame(), vp78_decode_frame(), and vp9_decode_frame().

◆ end_frame

int(* AVHWAccel::end_frame) (AVCodecContext *avctx)

Called at the end of each frame or field picture.

The whole picture is parsed at this point and can now be sent to the hardware accelerator. This function is mandatory.

Parameters
avctxthe codec context
Returns
zero if successful, a negative value otherwise

Definition at line 3677 of file avcodec.h.

Referenced by ff_h263_decode_frame(), ff_h264_field_end(), ff_mjpeg_decode_frame(), hevc_decode_frame(), mpeg_field_start(), slice_end(), vc1_decode_frame(), vp78_decode_frame(), and vp9_decode_frame().

◆ frame_priv_data_size

int AVHWAccel::frame_priv_data_size

Size of per-frame hardware accelerator private data.

Private data is allocated with av_mallocz() before AVCodecContext.get_buffer() and deallocated after AVCodecContext.release_buffer().

Definition at line 3686 of file avcodec.h.

Referenced by alloc_frame(), alloc_frame_buffer(), alloc_picture(), ff_mjpeg_decode_sof(), vp8_alloc_frame(), and vp9_frame_alloc().

◆ decode_mb

void(* AVHWAccel::decode_mb) (struct MpegEncContext *s)

Called for every Macroblock in a slice.

XvMC uses it to replace the ff_mpv_reconstruct_mb(). Instead of decoding to raw picture, MB parameters are stored in an array provided by the video driver.

Parameters
sthe mpeg context

Definition at line 3697 of file avcodec.h.

Referenced by ff_blockdsp_init_x86(), ff_er_frame_end(), is_intra_more_likely(), and mpv_reconstruct_mb_internal().

◆ init

int(* AVHWAccel::init) (AVCodecContext *avctx)

Initialize the hwaccel private data.

This will be called from ff_get_format(), after hwaccel and hwaccel_context are set and the hwaccel private data in AVCodecInternal is allocated.

Definition at line 3706 of file avcodec.h.

Referenced by ff_vdpau_common_reinit(), and hwaccel_init().

◆ uninit

int(* AVHWAccel::uninit) (AVCodecContext *avctx)

Uninitialize the hwaccel private data.

This will be called from get_format() or avcodec_close(), after hwaccel and hwaccel_context are already uninitialized.

Definition at line 3714 of file avcodec.h.

Referenced by avcodec_close(), ff_vdpau_common_reinit(), and hwaccel_uninit().

◆ priv_data_size

int AVHWAccel::priv_data_size

Size of the private data to allocate in AVCodecInternal.hwaccel_priv_data.

Definition at line 3720 of file avcodec.h.

Referenced by hwaccel_init().

◆ caps_internal

int AVHWAccel::caps_internal

Internal hwaccel capabilities.

Definition at line 3725 of file avcodec.h.

Referenced by ff_thread_finish_setup().

◆ frame_params

int(* AVHWAccel::frame_params) (AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)

Fill the given hw_frames context with current codec parameters.

Called from get_format. Refer to avcodec_get_hw_frames_parameters() for details.

This CAN be called before AVHWAccel.init is called, and you must assume that avctx->hwaccel_priv_data is invalid.

Definition at line 3735 of file avcodec.h.

Referenced by avcodec_get_hw_frames_parameters().


The documentation for this struct was generated from the following file: