MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / vaapi_encode_profile_entrypoint

Function vaapi_encode_profile_entrypoint

libavcodec/vaapi_encode.c:935–1134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

933#endif
934
935static av_cold int vaapi_encode_profile_entrypoint(AVCodecContext *avctx)
936{
937 FFHWBaseEncodeContext *base_ctx = avctx->priv_data;
938 VAAPIEncodeContext *ctx = avctx->priv_data;
939 VAProfile *va_profiles = NULL;
940 VAEntrypoint *va_entrypoints = NULL;
941 VAStatus vas;
942 const VAEntrypoint *usable_entrypoints;
943 const VAAPIEncodeProfile *profile;
944 const AVPixFmtDescriptor *desc;
945 VAConfigAttrib rt_format_attr;
946 const VAAPIEncodeRTFormat *rt_format;
947 const char *profile_string, *entrypoint_string;
948 int i, j, n, depth, err;
949
950
951 if (ctx->low_power) {
952#if VA_CHECK_VERSION(0, 39, 2)
953 usable_entrypoints = vaapi_encode_entrypoints_low_power;
954#else
955 av_log(avctx, AV_LOG_ERROR, "Low-power encoding is not "
956 "supported with this VAAPI version.\n");
957 return AVERROR(EINVAL);
958#endif
959 } else {
960 usable_entrypoints = vaapi_encode_entrypoints_normal;
961 }
962
963 desc = av_pix_fmt_desc_get(base_ctx->input_frames->sw_format);
964 if (!desc) {
965 av_log(avctx, AV_LOG_ERROR, "Invalid input pixfmt (%d).\n",
966 base_ctx->input_frames->sw_format);
967 return AVERROR(EINVAL);
968 }
969 depth = desc->comp[0].depth;
970 for (i = 1; i < desc->nb_components; i++) {
971 if (desc->comp[i].depth != depth) {
972 av_log(avctx, AV_LOG_ERROR, "Invalid input pixfmt (%s).\n",
973 desc->name);
974 return AVERROR(EINVAL);
975 }
976 }
977 av_log(avctx, AV_LOG_VERBOSE, "Input surface format is %s.\n",
978 desc->name);
979
980 n = vaMaxNumProfiles(ctx->hwctx->display);
981 va_profiles = av_malloc_array(n, sizeof(VAProfile));
982 if (!va_profiles) {
983 err = AVERROR(ENOMEM);
984 goto fail;
985 }
986 vas = vaQueryConfigProfiles(ctx->hwctx->display, va_profiles, &n);
987 if (vas != VA_STATUS_SUCCESS) {
988 av_log(avctx, AV_LOG_ERROR, "Failed to query profiles: %d (%s).\n",
989 vas, vaErrorStr(vas));
990 err = AVERROR_EXTERNAL;
991 goto fail;
992 }

Callers 1

ff_vaapi_encode_initFunction · 0.85

Calls 4

av_logFunction · 0.85
av_pix_fmt_desc_getFunction · 0.85
av_malloc_arrayFunction · 0.85
av_freepFunction · 0.85

Tested by

no test coverage detected