| 1448 | } |
| 1449 | |
| 1450 | static int d3d12va_create_encoder(AVCodecContext *avctx) |
| 1451 | { |
| 1452 | FFHWBaseEncodeContext *base_ctx = avctx->priv_data; |
| 1453 | D3D12VAEncodeContext *ctx = avctx->priv_data; |
| 1454 | AVD3D12VAFramesContext *frames_hwctx = base_ctx->input_frames->hwctx; |
| 1455 | HRESULT hr; |
| 1456 | |
| 1457 | D3D12_VIDEO_ENCODER_DESC desc = { |
| 1458 | .NodeMask = 0, |
| 1459 | .Flags = D3D12_VIDEO_ENCODER_FLAG_NONE, |
| 1460 | .EncodeCodec = ctx->codec->d3d12_codec, |
| 1461 | .EncodeProfile = ctx->profile->d3d12_profile, |
| 1462 | .InputFormat = frames_hwctx->format, |
| 1463 | .CodecConfiguration = ctx->codec_conf, |
| 1464 | .MaxMotionEstimationPrecision = ctx->me_precision, |
| 1465 | }; |
| 1466 | |
| 1467 | hr = ID3D12VideoDevice3_CreateVideoEncoder(ctx->video_device3, &desc, &IID_ID3D12VideoEncoder, |
| 1468 | (void **)&ctx->encoder); |
| 1469 | if (FAILED(hr)) { |
| 1470 | av_log(avctx, AV_LOG_ERROR, "Failed to create encoder.\n"); |
| 1471 | return AVERROR(EINVAL); |
| 1472 | } |
| 1473 | |
| 1474 | return 0; |
| 1475 | } |
| 1476 | |
| 1477 | static int d3d12va_create_encoder_heap(AVCodecContext *avctx) |
| 1478 | { |
no test coverage detected