d3d11: Update build-time dependency

Remove all the d3d11 and dxgi header version dependent ifdef
and bump the minimum requirement to d3d11_4.h and dxgi1_6.h.
We are already failing support old Visual Studio (Windows SDK actually)
such as Visual Studio 2015. Note that our MinGW toolchain satisfies
the requirement.

From runtime point of view, this change should be fine since
we are checking OS version with IUnknown::QueryInterface()
everywhere in order to check API availability

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1684>
This commit is contained in:
Seungha Yang 2022-02-10 22:31:06 +09:00 committed by GStreamer Marge Bot
parent 61d2a9ffde
commit e96687d88d
20 changed files with 54 additions and 240 deletions

View File

@ -29,31 +29,8 @@
#include <initguid.h> #include <initguid.h>
#endif #endif
#if (GST_D3D11_HEADER_VERSION >= 4)
#include <d3d11_4.h>
#elif (GST_D3D11_HEADER_VERSION >= 3)
#include <d3d11_3.h>
#elif (GST_D3D11_HEADER_VERSION >= 2)
#include <d3d11_2.h>
#elif (GST_D3D11_HEADER_VERSION >= 1)
#include <d3d11_1.h>
#else
#include <d3d11.h> #include <d3d11.h>
#endif
#if (GST_D3D11_DXGI_HEADER_VERSION >= 6)
#include <dxgi1_6.h>
#elif (GST_D3D11_DXGI_HEADER_VERSION >= 5)
#include <dxgi1_5.h>
#elif (GST_D3D11_DXGI_HEADER_VERSION >= 4)
#include <dxgi1_4.h>
#elif (GST_D3D11_DXGI_HEADER_VERSION >= 3)
#include <dxgi1_3.h>
#elif (GST_D3D11_DXGI_HEADER_VERSION >= 2)
#include <dxgi1_2.h>
#else
#include <dxgi.h> #include <dxgi.h>
#endif
G_BEGIN_DECLS G_BEGIN_DECLS

View File

@ -23,6 +23,8 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/d3d11/gstd3d11_fwd.h> #include <gst/d3d11/gstd3d11_fwd.h>
#include <d3d11_4.h>
#include <dxgi1_6.h>
G_BEGIN_DECLS G_BEGIN_DECLS

View File

@ -26,6 +26,7 @@
#include "gstd3d11memory.h" #include "gstd3d11memory.h"
#include "gstd3d11device.h" #include "gstd3d11device.h"
#include "gstd3d11utils.h" #include "gstd3d11utils.h"
#include "gstd3d11_private.h"
#include <string.h> #include <string.h>

View File

@ -7,8 +7,6 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#mesondefine GST_D3D11_DXGI_HEADER_VERSION
#mesondefine GST_D3D11_HEADER_VERSION
#mesondefine GST_D3D11_WINAPI_ONLY_APP #mesondefine GST_D3D11_WINAPI_ONLY_APP
#mesondefine GST_D3D11_WINAPI_APP #mesondefine GST_D3D11_WINAPI_APP

View File

@ -277,7 +277,7 @@ gst_d3d11_device_enable_dxgi_debug (void)
"DXGIGetDebugInterface", (gpointer *) & GstDXGIGetDebugInterface); "DXGIGetDebugInterface", (gpointer *) & GstDXGIGetDebugInterface);
if (GstDXGIGetDebugInterface) if (GstDXGIGetDebugInterface)
ret = TRUE; ret = TRUE;
#elif (GST_D3D11_DXGI_HEADER_VERSION >= 3) #else
ret = TRUE; ret = TRUE;
#endif #endif
g_once_init_leave (&_init, 1); g_once_init_leave (&_init, 1);
@ -292,12 +292,12 @@ gst_d3d11_device_dxgi_get_device_interface (REFIID riid, void **debug)
#if (!GST_D3D11_WINAPI_ONLY_APP) #if (!GST_D3D11_WINAPI_ONLY_APP)
if (GstDXGIGetDebugInterface) { if (GstDXGIGetDebugInterface) {
return GstDXGIGetDebugInterface (riid, debug); return GstDXGIGetDebugInterface (riid, debug);
} else {
return E_NOINTERFACE;
} }
#elif (GST_D3D11_DXGI_HEADER_VERSION >= 3) #else
return DXGIGetDebugInterface1 (0, riid, debug); return DXGIGetDebugInterface1 (0, riid, debug);
#endif #endif
return E_NOINTERFACE;
} }
static inline GstDebugLevel static inline GstDebugLevel

View File

@ -25,6 +25,7 @@
#include "gstd3d11utils.h" #include "gstd3d11utils.h"
#include "gstd3d11device.h" #include "gstd3d11device.h"
#include "gstd3d11memory.h" #include "gstd3d11memory.h"
#include "gstd3d11_private.h"
#include <string.h> #include <string.h>

View File

@ -25,6 +25,7 @@
#include "gstd3d11memory.h" #include "gstd3d11memory.h"
#include "gstd3d11device.h" #include "gstd3d11device.h"
#include "gstd3d11utils.h" #include "gstd3d11utils.h"
#include "gstd3d11_private.h"
#include <string.h> #include <string.h>

View File

