VAStatus vas;
int err, i, j;
const AVCodecDescriptor *codec_desc;
- VAProfile profile, va_profile, *profile_list = NULL;
- int profile_count, exact_match, alt_profile;
+ VAProfile *profile_list = NULL, matched_va_profile;
+ int profile_count, exact_match, matched_ff_profile;
const AVPixFmtDescriptor *sw_desc, *desc;
AVHWDeviceContext *device = (AVHWDeviceContext*)device_ref->data;
goto fail;
}
- profile = VAProfileNone;
+ matched_va_profile = VAProfileNone;
exact_match = 0;
for (i = 0; i < FF_ARRAY_ELEMS(vaapi_profile_map); i++) {
int profile_match = 0;
if (avctx->codec_id != vaapi_profile_map[i].codec_id)
continue;
- if (avctx->profile == vaapi_profile_map[i].codec_profile)
+ if (avctx->profile == vaapi_profile_map[i].codec_profile ||
+ vaapi_profile_map[i].codec_profile == FF_PROFILE_UNKNOWN)
profile_match = 1;
- profile = vaapi_profile_map[i].va_profile;
for (j = 0; j < profile_count; j++) {
- if (profile == profile_list[j]) {
+ if (vaapi_profile_map[i].va_profile == profile_list[j]) {
exact_match = profile_match;
break;
}
}
if (j < profile_count) {
+ matched_va_profile = vaapi_profile_map[i].va_profile;
+ matched_ff_profile = vaapi_profile_map[i].codec_profile;
if (exact_match)
break;
- alt_profile = vaapi_profile_map[i].codec_profile;
- va_profile = vaapi_profile_map[i].va_profile;
}
}
av_freep(&profile_list);
- if (profile == VAProfileNone) {
+ if (matched_va_profile == VAProfileNone) {
av_log(avctx, AV_LOG_ERROR, "No support for codec %s "
"profile %d.\n", codec_desc->name, avctx->profile);
err = AVERROR(ENOSYS);
codec_desc->name, avctx->profile);
av_log(avctx, AV_LOG_WARNING, "Using possibly-"
"incompatible profile %d instead.\n",
- alt_profile);
- profile = va_profile;
+ matched_ff_profile);
} else {
av_log(avctx, AV_LOG_VERBOSE, "Codec %s profile %d not "
"supported for hardware decode.\n",
}
}
- vas = vaCreateConfig(hwctx->display, profile,
+ vas = vaCreateConfig(hwctx->display, matched_va_profile,
VAEntrypointVLD, NULL, 0,
va_config);
if (vas != VA_STATUS_SUCCESS) {