Go to the documentation of this file.
19 #ifndef AVCODEC_VAAPI_ENCODE_H
20 #define AVCODEC_VAAPI_ENCODE_H
26 #if VA_CHECK_VERSION(1, 0, 0)
27 #include <va/va_str.h>
84 #if VA_CHECK_VERSION(1, 0, 0)
279 #if VA_CHECK_VERSION(0, 36, 0)
280 VAEncMiscParameterBufferQualityLevel quality_params;
437 char *
data,
size_t *data_len);
440 char *
data,
size_t *data_len);
444 char *
data,
size_t *data_len);
453 char *
data,
size_t *data_len);
461 char *
data,
size_t *data_len);
471 #define VAAPI_ENCODE_COMMON_OPTIONS \
473 "Use low-power encoding mode (only available on some platforms; " \
474 "may not support all encoding features)", \
475 OFFSET(common.low_power), AV_OPT_TYPE_BOOL, \
476 { .i64 = 0 }, 0, 1, FLAGS }, \
478 "Distance (in I-frames) between IDR frames", \
479 OFFSET(common.idr_interval), AV_OPT_TYPE_INT, \
480 { .i64 = 0 }, 0, INT_MAX, FLAGS }, \
482 "Maximum B-frame reference depth", \
483 OFFSET(common.desired_b_depth), AV_OPT_TYPE_INT, \
484 { .i64 = 1 }, 1, INT_MAX, FLAGS }, \
485 { "async_depth", "Maximum processing parallelism. " \
486 "Increase this to improve single channel performance. This option " \
487 "doesn't work if driver doesn't implement vaSyncBuffer function.", \
488 OFFSET(common.async_depth), AV_OPT_TYPE_INT, \
489 { .i64 = 2 }, 1, MAX_ASYNC_DEPTH, FLAGS }, \
490 { "max_frame_size", \
491 "Maximum frame size (in bytes)",\
492 OFFSET(common.max_frame_size), AV_OPT_TYPE_INT, \
493 { .i64 = 0 }, 0, INT_MAX, FLAGS }
495 #define VAAPI_ENCODE_RC_MODE(name, desc) \
496 { #name, desc, 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_ ## name }, \
497 0, 0, FLAGS, "rc_mode" }
498 #define VAAPI_ENCODE_RC_OPTIONS \
500 "Set rate control mode", \
501 OFFSET(common.explicit_rc_mode), AV_OPT_TYPE_INT, \
502 { .i64 = RC_MODE_AUTO }, RC_MODE_AUTO, RC_MODE_MAX, FLAGS, "rc_mode" }, \
503 { "auto", "Choose mode automatically based on other parameters", \
504 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_AUTO }, 0, 0, FLAGS, "rc_mode" }, \
505 VAAPI_ENCODE_RC_MODE(CQP, "Constant-quality"), \
506 VAAPI_ENCODE_RC_MODE(CBR, "Constant-bitrate"), \
507 VAAPI_ENCODE_RC_MODE(VBR, "Variable-bitrate"), \
508 VAAPI_ENCODE_RC_MODE(ICQ, "Intelligent constant-quality"), \
509 VAAPI_ENCODE_RC_MODE(QVBR, "Quality-defined variable-bitrate"), \
510 VAAPI_ENCODE_RC_MODE(AVBR, "Average variable-bitrate")
void * codec_slice_params
unsigned int va_packed_headers
unsigned int desired_packed_headers
This structure describes decoded (raw) audio or video data.
size_t global_params_size[MAX_GLOBAL_PARAMS]
int(* write_sequence_header)(AVCodecContext *avctx, char *data, size_t *data_len)
struct VAAPIEncodePicture * refs[MAX_PICTURE_REFERENCES]
int ff_vaapi_encode_init(AVCodecContext *avctx)
@ FLAG_CONSTANT_QUALITY_ONLY
VAEncMiscParameterRateControl rc_params
int(* configure)(AVCodecContext *avctx)
int row_height[MAX_TILE_ROWS]
@ FLAG_NON_IDR_KEY_PICTURES
int(* init_picture_params)(AVCodecContext *avctx, VAAPIEncodePicture *pic)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
VAEncMiscParameterBufferMaxFrameSize mfs_params
const VAAPIEncodeProfile * profile
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
const VAAPIEncodeRCMode * rc_mode
void * codec_picture_params
size_t picture_params_size
int global_params_type[MAX_GLOBAL_PARAMS]
const void * global_params[MAX_GLOBAL_PARAMS]
VAEntrypoint va_entrypoint
AVBufferRef * recon_frames_ref
AVHWDeviceContext * device
AVBufferPool * output_buffer_pool
struct VAAPIEncodePicture * prev
Describe the class of an AVClass context structure.
struct VAAPIEncodePicture * dpb[MAX_DPB_SIZE]
const VAAPIEncodeProfile * profiles
int ff_vaapi_encode_close(AVCodecContext *avctx)
int(* write_picture_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, char *data, size_t *data_len)
int(* init_sequence_params)(AVCodecContext *avctx)
void * codec_sequence_params
VAAPIEncodePicture * pic_start
int(* write_extra_buffer)(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES]
VAAPIEncodePicture * pic_end
VAAPIEncodeSlice * slices
VASurfaceID input_surface
AVHWFramesContext * recon_frames
VASurfaceID recon_surface
VAEncMiscParameterHRD hrd_params
int(* write_extra_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
int col_width[MAX_TILE_COLS]
const struct VAAPIEncodeType * codec
int(* init_slice_params)(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
int row_bd[MAX_TILE_ROWS+1]
VAAPIEncodePicture * next_prev
AVHWFramesContext * input_frames
void * codec_picture_params
This struct describes a set or pool of "hardware" frames (i.e.
AVBufferRef * output_buffer_ref
AVVAAPIDeviceContext * hwctx
int64_t ts_ring[MAX_REORDER_DELAY *3+MAX_ASYNC_DEPTH]
VABufferID * param_buffers
main external API structure.
AVBufferRef * input_frames_ref
VAEncMiscParameterFrameRate fr_params
int(* write_slice_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
@ FLAG_B_PICTURE_REFERENCES
struct VAAPIEncodePicture * next
size_t sequence_params_size
A reference to a data buffer.
This structure stores compressed data.
int col_bd[MAX_TILE_COLS+1]
size_t picture_priv_data_size
int(* get_encoder_caps)(AVCodecContext *avctx)
VAAPI connection details.
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
const AVCodecHWConfigInternal *const ff_vaapi_encode_hw_configs[]