[vlc-commits] [Git][videolan/vlc][master] 14 commits: direct3d11: get source D3D11_TEXTURE2D_DESC early
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sat Apr 15 07:36:57 UTC 2023
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
e4ba931b by Steve Lhomme at 2023-04-15T07:09:11+00:00
direct3d11: get source D3D11_TEXTURE2D_DESC early
- - - - -
ab84bbdd by Steve Lhomme at 2023-04-15T07:09:11+00:00
win32/common: remove unused dxgidebug_dll
- - - - -
445e74dd by Steve Lhomme at 2023-04-15T07:09:11+00:00
common/win32: make the HWND size update private to the event thread
- - - - -
6a5821aa by Steve Lhomme at 2023-04-15T07:09:11+00:00
win32/common: remove write-only parent_window
- - - - -
e9961dc3 by Steve Lhomme at 2023-04-15T07:09:11+00:00
win32/common: get the video HWND directly
No need for a special structure.
- - - - -
124be999 by Steve Lhomme at 2023-04-15T07:09:11+00:00
win32/common: make the video HWND private to event_thread_t
- - - - -
59c9fdd3 by Steve Lhomme at 2023-04-15T07:09:11+00:00
win32/common: remove vout_display_sys_win32_t indirection
We can just fill an opaque event_thread_t pointer.
- - - - -
1a0dbb0c by Steve Lhomme at 2023-04-15T07:09:11+00:00
win32/common: move the opaque event_thread_t in the area structure
We don't need to have them separated, they are closely tied.
- - - - -
cfdc7251 by Steve Lhomme at 2023-04-15T07:09:11+00:00
d3d11_swapchain: remove unused GUIDs
They are no longer used for external rendering
- - - - -
1ac410b6 by Steve Lhomme at 2023-04-15T07:09:11+00:00
direct3d11: don't compile D3D11_CreateLocalSwapchainHandleHwnd in UWP
HWND is not available in UWP apps, so we should never allow any code to use it.
- - - - -
e13d4e53 by Steve Lhomme at 2023-04-15T07:09:11+00:00
direct3d11: don't build d3d11_swapchain in UWP
We can't create a swapchain from DirectCompose or a HWND.
Maybe one day we will support CreateSwapChainForCoreWindow(). It can be
in its own file.
- - - - -
7e5d84ca by Steve Lhomme at 2023-04-15T07:09:11+00:00
direct3d11: don't build dxgi_swapchain in UWP
We can't use d3d11_swapchain, so we can't use dxgi_swapchain either.
Until we support CreateSwapChainForCoreWindow() we have no use for this.
- - - - -
b317441d by Steve Lhomme at 2023-04-15T07:09:11+00:00
vout/win32: initialize the initial picture placement
Otherwise we use vout_display_PlaceEquals() with uninitialized memory.
- - - - -
9814ddaa by Steve Lhomme at 2023-04-15T07:09:11+00:00
vout/win32: do CommonPlacePicture() outside of CommonWindowInit()
CommonWindowInit() is not called in UWP builds, but the initial
CommonPlacePicture() needs to be done.
direct3d11 already does its own in Direct3D11Open().
Do it earlier in direct3d9 to be closer to the CommonWindowInit() call.
- - - - -
14 changed files:
- modules/video_output/Makefile.am
- modules/video_output/win32/common.c
- modules/video_output/win32/common.h
- modules/video_output/win32/d3d11_swapchain.cpp
- modules/video_output/win32/d3d11_swapchain.h
- modules/video_output/win32/direct3d11.cpp
- modules/video_output/win32/direct3d9.c
- modules/video_output/win32/dxgi_swapchain.cpp
- modules/video_output/win32/dxgi_swapchain.h
- modules/video_output/win32/events.c
- modules/video_output/win32/events.h
- modules/video_output/win32/glwin32.c
- modules/video_output/win32/meson.build
- modules/video_output/win32/wingdi.c
Changes:
=====================================
modules/video_output/Makefile.am
=====================================
@@ -189,14 +189,14 @@ libdirect3d11_plugin_la_SOURCES = video_output/win32/direct3d11.cpp \
video_output/win32/d3d11_shaders.cpp video_output/win32/d3d11_shaders.h \
video_output/win32/d3d_shaders.c video_output/win32/d3d_shaders.h \
video_output/win32/d3d_dynamic_shader.c video_output/win32/d3d_dynamic_shader.h \
- video_output/win32/d3d11_swapchain.cpp video_output/win32/d3d11_swapchain.h \
- video_output/win32/dxgi_swapchain.cpp video_output/win32/dxgi_swapchain.h \
video_output/win32/common.c video_output/win32/common.h
libdirect3d11_plugin_la_CXXFLAGS = $(AM_CXXFLAGS) $(LIBCOMCXXFLAGS)
libdirect3d11_plugin_la_LIBADD = libchroma_copy.la libd3d11_common.la $(LIBCOM) -luuid
if !HAVE_WINSTORE
libdirect3d11_plugin_la_SOURCES += video_output/win32/events.c \
video_output/win32/events.h \
+ video_output/win32/d3d11_swapchain.cpp video_output/win32/d3d11_swapchain.h \
+ video_output/win32/dxgi_swapchain.cpp video_output/win32/dxgi_swapchain.h \
video_output/win32/sensors.cpp \
video_output/win32/win32touch.c video_output/win32/win32touch.h
libdirect3d11_plugin_la_LIBADD += -lgdi32
=====================================
modules/video_output/win32/common.c
=====================================
@@ -43,27 +43,21 @@
void CommonInit(display_win32_area_t *area)
{
+ ZeroMemory(&area->place, sizeof(area->place));
area->place_changed = false;
}
#ifndef VLC_WINSTORE_APP
/* */
int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area,
- vout_display_sys_win32_t *sys, bool projection_gestures)
+ bool projection_gestures)
{
if (unlikely(vd->cfg->window == NULL))
return VLC_EGENERIC;
/* */
-#if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
- sys->dxgidebug_dll = LoadLibrary(TEXT("DXGIDEBUG.DLL"));
-#endif
- sys->hvideownd = NULL;
- sys->hparent = NULL;
-
- /* */
- sys->event = EventThreadCreate(VLC_OBJECT(vd), vd->cfg->window);
- if (!sys->event)
+ area->event = EventThreadCreate(VLC_OBJECT(vd), vd->cfg->window);
+ if (!area->event)
return VLC_EGENERIC;
/* */
@@ -73,17 +67,16 @@ int CommonWindowInit(vout_display_t *vd, display_win32_area_t *area,
cfg.height = vd->cfg->display.height;
cfg.is_projected = projection_gestures;
- event_hwnd_t hwnd;
- if (EventThreadStart(sys->event, &hwnd, &cfg))
+ if (EventThreadStart(area->event, &cfg))
return VLC_EGENERIC;
- sys->hparent = hwnd.hparent;
- sys->hvideownd = hwnd.hvideownd;
-
- CommonPlacePicture(vd, area);
-
return VLC_SUCCESS;
}
+
+HWND CommonVideoHWND(const display_win32_area_t *area)
+{
+ return EventThreadVideoHWND(area->event);
+}
#endif /* !VLC_WINSTORE_APP */
/*****************************************************************************
@@ -117,7 +110,7 @@ void CommonPlacePicture(vout_display_t *vd, display_win32_area_t *area)
#ifndef VLC_WINSTORE_APP
/* */
-void CommonWindowClean(vout_display_sys_win32_t *sys)
+void CommonWindowClean(display_win32_area_t *sys)
{
if (sys->event) {
EventThreadStop(sys->event);
@@ -126,20 +119,15 @@ void CommonWindowClean(vout_display_sys_win32_t *sys)
}
#endif /* !VLC_WINSTORE_APP */
-void CommonControl(vout_display_t *vd, display_win32_area_t *area, vout_display_sys_win32_t *sys, int query)
+void CommonControl(vout_display_t *vd, display_win32_area_t *area, int query)
{
switch (query) {
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE:
#ifndef VLC_WINSTORE_APP
// Update dimensions
- if (sys->event != NULL)
+ if (area->event != NULL)
{
- RECT clientRect;
- GetClientRect(sys->hparent, &clientRect);
-
- SetWindowPos(sys->hvideownd, 0, 0, 0,
- RECTWidth(clientRect),
- RECTHeight(clientRect), SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
+ EventThreadUpdateSize(area->event);
}
#endif /* !VLC_WINSTORE_APP */
// fallthrough
=====================================
modules/video_output/win32/common.h
=====================================
@@ -32,48 +32,27 @@ extern "C" {
* event_thread_t: event thread
*****************************************************************************/
-typedef struct event_thread_t event_thread_t;
-
typedef struct display_win32_area_t
{
/* Coordinates of dest images (used when blitting to display) */
vout_display_place_t place;
bool place_changed;
+ struct event_thread_t *event; // only use if sys.event is not NULL
} display_win32_area_t;
#define RECTWidth(r) (LONG)((r).right - (r).left)
#define RECTHeight(r) (LONG)((r).bottom - (r).top)
-/*****************************************************************************
- * vout_sys_t: video output method descriptor
- *****************************************************************************
- * This structure is part of the video output thread descriptor.
- * It describes the module specific properties of an output thread.
- *****************************************************************************/
-typedef struct vout_display_sys_win32_t
-{
- /* */
- event_thread_t *event;
-
- /* */
- HWND hvideownd; /* Handle of the video sub-window */
- HWND hparent; /* Handle of the parent window */
-
-# if !defined(NDEBUG) && defined(HAVE_DXGIDEBUG_H)
- HINSTANCE dxgidebug_dll;
-# endif
-} vout_display_sys_win32_t;
-
-
/*****************************************************************************
* Prototypes from common.c
*****************************************************************************/
#ifndef VLC_WINSTORE_APP
-int CommonWindowInit(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *,
+int CommonWindowInit(vout_display_t *, display_win32_area_t *,
bool projection_gestures);
-void CommonWindowClean(vout_display_sys_win32_t *);
+void CommonWindowClean(display_win32_area_t *);
+HWND CommonVideoHWND(const display_win32_area_t *);
#endif /* !VLC_WINSTORE_APP */
-void CommonControl(vout_display_t *, display_win32_area_t *, vout_display_sys_win32_t *, int );
+void CommonControl(vout_display_t *, display_win32_area_t *, int );
void CommonPlacePicture (vout_display_t *, display_win32_area_t *);
=====================================
modules/video_output/win32/d3d11_swapchain.cpp
=====================================
@@ -53,9 +53,6 @@ struct d3d11_local_swapchain
ComPtr<ID3D11RenderTargetView> swapchainTargetView[DXGI_MAX_RENDER_TARGET];
};
-DEFINE_GUID(GUID_SWAPCHAIN_WIDTH, 0xf1b59347, 0x1643, 0x411a, 0xad, 0x6b, 0xc7, 0x80, 0x17, 0x7a, 0x06, 0xb6);
-DEFINE_GUID(GUID_SWAPCHAIN_HEIGHT, 0x6ea976a0, 0x9d60, 0x4bb7, 0xa5, 0xa9, 0x7d, 0xd1, 0x18, 0x7f, 0xc9, 0xbd);
-
static bool UpdateSwapchain( d3d11_local_swapchain *display, const libvlc_video_render_cfg_t *cfg )
{
HRESULT hr;
@@ -196,7 +193,7 @@ void *D3D11_CreateLocalSwapchainHandleHwnd(vlc_object_t *o, HWND hwnd, d3d11_dev
return display;
}
-#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP)
+#if defined(HAVE_DCOMP_H)
void *D3D11_CreateLocalSwapchainHandleDComp(vlc_object_t *o, void* dcompDevice, void* dcompVisual, d3d11_device_t *d3d_dev)
{
d3d11_local_swapchain *display = new (std::nothrow) d3d11_local_swapchain();
@@ -212,4 +209,4 @@ void *D3D11_CreateLocalSwapchainHandleDComp(vlc_object_t *o, void* dcompDevice,
return display;
}
-#endif
+#endif // HAVE_DCOMP_H
=====================================
modules/video_output/win32/d3d11_swapchain.h
=====================================
@@ -28,10 +28,11 @@
#include "dxgi_swapchain.h"
#include "../../video_chroma/d3d11_fmt.h"
+#ifndef VLC_WINSTORE_APP
void *D3D11_CreateLocalSwapchainHandleHwnd(vlc_object_t *, HWND, d3d11_device_t *d3d_dev);
-#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP)
+#if defined(HAVE_DCOMP_H)
void *D3D11_CreateLocalSwapchainHandleDComp(vlc_object_t *, void* dcompDevice, void* dcompVisual, d3d11_device_t *d3d_dev);
-#endif
+#endif // HAVE_DCOMP_H
void D3D11_LocalSwapchainCleanupDevice( void *opaque );
bool D3D11_LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_render_cfg_t *cfg, libvlc_video_output_cfg_t *out );
@@ -39,5 +40,6 @@ bool D3D11_LocalSwapchainStartEndRendering( void *opaque, bool enter );
bool D3D11_LocalSwapchainSelectPlane( void *opaque, size_t plane, void *output );
void D3D11_LocalSwapchainSwap( void *opaque );
void D3D11_LocalSwapchainSetMetadata( void *opaque, libvlc_video_metadata_type_t, const void * );
+#endif // !VLC_WINSTORE_APP
#endif /* VLC_D3D11_SWAPCHAIN_H */
=====================================
modules/video_output/win32/direct3d11.cpp
=====================================
@@ -43,7 +43,9 @@
#include "d3d11_quad.h"
#include "d3d11_shaders.h"
+#ifndef VLC_WINSTORE_APP
#include "d3d11_swapchain.h"
+#endif
#include "common.h"
#include "../../video_chroma/copy.h"
@@ -73,7 +75,6 @@ vlc_module_end ()
typedef struct vout_display_sys_t
{
- vout_display_sys_win32_t sys; /* only use if sys.event is not NULL */
display_win32_area_t area;
int log_level;
@@ -368,26 +369,27 @@ static int Open(vout_display_t *vd,
if ( sys->swapCb == NULL || sys->startEndRenderingCb == NULL || sys->updateOutputCb == NULL )
{
-#ifndef VLC_WINSTORE_APP
+#ifdef VLC_WINSTORE_APP
+ msg_Err(vd, "UWP apps needs to set an external rendering target");
+ goto error;
+#else // !VLC_WINSTORE_APP
if (vd->cfg->window->type == VLC_WINDOW_TYPE_HWND)
{
- if (CommonWindowInit(vd, &sys->area, &sys->sys,
+ if (CommonWindowInit(vd, &sys->area,
vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR))
goto error;
}
-#endif /* !VLC_WINSTORE_APP */
-
/* use our internal swapchain callbacks */
-#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP)
+#if defined(HAVE_DCOMP_H)
if (vd->cfg->window->type == VLC_WINDOW_TYPE_DCOMP)
sys->outside_opaque =
D3D11_CreateLocalSwapchainHandleDComp(VLC_OBJECT(vd),
vd->cfg->window->display.dcomp_device,
vd->cfg->window->handle.dcomp_visual, sys->d3d_dev);
else
-#endif
- sys->outside_opaque = D3D11_CreateLocalSwapchainHandleHwnd(VLC_OBJECT(vd), sys->sys.hvideownd, sys->d3d_dev);
+#endif //HAVE_DCOMP_H
+ sys->outside_opaque = D3D11_CreateLocalSwapchainHandleHwnd(VLC_OBJECT(vd), CommonVideoHWND(&sys->area), sys->d3d_dev);
if (unlikely(sys->outside_opaque == NULL))
goto error;
sys->updateOutputCb = D3D11_LocalSwapchainUpdateOutput;
@@ -395,11 +397,12 @@ static int Open(vout_display_t *vd,
sys->startEndRenderingCb = D3D11_LocalSwapchainStartEndRendering;
sys->sendMetadataCb = D3D11_LocalSwapchainSetMetadata;
sys->selectPlaneCb = D3D11_LocalSwapchainSelectPlane;
+#endif // !VLC_WINSTORE_APP
}
#ifndef VLC_WINSTORE_APP
- if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR && sys->sys.hvideownd)
- sys->p_sensors = HookWindowsSensors(vd, sys->sys.hvideownd);
+ if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR && CommonVideoHWND(&sys->area))
+ sys->p_sensors = HookWindowsSensors(vd, CommonVideoHWND(&sys->area));
#endif // !VLC_WINSTORE_APP
if (Direct3D11Open(vd, fmtp, context)) {
@@ -439,7 +442,7 @@ static void Close(vout_display_t *vd)
D3D_ReleaseShaderCompiler(sys->shaders);
#ifndef VLC_WINSTORE_APP
UnhookWindowsSensors(sys->p_sensors);
- CommonWindowClean(&sys->sys);
+ CommonWindowClean(&sys->area);
#endif
Direct3D11Close(vd);
delete sys;
@@ -447,7 +450,7 @@ static void Close(vout_display_t *vd)
static int Control(vout_display_t *vd, int query)
{
vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
- CommonControl( vd, &sys->area, &sys->sys, query );
+ CommonControl( vd, &sys->area, query );
if ( sys->area.place_changed )
{
@@ -534,9 +537,11 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
{
picture_sys_d3d11_t *p_sys = ActiveD3D11PictureSys(picture);
+ D3D11_TEXTURE2D_DESC srcDesc;
+ p_sys->texture[KNOWN_DXGI_INDEX]->GetDesc(&srcDesc);
+
if (sys->legacy_shader) {
- D3D11_TEXTURE2D_DESC srcDesc,texDesc;
- p_sys->texture[KNOWN_DXGI_INDEX]->GetDesc(&srcDesc);
+ D3D11_TEXTURE2D_DESC texDesc;
sys->stagingSys.texture[0]->GetDesc(&texDesc);
D3D11_BOX box;
box.top = 0;
@@ -552,21 +557,19 @@ static void PreparePicture(vout_display_t *vd, picture_t *picture, subpicture_t
}
else
{
- D3D11_TEXTURE2D_DESC texDesc;
- p_sys->texture[0]->GetDesc(&texDesc);
- if (texDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE)
+ if (srcDesc.BindFlags & D3D11_BIND_SHADER_RESOURCE)
{
/* for performance reason we don't want to allocate this during
* display, do it preferably when creating the texture */
assert(p_sys->renderSrc[0]!=NULL);
}
- if ( sys->picQuad.generic.i_height != texDesc.Height ||
- sys->picQuad.generic.i_width != texDesc.Width )
+ if ( sys->picQuad.generic.i_height != srcDesc.Height ||
+ sys->picQuad.generic.i_width != srcDesc.Width )
{
/* the decoder produced different sizes than the vout, we need to
* adjust the vertex */
- sys->picQuad.generic.i_height = texDesc.Height;
- sys->picQuad.generic.i_width = texDesc.Width;
+ sys->picQuad.generic.i_height = srcDesc.Height;
+ sys->picQuad.generic.i_width = srcDesc.Width;
CommonPlacePicture(vd, &sys->area);
UpdateSize(vd);
@@ -742,8 +745,10 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
}
if (err != VLC_SUCCESS)
{
+#ifndef VLC_WINSTORE_APP
if ( sys->swapCb == D3D11_LocalSwapchainSwap )
D3D11_LocalSwapchainCleanupDevice( sys->outside_opaque );
+#endif // !VLC_WINSTORE_APP
return err;
}
}
@@ -768,8 +773,10 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmtp, vlc_video_co
if (Direct3D11CreateGenericResources(vd)) {
msg_Err(vd, "Failed to allocate resources");
+#ifndef VLC_WINSTORE_APP
if ( sys->swapCb == D3D11_LocalSwapchainSwap )
D3D11_LocalSwapchainCleanupDevice( sys->outside_opaque );
+#endif // !VLC_WINSTORE_APP
return VLC_EGENERIC;
}
@@ -902,8 +909,10 @@ static void Direct3D11Close(vout_display_t *vd)
Direct3D11DestroyResources(vd);
+#ifndef VLC_WINSTORE_APP
if ( sys->swapCb == D3D11_LocalSwapchainSwap )
D3D11_LocalSwapchainCleanupDevice( sys->outside_opaque );
+#endif // !VLC_WINSTORE_APP
if (sys->d3d_dev && sys->d3d_dev == &sys->local_d3d_dev->d3d_dev)
D3D11_ReleaseDevice( sys->local_d3d_dev );
=====================================
modules/video_output/win32/direct3d9.c
=====================================
@@ -131,7 +131,6 @@ typedef struct
typedef struct vout_display_sys_t
{
- vout_display_sys_win32_t sys; /* only use if sys.event is not NULL */
display_win32_area_t area;
bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */
@@ -1139,7 +1138,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
RECT rect;
UINT width, height;
- GetClientRect(p_sys->sys.hvideownd, &rect);
+ GetClientRect(CommonVideoHWND(&sys->area), &rect);
width = RECTWidth(rect);
height = RECTHeight(rect);
@@ -1263,9 +1262,9 @@ static void Swap(vout_display_t *vd)
HRESULT hr;
if (sys->d3d9_device->hd3d.use_ex) {
- hr = IDirect3DDevice9Ex_PresentEx(p_d3d9_dev->devex, &src, &src, sys->sys.hvideownd, NULL, 0);
+ hr = IDirect3DDevice9Ex_PresentEx(p_d3d9_dev->devex, &src, &src, CommonVideoHWND(&sys->area), NULL, 0);
} else {
- hr = IDirect3DDevice9_Present(p_d3d9_dev->dev, &src, &src, sys->sys.hvideownd, NULL);
+ hr = IDirect3DDevice9_Present(p_d3d9_dev->dev, &src, &src, CommonVideoHWND(&sys->area), NULL);
}
if (FAILED(hr)) {
msg_Dbg(vd, "Failed Present: 0x%lX", hr);
@@ -1688,7 +1687,7 @@ static void Direct3D9Close(vout_display_t *vd)
static int Control(vout_display_t *vd, int query)
{
vout_display_sys_t *sys = vd->sys;
- CommonControl(vd, &sys->area, &sys->sys, query);
+ CommonControl(vd, &sys->area, query);
return VLC_SUCCESS;
}
@@ -1794,7 +1793,7 @@ static int Open(vout_display_t *vd,
if ( sys->swapCb == NULL || sys->startEndRenderingCb == NULL || sys->updateOutputCb == NULL )
{
/* use our own callbacks, since there isn't any external ones */
- if (CommonWindowInit(vd, &sys->area, &sys->sys, false))
+ if (CommonWindowInit(vd, &sys->area, false))
goto error;
sys->outside_opaque = vd;
@@ -1803,6 +1802,8 @@ static int Open(vout_display_t *vd,
sys->startEndRenderingCb = NULL;
}
+ CommonPlacePicture(vd, &sys->area);
+
sys->dec_device = context ? vlc_video_context_HoldDevice(context) : NULL;
sys->d3d9_device = GetD3D9OpaqueDevice(sys->dec_device);
if ( sys->d3d9_device == NULL )
@@ -1831,9 +1832,6 @@ static int Open(vout_display_t *vd,
goto error;
}
- if (sys->swapCb == LocalSwapchainSwap)
- CommonPlacePicture(vd, &sys->area);
-
sys->hxdll = Direct3D9LoadShaderLibrary();
if (!sys->hxdll)
msg_Warn(vd, "cannot load Direct3D9 Shader Library; HLSL pixel shading will be disabled.");
@@ -1872,7 +1870,7 @@ static int Open(vout_display_t *vd,
return VLC_SUCCESS;
error:
Direct3D9Close(vd);
- CommonWindowClean(&sys->sys);
+ CommonWindowClean(&sys->area);
Direct3D9Destroy(sys);
free(vd->sys);
return VLC_EGENERIC;
@@ -1887,7 +1885,7 @@ static void Close(vout_display_t *vd)
Direct3D9Close(vd);
- CommonWindowClean(&sys->sys);
+ CommonWindowClean(&sys->area);
Direct3D9Destroy(sys);
=====================================
modules/video_output/win32/dxgi_swapchain.cpp
=====================================
@@ -29,7 +29,7 @@
#include <vlc_es.h>
-#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP)
+#if defined(HAVE_DCOMP_H)
# include <dcomp.h>
#endif
@@ -76,7 +76,6 @@ struct dxgi_swapchain
const dxgi_color_space *colorspace = nullptr;
swapchain_surface_type swapchainSurfaceType;
-#ifndef VLC_WINSTORE_APP
union {
HWND hwnd;
#if defined(HAVE_DCOMP_H)
@@ -86,7 +85,6 @@ struct dxgi_swapchain
} dcomp;
#endif // HAVE_DCOMP_H
} swapchainSurface;
-#endif /* !VLC_WINSTORE_APP */
ComPtr<IDXGISwapChain1> dxgiswapChain; /* DXGI 1.2 swap chain */
ComPtr<IDXGISwapChain4> dxgiswapChain4; /* DXGI 1.5 for HDR metadata */
@@ -243,7 +241,6 @@ done:
color_spaces[best].color == (video_color_space_t) cfg->colorspace;
}
-#ifndef VLC_WINSTORE_APP
static void FillSwapChainDesc(dxgi_swapchain *display, UINT width, UINT height, DXGI_SWAP_CHAIN_DESC1 *out)
{
ZeroMemory(out, sizeof(*out));
@@ -358,8 +355,6 @@ static void DXGI_CreateSwapchainDComp(dxgi_swapchain *display,
}
#endif /* HAVE_DCOMP_H */
-#endif /* !VLC_WINSTORE_APP */
-
void DXGI_LocalSwapchainSwap( dxgi_swapchain *display )
{
DXGI_PRESENT_PARAMETERS presentParams = { };
@@ -408,17 +403,13 @@ dxgi_swapchain *DXGI_CreateLocalSwapchainHandleHwnd(vlc_object_t *o, HWND hwnd)
return NULL;
display->obj = o;
-#ifndef VLC_WINSTORE_APP
display->swapchainSurfaceType = SWAPCHAIN_SURFACE_HWND;
display->swapchainSurface.hwnd = hwnd;
-#else // VLC_WINSTORE_APP
- VLC_UNUSED(hwnd);
-#endif // VLC_WINSTORE_APP
return display;
}
-#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP)
+#if defined(HAVE_DCOMP_H)
dxgi_swapchain *DXGI_CreateLocalSwapchainHandleDComp(vlc_object_t *o, void* dcompDevice, void* dcompVisual)
{
dxgi_swapchain *display = new (std::nothrow) dxgi_swapchain();
@@ -457,7 +448,6 @@ bool DXGI_UpdateSwapChain( dxgi_swapchain *display, IDXGIAdapter *dxgiadapter,
UINT width = cfg->width ? cfg->width : 8;
UINT height = cfg->height ? cfg->height : 8;
-#ifndef VLC_WINSTORE_APP
if (display->dxgiswapChain.Get() && display->pixelFormat != newPixelFormat)
{
// the pixel format changed, we need a new swapchain
@@ -479,7 +469,6 @@ bool DXGI_UpdateSwapChain( dxgi_swapchain *display, IDXGIAdapter *dxgiadapter,
width, height);
}
-#endif /* !VLC_WINSTORE_APP */
if ( !display->dxgiswapChain.Get() )
return false;
=====================================
modules/video_output/win32/dxgi_swapchain.h
=====================================
@@ -48,11 +48,11 @@ struct dxgi_swapchain;
struct dxgi_swapchain *DXGI_CreateLocalSwapchainHandleHwnd(vlc_object_t *, HWND);
-#if defined(HAVE_DCOMP_H) && !defined(VLC_WINSTORE_APP)
+#if defined(HAVE_DCOMP_H)
struct dxgi_swapchain *DXGI_CreateLocalSwapchainHandleDComp(vlc_object_t *,
void /*IDCompositionDevice*/ * dcompDevice,
void /*IDCompositionVisual*/ * dcompVisual);
-#endif
+#endif // HAVE_DCOMP_H
Microsoft::WRL::ComPtr<IDXGISwapChain1> & DXGI_GetSwapChain1( struct dxgi_swapchain * );
Microsoft::WRL::ComPtr<IDXGISwapChain4> & DXGI_GetSwapChain4( struct dxgi_swapchain * );
=====================================
modules/video_output/win32/events.c
=====================================
@@ -171,7 +171,7 @@ void EventThreadDestroy( event_thread_t *p_event )
free( p_event );
}
-int EventThreadStart( event_thread_t *p_event, event_hwnd_t *p_hwnd, const event_cfg_t *p_cfg )
+int EventThreadStart( event_thread_t *p_event, const event_cfg_t *p_cfg )
{
p_event->is_projected = p_cfg->is_projected;
p_event->window_area.left = 0;
@@ -203,13 +203,14 @@ int EventThreadStart( event_thread_t *p_event, event_hwnd_t *p_hwnd, const event
}
msg_Dbg( p_event->obj, "Vout EventThread running" );
- /* */
- p_hwnd->parent_window = p_event->parent_window;
- p_hwnd->hparent = p_event->hparent;
- p_hwnd->hvideownd = p_event->hvideownd;
return VLC_SUCCESS;
}
+HWND EventThreadVideoHWND( const event_thread_t *p_event )
+{
+ return p_event->hvideownd;
+}
+
void EventThreadStop( event_thread_t *p_event )
{
if( !p_event->b_ready )
@@ -377,3 +378,13 @@ static void Win32VoutCloseWindow( event_thread_t *p_event )
CloseGestures( p_event->p_gesture);
}
+
+void EventThreadUpdateSize( event_thread_t *p_event )
+{
+ RECT clientRect;
+ GetClientRect(p_event->hparent, &clientRect);
+
+ SetWindowPos(p_event->hvideownd, 0, 0, 0,
+ RECTWidth(clientRect),
+ RECTHeight(clientRect), SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE);
+}
=====================================
modules/video_output/win32/events.h
=====================================
@@ -35,13 +35,9 @@ typedef struct {
unsigned height;
} event_cfg_t;
-typedef struct {
- vlc_window_t *parent_window;
- HWND hparent;
- HWND hvideownd;
-} event_hwnd_t;
-
event_thread_t *EventThreadCreate( vlc_object_t *, vlc_window_t *);
void EventThreadDestroy( event_thread_t * );
-int EventThreadStart( event_thread_t *, event_hwnd_t *, const event_cfg_t * );
+int EventThreadStart( event_thread_t *, const event_cfg_t * );
+HWND EventThreadVideoHWND( const event_thread_t * );
void EventThreadStop( event_thread_t * );
+void EventThreadUpdateSize( event_thread_t * );
=====================================
modules/video_output/win32/glwin32.c
=====================================
@@ -62,7 +62,6 @@ vlc_module_end()
*****************************************************************************/
typedef struct vout_display_sys_t
{
- vout_display_sys_win32_t sys;
display_win32_area_t area;
vlc_gl_t *gl;
@@ -84,7 +83,7 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
static int Control(vout_display_t *vd, int query)
{
vout_display_sys_t *sys = vd->sys;
- CommonControl(vd, &sys->area, &sys->sys, query);
+ CommonControl(vd, &sys->area, query);
return VLC_SUCCESS;
}
@@ -101,7 +100,7 @@ static vlc_window_t *EmbedVideoWindow_Create(vout_display_t *vd)
return NULL;
wnd->type = VLC_WINDOW_TYPE_HWND;
- wnd->handle.hwnd = sys->sys.hvideownd;
+ wnd->handle.hwnd = CommonVideoHWND(&sys->area);
wnd->ops = &embedVideoWindow_Ops;
return wnd;
}
@@ -133,12 +132,13 @@ static int Open(vout_display_t *vd,
/* */
CommonInit(&sys->area);
- if (CommonWindowInit(vd, &sys->area, &sys->sys,
+ if (CommonWindowInit(vd, &sys->area,
vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR))
goto error;
+ CommonPlacePicture(vd, &sys->area);
if (vd->source->projection_mode != PROJECTION_MODE_RECTANGULAR)
- sys->p_sensors = HookWindowsSensors(vd, sys->sys.hvideownd);
+ sys->p_sensors = HookWindowsSensors(vd, CommonVideoHWND(&sys->area));
vlc_window_SetTitle(vd->cfg->window, VOUT_TITLE " (OpenGL output)");
@@ -201,7 +201,7 @@ static void Close(vout_display_t *vd)
}
UnhookWindowsSensors(sys->p_sensors);
- CommonWindowClean(&sys->sys);
+ CommonWindowClean(&sys->area);
free(sys);
}
=====================================
modules/video_output/win32/meson.build
=====================================
@@ -3,7 +3,7 @@
#
# Direct3D11 video output
-d3d11_sources = files('direct3d11.cpp', 'd3d11_quad.cpp', 'd3d11_shaders.cpp', 'd3d_shaders.c', 'd3d_dynamic_shader.c', 'd3d11_swapchain.cpp', 'dxgi_swapchain.cpp', 'common.c')
+d3d11_sources = files('direct3d11.cpp', 'd3d11_quad.cpp', 'd3d11_shaders.cpp', 'd3d_shaders.c', 'd3d_dynamic_shader.c', 'common.c')
d3d11_link_with = [ d3d11_common_lib ]
d3d11_deps = []
if get_option('winstore_app')
@@ -12,7 +12,7 @@ if get_option('winstore_app')
cc.find_library('d3dcompiler_47')
]
else
- d3d11_sources += files('events.c', 'sensors.cpp', 'win32touch.c')
+ d3d11_sources += files('d3d11_swapchain.cpp', 'dxgi_swapchain.cpp', 'events.c', 'sensors.cpp', 'win32touch.c')
d3d11_link_with += [ chroma_copy_lib ]
endif
=====================================
modules/video_output/win32/wingdi.c
=====================================
@@ -59,7 +59,6 @@ vlc_module_end ()
*****************************************************************************/
typedef struct vout_display_sys_t
{
- vout_display_sys_win32_t sys;
display_win32_area_t area;
int i_depth;
@@ -99,7 +98,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
static int Control(vout_display_t *vd, int query)
{
vout_display_sys_t *sys = vd->sys;
- CommonControl(vd, &sys->area, &sys->sys, query);
+ CommonControl(vd, &sys->area, query);
return VLC_SUCCESS;
}
@@ -125,8 +124,9 @@ static int Open(vout_display_t *vd,
return VLC_ENOMEM;
CommonInit(&sys->area);
- if (CommonWindowInit(vd, &sys->area, &sys->sys, false))
+ if (CommonWindowInit(vd, &sys->area, false))
goto error;
+ CommonPlacePicture(vd, &sys->area);
/* */
if (Init(vd, fmtp))
@@ -150,9 +150,9 @@ static void Close(vout_display_t *vd)
Clean(vd);
- CommonWindowClean(&sys->sys);
+ CommonWindowClean(&sys->area);
- free(vd->sys);
+ free(sys);
}
static void Display(vout_display_t *vd, picture_t *picture)
@@ -160,7 +160,7 @@ static void Display(vout_display_t *vd, picture_t *picture)
vout_display_sys_t *sys = vd->sys;
VLC_UNUSED(picture);
- HDC hdc = GetDC(sys->sys.hvideownd);
+ HDC hdc = GetDC(CommonVideoHWND(&sys->area));
if (sys->area.place_changed)
{
@@ -196,7 +196,7 @@ static void Display(vout_display_t *vd, picture_t *picture)
SRCCOPY);
}
- ReleaseDC(sys->sys.hvideownd, hdc);
+ ReleaseDC(CommonVideoHWND(&sys->area), hdc);
}
static int Init(vout_display_t *vd, video_format_t *fmt)
@@ -206,7 +206,7 @@ static int Init(vout_display_t *vd, video_format_t *fmt)
/* Initialize an offscreen bitmap for direct buffer operations. */
/* */
- HDC window_dc = GetDC(sys->sys.hvideownd);
+ HDC window_dc = GetDC(CommonVideoHWND(&sys->area));
/* */
sys->i_depth = GetDeviceCaps(window_dc, PLANES) *
@@ -279,7 +279,7 @@ static int Init(vout_display_t *vd, video_format_t *fmt)
sys->off_dc = CreateCompatibleDC(window_dc);
SelectObject(sys->off_dc, sys->off_bitmap);
- ReleaseDC(sys->sys.hvideownd, window_dc);
+ ReleaseDC(CommonVideoHWND(&sys->area), window_dc);
return VLC_SUCCESS;
}
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e9937aecb8e28c8f06f0a3923235e9eebf7171a4...9814ddaa6987aaf79701ed07f6c8de845aa8a821
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/e9937aecb8e28c8f06f0a3923235e9eebf7171a4...9814ddaa6987aaf79701ed07f6c8de845aa8a821
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list