| 85 | } |
| 86 | |
| 87 | static int vaapi_encode_make_param_buffer(AVCodecContext *avctx, |
| 88 | VAAPIEncodePicture *pic, |
| 89 | int type, char *data, size_t len) |
| 90 | { |
| 91 | VAAPIEncodeContext *ctx = avctx->priv_data; |
| 92 | VAStatus vas; |
| 93 | VABufferID *tmp; |
| 94 | VABufferID buffer; |
| 95 | |
| 96 | tmp = av_realloc_array(pic->param_buffers, pic->nb_param_buffers + 1, sizeof(*tmp)); |
| 97 | if (!tmp) |
| 98 | return AVERROR(ENOMEM); |
| 99 | pic->param_buffers = tmp; |
| 100 | |
| 101 | vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context, |
| 102 | type, len, 1, data, &buffer); |
| 103 | if (vas != VA_STATUS_SUCCESS) { |
| 104 | av_log(avctx, AV_LOG_ERROR, "Failed to create parameter buffer " |
| 105 | "(type %d): %d (%s).\n", type, vas, vaErrorStr(vas)); |
| 106 | return AVERROR(EIO); |
| 107 | } |
| 108 | pic->param_buffers[pic->nb_param_buffers++] = buffer; |
| 109 | |
| 110 | av_log(avctx, AV_LOG_DEBUG, "Param buffer (%d) is %#x.\n", |
| 111 | type, buffer); |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 | static int vaapi_encode_make_misc_param_buffer(AVCodecContext *avctx, |
| 116 | VAAPIEncodePicture *pic, |
no test coverage detected