mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 12:32:29 +00:00
d3d11: Run gst-indent for all C++ code
Since all d3d11 plugin implementation code are C++, we need to run gst-indent manually. This is preparation for later "gst-indent sys/d3d11/*.cpp" run. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2077>
This commit is contained in:
parent
5b3e316039
commit
b08310f748
6 changed files with 155 additions and 113 deletions
|
@ -53,6 +53,7 @@
|
|||
|
||||
#include <wrl.h>
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -1408,6 +1409,7 @@ private:
|
|||
BYTE *vertex_buffer_;
|
||||
UINT vertex_buffer_size_;
|
||||
};
|
||||
/* *INDENT-ON* */
|
||||
|
||||
struct _GstD3D11DesktopDup
|
||||
{
|
||||
|
@ -1450,15 +1452,13 @@ gst_d3d11_desktop_dup_class_init (GstD3D11DesktopDupClass * klass)
|
|||
g_object_class_install_property (gobject_class, PROP_D3D11_DEVICE,
|
||||
g_param_spec_object ("d3d11device", "D3D11 Device",
|
||||
"GstD3D11Device object for operating",
|
||||
GST_TYPE_D3D11_DEVICE,
|
||||
(GParamFlags)
|
||||
GST_TYPE_D3D11_DEVICE, (GParamFlags)
|
||||
(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS)));
|
||||
g_object_class_install_property (gobject_class, PROP_OUTPUT_INDEX,
|
||||
g_param_spec_int ("monitor-index", "Monitor Index",
|
||||
"Zero-based index for monitor to capture (-1 = primary monitor)",
|
||||
-1, G_MAXINT, DEFAULT_MONITOR_INDEX,
|
||||
(GParamFlags)
|
||||
-1, G_MAXINT, DEFAULT_MONITOR_INDEX, (GParamFlags)
|
||||
(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS)));
|
||||
}
|
||||
|
@ -1506,10 +1506,12 @@ static void
|
|||
gst_d3d11_desktop_dup_constructed (GObject * object)
|
||||
{
|
||||
GstD3D11DesktopDup *self = GST_D3D11_DESKTOP_DUP (object);
|
||||
/* *INDENT-OFF* */
|
||||
ComPtr<IDXGIDevice> dxgi_device;
|
||||
ComPtr<IDXGIAdapter> adapter;
|
||||
ComPtr<IDXGIOutput> output;
|
||||
ComPtr<IDXGIOutput1> output1;
|
||||
/* *INDENT-ON* */
|
||||
ID3D11Device *device_handle;
|
||||
HRESULT hr;
|
||||
gboolean ret = FALSE;
|
||||
|
@ -1587,8 +1589,9 @@ gst_d3d11_desktop_dup_constructed (GObject * object)
|
|||
|
||||
GST_DEBUG_OBJECT (self,
|
||||
"Desktop coordinates left:top:right:bottom = %ld:%ld:%ld:%ld (%dx%d)",
|
||||
self->desktop_coordinates.left, self->desktop_coordinates.top, self->desktop_coordinates.right,
|
||||
self->desktop_coordinates.bottom, self->width, self->height);
|
||||
self->desktop_coordinates.left, self->desktop_coordinates.top,
|
||||
self->desktop_coordinates.right, self->desktop_coordinates.bottom,
|
||||
self->width, self->height);
|
||||
|
||||
ret = TRUE;
|
||||
|
||||
|
@ -1649,7 +1652,9 @@ gst_d3d11_desktop_dup_setup_texture (GstD3D11DesktopDup * self)
|
|||
D3D11_TEXTURE2D_DESC texture_desc = { 0, };
|
||||
ID3D11Device *device_handle;
|
||||
HRESULT hr;
|
||||
/* *INDENT-OFF* */
|
||||
ComPtr<ID3D11Texture2D> texture;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
/* This texture is for copying/updating only updated region from previously
|
||||
* captured frame (like a reference frame) */
|
||||
|
|
|
@ -311,7 +311,9 @@ gst_d3d11_window_prepare_dwrite_device (GstD3D11Window * self)
|
|||
{
|
||||
GstD3D11WindowPrivate *priv = self->priv;
|
||||
HRESULT hr;
|
||||
/* *INDENT-OFF* */
|
||||
ComPtr<IDXGIDevice> dxgi_device;
|
||||
/* *INDENT-ON* */
|
||||
ID3D11Device *device_handle;
|
||||
|
||||
if (!self->device) {
|
||||
|
@ -337,13 +339,15 @@ gst_d3d11_window_prepare_dwrite_device (GstD3D11Window * self)
|
|||
if (!gst_d3d11_result (hr, self->device))
|
||||
goto error;
|
||||
|
||||
hr = priv->d2d_device->CreateDeviceContext (D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS,
|
||||
hr = priv->d2d_device->CreateDeviceContext
|
||||
(D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS,
|
||||
&priv->d2d_device_context);
|
||||
if (!gst_d3d11_result (hr, self->device))
|
||||
goto error;
|
||||
|
||||
hr = priv->d2d_device_context->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Yellow),
|
||||
&priv->d2d_brush);
|
||||
hr = priv->
|
||||
d2d_device_context->CreateSolidColorBrush (D2D1::ColorF (D2D1::ColorF::
|
||||
Yellow), &priv->d2d_brush);
|
||||
if (!gst_d3d11_result (hr, self->device))
|
||||
goto error;
|
||||
|
||||
|
@ -372,8 +376,10 @@ gst_d3d11_window_dwrite_on_resize (GstD3D11Window * self,
|
|||
ID3D11Texture2D * backbuffer)
|
||||
{
|
||||
GstD3D11WindowPrivate *priv = self->priv;
|
||||
/* *INDENT-OFF* */
|
||||
ComPtr<IDXGISurface> dxgi_surface;
|
||||
ComPtr<ID2D1Bitmap1> bitmap;
|
||||
/* *INDENT-ON* */
|
||||
D2D1_BITMAP_PROPERTIES1 prop;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -393,8 +399,8 @@ gst_d3d11_window_dwrite_on_resize (GstD3D11Window * self,
|
|||
if (!gst_d3d11_result (hr, self->device))
|
||||
goto error;
|
||||
|
||||
hr = priv->d2d_device_context->CreateBitmapFromDxgiSurface (dxgi_surface.Get (),
|
||||
&prop, &bitmap);
|
||||
hr = priv->d2d_device_context->
|
||||
CreateBitmapFromDxgiSurface (dxgi_surface.Get (), &prop, &bitmap);
|
||||
if (!gst_d3d11_result (hr, self->device))
|
||||
goto error;
|
||||
|
||||
|
@ -538,7 +544,6 @@ gst_d3d11_window_on_resize_default (GstD3D11Window * window, guint width,
|
|||
&pov_desc, (ID3D11Resource *) backbuffer, &window->pov))
|
||||
goto done;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DIRECT_WRITE
|
||||
if (window->render_stats)
|
||||
gst_d3d11_window_dwrite_on_resize (window, backbuffer);
|
||||
|
@ -669,7 +674,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
|
|||
"Cannot determine render format");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DIRECT_WRITE
|
||||
if (window->render_stats && formats[1].supported) {
|
||||
/* FIXME: D2D seems to be accepting only DXGI_FORMAT_B8G8R8A8_UNORM */
|
||||
|
@ -730,7 +734,8 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
|
|||
klass = GST_D3D11_WINDOW_GET_CLASS (window);
|
||||
if (!window->swap_chain &&
|
||||
!klass->create_swap_chain (window, window->dxgi_format,
|
||||
display_width, display_height, swapchain_flags, &window->swap_chain)) {
|
||||
display_width, display_height, swapchain_flags,
|
||||
&window->swap_chain)) {
|
||||
GST_ERROR_OBJECT (window, "Cannot create swapchain");
|
||||
g_set_error (error, GST_RESOURCE_ERROR, GST_RESOURCE_ERROR_FAILED,
|
||||
"Cannot create swapchain");
|
||||
|
@ -814,7 +819,8 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
|
|||
(void **) &swapchain3);
|
||||
|
||||
if (gst_d3d11_result (hr, window->device)) {
|
||||
chosen_colorspace = gst_d3d11_find_swap_chain_color_space (&window->render_info,
|
||||
chosen_colorspace =
|
||||
gst_d3d11_find_swap_chain_color_space (&window->render_info,
|
||||
swapchain3, have_hdr10);
|
||||
if (chosen_colorspace) {
|
||||
native_colorspace_type =
|
||||
|
@ -834,10 +840,8 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
|
|||
chosen_colorspace->primaries;
|
||||
window->render_info.colorimetry.transfer =
|
||||
chosen_colorspace->transfer;
|
||||
window->render_info.colorimetry.range =
|
||||
chosen_colorspace->range;
|
||||
window->render_info.colorimetry.matrix =
|
||||
chosen_colorspace->matrix;
|
||||
window->render_info.colorimetry.range = chosen_colorspace->range;
|
||||
window->render_info.colorimetry.matrix = chosen_colorspace->matrix;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -854,7 +858,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
|
|||
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 =
|
||||
|
@ -874,8 +877,7 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
|
|||
processor =
|
||||
gst_d3d11_video_processor_new (window->device,
|
||||
GST_VIDEO_INFO_WIDTH (&window->info),
|
||||
GST_VIDEO_INFO_HEIGHT (&window->info),
|
||||
display_width, display_height);
|
||||
GST_VIDEO_INFO_HEIGHT (&window->info), display_width, display_height);
|
||||
}
|
||||
|
||||
if (processor) {
|
||||
|
@ -935,7 +937,6 @@ gst_d3d11_window_prepare_default (GstD3D11Window * window, guint display_width,
|
|||
"Cannot create overlay compositor");
|
||||
goto error;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DIRECT_WRITE
|
||||
if (window->render_stats)
|
||||
gst_d3d11_window_prepare_dwrite_device (window);
|
||||
|
@ -1016,7 +1017,9 @@ gst_d3d11_window_present_d2d (GstD3D11Window * self, GstStructure * stats)
|
|||
guint64 dropped = 0;
|
||||
guint64 rendered = 0;
|
||||
std::wostringstream stats_str;
|
||||
/* *INDENT-OFF* */
|
||||
ComPtr<IDWriteTextLayout> layout;
|
||||
/* *INDENT-ON* */
|
||||
FLOAT left;
|
||||
FLOAT top;
|
||||
|
||||
|
@ -1038,8 +1041,7 @@ gst_d3d11_window_present_d2d (GstD3D11Window * self, GstStructure * stats)
|
|||
hr = priv->dwrite_factory->CreateTextLayout (stats_str.str ().c_str (),
|
||||
(UINT32) stats_str.str ().size (), priv->dwrite_format,
|
||||
self->render_rect.right - self->render_rect.left,
|
||||
self->render_rect.bottom - self->render_rect.top,
|
||||
&layout);
|
||||
self->render_rect.bottom - self->render_rect.top, &layout);
|
||||
if (!gst_d3d11_result (hr, self->device))
|
||||
return;
|
||||
|
||||
|
@ -1077,16 +1079,14 @@ gst_d3d111_window_present (GstD3D11Window * self, GstBuffer * buffer,
|
|||
gst_d3d11_device_get_device_handle (self->device);
|
||||
|
||||
/* Map memory in any case so that we can upload pending stage texture */
|
||||
if (!gst_d3d11_buffer_map (buffer, device_handle,
|
||||
infos, GST_MAP_READ)) {
|
||||
if (!gst_d3d11_buffer_map (buffer, device_handle, infos, GST_MAP_READ)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't map buffer");
|
||||
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
if (!gst_d3d11_buffer_get_shader_resource_view (buffer, srv)) {
|
||||
if (!gst_d3d11_window_buffer_ensure_processor_input (self,
|
||||
buffer, &piv)) {
|
||||
if (!gst_d3d11_window_buffer_ensure_processor_input (self, buffer, &piv)) {
|
||||
GST_ERROR_OBJECT (self, "Input texture cannot be used for converter");
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
@ -1101,8 +1101,7 @@ gst_d3d111_window_present (GstD3D11Window * self, GstBuffer * buffer,
|
|||
viewport.Height = self->render_rect.bottom - self->render_rect.top;
|
||||
viewport.MinDepth = 0.0f;
|
||||
viewport.MaxDepth = 1.0f;
|
||||
gst_d3d11_converter_update_viewport (self->converter,
|
||||
&viewport);
|
||||
gst_d3d11_converter_update_viewport (self->converter, &viewport);
|
||||
gst_d3d11_overlay_compositor_update_viewport (self->compositor,
|
||||
&viewport);
|
||||
}
|
||||
|
@ -1110,7 +1109,8 @@ gst_d3d111_window_present (GstD3D11Window * self, GstBuffer * buffer,
|
|||
if (self->processor && piv && pov) {
|
||||
if (!gst_d3d11_video_processor_render_unlocked (self->processor,
|
||||
&self->input_rect, piv, &self->render_rect, pov)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't render to backbuffer using processor");
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Couldn't render to backbuffer using processor");
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto unmap_and_out;
|
||||
} else {
|
||||
|
@ -1119,7 +1119,8 @@ gst_d3d111_window_present (GstD3D11Window * self, GstBuffer * buffer,
|
|||
} else {
|
||||
if (!gst_d3d11_converter_convert_unlocked (self->converter,
|
||||
srv, &rtv, NULL, NULL)) {
|
||||
GST_ERROR_OBJECT (self, "Couldn't render to backbuffer using converter");
|
||||
GST_ERROR_OBJECT (self,
|
||||
"Couldn't render to backbuffer using converter");
|
||||
ret = GST_FLOW_ERROR;
|
||||
goto unmap_and_out;
|
||||
} else {
|
||||
|
@ -1231,8 +1232,7 @@ gst_d3d11_window_render_on_shared_handle (GstD3D11Window * window,
|
|||
pov = data.pov;
|
||||
}
|
||||
|
||||
ret = gst_d3d111_window_present (window, buffer, NULL,
|
||||
pov, rtv);
|
||||
ret = gst_d3d111_window_present (window, buffer, NULL, pov, rtv);
|
||||
|
||||
klass->release_shared_handle (window, &data);
|
||||
gst_d3d11_device_unlock (window->device);
|
||||
|
@ -1301,9 +1301,11 @@ gst_d3d11_window_get_native_type_from_handle (guintptr handle)
|
|||
#endif
|
||||
#if GST_D3D11_WINAPI_ONLY_APP
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
ComPtr<IInspectable> window = reinterpret_cast<IInspectable*> (handle);
|
||||
ComPtr<ABI::Windows::UI::Core::ICoreWindow> core_window;
|
||||
ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> panel;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
if (SUCCEEDED (window.As (&core_window)))
|
||||
return GST_D3D11_WINDOW_NATIVE_TYPE_CORE_WINDOW;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <wrl/wrappers/corewrappers.h>
|
||||
#include <windows.graphics.display.h>
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
using namespace ABI::Windows::UI;
|
||||
|
@ -46,10 +47,11 @@ typedef ABI::Windows::Foundation::
|
|||
__FITypedEventHandler_2_Windows__CUI__CCore__CCoreWindow_Windows__CUI__CCore__CWindowSizeChangedEventArgs_t
|
||||
IWindowSizeChangedEventHandler;
|
||||
|
||||
extern "C" {
|
||||
G_BEGIN_DECLS
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_window_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d11_window_debug
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
/* timeout to wait busy UI thread */
|
||||
#define DEFAULT_ASYNC_TIMEOUT (10 * 1000)
|
||||
|
@ -61,6 +63,7 @@ typedef struct _CoreWindowWinRTStorage
|
|||
HANDLE cancellable;
|
||||
EventRegistrationToken event_token;
|
||||
} CoreWindowWinRTStorage;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
struct _GstD3D11WindowCoreWindow
|
||||
{
|
||||
|
@ -75,18 +78,16 @@ G_DEFINE_TYPE (GstD3D11WindowCoreWindow, gst_d3d11_window_core_window,
|
|||
|
||||
static void gst_d3d11_window_core_window_constructed (GObject * object);
|
||||
static void gst_d3d11_window_core_window_dispose (GObject * object);
|
||||
static void gst_d3d11_window_core_window_update_swap_chain (GstD3D11Window * window);
|
||||
static void
|
||||
gst_d3d11_window_core_window_change_fullscreen_mode (GstD3D11Window * window);
|
||||
static gboolean
|
||||
gst_d3d11_window_core_window_create_swap_chain (GstD3D11Window * window,
|
||||
DXGI_FORMAT format, guint width, guint height, guint swapchain_flags,
|
||||
IDXGISwapChain ** swap_chain);
|
||||
static GstFlowReturn
|
||||
gst_d3d11_window_core_window_present (GstD3D11Window * window,
|
||||
guint present_flags);
|
||||
static gboolean
|
||||
gst_d3d11_window_core_window_unlock (GstD3D11Window * window);
|
||||
static void gst_d3d11_window_core_window_update_swap_chain (GstD3D11Window *
|
||||
window);
|
||||
static void gst_d3d11_window_core_window_change_fullscreen_mode (GstD3D11Window
|
||||
* window);
|
||||
static gboolean gst_d3d11_window_core_window_create_swap_chain (GstD3D11Window *
|
||||
window, DXGI_FORMAT format, guint width, guint height,
|
||||
guint swapchain_flags, IDXGISwapChain ** swap_chain);
|
||||
static GstFlowReturn gst_d3d11_window_core_window_present (GstD3D11Window *
|
||||
window, guint present_flags);
|
||||
static gboolean gst_d3d11_window_core_window_unlock (GstD3D11Window * window);
|
||||
static gboolean
|
||||
gst_d3d11_window_core_window_unlock_stop (GstD3D11Window * window);
|
||||
static void
|
||||
|
@ -94,16 +95,18 @@ gst_d3d11_window_core_window_on_resize (GstD3D11Window * window,
|
|||
guint width, guint height);
|
||||
static void
|
||||
gst_d3d11_window_core_window_on_resize_sync (GstD3D11Window * window);
|
||||
static void
|
||||
gst_d3d11_window_core_window_unprepare (GstD3D11Window * window);
|
||||
static void gst_d3d11_window_core_window_unprepare (GstD3D11Window * window);
|
||||
|
||||
static float
|
||||
get_logical_dpi (void)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
ComPtr<Display::IDisplayPropertiesStatics> properties;
|
||||
/* *INDENT-ON* */
|
||||
HRESULT hr;
|
||||
HStringReference str_ref =
|
||||
HStringReference (RuntimeClass_Windows_Graphics_Display_DisplayProperties);
|
||||
HStringReference
|
||||
(RuntimeClass_Windows_Graphics_Display_DisplayProperties);
|
||||
|
||||
hr = GetActivationFactory (str_ref.Get (), properties.GetAddressOf ());
|
||||
|
||||
|
@ -118,12 +121,14 @@ get_logical_dpi (void)
|
|||
return 96.0f;
|
||||
}
|
||||
|
||||
static inline float dip_to_pixel (float dip)
|
||||
static inline float
|
||||
dip_to_pixel (float dip)
|
||||
{
|
||||
/* https://docs.microsoft.com/en-us/windows/win32/learnwin32/dpi-and-device-independent-pixels */
|
||||
return dip * get_logical_dpi () / 96.0f;
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
class CoreResizeHandler
|
||||
: public RuntimeClass<RuntimeClassFlags<ClassicCom>,
|
||||
IWindowSizeChangedEventHandler>
|
||||
|
@ -233,6 +238,7 @@ get_window_size (const ComPtr<Core::ICoreDispatcher> &dispatcher,
|
|||
return hr;
|
||||
});
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static void
|
||||
gst_d3d11_window_core_window_class_init (GstD3D11WindowCoreWindowClass * klass)
|
||||
|
@ -268,6 +274,7 @@ gst_d3d11_window_core_window_init (GstD3D11WindowCoreWindow * self)
|
|||
self->storage->cancellable = CreateEvent (NULL, TRUE, FALSE, NULL);
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static void
|
||||
gst_d3d11_window_core_window_constructed (GObject * object)
|
||||
{
|
||||
|
@ -277,8 +284,8 @@ gst_d3d11_window_core_window_constructed (GObject * object)
|
|||
HRESULT hr;
|
||||
ComPtr<IInspectable> inspectable;
|
||||
ComPtr<IWindowSizeChangedEventHandler> resize_handler;
|
||||
Size size;
|
||||
ComPtr<Core::ICoreWindow> core_window;
|
||||
Size size;
|
||||
|
||||
if (!window->external_handle) {
|
||||
GST_ERROR_OBJECT (self, "No external window handle");
|
||||
|
@ -329,6 +336,7 @@ error:
|
|||
GST_ERROR_OBJECT (self, "Invalid window handle");
|
||||
return;
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static void
|
||||
gst_d3d11_window_core_window_dispose (GObject * object)
|
||||
|
@ -338,6 +346,7 @@ gst_d3d11_window_core_window_dispose (GObject * object)
|
|||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static void
|
||||
gst_d3d11_window_core_window_unprepare (GstD3D11Window * window)
|
||||
{
|
||||
|
@ -365,6 +374,7 @@ gst_d3d11_window_core_window_unprepare (GstD3D11Window * window)
|
|||
|
||||
self->storage = NULL;
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static IDXGISwapChain1 *
|
||||
create_swap_chain_for_core_window (GstD3D11WindowCoreWindow * self,
|
||||
|
@ -405,7 +415,9 @@ gst_d3d11_window_core_window_create_swap_chain (GstD3D11Window * window,
|
|||
IDXGISwapChain ** swap_chain)
|
||||
{
|
||||
GstD3D11WindowCoreWindow *self = GST_D3D11_WINDOW_CORE_WINDOW (window);
|
||||
/* *INDENT-OFF* */
|
||||
ComPtr<IDXGISwapChain1> new_swapchain;
|
||||
/* *INDENT-ON* */
|
||||
GstD3D11Device *device = window->device;
|
||||
DXGI_SWAP_CHAIN_DESC1 desc1 = { 0, };
|
||||
|
||||
|
@ -507,11 +519,13 @@ gst_d3d11_window_core_window_on_resize (GstD3D11Window * window,
|
|||
GstD3D11WindowCoreWindow *self = GST_D3D11_WINDOW_CORE_WINDOW (window);
|
||||
CoreWindowWinRTStorage *storage = self->storage;
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
run_async (storage->dispatcher, storage->cancellable, INFINITE,
|
||||
[window] {
|
||||
gst_d3d11_window_core_window_on_resize_sync (window);
|
||||
return S_OK;
|
||||
});
|
||||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "gstd3d11pluginutils.h"
|
||||
#include <wrl.h>
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
using namespace Microsoft::WRL;
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
@ -34,6 +35,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_window_debug);
|
|||
#define GST_CAT_DEFAULT gst_d3d11_window_debug
|
||||
|
||||
G_END_DECLS
|
||||
/* *INDENT-ON* */
|
||||
|
||||
struct _GstD3D11WindowDummy
|
||||
{
|
||||
|
@ -68,8 +70,7 @@ gst_d3d11_window_dummy_class_init (GstD3D11WindowDummyClass * klass)
|
|||
|
||||
window_class->on_resize =
|
||||
GST_DEBUG_FUNCPTR (gst_d3d11_window_dummy_on_resize);
|
||||
window_class->prepare =
|
||||
GST_DEBUG_FUNCPTR (gst_d3d11_window_dummy_prepare);
|
||||
window_class->prepare = GST_DEBUG_FUNCPTR (gst_d3d11_window_dummy_prepare);
|
||||
window_class->unprepare =
|
||||
GST_DEBUG_FUNCPTR (gst_d3d11_window_dummy_unprepare);
|
||||
window_class->open_shared_handle =
|
||||
|
@ -142,8 +143,7 @@ gst_d3d11_window_dummy_prepare (GstD3D11Window * window,
|
|||
processor =
|
||||
gst_d3d11_video_processor_new (window->device,
|
||||
GST_VIDEO_INFO_WIDTH (&window->info),
|
||||
GST_VIDEO_INFO_HEIGHT (&window->info),
|
||||
display_width, display_height);
|
||||
GST_VIDEO_INFO_HEIGHT (&window->info), display_width, display_height);
|
||||
}
|
||||
|
||||
/* Check if video processor can support all possible output dxgi formats */
|
||||
|
@ -331,6 +331,7 @@ gst_d3d11_window_dummy_setup_fallback_texture (GstD3D11Window * window,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static gboolean
|
||||
gst_d3d11_window_dummy_open_shared_handle (GstD3D11Window * window,
|
||||
GstD3D11WindowSharedHandleData * data)
|
||||
|
@ -404,10 +405,11 @@ gst_d3d11_window_dummy_open_shared_handle (GstD3D11Window * window,
|
|||
|
||||
GST_TRACE_OBJECT (window,
|
||||
"We are using video processor but keyed mutex is unavailable");
|
||||
if (!gst_d3d11_window_dummy_setup_fallback_texture (window, &desc))
|
||||
if (!gst_d3d11_window_dummy_setup_fallback_texture (window, &desc)) {
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hr = device_handle->CreateRenderTargetView ((ID3D11Resource *) texture,
|
||||
NULL, &rtv);
|
||||
|
@ -447,6 +449,7 @@ out:
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static gboolean
|
||||
gst_d3d11_window_dummy_release_shared_handle (GstD3D11Window * window,
|
||||
|
@ -463,7 +466,9 @@ gst_d3d11_window_dummy_release_shared_handle (GstD3D11Window * window,
|
|||
|
||||
data->keyed_mutex->Release ();
|
||||
} else {
|
||||
/* *INDENT-OFF* */
|
||||
ComPtr<ID3D11Query> query;
|
||||
/* *INDENT-ON* */
|
||||
D3D11_QUERY_DESC query_desc;
|
||||
ID3D11Device *device_handle = gst_d3d11_device_get_device_handle (device);
|
||||
ID3D11DeviceContext *context_handle =
|
||||
|
|
|
@ -34,15 +34,19 @@
|
|||
#include <wrl.h>
|
||||
#include <wrl/wrappers/corewrappers.h>
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
using namespace Microsoft::WRL;
|
||||
using namespace Microsoft::WRL::Wrappers;
|
||||
using namespace ABI::Windows::UI;
|
||||
using namespace ABI::Windows::Foundation;
|
||||
|
||||
extern "C" {
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_window_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d11_window_debug
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
/* timeout to wait busy UI thread */
|
||||
#define DEFAULT_ASYNC_TIMEOUT (10 * 1000)
|
||||
|
@ -55,6 +59,7 @@ typedef struct _SwapChainPanelWinRTStorage
|
|||
HANDLE cancellable;
|
||||
EventRegistrationToken event_token;
|
||||
} SwapChainPanelWinRTStorage;
|
||||
/* *INDENT-ON* */
|
||||
|
||||
struct _GstD3D11WindowSwapChainPanel
|
||||
{
|
||||
|
@ -90,11 +95,11 @@ static void
|
|||
gst_d3d11_window_swap_chain_panel_on_resize (GstD3D11Window * window,
|
||||
guint width, guint height);
|
||||
static void
|
||||
gst_d3d11_window_swap_chain_panel_on_resize_sync (GstD3D11Window *
|
||||
window);
|
||||
gst_d3d11_window_swap_chain_panel_on_resize_sync (GstD3D11Window * window);
|
||||
static void
|
||||
gst_d3d11_window_swap_chain_panel_unprepare (GstD3D11Window * window);
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
class PanelResizeHandler
|
||||
: public RuntimeClass<RuntimeClassFlags<ClassicCom>,
|
||||
Xaml::ISizeChangedEventHandler>
|
||||
|
@ -198,6 +203,7 @@ get_panel_size (const ComPtr<Core::ICoreDispatcher> &dispatcher,
|
|||
|
||||
return hr;
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static void
|
||||
gst_d3d11_window_swap_chain_panel_class_init (GstD3D11WindowSwapChainPanelClass
|
||||
|
@ -212,7 +218,8 @@ gst_d3d11_window_swap_chain_panel_class_init (GstD3D11WindowSwapChainPanelClass
|
|||
window_class->update_swap_chain =
|
||||
GST_DEBUG_FUNCPTR (gst_d3d11_window_swap_chain_panel_update_swap_chain);
|
||||
window_class->change_fullscreen_mode =
|
||||
GST_DEBUG_FUNCPTR (gst_d3d11_window_swap_chain_panel_change_fullscreen_mode);
|
||||
GST_DEBUG_FUNCPTR
|
||||
(gst_d3d11_window_swap_chain_panel_change_fullscreen_mode);
|
||||
window_class->create_swap_chain =
|
||||
GST_DEBUG_FUNCPTR (gst_d3d11_window_swap_chain_panel_create_swap_chain);
|
||||
window_class->present =
|
||||
|
@ -234,6 +241,7 @@ gst_d3d11_window_swap_chain_panel_init (GstD3D11WindowSwapChainPanel * self)
|
|||
self->storage->cancellable = CreateEvent (NULL, TRUE, FALSE, NULL);
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static void
|
||||
gst_d3d11_window_swap_chain_panel_constructed (GObject * object)
|
||||
{
|
||||
|
@ -301,6 +309,7 @@ error:
|
|||
GST_ERROR_OBJECT (self, "Invalid window handle");
|
||||
return;
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static void
|
||||
gst_d3d11_window_swap_chain_panel_dispose (GObject * object)
|
||||
|
@ -310,6 +319,7 @@ gst_d3d11_window_swap_chain_panel_dispose (GObject * object)
|
|||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static void
|
||||
gst_d3d11_window_swap_chain_panel_unprepare (GstD3D11Window * window)
|
||||
{
|
||||
|
@ -339,6 +349,7 @@ gst_d3d11_window_swap_chain_panel_unprepare (GstD3D11Window * window)
|
|||
|
||||
self->storage = NULL;
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static IDXGISwapChain1 *
|
||||
create_swap_chain_for_composition (GstD3D11WindowSwapChainPanel * self,
|
||||
|
@ -372,6 +383,7 @@ create_swap_chain_for_composition (GstD3D11WindowSwapChainPanel * self,
|
|||
return swap_chain;
|
||||
}
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
static gboolean
|
||||
gst_d3d11_window_swap_chain_panel_create_swap_chain (GstD3D11Window * window,
|
||||
DXGI_FORMAT format, guint width, guint height, guint swapchain_flags,
|
||||
|
@ -424,6 +436,7 @@ gst_d3d11_window_swap_chain_panel_create_swap_chain (GstD3D11Window * window,
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
|
||||
static GstFlowReturn
|
||||
gst_d3d11_window_swap_chain_panel_present (GstD3D11Window * window,
|
||||
|
@ -501,11 +514,11 @@ gst_d3d11_window_swap_chain_panel_on_resize (GstD3D11Window * window,
|
|||
GST_D3D11_WINDOW_SWAP_CHAIN_PANEL (window);
|
||||
SwapChainPanelWinRTStorage *storage = self->storage;
|
||||
|
||||
run_async (storage->dispatcher, storage->cancellable, INFINITE,
|
||||
[window] {
|
||||
run_async (storage->dispatcher, storage->cancellable, INFINITE,[window] {
|
||||
gst_d3d11_window_swap_chain_panel_on_resize_sync (window);
|
||||
return S_OK;
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -26,10 +26,14 @@
|
|||
|
||||
#include "gstd3d11window_win32.h"
|
||||
|
||||
extern "C" {
|
||||
/* *INDENT-OFF* */
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_d3d11_window_debug);
|
||||
#define GST_CAT_DEFAULT gst_d3d11_window_debug
|
||||
}
|
||||
|
||||
G_END_DECLS
|
||||
/* *INDENT-ON* */
|
||||
|
||||
G_LOCK_DEFINE_STATIC (create_lock);
|
||||
|
||||
|
@ -599,7 +603,8 @@ gst_d3d11_window_win32_handle_window_proc (GstD3D11WindowWin32 * self,
|
|||
case WM_MOUSEMOVE:
|
||||
/* To handle mouse event only once, do this only for internal window */
|
||||
if (self->internal_hwnd && self->internal_hwnd == hWnd)
|
||||
gst_d3d11_window_win32_on_mouse_event (self, hWnd, uMsg, wParam, lParam);
|
||||
gst_d3d11_window_win32_on_mouse_event (self, hWnd, uMsg, wParam,
|
||||
lParam);
|
||||
|
||||
/* DefWindowProc will not chain up mouse event to parent window */
|
||||
if (self->external_hwnd && self->external_hwnd != hWnd)
|
||||
|
@ -757,8 +762,7 @@ create_swap_chain (GstD3D11WindowWin32 * self, GstD3D11Device * device,
|
|||
IDXGIFactory1 *factory = gst_d3d11_device_get_dxgi_factory_handle (device);
|
||||
|
||||
gst_d3d11_device_lock (device);
|
||||
hr = factory->CreateSwapChain ((IUnknown *) device_handle,
|
||||
desc, &swap_chain);
|
||||
hr = factory->CreateSwapChain ((IUnknown *) device_handle, desc, &swap_chain);
|
||||
gst_d3d11_device_unlock (device);
|
||||
|
||||
if (!gst_d3d11_result (hr, device)) {
|
||||
|
@ -948,7 +952,6 @@ gst_d3d11_window_win32_present (GstD3D11Window * window, guint present_flags)
|
|||
|
||||
return GST_D3D11_WINDOW_FLOW_CLOSED;
|
||||
}
|
||||
|
||||
#if (GST_D3D11_DXGI_HEADER_VERSION >= 2)
|
||||
if (self->have_swapchain1) {
|
||||
IDXGISwapChain1 *swap_chain1 = (IDXGISwapChain1 *) window->swap_chain;
|
||||
|
|
Loading…
Reference in a new issue