34                                            int type, 
char *
data, 
size_t bit_len)
 
   38     VABufferID param_buffer, data_buffer;
 
   40     VAEncPackedHeaderParameterBuffer 
params = {
 
   42         .bit_length = bit_len,
 
   43         .has_emulation_bytes = 1,
 
   52                          VAEncPackedHeaderParameterBufferType,
 
   53                          sizeof(params), 1, ¶ms, ¶m_buffer);
 
   54     if (vas != VA_STATUS_SUCCESS) {
 
   56                "for packed header (type %d): %d (%s).\n",
 
   57                type, vas, vaErrorStr(vas));
 
   63                          VAEncPackedHeaderDataBufferType,
 
   64                          (bit_len + 7) / 8, 1, data, &data_buffer);
 
   65     if (vas != VA_STATUS_SUCCESS) {
 
   67                "for packed header (type %d): %d (%s).\n",
 
   68                type, vas, vaErrorStr(vas));
 
   74            "(%zu bits).\n", type, param_buffer, data_buffer, bit_len);
 
   93                          type, len, 1, data, &buffer);
 
   94     if (vas != VA_STATUS_SUCCESS) {
 
   96                "(type %d): %d (%s).\n", type, vas, vaErrorStr(vas));
 
  124     if (vas != VA_STATUS_SUCCESS) {
 
  126                "%d (%s).\n", vas, vaErrorStr(vas));
 
  154         for (i = 0; i < pic->
nb_refs; i++) {
 
  162     for (i = 0; i < pic->
nb_refs; i++) {
 
  167         if (ctx->
issue_mode == ISSUE_MODE_SERIALISE_EVERYTHING)
 
  212                                              VAEncSequenceParameterBufferType,
 
  222                                                  VAEncMiscParameterBufferType,
 
  234                    "parameters: %d.\n", err);
 
  238                                              VAEncPictureParameterBufferType,
 
  248             bit_len = 8 * 
sizeof(
data);
 
  252                        "header: %d.\n", err);
 
  265         bit_len = 8 * 
sizeof(
data);
 
  269                    "header: %d.\n", err);
 
  289                        "buffer %d: %d.\n", i, err);
 
  304             bit_len = 8 * 
sizeof(
data);
 
  311                        "header %d: %d.\n", i, err);
 
  344                 for (i = 0; i < rounding; i++)
 
  347                 for (i = 0; i < (rounding + 1) / 2; i++)
 
  349                 for (i = 0; i < rounding / 2; i++)
 
  352         } 
else if (rounding < 0) {
 
  372                "%d-%d (%d blocks).\n", i, slice->
row_start,
 
  389                        "parameters: %d.\n", err);
 
  396             bit_len = 8 * 
