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>
75 #if VA_CHECK_VERSION(1, 0, 0)
266 #if VA_CHECK_VERSION(0, 36, 0)
267 VAEncMiscParameterBufferQualityLevel quality_params;
394 char *
data,
size_t *data_len);
397 char *
data,
size_t *data_len);
401 char *
data,
size_t *data_len);
410 char *
data,
size_t *data_len);
418 char *
data,
size_t *data_len);
429 #define VAAPI_ENCODE_COMMON_OPTIONS \
431 "Use low-power encoding mode (only available on some platforms; " \
432 "may not support all encoding features)", \
433 OFFSET(common.low_power), AV_OPT_TYPE_BOOL, \
434 { .i64 = 0 }, 0, 1, FLAGS }, \
436 "Distance (in I-frames) between IDR frames", \
437 OFFSET(common.idr_interval), AV_OPT_TYPE_INT, \
438 { .i64 = 0 }, 0, INT_MAX, FLAGS }, \
440 "Maximum B-frame reference depth", \
441 OFFSET(common.desired_b_depth), AV_OPT_TYPE_INT, \
442 { .i64 = 1 }, 1, INT_MAX, FLAGS }
444 #define VAAPI_ENCODE_RC_MODE(name, desc) \
445 { #name, desc, 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_ ## name }, \
446 0, 0, FLAGS, "rc_mode" }
447 #define VAAPI_ENCODE_RC_OPTIONS \
449 "Set rate control mode", \
450 OFFSET(common.explicit_rc_mode), AV_OPT_TYPE_INT, \
451 { .i64 = RC_MODE_AUTO }, RC_MODE_AUTO, RC_MODE_MAX, FLAGS, "rc_mode" }, \
452 { "auto", "Choose mode automatically based on other parameters", \
453 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_AUTO }, 0, 0, FLAGS, "rc_mode" }, \
454 VAAPI_ENCODE_RC_MODE(CQP, "Constant-quality"), \
455 VAAPI_ENCODE_RC_MODE(CBR, "Constant-bitrate"), \
456 VAAPI_ENCODE_RC_MODE(VBR, "Variable-bitrate"), \
457 VAAPI_ENCODE_RC_MODE(ICQ, "Intelligent constant-quality"), \
458 VAAPI_ENCODE_RC_MODE(QVBR, "Quality-defined variable-bitrate"), \
459 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)
VAEncMiscParameterRateControl rc_params
int(* configure)(AVCodecContext *avctx)
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
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.
const AVCodecHWConfigInternal * ff_vaapi_encode_hw_configs[]
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
int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame)
VAAPIEncodeSlice * slices
VASurfaceID input_surface
@ FLAG_B_PICTURE_REFERENCES
AVHWFramesContext * recon_frames
@ FLAG_NON_IDR_KEY_PICTURES
VASurfaceID recon_surface
VAEncMiscParameterHRD hrd_params
int(* write_extra_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
const struct VAAPIEncodeType * codec
int(* init_slice_params)(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
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
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
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)
struct VAAPIEncodePicture * next
size_t sequence_params_size
@ FLAG_CONSTANT_QUALITY_ONLY
A reference to a data buffer.
This structure stores compressed data.
int64_t ts_ring[MAX_REORDER_DELAY *3]
size_t picture_priv_data_size
VAAPI connection details.
int ff_vaapi_encode_receive_packet(AVCodecContext *avctx, AVPacket *pkt)