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>
256 #if VA_CHECK_VERSION(0, 36, 0)
257 VAEncMiscParameterBufferQualityLevel quality_params;
373 char *
data,
size_t *data_len);
376 char *
data,
size_t *data_len);
380 char *
data,
size_t *data_len);
389 char *
data,
size_t *data_len);
397 char *
data,
size_t *data_len);
408 #define VAAPI_ENCODE_COMMON_OPTIONS \
410 "Use low-power encoding mode (only available on some platforms; " \
411 "may not support all encoding features)", \
412 OFFSET(common.low_power), AV_OPT_TYPE_BOOL, \
413 { .i64 = 0 }, 0, 1, FLAGS }, \
415 "Distance (in I-frames) between IDR frames", \
416 OFFSET(common.idr_interval), AV_OPT_TYPE_INT, \
417 { .i64 = 0 }, 0, INT_MAX, FLAGS }, \
419 "Maximum B-frame reference depth", \
420 OFFSET(common.desired_b_depth), AV_OPT_TYPE_INT, \
421 { .i64 = 1 }, 1, INT_MAX, FLAGS }
423 #define VAAPI_ENCODE_RC_MODE(name, desc) \
424 { #name, desc, 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_ ## name }, \
425 0, 0, FLAGS, "rc_mode" }
426 #define VAAPI_ENCODE_RC_OPTIONS \
428 "Set rate control mode", \
429 OFFSET(common.explicit_rc_mode), AV_OPT_TYPE_INT, \
430 { .i64 = RC_MODE_AUTO }, RC_MODE_AUTO, RC_MODE_MAX, FLAGS, "rc_mode" }, \
431 { "auto", "Choose mode automatically based on other parameters", \
432 0, AV_OPT_TYPE_CONST, { .i64 = RC_MODE_AUTO }, 0, 0, FLAGS, "rc_mode" }, \
433 VAAPI_ENCODE_RC_MODE(CQP, "Constant-quality"), \
434 VAAPI_ENCODE_RC_MODE(CBR, "Constant-bitrate"), \
435 VAAPI_ENCODE_RC_MODE(VBR, "Variable-bitrate"), \
436 VAAPI_ENCODE_RC_MODE(ICQ, "Intelligent constant-quality"), \
437 VAAPI_ENCODE_RC_MODE(QVBR, "Quality-defined variable-bitrate"), \
438 VAAPI_ENCODE_RC_MODE(AVBR, "Average variable-bitrate")
@ FLAG_CONSTANT_QUALITY_ONLY
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
@ FLAG_B_PICTURE_REFERENCES
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
int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame)
VAAPIEncodeSlice * slices
VASurfaceID input_surface
AVHWFramesContext * recon_frames
VASurfaceID recon_surface
@ FLAG_NON_IDR_KEY_PICTURES
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
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)