diff --git a/sys/d3d11/gstd3d11decoder.cpp b/sys/d3d11/gstd3d11decoder.cpp index 6255e38efc..c1479412b7 100644 --- a/sys/d3d11/gstd3d11decoder.cpp +++ b/sys/d3d11/gstd3d11decoder.cpp @@ -59,6 +59,59 @@ GST_DEBUG_CATEGORY (d3d11_decoder_debug); #define GST_CAT_DEFAULT d3d11_decoder_debug +/* GUID might not be defined in MinGW header */ +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_H264_IDCT_FGT, 0x1b81be67, 0xa0c7, + 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5); +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_NOFGT, 0x1b81be68, 0xa0c7, + 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5); +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_FGT, 0x1b81be69, 0xa0c7, + 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5); +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN, + 0x5b11d51b, 0x2f4c, 0x4452, 0xbc, 0xc3, 0x09, 0xf2, 0xa1, 0x16, 0x0c, 0xc0); +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10, + 0x107af0e0, 0xef1a, 0x4d19, 0xab, 0xa8, 0x67, 0xa1, 0x63, 0x07, 0x3d, 0x13); +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_VP8_VLD, + 0x90b899ea, 0x3a62, 0x4705, 0x88, 0xb3, 0x8d, 0xf0, 0x4b, 0x27, 0x44, 0xe7); +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0, + 0x463707f8, 0xa1d0, 0x4585, 0x87, 0x6d, 0x83, 0xaa, 0x6d, 0x60, 0xb8, 0x9e); +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2, + 0xa4c749ef, 0x6ecf, 0x48aa, 0x84, 0x48, 0x50, 0xa7, 0xa1, 0x16, 0x5f, 0xf7); +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_MPEG2_VLD, 0xee27417f, 0x5e28, + 0x4e65, 0xbe, 0xea, 0x1d, 0x26, 0xb5, 0x08, 0xad, 0xc9); +DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_MPEG2and1_VLD, 0x86695f12, 0x340e, + 0x4f04, 0x9f, 0xd3, 0x92, 0x53, 0xdd, 0x32, 0x74, 0x60); + +static const GUID *profile_h264_list[] = { + &GST_GUID_D3D11_DECODER_PROFILE_H264_IDCT_FGT, + &GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_NOFGT, + &GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_FGT, +}; + +static const GUID *profile_hevc_list[] = { + &GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN, +}; + +static const GUID *profile_hevc_10_list[] = { + &GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10, +}; + +static const GUID *profile_vp8_list[] = { + &GST_GUID_D3D11_DECODER_PROFILE_VP8_VLD, +}; + +static const GUID *profile_vp9_list[] = { + &GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0, +}; + +static const GUID *profile_vp9_10_list[] = { + &GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2, +}; + +static const GUID *profile_mpeg2_list[] = { + &GST_GUID_D3D11_DECODER_PROFILE_MPEG2_VLD, + &GST_GUID_D3D11_DECODER_PROFILE_MPEG2and1_VLD +}; + enum { PROP_0, @@ -376,7 +429,7 @@ error: gboolean gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Decoder * decoder, - const GUID ** decoder_profiles, guint profile_size, GUID * selected_profile) + GstD3D11Codec codec, GstVideoFormat format, const GUID ** selected_profile) { GUID *guid_list = NULL; const GUID *profile = NULL; @@ -384,12 +437,60 @@ gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Decoder * decoder, guint i, j; HRESULT hr; ID3D11VideoDevice *video_device; + const GUID **profile_list = NULL; + gint profile_size = 0; g_return_val_if_fail (GST_IS_D3D11_DECODER (decoder), FALSE); - g_return_val_if_fail (decoder_profiles != NULL, FALSE); - g_return_val_if_fail (profile_size > 0, FALSE); g_return_val_if_fail (selected_profile != NULL, FALSE); + switch (codec) { + case GST_D3D11_CODEC_H264: + if (format == GST_VIDEO_FORMAT_NV12) { + profile_list = profile_h264_list; + profile_size = G_N_ELEMENTS (profile_h264_list); + } + break; + case GST_D3D11_CODEC_H265: + if (format == GST_VIDEO_FORMAT_NV12) { + profile_list = profile_hevc_list; + profile_size = G_N_ELEMENTS (profile_hevc_list); + } else if (format == GST_VIDEO_FORMAT_P010_10LE) { + profile_list = profile_hevc_10_list; + profile_size = G_N_ELEMENTS (profile_hevc_10_list); + } + break; + case GST_D3D11_CODEC_VP8: + if (format == GST_VIDEO_FORMAT_NV12) { + profile_list = profile_vp8_list; + profile_size = G_N_ELEMENTS (profile_vp8_list); + } + break; + case GST_D3D11_CODEC_VP9: + if (format == GST_VIDEO_FORMAT_NV12) { + profile_list = profile_vp9_list; + profile_size = G_N_ELEMENTS (profile_vp9_list); + } else if (format == GST_VIDEO_FORMAT_P010_10LE) { + profile_list = profile_vp9_10_list; + profile_size = G_N_ELEMENTS (profile_vp9_10_list); + } + break; + case GST_D3D11_CODEC_MPEG2: + if (format == GST_VIDEO_FORMAT_NV12) { + profile_list = profile_mpeg2_list; + profile_size = G_N_ELEMENTS (profile_mpeg2_list); + } + break; + default: + break; + } + + if (!profile_list) { + GST_ERROR_OBJECT (decoder, + "Not supported codec (%d) and format (%s) configuration", codec, + gst_video_format_to_string (format)); + return FALSE; + } + video_device = decoder->video_device; available_profile_count = video_device->GetVideoDecoderProfileCount (); @@ -425,7 +526,7 @@ gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Decoder * decoder, GST_LOG_OBJECT (decoder, "Requested decoder GUID"); for (i = 0; i < profile_size; i++) { - const GUID *guid = decoder_profiles[i]; + const GUID *guid = profile_list[i]; GST_LOG_OBJECT (decoder, "\t { %8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x }", @@ -437,8 +538,8 @@ gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Decoder * decoder, for (i = 0; i < profile_size; i++) { for (j = 0; j < available_profile_count; j++) { - if (IsEqualGUID (*decoder_profiles[i], guid_list[j])) { - profile = decoder_profiles[i]; + if (IsEqualGUID (*profile_list[i], guid_list[j])) { + profile = profile_list[i]; break; } } @@ -449,25 +550,22 @@ gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Decoder * decoder, return FALSE; } - *selected_profile = *profile; + *selected_profile = profile; GST_DEBUG_OBJECT (decoder, "Selected guid " "{ %8.8x-%4.4x-%4.4x-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x }", - (guint) selected_profile->Data1, (guint) selected_profile->Data2, - (guint) selected_profile->Data3, - selected_profile->Data4[0], selected_profile->Data4[1], - selected_profile->Data4[2], selected_profile->Data4[3], - selected_profile->Data4[4], selected_profile->Data4[5], - selected_profile->Data4[6], selected_profile->Data4[7]); + (guint) profile->Data1, (guint) profile->Data2, (guint) profile->Data3, + profile->Data4[0], profile->Data4[1], profile->Data4[2], + profile->Data4[3], profile->Data4[4], profile->Data4[5], + profile->Data4[6], profile->Data4[7]); return TRUE; } gboolean gst_d3d11_decoder_configure (GstD3D11Decoder * decoder, GstD3D11Codec codec, - GstVideoInfo * info, gint coded_width, gint coded_height, - guint dpb_size, const GUID ** decoder_profiles, guint profile_size) + GstVideoInfo * info, gint coded_width, gint coded_height, guint dpb_size) { const GstD3D11Format *d3d11_format; HRESULT hr; @@ -477,7 +575,7 @@ gst_d3d11_decoder_configure (GstD3D11Decoder * decoder, GstD3D11Codec codec, D3D11_VIDEO_DECODER_CONFIG *best_config = NULL; D3D11_VIDEO_DECODER_DESC decoder_desc = { 0, }; D3D11_TEXTURE2D_DESC staging_desc = { 0, }; - GUID selected_profile; + const GUID *selected_profile = NULL; guint i; gint aligned_width, aligned_height; guint alignment; @@ -492,8 +590,6 @@ gst_d3d11_decoder_configure (GstD3D11Decoder * decoder, GstD3D11Codec codec, g_return_val_if_fail (coded_width >= GST_VIDEO_INFO_WIDTH (info), FALSE); g_return_val_if_fail (coded_height >= GST_VIDEO_INFO_HEIGHT (info), FALSE); g_return_val_if_fail (dpb_size > 0, FALSE); - g_return_val_if_fail (decoder_profiles != NULL, FALSE); - g_return_val_if_fail (profile_size > 0, FALSE); decoder->configured = FALSE; decoder->use_array_of_texture = FALSE; @@ -511,11 +607,11 @@ gst_d3d11_decoder_configure (GstD3D11Decoder * decoder, GstD3D11Codec codec, gst_d3d11_device_lock (decoder->device); if (!gst_d3d11_decoder_get_supported_decoder_profile (decoder, - decoder_profiles, profile_size, &selected_profile)) { + codec, GST_VIDEO_INFO_FORMAT (info), &selected_profile)) { goto error; } - hr = video_device->CheckVideoDecoderFormat (&selected_profile, + hr = video_device->CheckVideoDecoderFormat (selected_profile, d3d11_format->dxgi_format, &can_support); if (!gst_d3d11_result (hr, decoder->device) || !can_support) { GST_ERROR_OBJECT (decoder, @@ -576,7 +672,7 @@ gst_d3d11_decoder_configure (GstD3D11Decoder * decoder, GstD3D11Codec codec, decoder_desc.SampleWidth = aligned_width; decoder_desc.SampleHeight = aligned_height; decoder_desc.OutputFormat = d3d11_format->dxgi_format; - decoder_desc.Guid = selected_profile; + decoder_desc.Guid = *selected_profile; hr = video_device->GetVideoDecoderConfigCount (&decoder_desc, &config_count); if (!gst_d3d11_result (hr, decoder->device) || config_count == 0) { @@ -675,7 +771,7 @@ gst_d3d11_decoder_configure (GstD3D11Decoder * decoder, GstD3D11Codec codec, memset (decoder->stating_texture_stride, 0, sizeof (decoder->stating_texture_stride)); - decoder->decoder_profile = selected_profile; + decoder->decoder_profile = *selected_profile; /* Store pool related information here, then we will setup internal pool * later once the number of min buffer size required by downstream is known. diff --git a/sys/d3d11/gstd3d11decoder.h b/sys/d3d11/gstd3d11decoder.h index 834ad78233..20a806af6e 100644 --- a/sys/d3d11/gstd3d11decoder.h +++ b/sys/d3d11/gstd3d11decoder.h @@ -62,11 +62,9 @@ gboolean gst_d3d11_decoder_is_configured (GstD3D11Decoder * decoder); gboolean gst_d3d11_decoder_configure (GstD3D11Decoder * decoder, GstD3D11Codec codec, GstVideoInfo * info, - gint codec_width, - gint codec_height, - guint dpb_size, - const GUID ** decoder_profiles, - guint profile_size); + gint coded_width, + gint coded_height, + guint dpb_size); void gst_d3d11_decoder_reset (GstD3D11Decoder * decoder); @@ -129,9 +127,9 @@ gboolean gst_d3d11_decoder_can_direct_render (GstD3D11Decoder * decod gboolean gst_d3d11_decoder_util_is_legacy_device (GstD3D11Device * device); gboolean gst_d3d11_decoder_get_supported_decoder_profile (GstD3D11Decoder * decoder, - const GUID ** decoder_profiles, - guint profile_size, - GUID * selected_profile); + GstD3D11Codec codec, + GstVideoFormat format, + const GUID ** selected_profile); gboolean gst_d3d11_decoder_supports_format (GstD3D11Decoder * decoder, const GUID * decoder_profile, diff --git a/sys/d3d11/gstd3d11h264dec.cpp b/sys/d3d11/gstd3d11h264dec.cpp index 020b8df61d..1963243dd1 100644 --- a/sys/d3d11/gstd3d11h264dec.cpp +++ b/sys/d3d11/gstd3d11h264dec.cpp @@ -96,14 +96,6 @@ enum PROP_VENDOR_ID, }; -/* copied from d3d11.h since mingw header doesn't define them */ -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_H264_IDCT_FGT, 0x1b81be67, 0xa0c7, - 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5); -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_NOFGT, 0x1b81be68, 0xa0c7, - 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5); -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_FGT, 0x1b81be69, 0xa0c7, - 0x11d3, 0xb9, 0x84, 0x00, 0xc0, 0x4f, 0x2e, 0x73, 0xc5); - typedef struct _GstD3D11H264Dec { GstH264Decoder parent; @@ -427,11 +419,6 @@ gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder, gint crop_width, crop_height; gboolean interlaced; gboolean modified = FALSE; - static const GUID *supported_profiles[] = { - &GST_GUID_D3D11_DECODER_PROFILE_H264_IDCT_FGT, - &GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_NOFGT, - &GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_FGT - }; GST_LOG_OBJECT (self, "new sequence"); @@ -490,12 +477,6 @@ gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder, else { GST_FIXME_OBJECT (self, "Could not support 8bits non-4:2:0 format"); } - } else if (self->bitdepth == 10) { - if (self->chroma_format_idc == 1) - self->out_format = GST_VIDEO_FORMAT_P010_10LE; - else { - GST_FIXME_OBJECT (self, "Could not support 10bits non-4:2:0 format"); - } } if (self->out_format == GST_VIDEO_FORMAT_UNKNOWN) { @@ -516,8 +497,7 @@ gst_d3d11_h264_dec_new_sequence (GstH264Decoder * decoder, if (!gst_d3d11_decoder_configure (self->d3d11_decoder, GST_D3D11_CODEC_H264, &info, self->coded_width, self->coded_height, /* Additional 4 views margin for zero-copy rendering */ - max_dpb_size + 4, - supported_profiles, G_N_ELEMENTS (supported_profiles))) { + max_dpb_size + 4)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return FALSE; } @@ -1268,7 +1248,6 @@ gst_d3d11_h264_dec_register (GstPlugin * plugin, GstD3D11Device * device, guint index = 0; guint i; gboolean ret; - GUID profile; GTypeInfo type_info = { sizeof (GstD3D11H264DecClass), NULL, @@ -1280,11 +1259,7 @@ gst_d3d11_h264_dec_register (GstPlugin * plugin, GstD3D11Device * device, 0, (GInstanceInitFunc) gst_d3d11_h264_dec_init, }; - static const GUID *supported_profiles[] = { - &GST_GUID_D3D11_DECODER_PROFILE_H264_IDCT_FGT, - &GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_NOFGT, - &GST_GUID_D3D11_DECODER_PROFILE_H264_VLD_FGT - }; + const GUID *supported_profile = NULL; /* values were taken from chromium. See supported_profile_helper.cc */ GstD3D11H264DecResolution resolutions_to_check[] = { {1920, 1088}, {2560, 1440}, {3840, 2160}, {4096, 2160}, @@ -1297,14 +1272,16 @@ gst_d3d11_h264_dec_register (GstPlugin * plugin, GstD3D11Device * device, guint resolution; ret = gst_d3d11_decoder_get_supported_decoder_profile (decoder, - supported_profiles, G_N_ELEMENTS (supported_profiles), &profile); + GST_D3D11_CODEC_H264, GST_VIDEO_FORMAT_NV12, &supported_profile); if (!ret) { GST_WARNING_OBJECT (device, "decoder profile unavailable"); return; } - ret = gst_d3d11_decoder_supports_format (decoder, &profile, DXGI_FORMAT_NV12); + ret = + gst_d3d11_decoder_supports_format (decoder, supported_profile, + DXGI_FORMAT_NV12); if (!ret) { GST_FIXME_OBJECT (device, "device does not support NV12 format"); return; @@ -1317,7 +1294,7 @@ gst_d3d11_h264_dec_register (GstPlugin * plugin, GstD3D11Device * device, max_height = resolutions_to_check[0].height; } else { for (i = 0; i < G_N_ELEMENTS (resolutions_to_check); i++) { - if (gst_d3d11_decoder_supports_resolution (decoder, &profile, + if (gst_d3d11_decoder_supports_resolution (decoder, supported_profile, DXGI_FORMAT_NV12, resolutions_to_check[i].width, resolutions_to_check[i].height)) { max_width = resolutions_to_check[i].width; diff --git a/sys/d3d11/gstd3d11h265dec.cpp b/sys/d3d11/gstd3d11h265dec.cpp index 543c8b7c46..cc7ebab2da 100644 --- a/sys/d3d11/gstd3d11h265dec.cpp +++ b/sys/d3d11/gstd3d11h265dec.cpp @@ -66,12 +66,6 @@ enum PROP_VENDOR_ID, }; -/* copied from d3d11.h since mingw header doesn't define them */ -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN, - 0x5b11d51b, 0x2f4c, 0x4452, 0xbc, 0xc3, 0x09, 0xf2, 0xa1, 0x16, 0x0c, 0xc0); -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10, - 0x107af0e0, 0xef1a, 0x4d19, 0xab, 0xa8, 0x67, 0xa1, 0x63, 0x07, 0x3d, 0x13); - typedef struct _GstD3D11H265Dec { GstH265Decoder parent; @@ -378,9 +372,6 @@ gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, GstD3D11H265Dec *self = GST_D3D11_H265_DEC (decoder); gint crop_width, crop_height; gboolean modified = FALSE; - static const GUID *main_10_guid = - &GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10; - static const GUID *main_guid = &GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN; GstVideoInterlaceMode interlace_mode = GST_VIDEO_INTERLACE_MODE_PROGRESSIVE; GST_LOG_OBJECT (self, "new sequence"); @@ -436,7 +427,6 @@ gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, } if (modified || !gst_d3d11_decoder_is_configured (self->d3d11_decoder)) { - const GUID *profile_guid = NULL; GstVideoInfo info; self->out_format = GST_VIDEO_FORMAT_UNKNOWN; @@ -444,14 +434,12 @@ gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, if (self->bitdepth == 8) { if (self->chroma_format_idc == 1) { self->out_format = GST_VIDEO_FORMAT_NV12; - profile_guid = main_guid; } else { GST_FIXME_OBJECT (self, "Could not support 8bits non-4:2:0 format"); } } else if (self->bitdepth == 10) { if (self->chroma_format_idc == 1) { self->out_format = GST_VIDEO_FORMAT_P010_10LE; - profile_guid = main_10_guid; } else { GST_FIXME_OBJECT (self, "Could not support 10bits non-4:2:0 format"); } @@ -469,7 +457,7 @@ gst_d3d11_h265_dec_new_sequence (GstH265Decoder * decoder, if (!gst_d3d11_decoder_configure (self->d3d11_decoder, GST_D3D11_CODEC_H265, &info, self->coded_width, self->coded_height, /* Additional 4 views margin for zero-copy rendering */ - max_dpb_size + 4, &profile_guid, 1)) { + max_dpb_size + 4)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return FALSE; } @@ -1406,7 +1394,7 @@ gst_d3d11_h265_dec_register (GstPlugin * plugin, GstD3D11Device * device, gchar *feature_name; guint index = 0; guint i; - GUID profile; + const GUID *profile = NULL; GTypeInfo type_info = { sizeof (GstD3D11H265DecClass), NULL, @@ -1418,9 +1406,8 @@ gst_d3d11_h265_dec_register (GstPlugin * plugin, GstD3D11Device * device, 0, (GInstanceInitFunc) gst_d3d11_h265_dec_init, }; - static const GUID *main_10_guid = - &GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10; - static const GUID *main_guid = &GST_GUID_D3D11_DECODER_PROFILE_HEVC_VLD_MAIN; + const GUID *main_10_guid = NULL; + const GUID *main_guid = NULL; /* values were taken from chromium. * Note that since chromium does not support hevc decoding, this list is * the combination of lists for avc and vp9. @@ -1442,24 +1429,26 @@ gst_d3d11_h265_dec_register (GstPlugin * plugin, GstD3D11Device * device, DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN; have_main10 = gst_d3d11_decoder_get_supported_decoder_profile (decoder, - &main_10_guid, 1, &profile); + GST_D3D11_CODEC_H265, GST_VIDEO_FORMAT_P010_10LE, &main_10_guid); if (!have_main10) { GST_DEBUG_OBJECT (device, "decoder does not support HEVC_VLD_MAIN10"); } else { have_main10 &= - gst_d3d11_decoder_supports_format (decoder, &profile, DXGI_FORMAT_P010); + gst_d3d11_decoder_supports_format (decoder, main_10_guid, + DXGI_FORMAT_P010); if (!have_main10) { GST_FIXME_OBJECT (device, "device does not support P010 format"); } } have_main = gst_d3d11_decoder_get_supported_decoder_profile (decoder, - &main_guid, 1, &profile); + GST_D3D11_CODEC_H265, GST_VIDEO_FORMAT_NV12, &main_guid); if (!have_main) { GST_DEBUG_OBJECT (device, "decoder does not support HEVC_VLD_MAIN"); } else { have_main = - gst_d3d11_decoder_supports_format (decoder, &profile, DXGI_FORMAT_NV12); + gst_d3d11_decoder_supports_format (decoder, main_guid, + DXGI_FORMAT_NV12); if (!have_main) { GST_FIXME_OBJECT (device, "device does not support NV12 format"); } @@ -1471,15 +1460,15 @@ gst_d3d11_h265_dec_register (GstPlugin * plugin, GstD3D11Device * device, } if (have_main) { - profile = *main_guid; + profile = main_guid; format = DXGI_FORMAT_NV12; } else { - profile = *main_10_guid; + profile = main_10_guid; format = DXGI_FORMAT_P010; } for (i = 0; i < G_N_ELEMENTS (resolutions_to_check); i++) { - if (gst_d3d11_decoder_supports_resolution (decoder, &profile, + if (gst_d3d11_decoder_supports_resolution (decoder, profile, format, resolutions_to_check[i].width, resolutions_to_check[i].height)) { max_width = resolutions_to_check[i].width; diff --git a/sys/d3d11/gstd3d11mpeg2dec.cpp b/sys/d3d11/gstd3d11mpeg2dec.cpp index 1d100c7653..9d5b8e94aa 100644 --- a/sys/d3d11/gstd3d11mpeg2dec.cpp +++ b/sys/d3d11/gstd3d11mpeg2dec.cpp @@ -66,12 +66,6 @@ enum PROP_VENDOR_ID, }; -/* copied from d3d11.h since mingw header doesn't define them */ -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_MPEG2_VLD, 0xee27417f, 0x5e28, - 0x4e65, 0xbe, 0xea, 0x1d, 0x26, 0xb5, 0x08, 0xad, 0xc9); -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_MPEG2and1_VLD, 0x86695f12, 0x340e, - 0x4f04, 0x9f, 0xd3, 0x92, 0x53, 0xdd, 0x32, 0x74, 0x60); - /* reference list 2 + 4 margin */ #define NUM_OUTPUT_VIEW 6 @@ -369,10 +363,6 @@ gst_d3d11_mpeg2_dec_new_sequence (GstMpeg2Decoder * decoder, GstD3D11Mpeg2Dec *self = GST_D3D11_MPEG2_DEC (decoder); gboolean interlaced; gboolean modified = FALSE; - static const GUID *supported_profiles[] = { - &GST_GUID_D3D11_DECODER_PROFILE_MPEG2_VLD, - &GST_GUID_D3D11_DECODER_PROFILE_MPEG2and1_VLD, - }; gint width, height; GstMpegVideoProfile mpeg_profile; @@ -431,8 +421,7 @@ gst_d3d11_mpeg2_dec_new_sequence (GstMpeg2Decoder * decoder, gst_d3d11_decoder_reset (self->d3d11_decoder); if (!gst_d3d11_decoder_configure (self->d3d11_decoder, GST_D3D11_CODEC_MPEG2, &info, self->width, self->height, - NUM_OUTPUT_VIEW, supported_profiles, - G_N_ELEMENTS (supported_profiles))) { + NUM_OUTPUT_VIEW)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return FALSE; } @@ -991,7 +980,6 @@ gst_d3d11_mpeg2_dec_register (GstPlugin * plugin, GstD3D11Device * device, gchar *type_name; gchar *feature_name; guint index = 0; - GUID profile; GTypeInfo type_info = { sizeof (GstD3D11Mpeg2DecClass), NULL, @@ -1003,15 +991,12 @@ gst_d3d11_mpeg2_dec_register (GstPlugin * plugin, GstD3D11Device * device, 0, (GInstanceInitFunc) gst_d3d11_mpeg2_dec_init, }; - static const GUID *supported_profiles[] = { - &GST_GUID_D3D11_DECODER_PROFILE_MPEG2_VLD, - &GST_GUID_D3D11_DECODER_PROFILE_MPEG2and1_VLD - }; + const GUID *supported_profile = NULL; GstCaps *sink_caps = NULL; GstCaps *src_caps = NULL; if (!gst_d3d11_decoder_get_supported_decoder_profile (decoder, - supported_profiles, G_N_ELEMENTS (supported_profiles), &profile)) { + GST_D3D11_CODEC_MPEG2, GST_VIDEO_FORMAT_NV12, &supported_profile)) { GST_INFO_OBJECT (device, "device does not support MPEG-2 video decoding"); return; } diff --git a/sys/d3d11/gstd3d11vp8dec.cpp b/sys/d3d11/gstd3d11vp8dec.cpp index fc22022d90..bb1db4526f 100644 --- a/sys/d3d11/gstd3d11vp8dec.cpp +++ b/sys/d3d11/gstd3d11vp8dec.cpp @@ -66,10 +66,6 @@ enum PROP_VENDOR_ID, }; -/* copied from d3d11.h since mingw header doesn't define them */ -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_VP8_VLD, - 0x90b899ea, 0x3a62, 0x4705, 0x88, 0xb3, 0x8d, 0xf0, 0x4b, 0x27, 0x44, 0xe7); - /* reference list 4 + 4 margin */ #define NUM_OUTPUT_VIEW 8 @@ -325,7 +321,6 @@ gst_d3d11_vp8_dec_new_sequence (GstVp8Decoder * decoder, const GstVp8FrameHdr * frame_hdr) { GstD3D11Vp8Dec *self = GST_D3D11_VP8_DEC (decoder); - static const GUID *profile_guid = &GST_GUID_D3D11_DECODER_PROFILE_VP8_VLD; GstVideoInfo info; GST_LOG_OBJECT (self, "new sequence"); @@ -340,8 +335,7 @@ gst_d3d11_vp8_dec_new_sequence (GstVp8Decoder * decoder, gst_d3d11_decoder_reset (self->d3d11_decoder); if (!gst_d3d11_decoder_configure (self->d3d11_decoder, GST_D3D11_CODEC_VP8, - &info, self->width, self->height, - NUM_OUTPUT_VIEW, &profile_guid, 1)) { + &info, self->width, self->height, NUM_OUTPUT_VIEW)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return FALSE; } @@ -858,7 +852,6 @@ gst_d3d11_vp8_dec_register (GstPlugin * plugin, GstD3D11Device * device, gchar *feature_name; guint index = 0; guint i; - GUID profile; GTypeInfo type_info = { sizeof (GstD3D11Vp8DecClass), NULL, @@ -870,7 +863,7 @@ gst_d3d11_vp8_dec_register (GstPlugin * plugin, GstD3D11Device * device, 0, (GInstanceInitFunc) gst_d3d11_vp8_dec_init, }; - static const GUID *profile_guid = &GST_GUID_D3D11_DECODER_PROFILE_VP8_VLD; + const GUID *profile_guid = NULL; /* values were taken from chromium. See supported_profile_helper.cc */ GstD3D11Vp8DecResolution resolutions_to_check[] = { {1920, 1088}, {2560, 1440}, {3840, 2160}, {4096, 2160}, {4096, 2304} @@ -883,13 +876,13 @@ gst_d3d11_vp8_dec_register (GstPlugin * plugin, GstD3D11Device * device, DXGI_FORMAT format = DXGI_FORMAT_NV12; if (!gst_d3d11_decoder_get_supported_decoder_profile (decoder, - &profile_guid, 1, &profile)) { + GST_D3D11_CODEC_VP8, GST_VIDEO_FORMAT_NV12, &profile_guid)) { GST_INFO_OBJECT (device, "device does not support VP8 decoding"); return; } for (i = 0; i < G_N_ELEMENTS (resolutions_to_check); i++) { - if (gst_d3d11_decoder_supports_resolution (decoder, &profile, + if (gst_d3d11_decoder_supports_resolution (decoder, profile_guid, format, resolutions_to_check[i].width, resolutions_to_check[i].height)) { max_width = resolutions_to_check[i].width; diff --git a/sys/d3d11/gstd3d11vp9dec.cpp b/sys/d3d11/gstd3d11vp9dec.cpp index 550ac540b9..de86912302 100644 --- a/sys/d3d11/gstd3d11vp9dec.cpp +++ b/sys/d3d11/gstd3d11vp9dec.cpp @@ -96,12 +96,6 @@ enum PROP_VENDOR_ID, }; -/* copied from d3d11.h since mingw header doesn't define them */ -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0, - 0x463707f8, 0xa1d0, 0x4585, 0x87, 0x6d, 0x83, 0xaa, 0x6d, 0x60, 0xb8, 0x9e); -DEFINE_GUID (GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2, - 0xa4c749ef, 0x6ecf, 0x48aa, 0x84, 0x48, 0x50, 0xa7, 0xa1, 0x16, 0x5f, 0xf7); - /* reference list 8 + 4 margin */ #define NUM_OUTPUT_VIEW 12 @@ -366,10 +360,6 @@ gst_d3d11_vp9_dec_new_sequence (GstVp9Decoder * decoder, { GstD3D11Vp9Dec *self = GST_D3D11_VP9_DEC (decoder); gboolean modified = FALSE; - static const GUID *profile0_guid = - &GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0; - static const GUID *profile2_guid = - &GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2; GST_LOG_OBJECT (self, "new sequence"); @@ -388,17 +378,14 @@ gst_d3d11_vp9_dec_new_sequence (GstVp9Decoder * decoder, } if (modified || !gst_d3d11_decoder_is_configured (self->d3d11_decoder)) { - const GUID *profile_guid = NULL; GstVideoInfo info; self->out_format = GST_VIDEO_FORMAT_UNKNOWN; if (self->profile == GST_VP9_PROFILE_0) { self->out_format = GST_VIDEO_FORMAT_NV12; - profile_guid = profile0_guid; } else if (self->profile == GST_VP9_PROFILE_2) { self->out_format = GST_VIDEO_FORMAT_P010_10LE; - profile_guid = profile2_guid; } if (self->out_format == GST_VIDEO_FORMAT_UNKNOWN) { @@ -411,8 +398,7 @@ gst_d3d11_vp9_dec_new_sequence (GstVp9Decoder * decoder, gst_d3d11_decoder_reset (self->d3d11_decoder); if (!gst_d3d11_decoder_configure (self->d3d11_decoder, GST_D3D11_CODEC_VP9, - &info, self->width, self->height, - NUM_OUTPUT_VIEW, &profile_guid, 1)) { + &info, self->width, self->height, NUM_OUTPUT_VIEW)) { GST_ERROR_OBJECT (self, "Failed to create decoder"); return FALSE; } @@ -1091,7 +1077,7 @@ gst_d3d11_vp9_dec_register (GstPlugin * plugin, GstD3D11Device * device, gchar *feature_name; guint index = 0; guint i; - GUID profile; + const GUID *profile; GTypeInfo type_info = { sizeof (GstD3D11Vp9DecClass), NULL, @@ -1103,10 +1089,8 @@ gst_d3d11_vp9_dec_register (GstPlugin * plugin, GstD3D11Device * device, 0, (GInstanceInitFunc) gst_d3d11_vp9_dec_init, }; - static const GUID *profile2_guid = - &GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2; - static const GUID *profile0_guid = - &GST_GUID_D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0; + const GUID *profile2_guid = NULL; + const GUID *profile0_guid = NULL; /* values were taken from chromium. See supported_profile_helper.cc */ GstD3D11Vp9DecResolution resolutions_to_check[] = { {4096, 2160}, {4096, 2304}, {7680, 4320}, {8192, 4320}, {8192, 8192} @@ -1122,25 +1106,27 @@ gst_d3d11_vp9_dec_register (GstPlugin * plugin, GstD3D11Device * device, GValue vp9_profiles = G_VALUE_INIT; have_profile2 = gst_d3d11_decoder_get_supported_decoder_profile (decoder, - &profile2_guid, 1, &profile); + GST_D3D11_CODEC_VP9, GST_VIDEO_FORMAT_P010_10LE, &profile2_guid); if (!have_profile2) { GST_DEBUG_OBJECT (device, "decoder does not support VP9_VLD_10BIT_PROFILE2"); } else { have_profile2 &= - gst_d3d11_decoder_supports_format (decoder, &profile, DXGI_FORMAT_P010); + gst_d3d11_decoder_supports_format (decoder, + profile2_guid, DXGI_FORMAT_P010); if (!have_profile2) { GST_FIXME_OBJECT (device, "device does not support P010 format"); } } have_profile0 = gst_d3d11_decoder_get_supported_decoder_profile (decoder, - &profile0_guid, 1, &profile); + GST_D3D11_CODEC_VP9, GST_VIDEO_FORMAT_NV12, &profile0_guid); if (!have_profile0) { GST_DEBUG_OBJECT (device, "decoder does not support VP9_VLD_PROFILE0"); } else { have_profile0 = - gst_d3d11_decoder_supports_format (decoder, &profile, DXGI_FORMAT_NV12); + gst_d3d11_decoder_supports_format (decoder, profile0_guid, + DXGI_FORMAT_NV12); if (!have_profile0) { GST_FIXME_OBJECT (device, "device does not support NV12 format"); } @@ -1152,15 +1138,15 @@ gst_d3d11_vp9_dec_register (GstPlugin * plugin, GstD3D11Device * device, } if (have_profile0) { - profile = *profile0_guid; + profile = profile0_guid; format = DXGI_FORMAT_NV12; } else { - profile = *profile2_guid; + profile = profile2_guid; format = DXGI_FORMAT_P010; } for (i = 0; i < G_N_ELEMENTS (resolutions_to_check); i++) { - if (gst_d3d11_decoder_supports_resolution (decoder, &profile, + if (gst_d3d11_decoder_supports_resolution (decoder, profile, format, resolutions_to_check[i].width, resolutions_to_check[i].height)) { max_width = resolutions_to_check[i].width;