sizeof(
data);
 
  401                        "header: %d.\n", err);
 
  413                                                  VAEncSliceParameterBufferType,
 
  423     if (vas != VA_STATUS_SUCCESS) {
 
  425                "%d (%s).\n", vas, vaErrorStr(vas));
 
  427         goto fail_with_picture;
 
  432     if (vas != VA_STATUS_SUCCESS) {
 
  434                "%d (%s).\n", vas, vaErrorStr(vas));
 
  436         goto fail_with_picture;
 
  440     if (vas != VA_STATUS_SUCCESS) {
 
  442                "%d (%s).\n", vas, vaErrorStr(vas));
 
  458             if (vas != VA_STATUS_SUCCESS) {
 
  460                        "param buffer %#x: %d (%s).\n",
 
  469     if (ctx->
issue_mode == ISSUE_MODE_SERIALISE_EVERYTHING)
 
  499     VACodedBufferSegment *buf_list, *
buf;
 
  510     if (vas != VA_STATUS_SUCCESS) {
 
  512                "%d (%s).\n", vas, vaErrorStr(vas));
 
  517     for (buf = buf_list; 
buf; buf = buf->next) {
 
  519                "(status %08x).\n", buf->size, buf->status);
 
  525         memcpy(pkt->
data, buf->buf, buf->size);
 
  534     if (vas != VA_STATUS_SUCCESS) {
 
  536                "%d (%s).\n", vas, vaErrorStr(vas));
 
  563                "%"PRId64
"/%"PRId64
".\n",
 
  627     if (ctx->
issue_mode == ISSUE_MODE_SERIALISE_EVERYTHING ||
 
  628         ctx->
issue_mode == ISSUE_MODE_MINIMISE_LATENCY) {
 
  643         for (i = 0; i < pic->
nb_refs; i++) {
 
  655     } 
else if (ctx->
issue_mode == ISSUE_MODE_MAXIMISE_THROUGHPUT) {
 
  667                 for (i = 0; i < pic->
nb_refs; i++) {
 
  671                 if (i < pic->nb_refs)
 
  740         for (i = 0; i < ctx->
b_per_p &&
 
  767         for (i = 0, pic = start; pic; i++, pic = pic->
next) {
 
  825             for (pic = ctx->
pic_start; pic != last_pic; pic = pic->
next) {
 
  828                     pic->
refs[1] = last_pic;
 
  839         for (pic = last_pic->
next; pic; pic = next) {
 
  874         for (pic = old->
next; pic; pic = pic->
next) {
 
  877             for (i = 0; i < pic->
nb_refs; i++) {
 
  878                 if (pic->
refs[i] == old) {
 
  896                      const AVFrame *input_image, 
int *got_packet)
 
  928         pic->
pts = input_image->
pts;
 
  979                 pkt->
dts = INT64_MIN;
 
 1006                                                   VAEncMiscParameterBuffer *
buffer,
 
 1029     { 
"YUV400",    VA_RT_FORMAT_YUV400,        8, 1,      },
 
 1030     { 
"YUV420",    VA_RT_FORMAT_YUV420,        8, 3, 1, 1 },
 
 1031     { 
"YUV422",    VA_RT_FORMAT_YUV422,        8, 3, 1, 0 },
 
 1032     { 
"YUV444",    VA_RT_FORMAT_YUV444,        8, 3, 0, 0 },
 
 1033     { 
"YUV411",    VA_RT_FORMAT_YUV411,        8, 3, 2, 0 },
 
 1034 #if VA_CHECK_VERSION(0, 38, 1) 
 1035     { 
"YUV420_10", VA_RT_FORMAT_YUV420_10BPP, 10, 3, 1, 1 },
 
 1040     VAEntrypointEncSlice,
 
 1041     VAEntrypointEncPicture,
 
 1042 #if VA_CHECK_VERSION(0, 39, 2) 
 1043     VAEntrypointEncSliceLP,
 
 1047 #if VA_CHECK_VERSION(0, 39, 2) 
 1048 static const VAEntrypoint vaapi_encode_entrypoints_low_power[] = {
 
 1049     VAEntrypointEncSliceLP,
 
 1057     VAProfile    *va_profiles    = 
NULL;
 
 1058     VAEntrypoint *va_entrypoints = 
NULL;
 
 1060     const VAEntrypoint *usable_entrypoints;
 
 1063     VAConfigAttrib rt_format_attr;
 
 1065     const char *profile_string, *entrypoint_string;
 
 1066     int i, j, 
n, depth, err;
 
 1070 #if VA_CHECK_VERSION(0, 39, 2) 
 1071         usable_entrypoints = vaapi_encode_entrypoints_low_power;
 
 1074                "supported with this VAAPI version.\n");
 
 1104     vas = vaQueryConfigProfiles(ctx->
hwctx->
display, va_profiles, &n);
 
 1105     if (vas != VA_STATUS_SUCCESS) {
 
 1107                vas, vaErrorStr(vas));
 
 1116         if (depth               != profile->
depth ||
 
 1127 #if VA_CHECK_VERSION(1, 0, 0) 
 1128         profile_string = vaProfileStr(profile->
va_profile);
 
 1130         profile_string = 
"(no profile names)";
 
 1133         for (j = 0; j < 
n; j++) {
 
 1139                    "not supported by driver.\n", profile->
va_profile);
 
 1159     if (!va_entrypoints) {
 
 1164                                    va_entrypoints, &n);
 
 1165     if (vas != VA_STATUS_SUCCESS) {
 
 1167                "profile %s (%d): %d (%s).\n", profile_string,
 
 1173     for (i = 0; i < 
n; i++) {
 
 1174         for (j = 0; usable_entrypoints[j]; j++) {
 
 1175             if (va_entrypoints[i] == usable_entrypoints[j])
 
 1178         if (usable_entrypoints[j])
 
 1183                "for profile %s (%d).\n", profile_string, ctx->
va_profile);
 
 1189 #if VA_CHECK_VERSION(1, 0, 0) 
 1192     entrypoint_string = 
"(no entrypoint names)";
 
 1198         rt_format = &vaapi_encode_rt_formats[i];
 
 1199         if (rt_format->
depth         == depth &&
 
 1207                "found for profile %s (%d) entrypoint %s (%d).\n",
 
 1214     rt_format_attr = (VAConfigAttrib) { VAConfigAttribRTFormat };
 
 1217                                 &rt_format_attr, 1);
 
 1218     if (vas != VA_STATUS_SUCCESS) {
 
 1220                "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
 
 1225     if (rt_format_attr.value == VA_ATTRIB_NOT_SUPPORTED) {
 
 1227                "supported by driver: assuming surface RT format %s " 
 1228                "is valid.\n", rt_format->
name);
 
 1229     } 
else if (!(rt_format_attr.value & rt_format->
value)) {
 
 1231                "by driver for encoding profile %s (%d) entrypoint %s (%d).\n",
 
 1238                "format %s (%#x).\n", rt_format->
name, rt_format->
value);
 
 1241             .type  = VAConfigAttribRTFormat,
 
 1242             .value = rt_format->
value,
 
 1256     int64_t rc_bits_per_second;
 
 1257     int     rc_target_percentage;
 
 1259     int64_t hrd_buffer_size;
 
 1260     int64_t hrd_initial_buffer_fullness;
 
 1262     VAConfigAttrib rc_attr = { VAConfigAttribRateControl };
 
 1268     if (vas != VA_STATUS_SUCCESS) {
 
 1270                "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
 
 1274     if (rc_attr.value == VA_ATTRIB_NOT_SUPPORTED) {
 
 1276                "supported rate control modes: assuming constant-quality.\n");
 
 1283         if (rc_attr.value & VA_RC_CQP) {
 
 1288                        "ignored in constant-quality mode.\n");
 
 1293                    "constant-quality mode (%#x).\n", rc_attr.value);
 
 1298     if (!(rc_attr.value & (VA_RC_CBR | VA_RC_VBR))) {
 
 1300                "bitrate-targetted rate control modes.\n");
 
 1313                    "must have initial buffer size (%d) < " 
 1314                    "buffer size (%"PRId64
").\n",
 
 1320         hrd_initial_buffer_fullness = hrd_buffer_size * 3 / 4;
 
 1325                "bitrate (%"PRId64
") <= maxrate (%"PRId64
").\n",
 
 1331         if (!(rc_attr.value & VA_RC_VBR)) {
 
 1333                    "VBR mode (%#x), using CBR mode instead.\n",
 
 1337             rc_bits_per_second   = avctx->
bit_rate;
 
 1338             rc_target_percentage = 100;
 
 1343             rc_target_percentage = (avctx->
bit_rate * 100) /
 
 1348         if (!(rc_attr.value & VA_RC_CBR)) {
 
 1350                    "CBR mode (%#x), using VBR mode instead.\n",
 
 1357         rc_bits_per_second   = avctx->
bit_rate;
 
 1358         rc_target_percentage = 100;
 
 1361         if (rc_attr.value & VA_RC_VBR) {
 
 1368             rc_bits_per_second   = 2 * avctx->
bit_rate;
 
 1369             rc_target_percentage = 50;
 
 1373             rc_bits_per_second   = avctx->
bit_rate;
 
 1374             rc_target_percentage = 100;
 
 1378     rc_window_size = (hrd_buffer_size * 1000) / rc_bits_per_second;
 
 1381            "over %d ms.\n", ctx->
va_rc_mode == VA_RC_VBR ? 
"VBR" : 
"CBR",
 
 1382            rc_target_percentage, rc_bits_per_second, rc_window_size);
 
 1384            "initial fullness %"PRId64
" bits.\n",
 
 1385            hrd_buffer_size, hrd_initial_buffer_fullness);
 
 1387     if (rc_bits_per_second          > UINT32_MAX ||
 
 1388         hrd_buffer_size             > UINT32_MAX ||
 
 1389         hrd_initial_buffer_fullness > UINT32_MAX) {
 
 1391                "greater are not supported by VAAPI.\n");
 
 1399         .type  = VAConfigAttribRateControl,
 
 1403     ctx->
rc_params.
misc.type = VAEncMiscParameterTypeRateControl;
 
 1404     ctx->
rc_params.
rc = (VAEncMiscParameterRateControl) {
 
 1405         .bits_per_second   = rc_bits_per_second,
 
 1406         .target_percentage = rc_target_percentage,
 
 1407         .window_size       = rc_window_size,
 
 1409         .min_qp            = (avctx->
qmin > 0 ? avctx->
qmin : 0),
 
 1410         .basic_unit_size   = 0,
 
 1411 #
if VA_CHECK_VERSION(1, 1, 0)
 
 1412         .max_qp            = (avctx->
qmax > 0 ? avctx->
qmax : 0),
 
 1420         .initial_buffer_fullness = hrd_initial_buffer_fullness,
 
 1421         .buffer_size             = hrd_buffer_size,
 
 1434     ctx->
fr_params.
fr.framerate = (
unsigned int)fr_den << 16 | fr_num;
 
 1436 #if VA_CHECK_VERSION(0, 40, 0) 
 1448     VAConfigAttrib attr = { VAConfigAttribEncMaxRefFrames };
 
 1449     uint32_t ref_l0, ref_l1;
 
 1455     if (vas != VA_STATUS_SUCCESS) {
 
 1457                "attribute: %d (%s).\n", vas, vaErrorStr(vas));
 
 1461     if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
 
 1462         ref_l0 = ref_l1 = 0;
 
 1464         ref_l0 = attr.value       & 0xffff;
 
 1465         ref_l1 = attr.value >> 16 & 0xffff;
 
 1471     } 
else if (ref_l0 < 1) {
 
 1473                "reference frames.\n");
 
 1475     } 
else if (ref_l1 < 1 || avctx->max_b_frames < 1) {
 
 1477                "(supported references: %d / %d).\n", ref_l0, ref_l1);
 
 1483                "(supported references: %d / %d).\n", ref_l0, ref_l1);
 
 1495     VAConfigAttrib attr[2] = { { VAConfigAttribEncMaxSlices },
 
 1496                                { VAConfigAttribEncSliceStructure } };
 
 1498     uint32_t max_slices, slice_structure;
 
 1504                    "but this codec does not support controlling slices.\n");
 
 1514     if (avctx->
slices <= 1) {
 
 1524     if (vas != VA_STATUS_SUCCESS) {
 
 1526                "attributes: %d (%s).\n", vas, vaErrorStr(vas));
 
 1529     max_slices      = attr[0].value;
 
 1530     slice_structure = attr[1].value;
 
 1531     if (max_slices      == VA_ATTRIB_NOT_SUPPORTED ||
 
 1532         slice_structure == VA_ATTRIB_NOT_SUPPORTED) {
 
 1534                "pictures as multiple slices.\n.");
 
 1545                "configured number of slices (%d < %d); using " 
 1549         req_slices = avctx->
slices;
 
 1551     if (slice_structure & VA_ENC_SLICE_STRUCTURE_ARBITRARY_ROWS ||
 
 1552         slice_structure & VA_ENC_SLICE_STRUCTURE_ARBITRARY_MACROBLOCKS) {
 
 1555     } 
else if (slice_structure & VA_ENC_SLICE_STRUCTURE_POWER_OF_TWO_ROWS) {
 
 1557         for (k = 1;; k *= 2) {
 
 1563 #if VA_CHECK_VERSION(1, 0, 0) 
 1564     } 
else if (slice_structure & VA_ENC_SLICE_STRUCTURE_EQUAL_ROWS) {
 
 1570                "slice structure modes (%#x).\n", slice_structure);
 
 1576                "%d (from %d) due to driver constraints on slice " 
 1581                "encoding with %d slices (max %"PRIu32
").\n",
 
 1587            "(default size %d block rows).\n",
 
 1596     VAConfigAttrib attr = { VAConfigAttribEncPackedHeaders };
 
 1602     if (vas != VA_STATUS_SUCCESS) {
 
 1604                "attribute: %d (%s).\n", vas, vaErrorStr(vas));
 
 1608     if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
 
 1611                    "packed headers (wanted %#x).\n",
 
 1615                    "packed headers (none wanted).\n");
 
 1621                    "wanted packed headers (wanted %#x, found %#x).\n",
 
 1625                    "available (wanted %#x, found %#x).\n",
 
 1634             .type  = VAConfigAttribEncPackedHeaders,
 
 1643                "sequence headers, but a global header is requested.\n");
 
 1645                "this may result in a stream which is not usable for some " 
 1646                "purposes (e.g. not muxable to some containers).\n");
 
 1654 #if VA_CHECK_VERSION(0, 36, 0) 
 1657     VAConfigAttrib attr = { VAConfigAttribEncQualityRange };
 
 1664     if (vas != VA_STATUS_SUCCESS) {
 
 1666                "config attribute: %d (%s).\n", vas, vaErrorStr(vas));
 
 1670     if (attr.value == VA_ATTRIB_NOT_SUPPORTED) {
 
 1673                    "supported: will use default quality level.\n");
 
 1676         if (quality > attr.value) {
 
 1678                    "valid range is 0-%d, using %d.\n",
 
 1679                    attr.value, attr.value);
 
 1680             quality = attr.value;
 
 1683         ctx->quality_params.
misc.type = VAEncMiscParameterTypeQualityLevel;
 
 1684         ctx->quality_params.quality.quality_level = quality;
 
 1687                                       sizeof(ctx->quality_params));
 
 1691            "not supported with this VAAPI version.\n");
 
 1702     VABufferID buffer_id;
 
 1704     buffer_id = (VABufferID)(uintptr_t)
data;
 
 1716     VABufferID buffer_id;
 
 1725                          VAEncCodedBufferType,
 
 1727                          (1 << 16), 1, 0, &buffer_id);
 
 1728     if (vas != VA_STATUS_SUCCESS) {
 
 1730                "output buffer: %d (%s).\n", vas, vaErrorStr(vas));
 
 1799                "size %dx%d (constraints: width %d-%d height %d-%d).\n",
 
 1828                "frame context: %d.\n", err);
 
 1848                "required to associate the encoding device.\n");
 
 1900     if (vas != VA_STATUS_SUCCESS) {
 
 1902                "configuration: %d (%s).\n", vas, vaErrorStr(vas));
 
 1918     if (vas != VA_STATUS_SUCCESS) {
 
 1920                "context: %d (%s).\n", vas, vaErrorStr(vas));
 
 1965                    "failed: %d.\n", err);
 
 1972     ctx->
issue_mode = ISSUE_MODE_MAXIMISE_THROUGHPUT;
 
 1978         size_t bit_len = 8 * 
sizeof(
data);
 
 1983                    "for extradata: %d.\n", err);
 
 2009     for (pic = ctx->
pic_start; pic; pic = next) {
 
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e. 
VASurfaceID input_surface
VAEncMiscParameterBuffer misc
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
VAAPI-specific data associated with a frame pool. 
This structure describes decoded (raw) audio or video data. 
VAEntrypoint va_entrypoint
ptrdiff_t const GLvoid * data
static const VAAPIEncodeRTFormat vaapi_encode_rt_formats[]
#define AV_LOG_WARNING
Something somehow does not look correct. 
int64_t bit_rate
the average bitrate 
int max_b_frames
maximum number of B-frames between non-B-frames Note: The output will be delayed by max_b_frames+1 re...
int rc_initial_buffer_occupancy
Number of bits which should be loaded into the rc buffer before decoding starts. 
The driver does not destroy parameter buffers when they are used by vaRenderPicture(). 
static av_cold int vaapi_encode_profile_entrypoint(AVCodecContext *avctx)
int width
The allocated dimensions of the frames in this pool. 
static int vaapi_encode_make_packed_header(AVCodecContext *avctx, VAAPIEncodePicture *pic, int type, char *data, size_t bit_len)
static const char *const picture_type_name[]
void * av_hwdevice_hwconfig_alloc(AVBufferRef *ref)
Allocate a HW-specific configuration structure for a given HW device. 
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type. 
int(* write_slice_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice, char *data, size_t *data_len)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void * codec_sequence_params
AVBufferRef * input_frames_ref
VAEncMiscParameterHRD hrd
size_t picture_params_size
AVHWDeviceContext * device
static int vaapi_encode_clear_old(AVCodecContext *avctx)
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width. 
static int vaapi_encode_wait(AVCodecContext *avctx, VAAPIEncodePicture *pic)
int max_width
The maximum size of frames in this hw_frames_ctx. 
static int vaapi_encode_discard(AVCodecContext *avctx, VAAPIEncodePicture *pic)
static int vaapi_encode_make_param_buffer(AVCodecContext *avctx, VAAPIEncodePicture *pic, int type, char *data, size_t len)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
void av_hwframe_constraints_free(AVHWFramesConstraints **constraints)
Free an AVHWFrameConstraints structure. 
unsigned int va_packed_headers
#define av_assert0(cond)
assert() equivalent, that is always enabled. 
VAEncMiscParameterFrameRate fr
static VAAPIEncodePicture * vaapi_encode_alloc(void)
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed. 
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values. 
static int vaapi_encode_issue(AVCodecContext *avctx, VAAPIEncodePicture *pic)
static av_cold int end(AVCodecContext *avctx)
int(* write_picture_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, char *data, size_t *data_len)
int av_frame_ref(AVFrame *dst, const AVFrame *src)
Set up a new reference to the data described by the source frame. 
static AVBufferRef * vaapi_encode_alloc_output_buffer(void *opaque, int size)
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user). 
uint8_t * extradata
some codecs need / can use extradata like Huffman tables. 
AVBufferRef * output_buffer_ref
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context. 
VABufferID * param_buffers
struct VAAPIEncodeContext::@161 rc_params
#define AVERROR_EOF
End of file. 
#define AV_LOG_VERBOSE
Detailed information. 
VASurfaceID recon_surface
#define AV_BUFFER_FLAG_READONLY
Always treat the buffer as read-only, even when it has only one reference. 
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction. 
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe. 
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values. 
VAConfigAttrib config_attributes[MAX_CONFIG_ATTRIBUTES]
AVHWFramesContext * input_frames
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered. 
VAAPI hardware pipeline configuration details. 
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height. 
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g. 
static av_cold int vaapi_encode_init_packed_headers(AVCodecContext *avctx)
int qmax
maximum quantizer 
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers. 
VAEncMiscParameterBuffer * global_params[MAX_GLOBAL_PARAMS]
int(* configure)(AVCodecContext *avctx)
int flags
AV_CODEC_FLAG_*. 
struct VAAPIEncodeContext::@163 fr_params
simple assert() macros that are a bit more flexible than ISO C assert(). 
AVBufferRef * av_buffer_create(uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array. 
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use. 
int(* init_picture_params)(AVCodecContext *avctx, VAAPIEncodePicture *pic)
void * codec_picture_params
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext. 
int(* write_extra_header)(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
AVHWFramesContext * recon_frames
int flags
A combination of AV_PKT_FLAG values. 
int rc_buffer_size
decoder bitstream buffer size 
static av_cold int vaapi_encode_init_gop_structure(AVCodecContext *avctx)
VAAPIEncodeSlice * slices
int initial_pool_size
Initial size of the frame pool. 
uint8_t nb_components
The number of components each pixel has, (1-4) 
enum AVPictureType pict_type
Picture type of the frame. 
#define AV_CODEC_FLAG_QSCALE
Use fixed qscale. 
int width
picture width / height. 
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames...
const VAAPIEncodeProfile * profile
#define FF_PROFILE_UNKNOWN
const VAAPIEncodeProfile * profiles
av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
struct VAAPIEncodePicture * next
void * codec_picture_params
int64_t ts_ring[MAX_REORDER_DELAY *3]
AVBufferPool * output_buffer_pool
AVBufferPool * av_buffer_pool_init2(int size, void *opaque, AVBufferRef *(*alloc)(void *opaque, int size), void(*pool_free)(void *opaque))
Allocate and initialize a buffer pool with a more complex allocator. 
#define FF_ARRAY_ELEMS(a)
VADisplay display
The VADisplay handle, to be filled by the user. 
int(* write_sequence_header)(AVCodecContext *avctx, char *data, size_t *data_len)
struct VAAPIEncodePicture * refs[MAX_PICTURE_REFERENCES]
int min_width
The minimum size of frames in this hw_frames_ctx. 
const struct VAAPIEncodeType * codec
Libavcodec external API header. 
This struct describes the constraints on hardware frames attached to a given device with a hardware-s...
VAAPIEncodePicture * pic_start
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
main external API structure. 
AVHWFramesConstraints * av_hwdevice_get_hwframe_constraints(AVBufferRef *ref, const void *hwconfig)
Get the constraints on HW frames given a device and the HW-specific configuration to be used with tha...
uint8_t * data
The data buffer. 
int(* write_extra_buffer)(AVCodecContext *avctx, VAAPIEncodePicture *pic, int index, int *type, char *data, size_t *data_len)
int qmin
minimum quantizer 
void * hwctx
The format-specific data, allocated and freed automatically along with this context. 
unsigned int driver_quirks
Driver quirks to apply - this is filled by av_hwdevice_ctx_init(), with reference to a table of known...
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing. 
This struct describes a set or pool of "hardware" frames (i.e. 
static int vaapi_encode_step(AVCodecContext *avctx, VAAPIEncodePicture *target)
AVBufferRef * recon_frames_ref
static av_cold void vaapi_encode_add_global_param(AVCodecContext *avctx, VAEncMiscParameterBuffer *buffer, size_t size)
static int vaapi_encode_truncate_gop(AVCodecContext *avctx)
static av_cold int vaapi_encode_init_quality(AVCodecContext *avctx)
VAAPIEncodePicture * pic_end
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
AVBufferRef * device_ref
A reference to the parent AVHWDeviceContext. 
#define AV_CODEC_FLAG_GLOBAL_HEADER
Place global headers in extradata instead of every keyframe. 
size_t global_params_size[MAX_GLOBAL_PARAMS]
int gop_size
the number of pictures in a group of pictures, or 0 for intra_only 
VAEncMiscParameterRateControl rc
A reference to a data buffer. 
size_t sequence_params_size
common internal and external API header 
static int ref[MAX_W *MAX_W]
struct VAAPIEncodeContext::@162 hrd_params
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context. 
static int vaapi_encode_get_next(AVCodecContext *avctx, VAAPIEncodePicture **pic_out)
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer. 
int ff_vaapi_encode2(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *input_image, int *got_packet)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int slices
Number of slices. 
static av_cold int vaapi_encode_create_recon_frames(AVCodecContext *avctx)
static const VAEntrypoint vaapi_encode_entrypoints_normal[]
enum AVPixelFormat * valid_sw_formats
A list of possible values for sw_format in the hw_frames_ctx, terminated by AV_PIX_FMT_NONE. 
void * codec_slice_params
static int vaapi_encode_free(AVCodecContext *avctx, VAAPIEncodePicture *pic)
int(* init_slice_params)(AVCodecContext *avctx, VAAPIEncodePicture *pic, VAAPIEncodeSlice *slice)
VAConfigID config_id
ID of a VAAPI pipeline configuration. 
int(* init_sequence_params)(AVCodecContext *avctx)
static void vaapi_encode_free_output_buffer(void *opaque, uint8_t *data)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
unsigned int desired_packed_headers
enum VAAPIEncodeContext::@164 issue_mode
VASurfaceID * surface_ids
The surfaces IDs of all surfaces in the pool after creation. 
static av_cold int vaapi_encode_init_slice_structure(AVCodecContext *avctx)
AVBufferRef * av_buffer_pool_get(AVBufferPool *pool)
Allocate a new AVBuffer, reusing an old buffer from the pool when available. 
#define av_malloc_array(a, b)
static av_cold int vaapi_encode_init_rate_control(AVCodecContext *avctx)
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown. 
int depth
Number of bits in the component. 
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames. 
#define AVERROR_EXTERNAL
Generic error in an external library. 
AVPixelFormat
Pixel format. 
This structure stores compressed data. 
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
int64_t rc_max_rate
maximum bitrate 
void * av_mallocz_array(size_t nmemb, size_t size)
static int vaapi_encode_output(AVCodecContext *avctx, VAAPIEncodePicture *pic, AVPacket *pkt)
AVVAAPIDeviceContext * hwctx