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>
20 files changed:
#include <initguid.h>
#endif
#include <initguid.h>
#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
-#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 <gst/gst.h>
#include <gst/video/video.h>
#include <gst/d3d11/gstd3d11_fwd.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/d3d11/gstd3d11_fwd.h>
+#include <d3d11_4.h>
+#include <dxgi1_6.h>
#include "gstd3d11memory.h"
#include "gstd3d11device.h"
#include "gstd3d11utils.h"
#include "gstd3d11memory.h"
#include "gstd3d11device.h"
#include "gstd3d11utils.h"
+#include "gstd3d11_private.h"
-#mesondefine GST_D3D11_DXGI_HEADER_VERSION
-#mesondefine GST_D3D11_HEADER_VERSION
#mesondefine GST_D3D11_WINAPI_ONLY_APP
#mesondefine GST_D3D11_WINAPI_APP
#mesondefine GST_D3D11_WINAPI_ONLY_APP
#mesondefine GST_D3D11_WINAPI_APP
"DXGIGetDebugInterface", (gpointer *) & GstDXGIGetDebugInterface);
if (GstDXGIGetDebugInterface)
ret = TRUE;
"DXGIGetDebugInterface", (gpointer *) & GstDXGIGetDebugInterface);
if (GstDXGIGetDebugInterface)
ret = TRUE;
-#elif (GST_D3D11_DXGI_HEADER_VERSION >= 3)
ret = TRUE;
#endif
g_once_init_leave (&_init, 1);
ret = TRUE;
#endif
g_once_init_leave (&_init, 1);
#if (!GST_D3D11_WINAPI_ONLY_APP)
if (GstDXGIGetDebugInterface) {
return GstDXGIGetDebugInterface (riid, debug);
#if (!GST_D3D11_WINAPI_ONLY_APP)
if (GstDXGIGetDebugInterface) {
return GstDXGIGetDebugInterface (riid, debug);
+ } else {
+ return E_NOINTERFACE;
-#elif (GST_D3D11_DXGI_HEADER_VERSION >= 3)
return DXGIGetDebugInterface1 (0, riid, debug);
#endif
return DXGIGetDebugInterface1 (0, riid, debug);
#endif
-
- return E_NOINTERFACE;
}
static inline GstDebugLevel
}
static inline GstDebugLevel
#include "gstd3d11utils.h"
#include "gstd3d11device.h"
#include "gstd3d11memory.h"
#include "gstd3d11utils.h"
#include "gstd3d11device.h"
#include "gstd3d11memory.h"
+#include "gstd3d11_private.h"
#include "gstd3d11memory.h"
#include "gstd3d11device.h"
#include "gstd3d11utils.h"
#include "gstd3d11memory.h"
#include "gstd3d11device.h"
#include "gstd3d11utils.h"
+#include "gstd3d11_private.h"
-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)
d3d11_option = get_option('d3d11')
gstd3d11_dep = dependency('', required : false)
d3d11_option = get_option('d3d11')
'-DG_LOG_DOMAIN="GStreamer-D3D11"',
]
'-DG_LOG_DOMAIN="GStreamer-D3D11"',
]
-have_dxgi_header = false
-have_d3d11_header = false
have_d3d11sdk_h = false
have_dxgidebug_h = false
have_d3d11sdk_h = false
have_dxgidebug_h = false
-winapi_desktop = false
-winapi_app = false
+d3d11_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)
dxgi_lib = cc.find_library('dxgi', required : d3d11_option)
d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
runtimeobject_lib = cc.find_library('runtimeobject', required : false)
d3d11_lib = cc.find_library('d3d11', required : d3d11_option)
dxgi_lib = cc.find_library('dxgi', required : d3d11_option)
d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
runtimeobject_lib = cc.find_library('runtimeobject', required : false)
-foreach dxgi_h: dxgi_headers
- 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
+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_d3d11
if d3d11_option.enabled()
error('The d3d11 was enabled explicitly, but required dependencies were not found.')
if not have_d3d11
if d3d11_option.enabled()
error('The d3d11 was enabled explicitly, but required dependencies were not found.')
#include <windows.applicationmodel.core.h>
#include <wrl.h>
#include <wrl/wrappers/corewrappers.h>
#include <windows.applicationmodel.core.h>
#include <wrl.h>
#include <wrl/wrappers/corewrappers.h>
- #include <d3d11.h>
- #include <dxgi1_2.h>
+ #include <d3d11_4.h>
+ #include <dxgi1_6.h>
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#error "not winrt"
#endif
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#error "not winrt"
#endif
GST_ERROR_OBJECT (self, "couldn't set converter");
return FALSE;
}
GST_ERROR_OBJECT (self, "couldn't set converter");
return FALSE;
}
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
/* If both input and output formats are native DXGI format */
if (self->in_d3d11_format->dxgi_format != DXGI_FORMAT_UNKNOWN &&
self->out_d3d11_format->dxgi_format != DXGI_FORMAT_UNKNOWN) {
/* If both input and output formats are native DXGI format */
if (self->in_d3d11_format->dxgi_format != DXGI_FORMAT_UNKNOWN &&
self->out_d3d11_format->dxgi_format != DXGI_FORMAT_UNKNOWN) {
self->processor = processor;
gst_d3d11_device_unlock (filter->device);
}
self->processor = processor;
gst_d3d11_device_unlock (filter->device);
}
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), "
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), "
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
gboolean
gst_d3d11_hdr_meta_data_to_dxgi (GstVideoMasteringDisplayInfo * minfo,
GstVideoContentLightLevel * cll, DXGI_HDR_METADATA_HDR10 * dxgi_hdr10)
gboolean
gst_d3d11_hdr_meta_data_to_dxgi (GstVideoMasteringDisplayInfo * minfo,
GstVideoContentLightLevel * cll, DXGI_HDR_METADATA_HDR10 * dxgi_hdr10)
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
typedef enum
{
GST_DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
typedef enum
{
GST_DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
static void
fill_staging_desc (const D3D11_TEXTURE2D_DESC * ref,
static void
fill_staging_desc (const D3D11_TEXTURE2D_DESC * ref,
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/d3d11/gstd3d11.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/d3d11/gstd3d11.h>
+#include <d3d11_4.h>
+#include <dxgi1_6.h>
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,
GstVideoContentLightLevel * cll,
DXGI_HDR_METADATA_HDR10 * dxgi_hdr10);
gboolean gst_d3d11_hdr_meta_data_to_dxgi (GstVideoMasteringDisplayInfo * minfo,
GstVideoContentLightLevel * cll,
DXGI_HDR_METADATA_HDR10 * dxgi_hdr10);
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
const GstDxgiColorSpace * gst_d3d11_video_info_to_dxgi_color_space (GstVideoInfo * info);
const GstDxgiColorSpace * gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info,
IDXGISwapChain3 * swapchain);
const GstDxgiColorSpace * gst_d3d11_video_info_to_dxgi_color_space (GstVideoInfo * info);
const GstDxgiColorSpace * gst_d3d11_find_swap_chain_color_space (GstVideoInfo * info,
IDXGISwapChain3 * swapchain);
GstBuffer * gst_d3d11_allocate_staging_buffer_for (GstBuffer * buffer,
const GstVideoInfo * info,
GstBuffer * gst_d3d11_allocate_staging_buffer_for (GstBuffer * buffer,
const GstVideoInfo * info,
#pragma once
#include <gst/gst.h>
#pragma once
#include <gst/gst.h>
+#include "gstd3d11pluginutils.h"
#endif
#include "gstd3d11videoprocessor.h"
#endif
#include "gstd3d11videoprocessor.h"
-#include "gstd3d11pluginutils.h"
#include <string.h>
GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_video_processor_debug);
#define GST_CAT_DEFAULT gst_d3d11_video_processor_debug
#include <string.h>
GST_DEBUG_CATEGORY_EXTERN (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
{
GstD3D11Device *device;
ID3D11VideoDevice *video_device;
ID3D11VideoContext *video_context;
struct _GstD3D11VideoProcessor
{
GstD3D11Device *device;
ID3D11VideoDevice *video_device;
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;
ID3D11VideoProcessor *processor;
ID3D11VideoProcessorEnumerator *enumerator;
ID3D11VideoProcessor *processor;
ID3D11VideoProcessorEnumerator *enumerator;
-#ifdef HAVE_VIDEO_CONTEXT_ONE
ID3D11VideoProcessorEnumerator1 *enumerator1;
ID3D11VideoProcessorEnumerator1 *enumerator1;
D3D11_VIDEO_PROCESSOR_CAPS processor_caps;
};
D3D11_VIDEO_PROCESSOR_CAPS processor_caps;
};
&self->enumerator);
if (!gst_d3d11_result (hr, device))
goto fail;
&self->enumerator);
if (!gst_d3d11_result (hr, device))
goto fail;
-#ifdef HAVE_VIDEO_CONTEXT_ONE
hr = self->enumerator->QueryInterface (IID_PPV_ARGS (&self->enumerator1));
if (gst_d3d11_result (hr, device)) {
GST_DEBUG ("ID3D11VideoProcessorEnumerator1 interface available");
}
hr = self->enumerator->QueryInterface (IID_PPV_ARGS (&self->enumerator1));
if (gst_d3d11_result (hr, device)) {
GST_DEBUG ("ID3D11VideoProcessorEnumerator1 interface available");
}
hr = self->enumerator->GetVideoProcessorCaps (&self->processor_caps);
if (!gst_d3d11_result (hr, device))
hr = self->enumerator->GetVideoProcessorCaps (&self->processor_caps);
if (!gst_d3d11_result (hr, device))
if (!gst_d3d11_result (hr, device))
goto fail;
if (!gst_d3d11_result (hr, device))
goto fail;
-#ifdef HAVE_VIDEO_CONTEXT_ONE
hr = self->video_context->
QueryInterface (IID_PPV_ARGS (&self->video_context1));
if (gst_d3d11_result (hr, device)) {
GST_DEBUG ("ID3D11VideoContext1 interface available");
}
hr = self->video_context->
QueryInterface (IID_PPV_ARGS (&self->video_context1));
if (gst_d3d11_result (hr, device)) {
GST_DEBUG ("ID3D11VideoContext1 interface available");
}
-#endif
-#ifdef HAVE_VIDEO_CONTEXT_TWO
hr = self->video_context->
QueryInterface (IID_PPV_ARGS (&self->video_context2));
if (gst_d3d11_result (hr, device)) {
GST_DEBUG ("ID3D11VideoContext2 interface available");
}
hr = self->video_context->
QueryInterface (IID_PPV_ARGS (&self->video_context2));
if (gst_d3d11_result (hr, device)) {
GST_DEBUG ("ID3D11VideoContext2 interface available");
}
/* Setting up default options */
gst_d3d11_device_lock (self->device);
/* Setting up default options */
gst_d3d11_device_lock (self->device);
GST_D3D11_CLEAR_COM (processor->video_device);
GST_D3D11_CLEAR_COM (processor->video_context);
GST_D3D11_CLEAR_COM (processor->video_device);
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);
GST_D3D11_CLEAR_COM (processor->processor);
GST_D3D11_CLEAR_COM (processor->enumerator);
GST_D3D11_CLEAR_COM (processor->processor);
GST_D3D11_CLEAR_COM (processor->enumerator);
-#ifdef HAVE_VIDEO_CONTEXT_ONE
GST_D3D11_CLEAR_COM (processor->enumerator1);
GST_D3D11_CLEAR_COM (processor->enumerator1);
gst_clear_object (&processor->device);
g_free (processor);
gst_clear_object (&processor->device);
g_free (processor);
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
gboolean
gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor *
processor, DXGI_FORMAT in_format, DXGI_COLOR_SPACE_TYPE in_color_space,
DXGI_FORMAT out_format, DXGI_COLOR_SPACE_TYPE out_color_space)
{
gboolean
gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor *
processor, DXGI_FORMAT in_format, DXGI_COLOR_SPACE_TYPE in_color_space,
DXGI_FORMAT out_format, DXGI_COLOR_SPACE_TYPE out_color_space)
{
-#ifdef HAVE_VIDEO_CONTEXT_ONE
HRESULT hr;
BOOL supported = TRUE;
HRESULT hr;
BOOL supported = TRUE;
-#endif
-
- return FALSE;
{
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) {
processor->video_context1->VideoProcessorSetStreamColorSpace1
(processor->processor, 0, color_space);
return TRUE;
}
if (processor->video_context1) {
processor->video_context1->VideoProcessorSetStreamColorSpace1
(processor->processor, 0, color_space);
return TRUE;
}
{
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) {
processor->video_context1->VideoProcessorSetOutputColorSpace1
(processor->processor, color_space);
return TRUE;
}
if (processor->video_context1) {
processor->video_context1->VideoProcessorSetOutputColorSpace1
(processor->processor, color_space);
return TRUE;
}
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
/* D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10
* missing in mingw header */
#define FEATURE_CAPS_METADATA_HDR10 (0x800)
/* D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10
* missing in mingw header */
#define FEATURE_CAPS_METADATA_HDR10 (0x800)
{
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 &
FEATURE_CAPS_METADATA_HDR10)) {
if (hdr10_meta) {
if (processor->video_context2 && (processor->processor_caps.FeatureCaps &
FEATURE_CAPS_METADATA_HDR10)) {
if (hdr10_meta) {
{
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 &
FEATURE_CAPS_METADATA_HDR10)) {
if (hdr10_meta) {
if (processor->video_context2 && (processor->processor_caps.FeatureCaps &
FEATURE_CAPS_METADATA_HDR10)) {
if (hdr10_meta) {
gboolean
gst_d3d11_video_processor_create_input_view (GstD3D11VideoProcessor * processor,
gboolean
gst_d3d11_video_processor_create_input_view (GstD3D11VideoProcessor * processor,
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/d3d11/gstd3d11.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/d3d11/gstd3d11.h>
+#include "gstd3d11pluginutils.h"
gboolean gst_d3d11_video_processor_set_output_color_space (GstD3D11VideoProcessor * processor,
GstVideoColorimetry * color);
gboolean gst_d3d11_video_processor_set_output_color_space (GstD3D11VideoProcessor * processor,
GstVideoColorimetry * color);
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
gboolean gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor * processor,
DXGI_FORMAT in_format,
DXGI_COLOR_SPACE_TYPE in_color_space,
gboolean gst_d3d11_video_processor_check_format_conversion (GstD3D11VideoProcessor * processor,
DXGI_FORMAT in_format,
DXGI_COLOR_SPACE_TYPE in_color_space,
gboolean gst_d3d11_video_processor_set_output_dxgi_color_space (GstD3D11VideoProcessor * processor,
DXGI_COLOR_SPACE_TYPE color_space);
gboolean gst_d3d11_video_processor_set_output_dxgi_color_space (GstD3D11VideoProcessor * processor,
DXGI_COLOR_SPACE_TYPE color_space);
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
gboolean gst_d3d11_video_processor_set_input_hdr10_metadata (GstD3D11VideoProcessor * processor,
DXGI_HDR_METADATA_HDR10 * hdr10_meta);
gboolean gst_d3d11_video_processor_set_output_hdr10_metadata (GstD3D11VideoProcessor * processor,
DXGI_HDR_METADATA_HDR10 * hdr10_meta);
gboolean gst_d3d11_video_processor_set_input_hdr10_metadata (GstD3D11VideoProcessor * processor,
DXGI_HDR_METADATA_HDR10 * hdr10_meta);
gboolean gst_d3d11_video_processor_set_output_hdr10_metadata (GstD3D11VideoProcessor * processor,
DXGI_HDR_METADATA_HDR10 * hdr10_meta);
gboolean gst_d3d11_video_processor_create_input_view (GstD3D11VideoProcessor * processor,
D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC * desc,
gboolean gst_d3d11_video_processor_create_input_view (GstD3D11VideoProcessor * processor,
D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC * desc,
};
const GstD3D11WindowDisplayFormat *chosen_format = NULL;
const GstDxgiColorSpace *chosen_colorspace = NULL;
};
const GstD3D11WindowDisplayFormat *chosen_format = NULL;
const GstDxgiColorSpace *chosen_colorspace = NULL;
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
gboolean have_hdr10 = FALSE;
DXGI_COLOR_SPACE_TYPE native_colorspace_type =
DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709;
gboolean have_hdr10 = FALSE;
DXGI_COLOR_SPACE_TYPE native_colorspace_type =
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, };
/* Step 1: Clear old resources and objects */
gst_clear_buffer (&window->cached_buffer);
/* Step 1: Clear old resources and objects */
gst_clear_buffer (&window->cached_buffer);
* (or reuse old swapchain if the format is not changed) */
window->allow_tearing = FALSE;
* (or reuse old swapchain if the format is not changed) */
window->allow_tearing = FALSE;
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
{
ComPtr < IDXGIFactory5 > factory5;
IDXGIFactory1 *factory_handle;
{
ComPtr < IDXGIFactory5 > factory5;
IDXGIFactory1 *factory_handle;
if (SUCCEEDED (hr) && allow_tearing)
window->allow_tearing = allow_tearing;
}
if (SUCCEEDED (hr) && allow_tearing)
window->allow_tearing = allow_tearing;
}
if (window->allow_tearing) {
GST_DEBUG_OBJECT (window, "device support tearning");
if (window->allow_tearing) {
GST_DEBUG_OBJECT (window, "device support tearning");
window->input_rect.bottom = GST_VIDEO_INFO_HEIGHT (&window->info);
/* Step 4: Decide render color space and set it on converter/processor */
window->input_rect.bottom = GST_VIDEO_INFO_HEIGHT (&window->info);
/* Step 4: Decide render color space and set it on converter/processor */
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
{
GstVideoMasteringDisplayInfo minfo;
GstVideoContentLightLevel cll;
{
GstVideoMasteringDisplayInfo minfo;
GstVideoContentLightLevel cll;
/* Step 5: Choose display color space */
gst_video_info_set_format (&window->render_info,
/* Step 5: Choose display color space */
gst_video_info_set_format (&window->render_info,
* target display color space type */
window->render_info.colorimetry.range = GST_VIDEO_COLOR_RANGE_0_255;
* target display color space type */
window->render_info.colorimetry.range = GST_VIDEO_COLOR_RANGE_0_255;
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
{
ComPtr < IDXGISwapChain3 > swapchain3;
HRESULT hr;
{
ComPtr < IDXGISwapChain3 > swapchain3;
HRESULT hr;
/* otherwise, use most common DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
* color space */
/* otherwise, use most common DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
* color space */
window->render_info.colorimetry.transfer = GST_VIDEO_TRANSFER_BT709;
window->render_info.colorimetry.range = GST_VIDEO_COLOR_RANGE_0_255;
}
window->render_info.colorimetry.transfer = GST_VIDEO_TRANSFER_BT709;
window->render_info.colorimetry.range = GST_VIDEO_COLOR_RANGE_0_255;
}
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
if (chosen_colorspace) {
const GstDxgiColorSpace *in_color_space =
gst_d3d11_video_info_to_dxgi_color_space (&window->info);
if (chosen_colorspace) {
const GstDxgiColorSpace *in_color_space =
gst_d3d11_video_info_to_dxgi_color_space (&window->info);
gst_d3d11_video_processor_set_output_dxgi_color_space (processor,
out_dxgi_color_space);
gst_d3d11_video_processor_set_output_dxgi_color_space (processor,
out_dxgi_color_space);
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
if (have_hdr10) {
GST_DEBUG_OBJECT (window, "Set HDR metadata on video processor");
gst_d3d11_video_processor_set_input_hdr10_metadata (processor,
if (have_hdr10) {
GST_DEBUG_OBJECT (window, "Set HDR metadata on video processor");
gst_d3d11_video_processor_set_input_hdr10_metadata (processor,
gst_d3d11_video_processor_set_output_hdr10_metadata (processor,
&hdr10_metadata);
}
gst_d3d11_video_processor_set_output_hdr10_metadata (processor,
&hdr10_metadata);
}
}
window->processor = processor;
}
}
}
window->processor = processor;
}
}
*video_processor_available = !!window->processor;
/* configure shader even if video processor is available for fallback */
*video_processor_available = !!window->processor;
/* configure shader even if video processor is available for fallback */
gst_d3d11_overlay_compositor_upload (self->compositor, buffer);
gst_d3d11_overlay_compositor_draw_unlocked (self->compositor, &rtv);
gst_d3d11_overlay_compositor_upload (self->compositor, buffer);
gst_d3d11_overlay_compositor_draw_unlocked (self->compositor, &rtv);
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 5)
if (self->allow_tearing && self->fullscreen) {
present_flags |= DXGI_PRESENT_ALLOW_TEARING;
}
if (self->allow_tearing && self->fullscreen) {
present_flags |= DXGI_PRESENT_ALLOW_TEARING;
}
if (klass->present)
ret = klass->present (self, present_flags);
if (klass->present)
ret = klass->present (self, present_flags);
gst_d3d11_device_lock (window->device);
gst_d3d11_device_lock (window->device);
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 4)
{
const GstDxgiColorSpace *in_color_space =
gst_d3d11_video_info_to_dxgi_color_space (&window->info);
{
const GstDxgiColorSpace *in_color_space =
gst_d3d11_video_info_to_dxgi_color_space (&window->info);
window->processor = processor;
}
window->processor = processor;
}
*video_processor_available = !!window->processor;
window->converter =
*video_processor_available = !!window->processor;
window->converter =
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 2)
static IDXGISwapChain1 *
create_swap_chain_for_hwnd (GstD3D11WindowWin32 * self, GstD3D11Device * device,
HWND hwnd, DXGI_SWAP_CHAIN_DESC1 * desc,
static IDXGISwapChain1 *
create_swap_chain_for_hwnd (GstD3D11WindowWin32 * self, GstD3D11Device * device,
HWND hwnd, DXGI_SWAP_CHAIN_DESC1 * desc,
static gboolean
gst_d3d11_window_win32_create_swap_chain (GstD3D11Window * window,
static gboolean
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, };
desc1.Width = 0;
{
DXGI_SWAP_CHAIN_DESC1 desc1 = { 0, };
desc1.Width = 0;
self->have_swapchain1 = TRUE;
}
}
self->have_swapchain1 = TRUE;
}
}
if (!new_swapchain) {
DXGI_SWAP_EFFECT swap_effect = DXGI_SWAP_EFFECT_DISCARD;
if (!new_swapchain) {
DXGI_SWAP_EFFECT swap_effect = DXGI_SWAP_EFFECT_DISCARD;
return GST_D3D11_WINDOW_FLOW_CLOSED;
}
return GST_D3D11_WINDOW_FLOW_CLOSED;
}
-#if (GST_D3D11_DXGI_HEADER_VERSION >= 2)
if (self->have_swapchain1) {
IDXGISwapChain1 *swap_chain1 = (IDXGISwapChain1 *) window->swap_chain;
DXGI_PRESENT_PARAMETERS present_params = { 0, };
if (self->have_swapchain1) {
IDXGISwapChain1 *swap_chain1 = (IDXGISwapChain1 *) window->swap_chain;
DXGI_PRESENT_PARAMETERS present_params = { 0, };
}
hr = swap_chain1->Present1 (0, present_flags, &present_params);
}
hr = swap_chain1->Present1 (0, present_flags, &present_params);
hr = window->swap_chain->Present (0, present_flags);
}
hr = window->swap_chain->Present (0, present_flags);
}
'gstd3d11basefilter.cpp',
'gstd3d11basefilter.cpp',
- 'gstd3d11convert.cpp',
- 'gstd3d11converter.cpp',
'gstd3d11compositor.cpp',
'gstd3d11compositorbin.cpp',
'gstd3d11compositor.cpp',
'gstd3d11compositorbin.cpp',
+ 'gstd3d11convert.cpp',
+ 'gstd3d11converter.cpp',
+ 'gstd3d11decoder.cpp',
+ 'gstd3d11deinterlace.cpp',
+ 'gstd3d11h264dec.cpp',
+ 'gstd3d11h265dec.cpp',
+ 'gstd3d11mpeg2dec.cpp',
'gstd3d11overlaycompositor.cpp',
'gstd3d11pluginutils.cpp',
'gstd3d11shader.cpp',
'gstd3d11upload.cpp',
'gstd3d11videoprocessor.cpp',
'gstd3d11videosink.cpp',
'gstd3d11overlaycompositor.cpp',
'gstd3d11pluginutils.cpp',
'gstd3d11shader.cpp',
'gstd3d11upload.cpp',
'gstd3d11videoprocessor.cpp',
'gstd3d11videosink.cpp',
+ 'gstd3d11vp8dec.cpp',
+ 'gstd3d11vp9dec.cpp',
'gstd3d11window.cpp',
'gstd3d11window_dummy.cpp',
'plugin.cpp',
]
'gstd3d11window.cpp',
'gstd3d11window_dummy.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_args = ['-DGST_USE_UNSTABLE_API']
extra_dep = []
extra_c_args = ['-DCOBJMACROS']
extra_args = ['-DGST_USE_UNSTABLE_API']
extra_dep = []
-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()
error('The d3d11 was enabled explicitly, but required dependencies were not found.')
endif
if d3d11_option.enabled()
error('The d3d11 was enabled explicitly, but required dependencies were not found.')
endif
d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
runtimeobject_lib = cc.find_library('runtimeobject', required : false)
winmm_lib = cc.find_library('winmm', required: false)
d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
runtimeobject_lib = cc.find_library('runtimeobject', 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_option.enabled()
if d3d11_winapi_only_app and (not d3dcompiler_lib.found() or not runtimeobject_lib.found())
if d3d11_option.enabled()
if d3d11_winapi_desktop
d3d11_sources += ['gstd3d11window_win32.cpp']
if d3d11_winapi_desktop
d3d11_sources += ['gstd3d11window_win32.cpp']
- if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 6
- # Desktop Duplication API is unavailable for UWP
- # and MinGW is not supported due to some missing headers
- extra_args += ['-DHAVE_DXGI_DESKTOP_DUP']
- d3d11_sources += ['gstd3d11screencapture.cpp',
- 'gstd3d11screencapturedevice.cpp',
- 'gstd3d11screencapturesrc.cpp']
- message('Enable D3D11 Desktop Duplication API')
- endif
+ d3d11_sources += ['gstd3d11screencapture.cpp',
+ 'gstd3d11screencapturedevice.cpp',
+ 'gstd3d11screencapturesrc.cpp']
+
# 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_dep += [winmm_lib]
endif
endif
extra_args += ['-DHAVE_WINMM']
extra_dep += [winmm_lib]
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
# when ComPtr is in use. Let's just disable the warning
if cc.get_id() != 'msvc'
# MinGW 32bits compiler seems to be complaining about redundant-decls
# when ComPtr is in use. Let's just disable the warning
if cc.get_id() != 'msvc'
c_args : gst_plugins_bad_args + extra_c_args + extra_args,
cpp_args: gst_plugins_bad_args + extra_args,
include_directories : [configinc],
c_args : gst_plugins_bad_args + extra_c_args + extra_args,
cpp_args: gst_plugins_bad_args + extra_args,
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_dir : plugins_install_dir,
)
install : true,
install_dir : plugins_install_dir,
)
#include "gstd3d11shader.h"
#include "gstd3d11compositor.h"
#include "gstd3d11compositorbin.h"
#include "gstd3d11shader.h"
#include "gstd3d11compositor.h"
#include "gstd3d11compositorbin.h"
#include "gstd3d11h264dec.h"
#include "gstd3d11h265dec.h"
#include "gstd3d11vp9dec.h"
#include "gstd3d11vp8dec.h"
#include "gstd3d11mpeg2dec.h"
#include "gstd3d11av1dec.h"
#include "gstd3d11h264dec.h"
#include "gstd3d11h265dec.h"
#include "gstd3d11vp9dec.h"
#include "gstd3d11vp8dec.h"
#include "gstd3d11mpeg2dec.h"
#include "gstd3d11av1dec.h"
-#endif
-#ifdef HAVE_DXGI_DESKTOP_DUP
+#include "gstd3d11deinterlace.h"
+
+#if !GST_D3D11_WINAPI_ONLY_APP
#include "gstd3d11screencapturesrc.h"
#include "gstd3d11screencapturedevice.h"
#endif
#include "gstd3d11screencapturesrc.h"
#include "gstd3d11screencapturedevice.h"
#endif
-#ifdef HAVE_D3D11_VIDEO_PROC
-#include "gstd3d11deinterlace.h"
-#endif
GST_DEBUG_CATEGORY (gst_d3d11_debug);
GST_DEBUG_CATEGORY (gst_d3d11_shader_debug);
GST_DEBUG_CATEGORY (gst_d3d11_debug);
GST_DEBUG_CATEGORY (gst_d3d11_shader_debug);
GST_DEBUG_CATEGORY (gst_d3d11_window_debug);
GST_DEBUG_CATEGORY (gst_d3d11_video_processor_debug);
GST_DEBUG_CATEGORY (gst_d3d11_compositor_debug);
GST_DEBUG_CATEGORY (gst_d3d11_window_debug);
GST_DEBUG_CATEGORY (gst_d3d11_video_processor_debug);
GST_DEBUG_CATEGORY (gst_d3d11_compositor_debug);
GST_DEBUG_CATEGORY (gst_d3d11_decoder_debug);
GST_DEBUG_CATEGORY (gst_d3d11_h264_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_h265_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_decoder_debug);
GST_DEBUG_CATEGORY (gst_d3d11_h264_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_h265_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_vp8_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_mpeg2_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_av1_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_vp8_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_mpeg2_dec_debug);
GST_DEBUG_CATEGORY (gst_d3d11_av1_dec_debug);
+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_device_debug);
#endif
GST_DEBUG_CATEGORY (gst_d3d11_screen_capture_debug);
GST_DEBUG_CATEGORY (gst_d3d11_screen_capture_device_debug);
#endif
-#ifdef HAVE_D3D11_VIDEO_PROC
-GST_DEBUG_CATEGORY (gst_d3d11_deinterlace_debug);
-#endif
-
#define GST_CAT_DEFAULT gst_d3d11_debug
static gboolean
#define GST_CAT_DEFAULT gst_d3d11_debug
static gboolean
GST_WARNING ("Cannot initialize d3d11 shader");
return TRUE;
}
GST_WARNING ("Cannot initialize d3d11 shader");
return TRUE;
}
/* DXVA2 API is availble since Windows 8 */
if (gst_d3d11_is_windows_8_or_greater ()) {
GST_DEBUG_CATEGORY_INIT (gst_d3d11_decoder_debug,
/* DXVA2 API is availble since Windows 8 */
if (gst_d3d11_is_windows_8_or_greater ()) {
GST_DEBUG_CATEGORY_INIT (gst_d3d11_decoder_debug,
"d3d11mpeg2dec", 0, "Direct3D11 MPEG2 Decoder");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_av1_dec_debug,
"d3d11av1dec", 0, "Direct3D11 AV1 Decoder");
"d3d11mpeg2dec", 0, "Direct3D11 MPEG2 Decoder");
GST_DEBUG_CATEGORY_INIT (gst_d3d11_av1_dec_debug,
"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
* feature level */
/* Enumerate devices to register decoders per device and to get the highest
* feature level */
if (feature_level > max_feature_level)
max_feature_level = feature_level;
if (feature_level > max_feature_level)
max_feature_level = feature_level;
/* DXVA2 API is availble since Windows 8 */
if (gst_d3d11_is_windows_8_or_greater () &&
gst_d3d11_device_get_video_device_handle (device)) {
/* DXVA2 API is availble since Windows 8 */
if (gst_d3d11_is_windows_8_or_greater () &&
gst_d3d11_device_get_video_device_handle (device)) {
gst_d3d11_av1_dec_register (plugin, device, GST_RANK_PRIMARY);
gst_d3d11_mpeg2_dec_register (plugin, device, GST_RANK_SECONDARY);
}
gst_d3d11_av1_dec_register (plugin, device, GST_RANK_PRIMARY);
gst_d3d11_mpeg2_dec_register (plugin, device, GST_RANK_SECONDARY);
}
-#ifdef HAVE_D3D11_VIDEO_PROC
- /* 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);
+ gst_d3d11_deinterlace_register (plugin, device, GST_RANK_MARGINAL);
gst_object_unref (device);
}
gst_object_unref (device);
}
gst_element_register (plugin,
"d3d11compositor", GST_RANK_SECONDARY, GST_TYPE_D3D11_COMPOSITOR_BIN);
gst_element_register (plugin,
"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 ()) {
GST_DEBUG_CATEGORY_INIT (gst_d3d11_screen_capture_debug,
"d3d11screencapturesrc", 0, "d3d11screencapturesrc");
if (gst_d3d11_is_windows_8_or_greater ()) {
GST_DEBUG_CATEGORY_INIT (gst_d3d11_screen_capture_debug,
"d3d11screencapturesrc", 0, "d3d11screencapturesrc");
#if GST_MF_HAVE_D3D11
#include <gst/d3d11/gstd3d11.h>
#if GST_MF_HAVE_D3D11
#include <gst/d3d11/gstd3d11.h>
+#include <d3d11_4.h>
+#include <dxgi1_6.h>
#include <gstmfplatloader.h>
#endif
#include <gstmfplatloader.h>
#endif