@ -7,23 +7,6 @@ d3d11_sources = [
'gstd3d11utils.cpp', 'gstd3d11utils.cpp',
] ]
dxgi_headers = [
['dxgi1_6.h', 6],
['dxgi1_5.h', 5],
['dxgi1_4.h', 4],
['dxgi1_3.h', 3],
['dxgi1_2.h', 2],
['dxgi.h', 1]
]
d3d11_headers = [
['d3d11_4.h', 4],
['d3d11_3.h', 3],
['d3d11_2.h', 2],
['d3d11_1.h', 1],
['d3d11.h', 0]
]
gstd3d11_dep = dependency('', required : false) gstd3d11_dep = dependency('', required : false)
d3d11_option = get_option('d3d11') d3d11_option = get_option('d3d11')
@ -41,43 +24,17 @@ extra_comm_args = [
'-DG_LOG_DOMAIN="GStreamer-D3D11"', '-DG_LOG_DOMAIN="GStreamer-D3D11"',
] ]
have_dxgi_header = false
have_d3d11_header = false
have_d3d11sdk_h = false have_d3d11sdk_h = false
have_dxgidebug_h = false have_dxgidebug_h = false
winapi_desktop = false d3d11_winapi_app = false
winapi_app = false
d3d11_conf = configuration_data() d3d11_conf = configuration_data()
d3d11_conf_options = [
'GST_D3D11_DXGI_HEADER_VERSION',
'GST_D3D11_HEADER_VERSION',
'GST_D3D11_WINAPI_ONLY_APP',
]
foreach option : d3d11_conf_options
d3d11_conf.set10(option, false)
endforeach
d3d11_lib = cc.find_library('d3d11', required : d3d11_option) d3d11_lib = cc.find_library('d3d11', required : d3d11_option)
dxgi_lib = cc.find_library('dxgi', required : d3d11_option) dxgi_lib = cc.find_library('dxgi', required : d3d11_option)
d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option) d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
runtimeobject_lib = cc.find_library('runtimeobject', required : false) runtimeobject_lib = cc.find_library('runtimeobject', required : false)
foreach dxgi_h: dxgi_headers have_d3d11 = d3d11_lib.found() and dxgi_lib.found() and cc.has_header('d3d11_4.h') and cc.has_header('dxgi1_6.h')
if not have_dxgi_header and cc.has_header(dxgi_h[0])
d3d11_conf.set('GST_D3D11_DXGI_HEADER_VERSION', dxgi_h[1])
have_dxgi_header = true
endif
endforeach
foreach d3d11_h: d3d11_headers
if not have_d3d11_header and cc.has_header(d3d11_h[0])
d3d11_conf.set('GST_D3D11_HEADER_VERSION', d3d11_h[1])
have_d3d11_header = true
endif
endforeach
have_d3d11 = d3d11_lib.found() and dxgi_lib.found() and have_d3d11_header and have_dxgi_header
if not have_d3d11 if not have_d3d11
if d3d11_option.enabled() if d3d11_option.enabled()
error('The d3d11 was enabled explicitly, but required dependencies were not found.') error('The d3d11 was enabled explicitly, but required dependencies were not found.')
@ -97,8 +54,8 @@ if runtimeobject_lib.found() and d3dcompiler_lib.found()
#include <windows.applicationmodel.core.h> #include <windows.applicationmodel.core.h>
#include <wrl.h> #include <wrl.h>
#include <wrl/wrappers/corewrappers.h> #include <wrl/wrappers/corewrappers.h>
#include <d3d11.h> #include <d3d11_4.h>
#include <dxgi1_2.h> #include <dxgi1_6.h>
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#error "not winrt" #error "not winrt"
#endif #endif

View File

