#include <va/va.h>
+#if VA_CHECK_VERSION(1, 0, 0)
+#include <va/va_str.h>
+#endif
+
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_vaapi.h"
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;
// 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;
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;
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).
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 */