diff --git a/gst-libs/gst/vaapi/gstvaapiprofile.c b/gst-libs/gst/vaapi/gstvaapiprofile.c index 539ac9b315..3105b90670 100644 --- a/gst-libs/gst/vaapi/gstvaapiprofile.c +++ b/gst-libs/gst/vaapi/gstvaapiprofile.c @@ -426,6 +426,15 @@ gst_vaapi_profile_from_caps (const GstCaps * caps) /* HACK: qtdemux does not report profiles for h263 */ profile = m->profile; } + + /* Consider HEVC -intra profiles. Just map them to their + * non-intra profiles */ + if (!profile && profile_str + && strncmp (name, "video/x-h265", namelen) == 0 + && g_str_has_prefix (profile_str, m->profile_str) + && strncmp (profile_str + strlen (m->profile_str), "-intra", 6) == 0) { + profile = m->profile; + } } gst_caps_unref (caps_test); } diff --git a/gst-libs/gst/vaapi/gstvaapiutils_h265.c b/gst-libs/gst/vaapi/gstvaapiutils_h265.c index 2c078e820d..a276a7ba1f 100644 --- a/gst-libs/gst/vaapi/gstvaapiutils_h265.c +++ b/gst-libs/gst/vaapi/gstvaapiutils_h265.c @@ -184,6 +184,61 @@ gst_vaapi_utils_h265_get_profile (GstH265SPS * sps) && sps->profile_tier_level.lower_bit_rate_constraint_flag == 1) { profile = GST_VAAPI_PROFILE_H265_MAIN_444_10; break; + } else if (sps->profile_tier_level.max_12bit_constraint_flag == 1 + && sps->profile_tier_level.max_10bit_constraint_flag == 1 + && sps->profile_tier_level.max_8bit_constraint_flag == 1 + && sps->profile_tier_level.max_422chroma_constraint_flag == 1 + && sps->profile_tier_level.max_420chroma_constraint_flag == 1 + && sps->profile_tier_level.max_monochrome_constraint_flag == 0 + && sps->profile_tier_level.intra_constraint_flag == 1 + && sps->profile_tier_level.one_picture_only_constraint_flag == 0) { + /* Main Intra, recognize it as MAIN */ + profile = GST_VAAPI_PROFILE_H265_MAIN; + break; + } else if (sps->profile_tier_level.max_12bit_constraint_flag == 1 + && sps->profile_tier_level.max_10bit_constraint_flag == 1 + && sps->profile_tier_level.max_8bit_constraint_flag == 0 + && sps->profile_tier_level.max_422chroma_constraint_flag == 1 + && sps->profile_tier_level.max_420chroma_constraint_flag == 1 + && sps->profile_tier_level.max_monochrome_constraint_flag == 0 + && sps->profile_tier_level.intra_constraint_flag == 1 + && sps->profile_tier_level.one_picture_only_constraint_flag == 0) { + /* Main 10 Intra, recognize it as MAIN10 */ + profile = GST_VAAPI_PROFILE_H265_MAIN10; + break; + } else if (sps->profile_tier_level.max_12bit_constraint_flag == 1 + && sps->profile_tier_level.max_10bit_constraint_flag == 1 + && sps->profile_tier_level.max_8bit_constraint_flag == 1 + && sps->profile_tier_level.max_422chroma_constraint_flag == 0 + && sps->profile_tier_level.max_420chroma_constraint_flag == 0 + && sps->profile_tier_level.max_monochrome_constraint_flag == 0 + && sps->profile_tier_level.intra_constraint_flag == 1 + && sps->profile_tier_level.one_picture_only_constraint_flag == 0) { + /* Main 444 Intra, recognize it as MAIN_444 */ + profile = GST_VAAPI_PROFILE_H265_MAIN_444; + break; + } else if (sps->profile_tier_level.max_12bit_constraint_flag == 1 + && sps->profile_tier_level.max_10bit_constraint_flag == 1 + && sps->profile_tier_level.max_8bit_constraint_flag == 0 + && sps->profile_tier_level.max_422chroma_constraint_flag == 0 + && sps->profile_tier_level.max_420chroma_constraint_flag == 0 + && sps->profile_tier_level.max_monochrome_constraint_flag == 0 + && sps->profile_tier_level.intra_constraint_flag == 1 + && sps->profile_tier_level.one_picture_only_constraint_flag == 0) { + /* Main 444_10 Intra, recognize it as MAIN_444_10 */ + profile = GST_VAAPI_PROFILE_H265_MAIN_444_10; + break; + } else if (sps->profile_tier_level.max_12bit_constraint_flag == 1 + && sps->profile_tier_level.max_10bit_constraint_flag == 1 + && sps->profile_tier_level.max_8bit_constraint_flag == 0 + && sps->profile_tier_level.max_422chroma_constraint_flag == 1 + && sps->profile_tier_level.max_420chroma_constraint_flag == 0 + && sps->profile_tier_level.max_monochrome_constraint_flag == 0 + && sps->profile_tier_level.intra_constraint_flag == 1 + && sps->profile_tier_level.one_picture_only_constraint_flag == 0) { + /* Main 422_10 Intra, recognize it as MAIN_422_10 */ + profile = GST_VAAPI_PROFILE_H265_MAIN_422_10; + break; } default: GST_DEBUG ("unsupported profile_idc value"); diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index d5db810793..68de7e9d5b 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -1267,9 +1267,34 @@ gst_vaapidecode_ensure_allowed_sinkpad_caps (GstVaapiDecode * decode) continue; profile_name = gst_vaapi_profile_get_name (profile); - if (profile_name) - gst_structure_set (structure, "profile", G_TYPE_STRING, - profile_name, NULL); + if (profile_name) { + /* Add all according -intra profile for HEVC */ + if (profile == GST_VAAPI_PROFILE_H265_MAIN + || profile == GST_VAAPI_PROFILE_H265_MAIN10 + || profile == GST_VAAPI_PROFILE_H265_MAIN_422_10 + || profile == GST_VAAPI_PROFILE_H265_MAIN_444 + || profile == GST_VAAPI_PROFILE_H265_MAIN_444_10) { + GValue list_value = G_VALUE_INIT; + GValue value = G_VALUE_INIT; + gchar *intra_name; + + g_value_init (&list_value, GST_TYPE_LIST); + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, profile_name); + gst_value_list_append_value (&list_value, &value); + + intra_name = g_strdup_printf ("%s-intra", profile_name); + g_value_take_string (&value, intra_name); + gst_value_list_append_value (&list_value, &value); + + gst_structure_set_value (structure, "profile", &list_value); + g_value_unset (&list_value); + g_value_unset (&value); + } else { + gst_structure_set (structure, "profile", G_TYPE_STRING, + profile_name, NULL); + } + } gst_vaapi_profile_caps_append_decoder (display, profile, structure);