X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavcodec%2Fvaapi_encode.h;h=5d6fdcf336a788d171a799a12a40c5f494cf3df2;hb=bf726c26fde26601a90daacf1b10a9860d21321c;hp=c7370a17e2ae50746fba5e065fd329bd3c25a269;hpb=9a88a47be4da9cd25a582feec7cc36790500b481;p=ffmpeg diff --git a/libavcodec/vaapi_encode.h b/libavcodec/vaapi_encode.h index c7370a17e2a..5d6fdcf336a 100644 --- a/libavcodec/vaapi_encode.h +++ b/libavcodec/vaapi_encode.h @@ -23,6 +23,10 @@ #include +#if VA_CHECK_VERSION(1, 0, 0) +#include +#endif + #include "libavutil/hwcontext.h" #include "libavutil/hwcontext_vaapi.h" @@ -86,20 +90,32 @@ typedef struct VAAPIEncodePicture { VAAPIEncodeSlice *slices; } VAAPIEncodePicture; +typedef struct VAAPIEncodeProfile { + // lavc profile value (FF_PROFILE_*). + int av_profile; + // Supported bit depth. + int depth; + // Number of components. + int nb_components; + // Chroma subsampling in width dimension. + int log2_chroma_w; + // Chroma subsampling in height dimension. + int log2_chroma_h; + // VAAPI profile value. + VAProfile va_profile; +} VAAPIEncodeProfile; + typedef struct VAAPIEncodeContext { const AVClass *class; // Codec-specific hooks. const struct VAAPIEncodeType *codec; - // Encoding profile (VAProfileXXX). - VAProfile va_profile; - // Encoding entrypoint (usually VAEntryointEncSlice). - VAEntrypoint va_entrypoint; - // Surface colour/sampling format (usually VA_RT_FORMAT_YUV420). - unsigned int va_rt_format; - // Rate control mode. - unsigned int va_rc_mode; + // Global options. + + // Use low power encoding mode. + int low_power; + // Supported packed headers (initially the desired set, modified // later to what is actually supported). unsigned int va_packed_headers; @@ -113,6 +129,18 @@ typedef struct VAAPIEncodeContext { // Everything above this point must be set before calling // ff_vaapi_encode_init(). + // Chosen encoding profile details. + const VAAPIEncodeProfile *profile; + + // Encoding profile (VAProfile*). + VAProfile va_profile; + // Encoding entrypoint (VAEntryoint*). + VAEntrypoint va_entrypoint; + // Rate control mode. + unsigned int va_rc_mode; + // Bitrate for codec-specific encoder parameters. + unsigned int va_bit_rate; + // Configuration attributes to use when creating va_config. VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES]; int nb_config_attributes; @@ -196,6 +224,7 @@ typedef struct VAAPIEncodeContext { int64_t ts_ring[MAX_REORDER_DELAY * 3]; // Frame type decision. + int gop_size; int p_per_i; int b_per_p; int force_idr; @@ -204,8 +233,11 @@ typedef struct VAAPIEncodeContext { int end_of_stream; } VAAPIEncodeContext; - typedef struct VAAPIEncodeType { + // List of supported profiles and corresponding VAAPI profiles. + // (Must end with FF_PROFILE_UNKNOWN.) + const VAAPIEncodeProfile *profiles; + // Perform any extra codec-specific configuration after the // codec context is initialised (set up the private data and // add any necessary global parameters). @@ -269,4 +301,13 @@ int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, int ff_vaapi_encode_init(AVCodecContext *avctx); int ff_vaapi_encode_close(AVCodecContext *avctx); + +#define VAAPI_ENCODE_COMMON_OPTIONS \ + { "low_power", \ + "Use low-power encoding mode (only available on some platforms; " \ + "may not support all encoding features)", \ + OFFSET(common.low_power), AV_OPT_TYPE_BOOL, \ + { .i64 = 0 }, 0, 1, FLAGS } + + #endif /* AVCODEC_VAAPI_ENCODE_H */