@ -1810,7 +1810,7 @@ gst_d3d11_base_convert_set_info (GstD3D11BaseFilter * filter,
GST_ERROR_OBJECT (self, "couldn't set converter"); GST_ERROR_OBJECT (self, "couldn't set converter");
return FALSE; return FALSE;
} }
#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
/* If both input and output formats are native DXGI format */ /* If both input and output formats are native DXGI format */
if (self->in_d3d11_format->dxgi_format != DXGI_FORMAT_UNKNOWN && if (self->in_d3d11_format->dxgi_format != DXGI_FORMAT_UNKNOWN &&
self->out_d3d11_format->dxgi_format != DXGI_FORMAT_UNKNOWN) { self->out_d3d11_format->dxgi_format != DXGI_FORMAT_UNKNOWN) {
@ -1863,7 +1863,6 @@ gst_d3d11_base_convert_set_info (GstD3D11BaseFilter * filter,
self->processor = processor; self->processor = processor;
gst_d3d11_device_unlock (filter->device); gst_d3d11_device_unlock (filter->device);
} }
#endif
GST_DEBUG_OBJECT (self, "from=%dx%d (par=%d/%d dar=%d/%d), size %" GST_DEBUG_OBJECT (self, "from=%dx%d (par=%d/%d dar=%d/%d), size %"
G_GSIZE_FORMAT " -> to=%dx%d (par=%d/%d dar=%d/%d borders=%d:%d), " G_GSIZE_FORMAT " -> to=%dx%d (par=%d/%d dar=%d/%d borders=%d:%d), "

View File

@ -133,7 +133,6 @@ gst_d3d11_get_device_vendor (GstD3D11Device * device)
return vendor; return vendor;
} }
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
gboolean gboolean
gst_d3d11_hdr_meta_data_to_dxgi (GstVideoMasteringDisplayInfo * minfo, gst_d3d11_hdr_meta_data_to_dxgi (GstVideoMasteringDisplayInfo * minfo,
GstVideoContentLightLevel * cll, DXGI_HDR_METADATA_HDR10 * dxgi_hdr10) GstVideoContentLightLevel * cll, DXGI_HDR_METADATA_HDR10 * dxgi_hdr10)
@ -163,9 +162,7 @@ gst_d3d11_hdr_meta_data_to_dxgi (GstVideoMasteringDisplayInfo * minfo,
return TRUE; return TRUE;
} }
#endif
#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
typedef enum typedef enum
{ {
GST_DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0, GST_DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
@ -573,7 +570,6 @@ gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info,
return colorspace; return colorspace;
} }
#endif
static void static void
fill_staging_desc (const D3D11_TEXTURE2D_DESC * ref, fill_staging_desc (const D3D11_TEXTURE2D_DESC * ref,

View File

@ -24,6 +24,8 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/d3d11/gstd3d11.h> #include <gst/d3d11/gstd3d11.h>
#include <d3d11_4.h>
#include <dxgi1_6.h>
G_BEGIN_DECLS G_BEGIN_DECLS
@ -63,18 +65,14 @@ gboolean gst_d3d11_is_windows_8_or_greater (void);
GstD3D11DeviceVendor gst_d3d11_get_device_vendor (GstD3D11Device * device); GstD3D11DeviceVendor gst_d3d11_get_device_vendor (GstD3D11Device * device);
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
gboolean gst_d3d11_hdr_meta_data_to_dxgi (GstVideoMasteringDisplayInfo * minfo, gboolean gst_d3d11_hdr_meta_data_to_dxgi (GstVideoMasteringDisplayInfo * minfo,
GstVideoContentLightLevel * cll, GstVideoContentLightLevel * cll,
DXGI_HDR_METADATA_HDR10 * dxgi_hdr10); DXGI_HDR_METADATA_HDR10 * dxgi_hdr10);
#endif
#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
const GstDxgiColorSpace * gst_d3d11_video_info_to_dxgi_color_space (GstVideoInfo * info); const GstDxgiColorSpace * gst_d3d11_video_info_to_dxgi_color_space (GstVideoInfo * info);
const GstDxgiColorSpace * gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info, const GstDxgiColorSpace * gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info,
IDXGISwapChain3 * swapchain); IDXGISwapChain3 * swapchain);
#endif
GstBuffer * gst_d3d11_allocate_staging_buffer_for (GstBuffer * buffer, GstBuffer * gst_d3d11_allocate_staging_buffer_for (GstBuffer * buffer,
const GstVideoInfo * info, const GstVideoInfo * info,

View File

@ -20,6 +20,7 @@
#pragma once #pragma once
#include <gst/gst.h> #include <gst/gst.h>
#include "gstd3d11pluginutils.h"
G_BEGIN_DECLS G_BEGIN_DECLS

View File

@ -22,38 +22,23 @@
#endif #endif
#include "gstd3d11videoprocessor.h" #include "gstd3d11videoprocessor.h"
#include "gstd3d11pluginutils.h"
#include <string.h> #include <string.h>
GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_video_processor_debug); GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_video_processor_debug);
#define GST_CAT_DEFAULT gst_d3d11_video_processor_debug #define GST_CAT_DEFAULT gst_d3d11_video_processor_debug
#if (GST_D3D11_HEADER_VERSION >= 1 && GST_D3D11_DXGI_HEADER_VERSION >= 4)
#define HAVE_VIDEO_CONTEXT_ONE
#endif
#if (GST_D3D11_HEADER_VERSION >= 4) && (GST_D3D11_DXGI_HEADER_VERSION >= 5)
#define HAVE_VIDEO_CONTEXT_TWO
#endif
struct _GstD3D11VideoProcessor struct _GstD3D11VideoProcessor
{ {
GstD3D11Device *device; GstD3D11Device *device;
ID3D11VideoDevice *video_device; ID3D11VideoDevice *video_device;
ID3D11VideoContext *video_context; ID3D11VideoContext *video_context;
#ifdef HAVE_VIDEO_CONTEXT_ONE
ID3D11VideoContext1 *video_context1; ID3D11VideoContext1 *video_context1;
#endif
#ifdef HAVE_VIDEO_CONTEXT_TWO
ID3D11VideoContext2 *video_context2; ID3D11VideoContext2 *video_context2;
#endif
ID3D11VideoProcessor *processor; ID3D11VideoProcessor *processor;
ID3D11VideoProcessorEnumerator *enumerator; ID3D11VideoProcessorEnumerator *enumerator;
#ifdef HAVE_VIDEO_CONTEXT_ONE
ID3D11VideoProcessorEnumerator1 *enumerator1; ID3D11VideoProcessorEnumerator1 *enumerator1;
#endif
D3D11_VIDEO_PROCESSOR_CAPS processor_caps; D3D11_VIDEO_PROCESSOR_CAPS processor_caps;
}; };
@ -105,12 +90,11 @@ gst_d3d11_video_processor_new (GstD3D11Device * device, guint in_width,
&self->enumerator); &self->enumerator);
if (!gst_d3d11_result (hr, device)) if (!gst_d3d11_result (hr, device))
goto fail; goto fail;
#ifdef HAVE_VIDEO_CONTEXT_ONE
hr = self->enumerator->QueryInterface (IID_PPV_ARGS (&self->enumerator1)); hr = self->enumerator->QueryInterface (IID_PPV_ARGS (&self->enumerator1));
if (gst_d3d11_result (hr, device)) { if (gst_d3d11_result (hr, device)) {
GST_DEBUG ("ID3D11VideoProcessorEnumerator1 interface available"); GST_DEBUG ("ID3D11VideoProcessorEnumerator1 interface available");
} }
#endif
hr = self->enumerator->GetVideoProcessorCaps (&self->processor_caps); hr = self->enumerator->GetVideoProcessorCaps (&self->processor_caps);
if (!gst_d3d11_result (hr, device)) if (!gst_d3d11_result (hr, device))
@ -121,20 +105,17 @@ gst_d3d11_video_processor_new (GstD3D11Device * device, guint in_width,
if (!gst_d3d11_result (hr, device)) if (!gst_d3d11_result (hr, device))
goto fail; goto fail;
#ifdef HAVE_VIDEO_CONTEXT_ONE
hr = self->video_context-> hr = self->video_context->
QueryInterface (IID_PPV_ARGS (&self->video_context1)); QueryInterface (IID_PPV_ARGS (&self->video_context1));
if (gst_d3d11_result (hr, device)) { if (gst_d3d11_result (hr, device)) {
GST_DEBUG ("ID3D11VideoContext1 interface available"); GST_DEBUG ("ID3D11VideoContext1 interface available");
} }
#endif
#ifdef HAVE_VIDEO_CONTEXT_TWO
hr = self->video_context-> hr = self->video_context->
QueryInterface (IID_PPV_ARGS (&self->video_context2)); QueryInterface (IID_PPV_ARGS (&self->video_context2));
if (gst_d3d11_result (hr, device)) { if (gst_d3d11_result (hr, device)) {
GST_DEBUG ("ID3D11VideoContext2 interface available"); GST_DEBUG ("ID3D11VideoContext2 interface available");
} }
#endif
/* Setting up default options */ /* Setting up default options */
gst_d3d11_device_lock (self->device); gst_d3d11_device_lock (self->device);
@ -158,17 +139,11 @@ gst_d3d11_video_processor_free (GstD3D11VideoProcessor * processor)
GST_D3D11_CLEAR_COM (processor->video_device); GST_D3D11_CLEAR_COM (processor->video_device);
GST_D3D11_CLEAR_COM (processor->video_context); GST_D3D11_CLEAR_COM (processor->video_context);
#ifdef HAVE_VIDEO_CONTEXT_ONE
GST_D3D11_CLEAR_COM (processor->video_context1); GST_D3D11_CLEAR_COM (processor->video_context1);
#endif
#ifdef HAVE_VIDEO_CONTEXT_TWO
GST_D3D11_CLEAR_COM (processor->video_context2); GST_D3D11_CLEAR_COM (processor->video_context2);
#endif
GST_D3D11_CLEAR_COM (processor->processor); GST_D3D11_CLEAR_COM (processor->processor);
GST_D3D11_CLEAR_COM (processor->enumerator); GST_D3D11_CLEAR_COM (processor->enumerator);
#ifdef HAVE_VIDEO_CONTEXT_ONE
GST_D3D11_CLEAR_COM (processor->enumerator1); GST_D3D11_CLEAR_COM (processor->enumerator1);
#endif
gst_clear_object (&processor->device); gst_clear_object (&processor->device);
g_free (processor); g_free (processor);
@ -302,13 +277,11 @@ gst_d3d11_video_processor_set_output_color_space (GstD3D11VideoProcessor *
return TRUE; return TRUE;
} }
#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
gboolean gboolean
gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor * gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor *
processor, DXGI_FORMAT in_format, DXGI_COLOR_SPACE_TYPE in_color_space, processor, DXGI_FORMAT in_format, DXGI_COLOR_SPACE_TYPE in_color_space,
DXGI_FORMAT out_format, DXGI_COLOR_SPACE_TYPE out_color_space) DXGI_FORMAT out_format, DXGI_COLOR_SPACE_TYPE out_color_space)
{ {
#ifdef HAVE_VIDEO_CONTEXT_ONE
HRESULT hr; HRESULT hr;
BOOL supported = TRUE; BOOL supported = TRUE;
@ -325,9 +298,6 @@ gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor *
} }
return supported; return supported;
#endif
return FALSE;
} }
gboolean gboolean
@ -336,13 +306,11 @@ gst_d3d11_video_processor_set_input_dxgi_color_space (GstD3D11VideoProcessor *
{ {
g_return_val_if_fail (processor != NULL, FALSE); g_return_val_if_fail (processor != NULL, FALSE);
#ifdef HAVE_VIDEO_CONTEXT_ONE
if (processor->video_context1) { if (processor->video_context1) {
processor->video_context1->VideoProcessorSetStreamColorSpace1 processor->video_context1->VideoProcessorSetStreamColorSpace1
(processor->processor, 0, color_space); (processor->processor, 0, color_space);
return TRUE; return TRUE;
} }
#endif
return FALSE; return FALSE;
} }
@ -353,19 +321,15 @@ gst_d3d11_video_processor_set_output_dxgi_color_space (GstD3D11VideoProcessor *
{ {
g_return_val_if_fail (processor != NULL, FALSE); g_return_val_if_fail (processor != NULL, FALSE);
#ifdef HAVE_VIDEO_CONTEXT_ONE
if (processor->video_context1) { if (processor->video_context1) {
processor->video_context1->VideoProcessorSetOutputColorSpace1 processor->video_context1->VideoProcessorSetOutputColorSpace1
(processor->processor, color_space); (processor->processor, color_space);
return TRUE; return TRUE;
} }
#endif
return FALSE; return FALSE;
} }
#endif
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
/* D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10 /* D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10
* missing in mingw header */ * missing in mingw header */
#define FEATURE_CAPS_METADATA_HDR10 (0x800) #define FEATURE_CAPS_METADATA_HDR10 (0x800)
@ -376,7 +340,6 @@ gst_d3d11_video_processor_set_input_hdr10_metadata (GstD3D11VideoProcessor *
{ {
g_return_val_if_fail (processor != NULL, FALSE); g_return_val_if_fail (processor != NULL, FALSE);
#ifdef HAVE_VIDEO_CONTEXT_TWO
if (processor->video_context2 && (processor->processor_caps.FeatureCaps & if (processor->video_context2 && (processor->processor_caps.FeatureCaps &
FEATURE_CAPS_METADATA_HDR10)) { FEATURE_CAPS_METADATA_HDR10)) {
if (hdr10_meta) { if (hdr10_meta) {
@ -391,7 +354,6 @@ gst_d3d11_video_processor_set_input_hdr10_metadata (GstD3D11VideoProcessor *
return TRUE; return TRUE;
} }
#endif
return FALSE; return FALSE;
} }
@ -402,7 +364,6 @@ gst_d3d11_video_processor_set_output_hdr10_metadata (GstD3D11VideoProcessor *
{ {
g_return_val_if_fail (processor != NULL, FALSE); g_return_val_if_fail (processor != NULL, FALSE);
#ifdef HAVE_VIDEO_CONTEXT_TWO
if (processor->video_context2 && (processor->processor_caps.FeatureCaps & if (processor->video_context2 && (processor->processor_caps.FeatureCaps &
FEATURE_CAPS_METADATA_HDR10)) { FEATURE_CAPS_METADATA_HDR10)) {
if (hdr10_meta) { if (hdr10_meta) {
@ -416,11 +377,9 @@ gst_d3d11_video_processor_set_output_hdr10_metadata (GstD3D11VideoProcessor *
return TRUE; return TRUE;
} }
#endif
return FALSE; return FALSE;
} }
#endif
gboolean gboolean
gst_d3d11_video_processor_create_input_view (GstD3D11VideoProcessor * processor, gst_d3d11_video_processor_create_input_view (GstD3D11VideoProcessor * processor,

View File

@ -23,6 +23,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/d3d11/gstd3d11.h> #include <gst/d3d11/gstd3d11.h>
#include "gstd3d11pluginutils.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -51,7 +52,6 @@ gboolean gst_d3d11_video_processor_set_input_color_space (GstD3D11VideoProcess
gboolean gst_d3d11_video_processor_set_output_color_space (GstD3D11VideoProcessor * processor, gboolean gst_d3d11_video_processor_set_output_color_space (GstD3D11VideoProcessor * processor,
GstVideoColorimetry * color); GstVideoColorimetry * color);
#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
gboolean gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor * processor, gboolean gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor * processor,
DXGI_FORMAT in_format, DXGI_FORMAT in_format,
DXGI_COLOR_SPACE_TYPE in_color_space, DXGI_COLOR_SPACE_TYPE in_color_space,
@ -63,15 +63,12 @@ gboolean gst_d3d11_video_processor_set_input_dxgi_color_space (GstD3D11VideoPro
gboolean gst_d3d11_video_processor_set_output_dxgi_color_space (GstD3D11VideoProcessor * processor, gboolean gst_d3d11_video_processor_set_output_dxgi_color_space (GstD3D11VideoProcessor * processor,
DXGI_COLOR_SPACE_TYPE color_space); DXGI_COLOR_SPACE_TYPE color_space);
#endif
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
gboolean gst_d3d11_video_processor_set_input_hdr10_metadata (GstD3D11VideoProcessor * processor, gboolean gst_d3d11_video_processor_set_input_hdr10_metadata (GstD3D11VideoProcessor * processor,
DXGI_HDR_METADATA_HDR10 * hdr10_meta); DXGI_HDR_METADATA_HDR10 * hdr10_meta);
gboolean gst_d3d11_video_processor_set_output_hdr10_metadata (GstD3D11VideoProcessor * processor, gboolean gst_d3d11_video_processor_set_output_hdr10_metadata (GstD3D11VideoProcessor * processor,
DXGI_HDR_METADATA_HDR10 * hdr10_meta); DXGI_HDR_METADATA_HDR10 * hdr10_meta);
#endif
gboolean gst_d3d11_video_processor_create_input_view (GstD3D11VideoProcessor * processor, gboolean gst_d3d11_video_processor_create_input_view (GstD3D11VideoProcessor * processor,
D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC * desc, D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC * desc,

View File

@ -452,14 +452,10 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
}; };
const GstD3D11WindowDisplayFormat *chosen_format = NULL; const GstD3D11WindowDisplayFormat *chosen_format = NULL;
const GstDxgiColorSpace *chosen_colorspace = NULL; const GstDxgiColorSpace *chosen_colorspace = NULL;
#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
gboolean have_hdr10 = FALSE; gboolean have_hdr10 = FALSE;
DXGI_COLOR_SPACE_TYPE native_colorspace_type = DXGI_COLOR_SPACE_TYPE native_colorspace_type =
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
#endif
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
DXGI_HDR_METADATA_HDR10 hdr10_metadata = { 0, }; DXGI_HDR_METADATA_HDR10 hdr10_metadata = { 0, };
#endif
/* Step 1: Clear old resources and objects */ /* Step 1: Clear old resources and objects */
gst_clear_buffer (&window->cached_buffer); gst_clear_buffer (&window->cached_buffer);
@ -534,7 +530,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
* (or reuse old swapchain if the format is not changed) */ * (or reuse old swapchain if the format is not changed) */
window->allow_tearing = FALSE; window->allow_tearing = FALSE;
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
{ {
ComPtr < IDXGIFactory5 > factory5; ComPtr < IDXGIFactory5 > factory5;
IDXGIFactory1 *factory_handle; IDXGIFactory1 *factory_handle;
@ -550,7 +545,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
if (SUCCEEDED (hr) && allow_tearing) if (SUCCEEDED (hr) && allow_tearing)
window->allow_tearing = allow_tearing; window->allow_tearing = allow_tearing;
} }
#endif
if (window->allow_tearing) { if (window->allow_tearing) {
GST_DEBUG_OBJECT (window, "device support tearning"); GST_DEBUG_OBJECT (window, "device support tearning");
@ -583,7 +577,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
window->input_rect.bottom = GST_VIDEO_INFO_HEIGHT (&window->info); window->input_rect.bottom = GST_VIDEO_INFO_HEIGHT (&window->info);
/* Step 4: Decide render color space and set it on converter/processor */ /* Step 4: Decide render color space and set it on converter/processor */
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
{ {
GstVideoMasteringDisplayInfo minfo; GstVideoMasteringDisplayInfo minfo;
GstVideoContentLightLevel cll; GstVideoContentLightLevel cll;
@ -610,7 +603,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
} }
} }
} }
#endif
/* Step 5: Choose display color space */ /* Step 5: Choose display color space */
gst_video_info_set_format (&window->render_info, gst_video_info_set_format (&window->render_info,
@ -625,7 +617,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
* target display color space type */ * target display color space type */
window->render_info.colorimetry.range = GST_VIDEO_COLOR_RANGE_0_255; window->render_info.colorimetry.range = GST_VIDEO_COLOR_RANGE_0_255;
#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
{ {
ComPtr < IDXGISwapChain3 > swapchain3; ComPtr < IDXGISwapChain3 > swapchain3;
HRESULT hr; HRESULT hr;
@ -660,7 +651,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
} }
} }
} }
#endif
/* otherwise, use most common DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 /* otherwise, use most common DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
* color space */ * color space */
@ -670,7 +660,7 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
window->render_info.colorimetry.transfer = GST_VIDEO_TRANSFER_BT709; window->render_info.colorimetry.transfer = GST_VIDEO_TRANSFER_BT709;
window->render_info.colorimetry.range = GST_VIDEO_COLOR_RANGE_0_255; window->render_info.colorimetry.range = GST_VIDEO_COLOR_RANGE_0_255;
} }
#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
if (chosen_colorspace) { if (chosen_colorspace) {
const GstDxgiColorSpace *in_color_space = const GstDxgiColorSpace *in_color_space =
gst_d3d11_video_info_to_dxgi_color_space (&window->info); gst_d3d11_video_info_to_dxgi_color_space (&window->info);
@ -712,7 +702,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
gst_d3d11_video_processor_set_output_dxgi_color_space (processor, gst_d3d11_video_processor_set_output_dxgi_color_space (processor,
out_dxgi_color_space); out_dxgi_color_space);
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
if (have_hdr10) { if (have_hdr10) {
GST_DEBUG_OBJECT (window, "Set HDR metadata on video processor"); GST_DEBUG_OBJECT (window, "Set HDR metadata on video processor");
gst_d3d11_video_processor_set_input_hdr10_metadata (processor, gst_d3d11_video_processor_set_input_hdr10_metadata (processor,
@ -720,13 +709,12 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
gst_d3d11_video_processor_set_output_hdr10_metadata (processor, gst_d3d11_video_processor_set_output_hdr10_metadata (processor,
&hdr10_metadata); &hdr10_metadata);
} }
#endif
} }
window->processor = processor; window->processor = processor;
} }
} }
#endif
*video_processor_available = !!window->processor; *video_processor_available = !!window->processor;
/* configure shader even if video processor is available for fallback */ /* configure shader even if video processor is available for fallback */
@ -976,11 +964,9 @@ gst_d3d111_window_present (GstD3D11Window * self, GstBuffer * buffer,
gst_d3d11_overlay_compositor_upload (self->compositor, buffer); gst_d3d11_overlay_compositor_upload (self->compositor, buffer);
gst_d3d11_overlay_compositor_draw_unlocked (self->compositor, &rtv); gst_d3d11_overlay_compositor_draw_unlocked (self->compositor, &rtv);
#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
if (self->allow_tearing && self->fullscreen) { if (self->allow_tearing && self->fullscreen) {
present_flags |= DXGI_PRESENT_ALLOW_TEARING; present_flags |= DXGI_PRESENT_ALLOW_TEARING;
} }
#endif
if (klass->present) if (klass->present)
ret = klass->present (self, present_flags); ret = klass->present (self, present_flags);

View File

@ -114,7 +114,6 @@ gst_d3d11_window_dummy_prepare (GstD3D11Window * window,
gst_d3d11_device_lock (window->device); gst_d3d11_device_lock (window->device);
#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
{ {
const GstDxgiColorSpace *in_color_space = const GstDxgiColorSpace *in_color_space =
gst_d3d11_video_info_to_dxgi_color_space (&window->info); gst_d3d11_video_info_to_dxgi_color_space (&window->info);
@ -167,7 +166,7 @@ gst_d3d11_window_dummy_prepare (GstD3D11Window * window,
window->processor = processor; window->processor = processor;
} }
#endif
*video_processor_available = !!window->processor; *video_processor_available = !!window->processor;
window->converter = window->converter =

View File

@ -896,7 +896,6 @@ create_swap_chain (GstD3D11WindowWin32 * self, GstD3D11Device * device,
return swap_chain; return swap_chain;
} }
#if (GST_D3D11_DXGI_HEADER_VERSION >= 2)
static IDXGISwapChain1 * static IDXGISwapChain1 *
create_swap_chain_for_hwnd (GstD3D11WindowWin32 * self, GstD3D11Device * device, create_swap_chain_for_hwnd (GstD3D11WindowWin32 * self, GstD3D11Device * device,
HWND hwnd, DXGI_SWAP_CHAIN_DESC1 * desc, HWND hwnd, DXGI_SWAP_CHAIN_DESC1 * desc,
@ -927,7 +926,6 @@ create_swap_chain_for_hwnd (GstD3D11WindowWin32 * self, GstD3D11Device * device,
return swap_chain; return swap_chain;
} }
#endif
static gboolean static gboolean
gst_d3d11_window_win32_create_swap_chain (GstD3D11Window * window, gst_d3d11_window_win32_create_swap_chain (GstD3D11Window * window,
@ -941,7 +939,6 @@ gst_d3d11_window_win32_create_swap_chain (GstD3D11Window * window,
self->have_swapchain1 = FALSE; self->have_swapchain1 = FALSE;
#if (GST_D3D11_DXGI_HEADER_VERSION >= 2)
{ {
DXGI_SWAP_CHAIN_DESC1 desc1 = { 0, }; DXGI_SWAP_CHAIN_DESC1 desc1 = { 0, };
desc1.Width = 0; desc1.Width = 0;
@ -972,7 +969,6 @@ gst_d3d11_window_win32_create_swap_chain (GstD3D11Window * window,
self->have_swapchain1 = TRUE; self->have_swapchain1 = TRUE;
} }
} }
#endif
if (!new_swapchain) { if (!new_swapchain) {
DXGI_SWAP_EFFECT swap_effect = DXGI_SWAP_EFFECT_DISCARD; DXGI_SWAP_EFFECT swap_effect = DXGI_SWAP_EFFECT_DISCARD;
@ -1070,7 +1066,7 @@ gst_d3d11_window_win32_present (GstD3D11Window * window, guint present_flags)
return GST_D3D11_WINDOW_FLOW_CLOSED; return GST_D3D11_WINDOW_FLOW_CLOSED;
} }
#if (GST_D3D11_DXGI_HEADER_VERSION >= 2)
if (self->have_swapchain1) { if (self->have_swapchain1) {
IDXGISwapChain1 *swap_chain1 = (IDXGISwapChain1 *) window->swap_chain; IDXGISwapChain1 *swap_chain1 = (IDXGISwapChain1 *) window->swap_chain;
DXGI_PRESENT_PARAMETERS present_params = { 0, }; DXGI_PRESENT_PARAMETERS present_params = { 0, };
@ -1082,9 +1078,7 @@ gst_d3d11_window_win32_present (GstD3D11Window * window, guint present_flags)
} }
hr = swap_chain1->Present1 (0, present_flags, &present_params); hr = swap_chain1->Present1 (0, present_flags, &present_params);
} else } else {
#endif
{
hr = window->swap_chain->Present (0, present_flags); hr = window->swap_chain->Present (0, present_flags);
} }

View File

@ -1,31 +1,29 @@
d3d11_sources = [ d3d11_sources = [
'gstd3d11av1dec.cpp',
'gstd3d11basefilter.cpp', 'gstd3d11basefilter.cpp',
'gstd3d11convert.cpp',
'gstd3d11converter.cpp',
'gstd3d11compositor.cpp', 'gstd3d11compositor.cpp',
'gstd3d11compositorbin.cpp', 'gstd3d11compositorbin.cpp',
'gstd3d11convert.cpp',
'gstd3d11converter.cpp',
'gstd3d11decoder.cpp',
'gstd3d11deinterlace.cpp',
'gstd3d11download.cpp', 'gstd3d11download.cpp',
'gstd3d11h264dec.cpp',
'gstd3d11h265dec.cpp',
'gstd3d11mpeg2dec.cpp',
'gstd3d11overlaycompositor.cpp', 'gstd3d11overlaycompositor.cpp',
'gstd3d11pluginutils.cpp', 'gstd3d11pluginutils.cpp',
'gstd3d11shader.cpp', 'gstd3d11shader.cpp',
'gstd3d11upload.cpp', 'gstd3d11upload.cpp',
'gstd3d11videoprocessor.cpp', 'gstd3d11videoprocessor.cpp',
'gstd3d11videosink.cpp', 'gstd3d11videosink.cpp',
'gstd3d11vp8dec.cpp',
'gstd3d11vp9dec.cpp',
'gstd3d11window.cpp', 'gstd3d11window.cpp',
'gstd3d11window_dummy.cpp', 'gstd3d11window_dummy.cpp',
'plugin.cpp', 'plugin.cpp',
] ]
d3d11_dec_sources = [
'gstd3d11av1dec.cpp',
'gstd3d11decoder.cpp',
'gstd3d11h264dec.cpp',
'gstd3d11vp9dec.cpp',
'gstd3d11h265dec.cpp',
'gstd3d11mpeg2dec.cpp',
'gstd3d11vp8dec.cpp',
]
extra_c_args = ['-DCOBJMACROS'] extra_c_args = ['-DCOBJMACROS']
extra_args = ['-DGST_USE_UNSTABLE_API'] extra_args = ['-DGST_USE_UNSTABLE_API']
extra_dep = [] extra_dep = []
@ -35,7 +33,7 @@ if host_system != 'windows' or d3d11_option.disabled()
subdir_done() subdir_done()
endif endif
if not gstd3d11_dep.found() if not gstd3d11_dep.found() or not cc.has_header('dxva.h') or not cc.has_header('d3d9.h') or not cc.has_header('d3dcompiler.h')
if d3d11_option.enabled() if d3d11_option.enabled()
error('The d3d11 was enabled explicitly, but required dependencies were not found.') error('The d3d11 was enabled explicitly, but required dependencies were not found.')
endif endif
@ -45,23 +43,6 @@ endif
d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option) d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
runtimeobject_lib = cc.find_library('runtimeobject', required : false) runtimeobject_lib = cc.find_library('runtimeobject', required : false)
winmm_lib = cc.find_library('winmm', required: false) winmm_lib = cc.find_library('winmm', required: false)
has_decoder = false
have_d3d11 = cc.has_header('d3dcompiler.h')
if not have_d3d11
if d3d11_option.enabled()
error('The d3d11 plugin was enabled explicitly, but required dependencies were not found.')
endif
subdir_done()
endif
# d3d11 video api uses dxva structure for decoding, and dxva.h needs d3d9 types
if cc.has_header('dxva.h') and cc.has_header('d3d9.h')
d3d11_sources += d3d11_dec_sources
extra_args += ['-DHAVE_DXVA_H']
extra_dep += [gstcodecs_dep]
has_decoder = true
endif
if d3d11_winapi_only_app and (not d3dcompiler_lib.found() or not runtimeobject_lib.found()) if d3d11_winapi_only_app and (not d3dcompiler_lib.found() or not runtimeobject_lib.found())
if d3d11_option.enabled() if d3d11_option.enabled()
@ -80,28 +61,17 @@ endif
if d3d11_winapi_desktop if d3d11_winapi_desktop
d3d11_sources += ['gstd3d11window_win32.cpp'] d3d11_sources += ['gstd3d11window_win32.cpp']
if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 6 d3d11_sources += ['gstd3d11screencapture.cpp',
# Desktop Duplication API is unavailable for UWP 'gstd3d11screencapturedevice.cpp',
# and MinGW is not supported due to some missing headers 'gstd3d11screencapturesrc.cpp']
extra_args += ['-DHAVE_DXGI_DESKTOP_DUP']
d3d11_sources += ['gstd3d11screencapture.cpp',
'gstd3d11screencapturedevice.cpp',
'gstd3d11screencapturesrc.cpp']
message('Enable D3D11 Desktop Duplication API')
endif
# multimedia clock is desktop only API # multimedia clock is desktop only API
if has_decoder and winmm_lib.found() and cc.has_header('timeapi.h') if winmm_lib.found() and cc.has_header('timeapi.h')
extra_args += ['-DHAVE_WINMM'] extra_args += ['-DHAVE_WINMM']
extra_dep += [winmm_lib] extra_dep += [winmm_lib]
endif endif
endif endif
# need dxgi1_5.h for HDR10 processing and d3d11_4.h for ID3D11VideoContext2 interface
if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 5 and d3d11_conf.get('GST_D3D11_HEADER_VERSION') >= 4
d3d11_sources += ['gstd3d11deinterlace.cpp']
extra_args += ['-DHAVE_D3D11_VIDEO_PROC']
endif
# MinGW 32bits compiler seems to be complaining about redundant-decls # MinGW 32bits compiler seems to be complaining about redundant-decls
# when ComPtr is in use. Let's just disable the warning # when ComPtr is in use. Let's just disable the warning
if cc.get_id() != 'msvc' if cc.get_id() != 'msvc'
@ -117,7 +87,7 @@ gstd3d11 = library('gstd3d11',
c_args : gst_plugins_bad_args + extra_c_args + extra_args, c_args : gst_plugins_bad_args + extra_c_args + extra_args,
cpp_args: gst_plugins_bad_args + extra_args, cpp_args: gst_plugins_bad_args + extra_args,
include_directories : [configinc], include_directories : [configinc],
dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, gstcontroller_dep, gstd3d11_dep] + extra_dep, dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, gstcontroller_dep, gstd3d11_dep, gstcodecs_dep] + extra_dep,
install : true, install : true,
install_dir : plugins_install_dir, install_dir : plugins_install_dir,
) )

View File

@ -69,21 +69,18 @@
#include "gstd3d11shader.h" #include "gstd3d11shader.h"
#include "gstd3d11compositor.h" #include "gstd3d11compositor.h"
#include "gstd3d11compositorbin.h" #include "gstd3d11compositorbin.h"
#ifdef HAVE_DXVA_H
#include "gstd3d11h264dec.h" #include "gstd3d11h264dec.h"
#include "gstd3d11h265dec.h" #include "gstd3d11h265dec.h"
#include "gstd3d11vp9dec.h" #include "gstd3d11vp9dec.h"
#include "gstd3d11vp8dec.h" #include "gstd3d11vp8dec.h"
#include "gstd3d11mpeg2dec.h" #include "gstd3d11mpeg2dec.h"
#include "gstd3d11av1dec.h" #include "gstd3d11av1dec.h"
#endif #include "gstd3d11deinterlace.h"
#ifdef HAVE_DXGI_DESKTOP_DUP
#if !GST_D3D11_WINAPI_ONLY_APP
#include "gstd3d11screencapturesrc.h" #include "gstd3d11screencapturesrc.h"
#include "gstd3d11screencapturedevice.h" #include "gstd3d11screencapturedevice.h"
#endif #endif
#ifdef HAVE_D3D11_VIDEO_PROC
#include "gstd3d11deinterlace.h"
#endif
GST_DEBUG_CATEGORY (gst_d3d11_debug); GST_DEBUG_CATEGORY (gst_d3d11_debug);
GST_DEBUG_CATEGORY (gst_d3d11_shader_debug); GST_DEBUG_CATEGORY (gst_d3d11_shader_debug);
@ -95,8 +92,6 @@ GST_DEBUG_CATEGORY (gst_d3d11_overlay_compositor_debug);
GST_DEBUG_CATEGORY (gst_d3d11_window_debug); GST_DEBUG_CATEGORY (gst_d3d11_window_debug);
GST_DEBUG_CATEGORY (gst_d3d11_video_processor_debug); GST_DEBUG_CATEGORY (gst_d3d11_video_processor_debug);
GST_DEBUG_CATEGORY (gst_d3d11_compositor_debug); GST_DEBUG_CATEGORY (gst_d3d11_compositor_debug);
#ifdef HAVE_DXVA_H
GST_DEBUG_CATEGORY (gst_d3d11_decoder_debug); GST_DEBUG_CATEGORY (gst_d3d11_decoder_debug);
GST_DEBUG_CATEGORY (gst_d3d11_h264_dec_debug); GST_DEBUG_CATEGORY (gst_d3d11_h264_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_h265_dec_debug); GST_DEBUG_CATEGORY (gst_d3d11_h265_dec_debug);
@ -104,17 +99,13 @@ GST_DEBUG_CATEGORY (gst_d3d11_vp9_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_vp8_dec_debug); GST_DEBUG_CATEGORY (gst_d3d11_vp8_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_mpeg2_dec_debug); GST_DEBUG_CATEGORY (gst_d3d11_mpeg2_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_av1_dec_debug); GST_DEBUG_CATEGORY (gst_d3d11_av1_dec_debug);
#endif GST_DEBUG_CATEGORY (gst_d3d11_deinterlace_debug);
#ifdef HAVE_DXGI_DESKTOP_DUP #if !GST_D3D11_WINAPI_ONLY_APP
GST_DEBUG_CATEGORY (gst_d3d11_screen_capture_debug); GST_DEBUG_CATEGORY (gst_d3d11_screen_capture_debug);
GST_DEBUG_CATEGORY (gst_d3d11_screen_capture_device_debug); GST_DEBUG_CATEGORY (gst_d3d11_screen_capture_device_debug);
#endif #endif
#ifdef HAVE_D3D11_VIDEO_PROC
GST_DEBUG_CATEGORY (gst_d3d11_deinterlace_debug);
#endif
#define GST_CAT_DEFAULT gst_d3d11_debug #define GST_CAT_DEFAULT gst_d3d11_debug
static gboolean static gboolean
@ -144,7 +135,7 @@ plugin_init (GstPlugin * plugin)
GST_WARNING ("Cannot initialize d3d11 shader"); GST_WARNING ("Cannot initialize d3d11 shader");
return TRUE; return TRUE;
} }
#ifdef HAVE_DXVA_H
/* DXVA2 API is availble since Windows 8 */ /* DXVA2 API is availble since Windows 8 */
if (gst_d3d11_is_windows_8_or_greater ()) { if (gst_d3d11_is_windows_8_or_greater ()) {
GST_DEBUG_CATEGORY_INIT (gst_d3d11_decoder_debug, GST_DEBUG_CATEGORY_INIT (gst_d3d11_decoder_debug,
@ -161,13 +152,9 @@ plugin_init (GstPlugin * plugin)
"d3d11mpeg2dec", 0, "Direct3D11 MPEG2 Decoder"); "d3d11mpeg2dec", 0, "Direct3D11 MPEG2 Decoder");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_av1_dec_debug, GST_DEBUG_CATEGORY_INIT (gst_d3d11_av1_dec_debug,
"d3d11av1dec", 0, "Direct3D11 AV1 Decoder"); "d3d11av1dec", 0, "Direct3D11 AV1 Decoder");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_deinterlace_debug,
"d3d11deinterlace", 0, "Direct3D11 Deinterlacer");
} }
#endif
#ifdef HAVE_D3D11_VIDEO_PROC
GST_DEBUG_CATEGORY_INIT (gst_d3d11_deinterlace_debug,
"d3d11deinterlace", 0, "Direct3D11 Deinterlacer");
#endif
/* Enumerate devices to register decoders per device and to get the highest /* Enumerate devices to register decoders per device and to get the highest
* feature level */ * feature level */
@ -187,7 +174,6 @@ plugin_init (GstPlugin * plugin)
if (feature_level > max_feature_level) if (feature_level > max_feature_level)
max_feature_level = feature_level; max_feature_level = feature_level;
#ifdef HAVE_DXVA_H
/* DXVA2 API is availble since Windows 8 */ /* DXVA2 API is availble since Windows 8 */
if (gst_d3d11_is_windows_8_or_greater () && if (gst_d3d11_is_windows_8_or_greater () &&
gst_d3d11_device_get_video_device_handle (device)) { gst_d3d11_device_get_video_device_handle (device)) {
@ -203,19 +189,9 @@ plugin_init (GstPlugin * plugin)
gst_d3d11_av1_dec_register (plugin, device, GST_RANK_PRIMARY); gst_d3d11_av1_dec_register (plugin, device, GST_RANK_PRIMARY);
gst_d3d11_mpeg2_dec_register (plugin, device, GST_RANK_SECONDARY); gst_d3d11_mpeg2_dec_register (plugin, device, GST_RANK_SECONDARY);
} }
}
#endif
#ifdef HAVE_D3D11_VIDEO_PROC gst_d3d11_deinterlace_register (plugin, device, GST_RANK_MARGINAL);
/* D3D11 video processor API is availble since Windows 8 */
if (gst_d3d11_is_windows_8_or_greater ()) {
gboolean hardware;
g_object_get (device, "hardware", &hardware, NULL);
if (hardware)
gst_d3d11_deinterlace_register (plugin, device, GST_RANK_MARGINAL);
} }
#endif
gst_object_unref (device); gst_object_unref (device);
} }
@ -252,7 +228,7 @@ plugin_init (GstPlugin * plugin)
gst_element_register (plugin, gst_element_register (plugin,
"d3d11compositor", GST_RANK_SECONDARY, GST_TYPE_D3D11_COMPOSITOR_BIN); "d3d11compositor", GST_RANK_SECONDARY, GST_TYPE_D3D11_COMPOSITOR_BIN);
#ifdef HAVE_DXGI_DESKTOP_DUP #if !GST_D3D11_WINAPI_ONLY_APP
if (gst_d3d11_is_windows_8_or_greater ()) { if (gst_d3d11_is_windows_8_or_greater ()) {
GST_DEBUG_CATEGORY_INIT (gst_d3d11_screen_capture_debug, GST_DEBUG_CATEGORY_INIT (gst_d3d11_screen_capture_debug,
"d3d11screencapturesrc", 0, "d3d11screencapturesrc"); "d3d11screencapturesrc", 0, "d3d11screencapturesrc");

View File

@ -77,6 +77,8 @@
#if GST_MF_HAVE_D3D11 #if GST_MF_HAVE_D3D11
#include <gst/d3d11/gstd3d11.h> #include <gst/d3d11/gstd3d11.h>
#include <d3d11_4.h>
#include <dxgi1_6.h>
#include <gstmfplatloader.h> #include <gstmfplatloader.h>
#endif #endif