| 32 | |
| 33 | |
| 34 | int ff_vaapi_decode_make_param_buffer(AVCodecContext *avctx, |
| 35 | VAAPIDecodePicture *pic, |
| 36 | int type, |
| 37 | const void *data, |
| 38 | size_t size) |
| 39 | { |
| 40 | VAAPIDecodeContext *ctx = avctx->internal->hwaccel_priv_data; |
| 41 | VAStatus vas; |
| 42 | |
| 43 | av_assert0(pic->nb_param_buffers <= pic->nb_param_buffers_allocated); |
| 44 | if (pic->nb_param_buffers == pic->nb_param_buffers_allocated) { |
| 45 | VABufferID *tmp = |
| 46 | av_realloc_array(pic->param_buffers, |
| 47 | pic->nb_param_buffers_allocated + 16, |
| 48 | sizeof(*pic->param_buffers)); |
| 49 | if (!tmp) |
| 50 | return AVERROR(ENOMEM); |
| 51 | |
| 52 | pic->param_buffers = tmp; |
| 53 | pic->nb_param_buffers_allocated += 16; |
| 54 | } |
| 55 | av_assert0(pic->nb_param_buffers + 1 <= pic->nb_param_buffers_allocated); |
| 56 | |
| 57 | vas = vaCreateBuffer(ctx->hwctx->display, ctx->va_context, |
| 58 | type, size, 1, (void*)data, |
| 59 | &pic->param_buffers[pic->nb_param_buffers]); |
| 60 | if (vas != VA_STATUS_SUCCESS) { |
| 61 | av_log(avctx, AV_LOG_ERROR, "Failed to create parameter " |
| 62 | "buffer (type %d): %d (%s).\n", |
| 63 | type, vas, vaErrorStr(vas)); |
| 64 | return AVERROR(EIO); |
| 65 | } |
| 66 | |
| 67 | av_log(avctx, AV_LOG_DEBUG, "Param buffer (type %d, %zu bytes) " |
| 68 | "is %#x.\n", type, size, pic->param_buffers[pic->nb_param_buffers]); |
| 69 | |
| 70 | ++pic->nb_param_buffers; |
| 71 | |
| 72 | return 0; |
| 73 | } |
| 74 | |
| 75 | int ff_vaapi_decode_make_slice_buffer(AVCodecContext *avctx, |
| 76 | VAAPIDecodePicture *pic, |
no test coverage detected