From b73a223dc58df05b8ce814ce70c87c8e1de7b2b7 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 10 Sep 2020 20:32:13 +0900 Subject: [PATCH] d3d11vp9dec: Specify profile and alignment on sink template Set supported profile(s) on sink template caps, so that decodebin can filter out this element if profile of given vp9 stream is not supported by hardware decoder. Part-of: --- sys/d3d11/gstd3d11vp9dec.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sys/d3d11/gstd3d11vp9dec.c b/sys/d3d11/gstd3d11vp9dec.c index f2cffc6dde..8887f0c489 100644 --- a/sys/d3d11/gstd3d11vp9dec.c +++ b/sys/d3d11/gstd3d11vp9dec.c @@ -1136,6 +1136,7 @@ gst_d3d11_vp9_dec_register (GstPlugin * plugin, GstD3D11Device * device, gboolean have_profile2 = FALSE; gboolean have_profile0 = FALSE; DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN; + GValue vp9_profiles = G_VALUE_INIT; have_profile2 = gst_d3d11_decoder_get_supported_decoder_profile (decoder, &profile2_guid, 1, &profile); @@ -1198,15 +1199,26 @@ gst_d3d11_vp9_dec_register (GstPlugin * plugin, GstD3D11Device * device, } sink_caps = gst_caps_from_string ("video/x-vp9, " - "framerate = " GST_VIDEO_FPS_RANGE); + "alignment = (string) frame, framerate = " GST_VIDEO_FPS_RANGE); src_caps = gst_caps_from_string ("video/x-raw(" GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY "), " "framerate = " GST_VIDEO_FPS_RANGE ";" "video/x-raw, " "framerate = " GST_VIDEO_FPS_RANGE); + g_value_init (&vp9_profiles, GST_TYPE_LIST); + + if (have_profile0) { + GValue vp9_profile_val = G_VALUE_INIT; + + g_value_init (&vp9_profile_val, G_TYPE_STRING); + g_value_set_string (&vp9_profile_val, "0"); + gst_value_list_append_and_take_value (&vp9_profiles, &vp9_profile_val); + } + if (have_profile2) { GValue format_list = G_VALUE_INIT; GValue format_value = G_VALUE_INIT; + GValue vp9_profile_val = G_VALUE_INIT; g_value_init (&format_list, GST_TYPE_LIST); @@ -1220,10 +1232,17 @@ gst_d3d11_vp9_dec_register (GstPlugin * plugin, GstD3D11Device * device, gst_caps_set_value (src_caps, "format", &format_list); g_value_unset (&format_list); + + g_value_init (&vp9_profile_val, G_TYPE_STRING); + g_value_set_string (&vp9_profile_val, "2"); + gst_value_list_append_and_take_value (&vp9_profiles, &vp9_profile_val); } else { gst_caps_set_simple (src_caps, "format", G_TYPE_STRING, "NV12", NULL); } + gst_caps_set_value (sink_caps, "profile", &vp9_profiles); + g_value_unset (&vp9_profiles); + /* To cover both landscape and portrait, select max value */ resolution = MAX (max_width, max_height); gst_caps_set_simple (sink_caps,