Commit 70437b20 authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

vout: win32: split vout_display_sys_t in 2 structures

One really common becomes vout_display_sys_win32_t, the other one remains
vout_display_sys_t.

use_desktop and use_overlay have been moved in the common structure for
convenience.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 86f58b58
......@@ -59,7 +59,7 @@ static void RestoreScreensaver(vout_display_t *);
/* */
int CommonInit(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
sys->hwnd = NULL;
sys->hvideownd = NULL;
......@@ -124,7 +124,7 @@ int CommonInit(vout_display_t *vd)
picture_pool_t *CommonPool(vout_display_t *vd, unsigned count)
{
VLC_UNUSED(count);
return vd->sys->pool;
return vd->sys->sys.pool;
}
/*****************************************************************************
......@@ -139,7 +139,7 @@ void UpdateRects(vout_display_t *vd,
const video_format_t *source,
bool is_forced)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
#define rect_src sys->rect_src
#define rect_src_clipped sys->rect_src_clipped
#define rect_dest sys->rect_dest
......@@ -355,7 +355,7 @@ exit:
/* */
void CommonClean(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
if (sys->event) {
CommonChangeThumbnailClip(vd, false);
EventThreadStop(sys->event);
......@@ -382,7 +382,7 @@ void CommonClean(vout_display_t *vd)
void CommonManage(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
/* We used to call the Win32 PeekMessage function here to read the window
* messages. But since window can stay blocked into this function for a
......@@ -432,7 +432,7 @@ void CommonManage(vout_display_t *vd)
*/
void CommonDisplay(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
if (!sys->is_first_display)
return;
......@@ -536,7 +536,7 @@ void AlignRect(RECT *r, int align_boundary, int align_size)
/* */
static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
/* Windows 7 taskbar thumbnail code */
OSVERSIONINFO winVer;
......@@ -578,7 +578,7 @@ static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
static int CommonControlSetFullscreen(vout_display_t *vd, bool is_fullscreen)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
#ifdef MODULE_NAME_IS_direct3d9
if (sys->use_desktop && is_fullscreen)
......@@ -665,7 +665,7 @@ static int CommonControlSetFullscreen(vout_display_t *vd, bool is_fullscreen)
int CommonControl(vout_display_t *vd, int query, va_list args)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
switch (query) {
case VOUT_DISPLAY_CHANGE_DISPLAY_SIZE: /* const vout_display_cfg_t *p_cfg */
......@@ -741,7 +741,7 @@ int CommonControl(vout_display_t *vd, int query, va_list args)
static void DisableScreensaver(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
/* disable screensaver by temporarily changing system settings */
sys->i_spi_screensaveactive = 0;
......@@ -758,7 +758,7 @@ static void DisableScreensaver(vout_display_t *vd)
static void RestoreScreensaver(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
vout_display_sys_win32_t *sys = &vd->sys->sys;
/* restore screensaver system settings */
if (0 != sys->i_spi_screensaveactive) {
......
......@@ -85,7 +85,7 @@ extern const GUID GUID_SWAPCHAIN_HEIGHT;
* This structure is part of the video output thread descriptor.
* It describes the module specific properties of an output thread.
*****************************************************************************/
struct vout_display_sys_t
typedef struct vout_display_sys_win32_t
{
/* */
event_thread_t *event;
......@@ -124,20 +124,27 @@ struct vout_display_sys_t
picture_pool_t *pool;
bool use_desktop; /* show video on desktop window ? */
bool use_overlay; /* Are we using an overlay surface */
/* Overlay alignment restrictions */
int i_align_src_boundary;
int i_align_src_size;
int i_align_dest_boundary;
int i_align_dest_size;
} vout_display_sys_win32_t;
struct vout_display_sys_t
{
vout_display_sys_win32_t sys;
#ifdef MODULE_NAME_IS_directdraw
/* Multi-monitor support */
HMONITOR hmonitor; /* handle of the current monitor */
GUID *display_driver;
/* Overlay alignment restrictions */
int i_align_src_boundary;
int i_align_src_size;
int i_align_dest_boundary;
int i_align_dest_size;
bool use_wallpaper; /* show as desktop wallpaper ? */
bool use_overlay; /* Are we using an overlay surface */
bool restore_overlay;
/* DDraw capabilities */
......@@ -214,8 +221,6 @@ struct vout_display_sys_t
#ifdef MODULE_NAME_IS_direct3d9
bool allow_hw_yuv; /* Should we use hardware YUV->RGB conversions */
/* show video on desktop window ? */
bool use_desktop;
struct {
bool is_fullscreen;
bool is_on_top;
......
......@@ -470,8 +470,8 @@ static void Close(vlc_object_t *object)
static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
{
if ( vd->sys->pool != NULL )
return vd->sys->pool;
if ( vd->sys->sys.pool != NULL )
return vd->sys->sys.pool;
if (pool_size > 30) {
msg_Err(vd, "Avoid crashing when using ID3D11VideoDecoderOutputView with too many slices (%d)", pool_size);
......@@ -551,10 +551,10 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
pool_cfg.picture_count = pool_size;
pool_cfg.picture = pictures;
vd->sys->pool = picture_pool_NewExtended( &pool_cfg );
vd->sys->sys.pool = picture_pool_NewExtended( &pool_cfg );
error:
if (vd->sys->pool ==NULL && pictures) {
if (vd->sys->sys.pool ==NULL && pictures) {
msg_Dbg(vd, "Failed to create the picture d3d11 pool");
for (unsigned i=0;i<picture_count; ++i)
DestroyDisplayPoolPicture(pictures[i]);
......@@ -565,10 +565,10 @@ error:
memset( &pool_cfg, 0, sizeof( pool_cfg ) );
pool_cfg.picture_count = 0;
vd->sys->pool = picture_pool_NewExtended( &pool_cfg );
vd->sys->sys.pool = picture_pool_NewExtended( &pool_cfg );
}
#endif
return vd->sys->pool;
return vd->sys->sys.pool;
}
#ifdef HAVE_ID3D11VIDEODECODER
......@@ -603,8 +603,8 @@ static HRESULT UpdateBackBuffer(vout_display_t *vd)
HRESULT hr;
ID3D11Texture2D* pDepthStencil;
ID3D11Texture2D* pBackBuffer;
uint32_t i_width = RECTWidth(sys->rect_dest_clipped);
uint32_t i_height = RECTHeight(sys->rect_dest_clipped);
uint32_t i_width = RECTWidth(sys->sys.rect_dest_clipped);
uint32_t i_height = RECTHeight(sys->sys.rect_dest_clipped);
#if VLC_WINSTORE_APP
UINT dataSize = sizeof(i_width);
hr = IDXGISwapChain_GetPrivateData(sys->dxgiswapChain, &GUID_SWAPCHAIN_WIDTH, &dataSize, &i_width);
......@@ -879,14 +879,14 @@ static int Control(vout_display_t *vd, int query, va_list args)
static void Manage(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
RECT size_before = sys->rect_dest_clipped;
RECT size_before = sys->sys.rect_dest_clipped;
video_format_t core_source;
CropStagingFormat( vd, &core_source );
CommonManage(vd);
if (RECTWidth(size_before) != RECTWidth(sys->rect_dest_clipped) ||
RECTHeight(size_before) != RECTHeight(sys->rect_dest_clipped))
if (RECTWidth(size_before) != RECTWidth(sys->sys.rect_dest_clipped) ||
RECTHeight(size_before) != RECTHeight(sys->sys.rect_dest_clipped))
{
#if defined(HAVE_ID3D11VIDEODECODER)
if( sys->context_lock != INVALID_HANDLE_VALUE )
......@@ -894,8 +894,8 @@ static void Manage(vout_display_t *vd)
WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
}
#endif
msg_Dbg(vd, "Manage detected size change %dx%d", RECTWidth(sys->rect_dest_clipped),
RECTHeight(sys->rect_dest_clipped));
msg_Dbg(vd, "Manage detected size change %dx%d", RECTWidth(sys->sys.rect_dest_clipped),
RECTHeight(sys->sys.rect_dest_clipped));
UpdateBackBuffer(vd);
......@@ -1201,7 +1201,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
}
hr = IDXGIFactory2_CreateSwapChainForHwnd(sys->dxgifactory, (IUnknown *)sys->d3ddevice,
sys->hvideownd, &scd, NULL, NULL, &sys->dxgiswapChain);
sys->sys.hvideownd, &scd, NULL, NULL, &sys->dxgiswapChain);
IDXGIFactory2_Release(sys->dxgifactory);
if (FAILED(hr)) {
msg_Err(vd, "Could not create the SwapChain. (hr=0x%lX)", hr);
......@@ -1380,7 +1380,7 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
#endif
#if !VLC_WINSTORE_APP
EventThreadUpdateTitle(sys->event, VOUT_TITLE " (Direct3D11 output)");
EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (Direct3D11 output)");
#endif
msg_Dbg(vd, "Direct3D11 device adapter successfully initialized");
......@@ -1415,15 +1415,15 @@ static void Direct3D11Close(vout_display_t *vd)
static void UpdatePicQuadPosition(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
int i_width = RECTWidth(sys->rect_dest_clipped);
int i_height = RECTHeight(sys->rect_dest_clipped);
int i_width = RECTWidth(sys->sys.rect_dest_clipped);
int i_height = RECTHeight(sys->sys.rect_dest_clipped);
int i_top = sys->rect_src_clipped.top * i_height;
int i_top = sys->sys.rect_src_clipped.top * i_height;
i_top /= vd->source.i_visible_height;
i_top -= sys->rect_dest_clipped.top;
int i_left = sys->rect_src_clipped.left * i_width;
i_top -= sys->sys.rect_dest_clipped.top;
int i_left = sys->sys.rect_src_clipped.left * i_width;
i_left /= vd->source.i_visible_width;
i_left -= sys->rect_dest_clipped.left;
i_left -= sys->sys.rect_dest_clipped.left;
sys->picQuad.cropViewport.Width = (FLOAT) vd->source.i_width * i_width / vd->source.i_visible_width;
sys->picQuad.cropViewport.Height = (FLOAT) vd->source.i_height * i_height / vd->source.i_visible_height;
......@@ -1682,8 +1682,8 @@ static int Direct3D11CreatePool(vout_display_t *vd, video_format_t *fmt)
pool_cfg.lock = Direct3D11MapTexture;
//pool_cfg.unlock = Direct3D11UnmapTexture;
sys->pool = picture_pool_NewExtended(&pool_cfg);
if (!sys->pool) {
sys->sys.pool = picture_pool_NewExtended(&pool_cfg);
if (!sys->sys.pool) {
picture_Release(picture);
return VLC_ENOMEM;
}
......@@ -1695,9 +1695,9 @@ static void Direct3D11DestroyPool(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
if (sys->pool)
picture_pool_Release(sys->pool);
sys->pool = NULL;
if (sys->sys.pool)
picture_pool_Release(sys->sys.pool);
sys->sys.pool = NULL;
}
static void SetupQuadFlat(d3d_vertex_t *dst_data, WORD *triangle_pos)
......@@ -2300,12 +2300,12 @@ static int Direct3D11MapSubpicture(vout_display_t *vd, int *subpicture_region_co
d3d_quad_t *quad = (d3d_quad_t *) quad_picture->p_sys;
quad->cropViewport.Width = (FLOAT) r->fmt.i_visible_width * RECTWidth(sys->rect_dest) / subpicture->i_original_picture_width;
quad->cropViewport.Height = (FLOAT) r->fmt.i_visible_height * RECTHeight(sys->rect_dest) / subpicture->i_original_picture_height;
quad->cropViewport.Width = (FLOAT) r->fmt.i_visible_width * RECTWidth(sys->sys.rect_dest) / subpicture->i_original_picture_width;
quad->cropViewport.Height = (FLOAT) r->fmt.i_visible_height * RECTHeight(sys->sys.rect_dest) / subpicture->i_original_picture_height;
quad->cropViewport.MinDepth = 0.0f;
quad->cropViewport.MaxDepth = 1.0f;
quad->cropViewport.TopLeftX = sys->rect_dest.left + (FLOAT) r->i_x * RECTWidth(sys->rect_dest) / subpicture->i_original_picture_width;
quad->cropViewport.TopLeftY = sys->rect_dest.top + (FLOAT) r->i_y * RECTHeight(sys->rect_dest) / subpicture->i_original_picture_height;
quad->cropViewport.TopLeftX = sys->sys.rect_dest.left + (FLOAT) r->i_x * RECTWidth(sys->sys.rect_dest) / subpicture->i_original_picture_width;
quad->cropViewport.TopLeftY = sys->sys.rect_dest.top + (FLOAT) r->i_y * RECTHeight(sys->sys.rect_dest) / subpicture->i_original_picture_height;
UpdateQuadOpacity(vd, quad, r->i_alpha / 255.0f );
}
......
......@@ -190,7 +190,7 @@ static int Open(vlc_object_t *object)
return VLC_EGENERIC;
}
sys->use_desktop = var_CreateGetBool(vd, "video-wallpaper");
sys->sys.use_desktop = var_CreateGetBool(vd, "video-wallpaper");
sys->reset_device = false;
sys->reopen_device = false;
sys->lost_not_ready = false;
......@@ -232,7 +232,7 @@ static int Open(vlc_object_t *object)
/* Interaction */
vlc_mutex_init(&sys->lock);
sys->ch_desktop = false;
sys->desktop_requested = sys->use_desktop;
sys->desktop_requested = sys->sys.use_desktop;
vlc_value_t val;
val.psz_string = _("Desktop");
......@@ -251,7 +251,7 @@ static int Open(vlc_object_t *object)
vd->manage = Manage;
/* Fix state in case of desktop mode */
if (sys->use_desktop && vd->cfg->is_fullscreen)
if (sys->sys.use_desktop && vd->cfg->is_fullscreen)
vout_display_SendEventFullscreen(vd, false);
return VLC_SUCCESS;
......@@ -293,8 +293,8 @@ static void DestroyPicture(picture_t *picture)
/* */
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
if ( vd->sys->pool != NULL )
return vd->sys->pool;
if ( vd->sys->sys.pool != NULL )
return vd->sys->sys.pool;
picture_t** pictures = NULL;
unsigned picture_count = 0;
......@@ -341,15 +341,15 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
pool_cfg.picture_count = count;
pool_cfg.picture = pictures;
vd->sys->pool = picture_pool_NewExtended( &pool_cfg );
vd->sys->sys.pool = picture_pool_NewExtended( &pool_cfg );
error:
if (vd->sys->pool == NULL && pictures) {
if (vd->sys->sys.pool == NULL && pictures) {
for (unsigned i=0;i<picture_count; ++i)
DestroyPicture(pictures[i]);
}
free(pictures);
return vd->sys->pool;
return vd->sys->sys.pool;
}
static int Direct3D9LockSurface(picture_t *);
......@@ -415,8 +415,8 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
// Present the back buffer contents to the display
// No stretching should happen here !
const RECT src = sys->rect_dest_clipped;
const RECT dst = sys->rect_dest_clipped;
const RECT src = sys->sys.rect_dest_clipped;
const RECT dst = sys->sys.rect_dest_clipped;
HRESULT hr;
if (sys->use_d3d9ex) {
......@@ -447,31 +447,31 @@ static int ControlReopenDevice(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
if (!sys->use_desktop) {
if (!sys->sys.use_desktop) {
/* Save non-desktop state */
sys->desktop_save.is_fullscreen = vd->cfg->is_fullscreen;
sys->desktop_save.is_on_top = sys->is_on_top;
sys->desktop_save.is_on_top = sys->sys.is_on_top;
WINDOWPLACEMENT wp = { .length = sizeof(wp), };
GetWindowPlacement(sys->hparent ? sys->hparent : sys->hwnd, &wp);
GetWindowPlacement(sys->sys.hparent ? sys->sys.hparent : sys->sys.hwnd, &wp);
sys->desktop_save.win = wp.rcNormalPosition;
}
/* */
Direct3D9Close(vd);
EventThreadStop(sys->event);
EventThreadStop(sys->sys.event);
/* */
vlc_mutex_lock(&sys->lock);
sys->use_desktop = sys->desktop_requested;
sys->sys.use_desktop = sys->desktop_requested;
sys->ch_desktop = false;
vlc_mutex_unlock(&sys->lock);
/* */
event_cfg_t cfg;
memset(&cfg, 0, sizeof(cfg));
cfg.use_desktop = sys->use_desktop;
if (!sys->use_desktop) {
cfg.use_desktop = sys->sys.use_desktop;
if (!sys->sys.use_desktop) {
cfg.x = sys->desktop_save.win.left;
cfg.y = sys->desktop_save.win.top;
cfg.width = sys->desktop_save.win.right - sys->desktop_save.win.left;
......@@ -479,16 +479,16 @@ static int ControlReopenDevice(vout_display_t *vd)
}
event_hwnd_t hwnd;
if (EventThreadStart(sys->event, &hwnd, &cfg)) {
if (EventThreadStart(sys->sys.event, &hwnd, &cfg)) {
msg_Err(vd, "Failed to restart event thread");
return VLC_EGENERIC;
}
sys->parent_window = hwnd.parent_window;
sys->hparent = hwnd.hparent;
sys->hwnd = hwnd.hwnd;
sys->hvideownd = hwnd.hvideownd;
sys->hfswnd = hwnd.hfswnd;
SetRectEmpty(&sys->rect_parent);
sys->sys.parent_window = hwnd.parent_window;
sys->sys.hparent = hwnd.hparent;
sys->sys.hwnd = hwnd.hwnd;
sys->sys.hvideownd = hwnd.hvideownd;
sys->sys.hfswnd = hwnd.hfswnd;
SetRectEmpty(&sys->sys.rect_parent);
/* */
video_format_t fmt;
......@@ -498,9 +498,9 @@ static int ControlReopenDevice(vout_display_t *vd)
return VLC_EGENERIC;
}
vd->fmt = fmt;
sys->is_first_display = true;
sys->sys.is_first_display = true;
if (sys->use_desktop) {
if (sys->sys.use_desktop) {
/* Disable fullscreen/on_top while using desktop */
if (sys->desktop_save.is_fullscreen)
vout_display_SendEventFullscreen(vd, false);
......@@ -558,12 +558,12 @@ static void Manage (vout_display_t *vd)
}
/* Position Change */
if (sys->changes & DX_POSITION_CHANGE) {
if (sys->sys.changes & DX_POSITION_CHANGE) {
#if 0 /* need that when bicubic filter is available */
RECT rect;
UINT width, height;
GetClientRect(p_sys->hvideownd, &rect);
GetClientRect(p_sys->sys.hvideownd, &rect);
width = rect.right-rect.left;
height = rect.bottom-rect.top;
......@@ -576,7 +576,7 @@ static void Manage (vout_display_t *vd)
}
#endif
sys->clear_scene = true;
sys->changes &= ~DX_POSITION_CHANGE;
sys->sys.changes &= ~DX_POSITION_CHANGE;
}
}
......@@ -719,7 +719,7 @@ static int Direct3D9FillPresentationParameters(vout_display_t *vd)
ZeroMemory(d3dpp, sizeof(D3DPRESENT_PARAMETERS));
d3dpp->Flags = D3DPRESENTFLAG_VIDEO;
d3dpp->Windowed = TRUE;
d3dpp->hDeviceWindow = vd->sys->hvideownd;
d3dpp->hDeviceWindow = vd->sys->sys.hvideownd;
d3dpp->BackBufferWidth = __MAX((unsigned int)GetSystemMetrics(SM_CXVIRTUALSCREEN),
d3ddm.Width);
d3dpp->BackBufferHeight = __MAX((unsigned int)GetSystemMetrics(SM_CYVIRTUALSCREEN),
......@@ -732,7 +732,7 @@ static int Direct3D9FillPresentationParameters(vout_display_t *vd)
d3dpp->EnableAutoDepthStencil = FALSE;
/* */
RECT *display = &vd->sys->rect_display;
RECT *display = &vd->sys->sys.rect_display;
display->left = 0;
display->top = 0;
display->right = d3dpp->BackBufferWidth;
......@@ -788,7 +788,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
if (sys->use_d3d9ex) {
LPDIRECT3DDEVICE9EX d3ddevex;
hr = IDirect3D9Ex_CreateDeviceEx((LPDIRECT3D9EX)d3dobj, AdapterToUse,
DeviceType, sys->hvideownd,
DeviceType, sys->sys.hvideownd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|
D3DCREATE_MULTITHREADED,
&sys->d3dpp, NULL, &d3ddevex);
......@@ -796,7 +796,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
} else {
LPDIRECT3DDEVICE9 d3ddev;
hr = IDirect3D9_CreateDevice(d3dobj, AdapterToUse,
DeviceType, sys->hvideownd,
DeviceType, sys->sys.hvideownd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|
D3DCREATE_MULTITHREADED,
&sys->d3dpp, &d3ddev);
......@@ -816,7 +816,7 @@ static int Direct3D9Open(vout_display_t *vd, video_format_t *fmt)
}
/* Change the window title bar text */
EventThreadUpdateTitle(sys->event, VOUT_TITLE " (Direct3D9 output)");
EventThreadUpdateTitle(sys->sys.event, VOUT_TITLE " (Direct3D9 output)");
msg_Dbg(vd, "Direct3D9 device adapter successfully initialized");
return VLC_SUCCESS;
......@@ -1147,8 +1147,8 @@ static int Direct3D9CreatePool(vout_display_t *vd, video_format_t *fmt)
pool_cfg.lock = Direct3D9LockSurface;
pool_cfg.unlock = Direct3D9UnlockSurface;
sys->pool = picture_pool_NewExtended(&pool_cfg);
if (!sys->pool) {
sys->sys.pool = picture_pool_NewExtended(&pool_cfg);
if (!sys->sys.pool) {
picture_Release(picture);
IDirect3DSurface9_Release(surface);
return VLC_ENOMEM;
......@@ -1162,16 +1162,16 @@ static void Direct3D9DestroyPool(vout_display_t *vd)
{
vout_display_sys_t *sys = vd->sys;
if (sys->pool) {
if (sys->sys.pool) {
picture_sys_t *picsys = sys->picsys;
if ( picsys != NULL ) {
IDirect3DSurface9_Release(picsys->surface);
if (picsys->fallback)
picture_Release(picsys->fallback);
}
picture_pool_Release(sys->pool);
picture_pool_Release(sys->sys.pool);
}
sys->pool = NULL;
sys->sys.pool = NULL;
}
/**
......@@ -1604,7 +1604,7 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
/* Copy picture surface into texture surface
* color space conversion happen here */
hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, &vd->sys->rect_src_clipped, destination, NULL, D3DTEXF_NONE );
hr = IDirect3DDevice9_StretchRect(sys->d3ddev, source, &vd->sys->sys.rect_src_clipped, destination, NULL, D3DTEXF_NONE );
IDirect3DSurface9_Release(destination);
if (FAILED(hr)) {
msg_Dbg(vd, "Failed IDirect3DDevice9_StretchRect: source 0x%p 0x%0lx",
......@@ -1614,7 +1614,7 @@ static int Direct3D9ImportPicture(vout_display_t *vd,
/* */
region->texture = sys->d3dtex;
Direct3D9SetupVertices(region->vertex, &vd->sys->rect_dest_clipped, 255, vd->fmt.orientation);
Direct3D9SetupVertices(region->vertex, &vd->sys->sys.rect_dest_clipped, 255, vd->fmt.orientation);
return VLC_SUCCESS;
}
......@@ -1721,8 +1721,8 @@ static void Direct3D9ImportSubpicture(vout_display_t *vd,
msg_Err(vd, "Failed to lock the texture");
}
/* Map the subpicture to sys->rect_dest */
const RECT video = sys->rect_dest;
/* Map the subpicture to sys->sys.rect_dest */
const RECT video = sys->sys.rect_dest;
const float scale_w = (float)(video.right - video.left) / subpicture->i_original_picture_width;
const float scale_h = (float)(video.bottom - video.top) / subpicture->i_original_picture_height;
......
......@@ -182,7 +182,7 @@ static int Open(vlc_object_t *object)
/* */
sys->use_wallpaper = var_CreateGetBool(vd, "video-wallpaper");
/* FIXME */
sys->use_overlay = false;//var_CreateGetBool(vd, "overlay"); /* FIXME */
sys->sys.use_overlay = false;//var_CreateGetBool(vd, "overlay"); /* FIXME */
sys->restore_overlay = false;
var_Create(vd, "directx-device", VLC_VAR_STRING | VLC_VAR_DOINHERIT);
......@@ -260,7 +260,7 @@ static void Close(vlc_object_t *object)
static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
VLC_UNUSED(count);
return vd->sys->pool;
return vd->sys->sys.pool;
}
static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture)
{
......@@ -272,7 +272,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
* and restore it if need be */
if (IDirectDrawSurface2_IsLost(sys->display) == DDERR_SURFACELOST) {
if (IDirectDrawSurface2_Restore(sys->display) == DD_OK) {
if (sys->use_overlay)
if (sys->sys.use_overlay)
DirectXUpdateOverlay(vd, NULL);
}
}
......@@ -282,7 +282,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
/* */
DirectXUnlock(picture);
if (sys->use_overlay) {
if (sys->sys.use_overlay) {
/* Flip the overlay buffers if we are using back buffers */
if (picture->p_sys->surface != picture->p_sys->front_surface) {
HRESULT hr = IDirectDrawSurface2_Flip(picture->p_sys->front_surface,
......@@ -298,22 +298,22 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
ddbltfx.dwDDFX = DDBLTFX_NOTEARING;
HRESULT hr = IDirectDrawSurface2_Blt(sys->display,
&sys->rect_dest_clipped,
&sys->sys.rect_dest_clipped,
picture->p_sys->surface,
&sys->rect_src_clipped,
&sys->sys.rect_src_clipped,
DDBLT_ASYNC, &ddbltfx);
if (hr != DD_OK)
msg_Warn(vd, "could not blit surface (error %li)", hr);
}
DirectXLock(picture);
if (sys->is_first_display) {
if (sys->sys.is_first_display) {
IDirectDraw_WaitForVerticalBlank(sys->ddobject,
DDWAITVB_BLOCKBEGIN, NULL);
if (sys->use_overlay) {
if (sys->sys.use_overlay) {
HBRUSH brush = CreateSolidBrush(sys->i_rgb_colorkey);
/* set the colorkey as the backgound brush for the video window */
SetClassLongPtr(sys->hvideownd, GCLP_HBRBACKGROUND, (LONG_PTR)brush);
SetClassLongPtr(sys->sys.hvideownd, GCLP_HBRBACKGROUND, (LONG_PTR)brush);
}
}
CommonDisplay(vd);
......@@ -350,18 +350,18 @@ static void Manage(vout_display_t *vd)
CommonManage(vd);
if (sys->changes & DX_POSITION_CHANGE) {
if (sys->sys.changes & DX_POSITION_CHANGE) {
/* Update overlay */
if (sys->use_overlay)
if (sys->sys.use_overlay)
DirectXUpdateOverlay(vd, NULL);
/* Check if we are still on the same monitor */
HMONITOR hmon = MonitorFromWindow(sys->hwnd, MONITOR_DEFAULTTONEAREST);
HMONITOR hmon = MonitorFromWindow(sys->sys.hwnd, MONITOR_DEFAULTTONEAREST);
if (sys->hmonitor != hmon) {
vout_display_SendEventPicturesInvalid(vd);
}
/* */
sys->changes &= ~DX_POSITION_CHANGE;
sys->sys.changes &= ~DX_POSITION_CHANGE;
}
/* Wallpaper mode change */
......@@ -411,25 +411,25 @@ static int DirectXOpen(vout_display_t *vd, video_format_t *fmt)
UpdateRects(vd, NULL, NULL, true);
/* Create the picture pool */
if (DirectXCreatePool(vd, &sys->use_overlay, fmt)) {
if (DirectXCreatePool(vd, &sys->sys.use_overlay, fmt)) {
msg_Err(vd, "cannot create any DirectX surface");
return VLC_EGENERIC;
}
/* */
if (sys->use_overlay)
if (sys->sys.use_overlay)