From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/quartz_private.h | 2 +- dlls/quartz/video.c | 4 +--- dlls/quartz/videorenderer.c | 4 +--- dlls/quartz/vmr9.c | 4 +--- 4 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index 946daeb4848..8563edeaae3 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -214,7 +214,7 @@ typedef struct BaseControlVideoFuncTable BaseControlVideo_SetTargetRect pfnSetTargetRect; } BaseControlVideoFuncTable;
-HRESULT basic_video_init(BaseControlVideo *video, struct strmbase_filter *filter, +void basic_video_init(BaseControlVideo *video, struct strmbase_filter *filter, struct strmbase_pin *pin, const BaseControlVideoFuncTable *func_table) DECLSPEC_HIDDEN; HRESULT WINAPI BaseControlVideo_Destroy(BaseControlVideo *pControlVideo) DECLSPEC_HIDDEN;
diff --git a/dlls/quartz/video.c b/dlls/quartz/video.c index f59c2dee0cc..0f400df4812 100644 --- a/dlls/quartz/video.c +++ b/dlls/quartz/video.c @@ -647,13 +647,11 @@ static const IBasicVideoVtbl basic_video_vtbl = basic_video_IsUsingDefaultDestination };
-HRESULT basic_video_init(BaseControlVideo *video, struct strmbase_filter *filter, +void basic_video_init(BaseControlVideo *video, struct strmbase_filter *filter, struct strmbase_pin *pin, const BaseControlVideoFuncTable *func_table) { video->IBasicVideo_iface.lpVtbl = &basic_video_vtbl; video->pFilter = filter; video->pPin = pin; video->pFuncsTable = func_table; - - return S_OK; } diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 73c23603f84..cdb496ba298 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -716,10 +716,8 @@ HRESULT video_renderer_create(IUnknown *outer, IUnknown **out) if (FAILED(hr)) goto fail;
- hr = basic_video_init(&object->baseControlVideo, &object->renderer.filter, + basic_video_init(&object->baseControlVideo, &object->renderer.filter, &object->renderer.sink.pin, &renderer_BaseControlVideoFuncTable); - if (FAILED(hr)) - goto fail;
if (FAILED(hr = BaseWindowImpl_PrepareWindow(&object->baseControlWindow.baseWindow))) goto fail; diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 07a3dbc241b..bdf709cafcb 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2326,10 +2326,8 @@ static HRESULT vmr_create(IUnknown *outer, IUnknown **out, const CLSID *clsid) if (FAILED(hr = BaseWindowImpl_PrepareWindow(&object->baseControlWindow.baseWindow))) goto fail;
- hr = basic_video_init(&object->baseControlVideo, &object->renderer.filter, + basic_video_init(&object->baseControlVideo, &object->renderer.filter, &object->renderer.sink.pin, &renderer_BaseControlVideoFuncTable); - if (FAILED(hr)) - goto fail;
object->run_event = CreateEventW(NULL, TRUE, FALSE, NULL);
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/quartz_private.h | 1 - dlls/quartz/video.c | 5 ----- dlls/quartz/videorenderer.c | 1 - 3 files changed, 7 deletions(-)
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index 8563edeaae3..c108e5e4e66 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -216,6 +216,5 @@ typedef struct BaseControlVideoFuncTable
void basic_video_init(BaseControlVideo *video, struct strmbase_filter *filter, struct strmbase_pin *pin, const BaseControlVideoFuncTable *func_table) DECLSPEC_HIDDEN; -HRESULT WINAPI BaseControlVideo_Destroy(BaseControlVideo *pControlVideo) DECLSPEC_HIDDEN;
#endif /* __QUARTZ_PRIVATE_INCLUDED__ */ diff --git a/dlls/quartz/video.c b/dlls/quartz/video.c index 0f400df4812..11baee261d5 100644 --- a/dlls/quartz/video.c +++ b/dlls/quartz/video.c @@ -27,11 +27,6 @@ static inline BaseControlVideo *impl_from_IBasicVideo(IBasicVideo *iface) return CONTAINING_RECORD(iface, BaseControlVideo, IBasicVideo_iface); }
-HRESULT WINAPI BaseControlVideo_Destroy(BaseControlVideo *pControlVideo) -{ - return S_OK; -} - static HRESULT BaseControlVideoImpl_CheckSourceRect(BaseControlVideo *This, RECT *pSourceRect) { LONG VideoWidth, VideoHeight; diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index cdb496ba298..0b4db6eaec0 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -244,7 +244,6 @@ static void video_renderer_destroy(struct strmbase_renderer *iface) struct video_renderer *filter = impl_from_strmbase_renderer(iface);
BaseControlWindow_Destroy(&filter->baseControlWindow); - BaseControlVideo_Destroy(&filter->baseControlVideo); CloseHandle(filter->run_event); strmbase_renderer_cleanup(&filter->renderer); free(filter);
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/quartz_private.h | 8 +-- dlls/quartz/videorenderer.c | 2 +- dlls/quartz/vmr9.c | 2 +- dlls/quartz/window.c | 94 ++++++++++++++++++------------------ 4 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index c108e5e4e66..cf696f7936a 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -113,7 +113,7 @@ HRESULT WINAPI BaseWindow_Destroy(BaseWindow *pBaseWindow) DECLSPEC_HIDDEN; HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This) DECLSPEC_HIDDEN; HRESULT WINAPI BaseWindowImpl_DoneWithWindow(BaseWindow *This) DECLSPEC_HIDDEN;
-typedef struct tagBaseControlWindow +struct video_window { BaseWindow baseWindow; IVideoWindow IVideoWindow_iface; @@ -123,12 +123,12 @@ typedef struct tagBaseControlWindow HWND hwndOwner; struct strmbase_filter *pFilter; struct strmbase_pin *pPin; -} BaseControlWindow; +};
-HRESULT video_window_init(BaseControlWindow *window, const IVideoWindowVtbl *vtbl, +HRESULT video_window_init(struct video_window *window, const IVideoWindowVtbl *vtbl, struct strmbase_filter *filter, struct strmbase_pin *pin, const BaseWindowFuncTable *func_table) DECLSPEC_HIDDEN; void video_window_unregister_class(void) DECLSPEC_HIDDEN; -HRESULT WINAPI BaseControlWindow_Destroy(BaseControlWindow *pControlWindow) DECLSPEC_HIDDEN; +HRESULT WINAPI BaseControlWindow_Destroy(struct video_window *window) DECLSPEC_HIDDEN;
BOOL WINAPI BaseControlWindowImpl_PossiblyEatMessage(BaseWindow *This, UINT uMsg, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN;
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 0b4db6eaec0..ef27a8a87d1 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -39,7 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz); struct video_renderer { struct strmbase_renderer renderer; - BaseControlWindow baseControlWindow; + struct video_window baseControlWindow; BaseControlVideo baseControlVideo;
IOverlay IOverlay_iface; diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index bdf709cafcb..3db6a82f6a2 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -42,7 +42,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz); struct quartz_vmr { struct strmbase_renderer renderer; - BaseControlWindow baseControlWindow; + struct video_window baseControlWindow; BaseControlVideo baseControlVideo;
IAMCertifiedOutputProtection IAMCertifiedOutputProtection_iface; diff --git a/dlls/quartz/window.c b/dlls/quartz/window.c index 4656bad8d6a..1144d2e3404 100644 --- a/dlls/quartz/window.c +++ b/dlls/quartz/window.c @@ -24,20 +24,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
static const WCHAR class_name[] = L"wine_quartz_window";
-static inline BaseControlWindow *impl_from_IVideoWindow( IVideoWindow *iface) +static inline struct video_window *impl_from_IVideoWindow(IVideoWindow *iface) { - return CONTAINING_RECORD(iface, BaseControlWindow, IVideoWindow_iface); + return CONTAINING_RECORD(iface, struct video_window, IVideoWindow_iface); }
-static inline BaseControlWindow *impl_from_BaseWindow(BaseWindow *iface) +static inline struct video_window *impl_from_BaseWindow(BaseWindow *iface) { - return CONTAINING_RECORD(iface, BaseControlWindow, baseWindow); + return CONTAINING_RECORD(iface, struct video_window, baseWindow); }
static LRESULT CALLBACK WndProcW(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { BaseWindow* This = (BaseWindow*)GetWindowLongPtrW(hwnd, 0); - BaseControlWindow *window = impl_from_BaseWindow(This); + struct video_window *window = impl_from_BaseWindow(This);
if (!This) return DefWindowProcW(hwnd, message, wparam, lparam); @@ -151,7 +151,7 @@ HRESULT WINAPI BaseWindowImpl_DoneWithWindow(BaseWindow *This) return S_OK; }
-HRESULT video_window_init(BaseControlWindow *pControlWindow, +HRESULT video_window_init(struct video_window *pControlWindow, const IVideoWindowVtbl *lpVtbl, struct strmbase_filter *owner, struct strmbase_pin *pPin, const BaseWindowFuncTable *pFuncsTable) { @@ -170,7 +170,7 @@ HRESULT video_window_init(BaseControlWindow *pControlWindow, return hr; }
-HRESULT WINAPI BaseControlWindow_Destroy(BaseControlWindow *pControlWindow) +HRESULT WINAPI BaseControlWindow_Destroy(struct video_window *pControlWindow) { BaseWindowImpl_DoneWithWindow(&pControlWindow->baseWindow); return S_OK; @@ -178,19 +178,19 @@ HRESULT WINAPI BaseControlWindow_Destroy(BaseControlWindow *pControlWindow)
HRESULT WINAPI BaseControlWindowImpl_QueryInterface(IVideoWindow *iface, REFIID iid, void **out) { - BaseControlWindow *window = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface); return IUnknown_QueryInterface(window->pFilter->outer_unk, iid, out); }
ULONG WINAPI BaseControlWindowImpl_AddRef(IVideoWindow *iface) { - BaseControlWindow *window = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface); return IUnknown_AddRef(window->pFilter->outer_unk); }
ULONG WINAPI BaseControlWindowImpl_Release(IVideoWindow *iface) { - BaseControlWindow *window = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface); return IUnknown_Release(window->pFilter->outer_unk); }
@@ -244,7 +244,7 @@ HRESULT WINAPI BaseControlWindowImpl_Invoke(IVideoWindow *iface, DISPID id, REFI
HRESULT WINAPI BaseControlWindowImpl_put_Caption(IVideoWindow *iface, BSTR strCaption) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
@@ -256,7 +256,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_Caption(IVideoWindow *iface, BSTR strCa
HRESULT WINAPI BaseControlWindowImpl_get_Caption(IVideoWindow *iface, BSTR *caption) { - BaseControlWindow *window = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface); WCHAR *str; int len;
@@ -276,7 +276,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_Caption(IVideoWindow *iface, BSTR *capt
HRESULT WINAPI BaseControlWindowImpl_put_WindowStyle(IVideoWindow *iface, LONG WindowStyle) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface); LONG old;
old = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE); @@ -295,7 +295,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_WindowStyle(IVideoWindow *iface, LONG W
HRESULT WINAPI BaseControlWindowImpl_get_WindowStyle(IVideoWindow *iface, LONG *style) { - BaseControlWindow *window = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface);
TRACE("window %p, style %p.\n", window, style);
@@ -306,7 +306,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_WindowStyle(IVideoWindow *iface, LONG *
HRESULT WINAPI BaseControlWindowImpl_put_WindowStyleEx(IVideoWindow *iface, LONG WindowStyleEx) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
@@ -318,7 +318,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_WindowStyleEx(IVideoWindow *iface, LONG
HRESULT WINAPI BaseControlWindowImpl_get_WindowStyleEx(IVideoWindow *iface, LONG *WindowStyleEx) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
@@ -329,7 +329,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_WindowStyleEx(IVideoWindow *iface, LONG
HRESULT WINAPI BaseControlWindowImpl_put_AutoShow(IVideoWindow *iface, LONG AutoShow) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
@@ -340,7 +340,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_AutoShow(IVideoWindow *iface, LONG Auto
HRESULT WINAPI BaseControlWindowImpl_get_AutoShow(IVideoWindow *iface, LONG *AutoShow) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
@@ -351,7 +351,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_AutoShow(IVideoWindow *iface, LONG *Aut
HRESULT WINAPI BaseControlWindowImpl_put_WindowState(IVideoWindow *iface, LONG WindowState) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%d)\n", This, iface, WindowState); ShowWindow(This->baseWindow.hWnd, WindowState); @@ -360,7 +360,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_WindowState(IVideoWindow *iface, LONG W
HRESULT WINAPI BaseControlWindowImpl_get_WindowState(IVideoWindow *iface, LONG *state) { - BaseControlWindow *window = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface); DWORD style;
TRACE("window %p, state %p.\n", window, state); @@ -380,7 +380,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_WindowState(IVideoWindow *iface, LONG *
HRESULT WINAPI BaseControlWindowImpl_put_BackgroundPalette(IVideoWindow *iface, LONG BackgroundPalette) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette);
@@ -389,7 +389,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_BackgroundPalette(IVideoWindow *iface,
HRESULT WINAPI BaseControlWindowImpl_get_BackgroundPalette(IVideoWindow *iface, LONG *pBackgroundPalette) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
@@ -398,7 +398,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_BackgroundPalette(IVideoWindow *iface,
HRESULT WINAPI BaseControlWindowImpl_put_Visible(IVideoWindow *iface, LONG Visible) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%d)\n", This, iface, Visible);
@@ -409,7 +409,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_Visible(IVideoWindow *iface, LONG Visib
HRESULT WINAPI BaseControlWindowImpl_get_Visible(IVideoWindow *iface, LONG *pVisible) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
@@ -420,7 +420,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_Visible(IVideoWindow *iface, LONG *pVis
HRESULT WINAPI BaseControlWindowImpl_put_Left(IVideoWindow *iface, LONG Left) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface); RECT WindowPos;
TRACE("(%p/%p)->(%d)\n", This, iface, Left); @@ -435,7 +435,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_Left(IVideoWindow *iface, LONG Left)
HRESULT WINAPI BaseControlWindowImpl_get_Left(IVideoWindow *iface, LONG *pLeft) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface); RECT WindowPos;
TRACE("(%p/%p)->(%p)\n", This, iface, pLeft); @@ -448,7 +448,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_Left(IVideoWindow *iface, LONG *pLeft)
HRESULT WINAPI BaseControlWindowImpl_put_Width(IVideoWindow *iface, LONG Width) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%d)\n", This, iface, Width);
@@ -463,7 +463,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_Width(IVideoWindow *iface, LONG Width)
HRESULT WINAPI BaseControlWindowImpl_get_Width(IVideoWindow *iface, LONG *pWidth) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
@@ -474,7 +474,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_Width(IVideoWindow *iface, LONG *pWidth
HRESULT WINAPI BaseControlWindowImpl_put_Top(IVideoWindow *iface, LONG Top) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface); RECT WindowPos;
TRACE("(%p/%p)->(%d)\n", This, iface, Top); @@ -489,7 +489,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_Top(IVideoWindow *iface, LONG Top)
HRESULT WINAPI BaseControlWindowImpl_get_Top(IVideoWindow *iface, LONG *pTop) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface); RECT WindowPos;
TRACE("(%p/%p)->(%p)\n", This, iface, pTop); @@ -502,7 +502,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_Top(IVideoWindow *iface, LONG *pTop)
HRESULT WINAPI BaseControlWindowImpl_put_Height(IVideoWindow *iface, LONG Height) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%d)\n", This, iface, Height);
@@ -517,7 +517,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_Height(IVideoWindow *iface, LONG Height
HRESULT WINAPI BaseControlWindowImpl_get_Height(IVideoWindow *iface, LONG *pHeight) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
@@ -528,7 +528,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_Height(IVideoWindow *iface, LONG *pHeig
HRESULT WINAPI BaseControlWindowImpl_put_Owner(IVideoWindow *iface, OAHWND owner) { - BaseControlWindow *window = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface); HWND hwnd = window->baseWindow.hWnd;
TRACE("window %p, owner %#lx.\n", window, owner); @@ -548,7 +548,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_Owner(IVideoWindow *iface, OAHWND owner
HRESULT WINAPI BaseControlWindowImpl_get_Owner(IVideoWindow *iface, OAHWND *Owner) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
@@ -559,7 +559,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_Owner(IVideoWindow *iface, OAHWND *Owne
HRESULT WINAPI BaseControlWindowImpl_put_MessageDrain(IVideoWindow *iface, OAHWND Drain) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
@@ -570,7 +570,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_MessageDrain(IVideoWindow *iface, OAHWN
HRESULT WINAPI BaseControlWindowImpl_get_MessageDrain(IVideoWindow *iface, OAHWND *Drain) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
@@ -581,7 +581,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_MessageDrain(IVideoWindow *iface, OAHWN
HRESULT WINAPI BaseControlWindowImpl_get_BorderColor(IVideoWindow *iface, LONG *Color) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
@@ -590,7 +590,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_BorderColor(IVideoWindow *iface, LONG *
HRESULT WINAPI BaseControlWindowImpl_put_BorderColor(IVideoWindow *iface, LONG Color) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color);
@@ -612,7 +612,7 @@ HRESULT WINAPI BaseControlWindowImpl_put_FullScreenMode(IVideoWindow *iface, LON
HRESULT WINAPI BaseControlWindowImpl_SetWindowForeground(IVideoWindow *iface, LONG focus) { - BaseControlWindow *window = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface); UINT flags = SWP_NOMOVE | SWP_NOSIZE;
TRACE("window %p, focus %d.\n", window, focus); @@ -632,7 +632,7 @@ HRESULT WINAPI BaseControlWindowImpl_SetWindowForeground(IVideoWindow *iface, LO
HRESULT WINAPI BaseControlWindowImpl_SetWindowPosition(IVideoWindow *iface, LONG Left, LONG Top, LONG Width, LONG Height) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
@@ -647,7 +647,7 @@ HRESULT WINAPI BaseControlWindowImpl_SetWindowPosition(IVideoWindow *iface, LONG
HRESULT WINAPI BaseControlWindowImpl_GetWindowPosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface); RECT WindowPos;
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight); @@ -664,7 +664,7 @@ HRESULT WINAPI BaseControlWindowImpl_GetWindowPosition(IVideoWindow *iface, LONG HRESULT WINAPI BaseControlWindowImpl_NotifyOwnerMessage(IVideoWindow *iface, OAHWND hwnd, LONG message, LONG_PTR wparam, LONG_PTR lparam) { - BaseControlWindow *window = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface);
TRACE("window %p, hwnd %#lx, message %#x, wparam %#lx, lparam %#lx.\n", window, hwnd, message, wparam, lparam); @@ -689,7 +689,7 @@ HRESULT WINAPI BaseControlWindowImpl_NotifyOwnerMessage(IVideoWindow *iface,
HRESULT WINAPI BaseControlWindowImpl_GetMinIdealImageSize(IVideoWindow *iface, LONG *pWidth, LONG *pHeight) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface); RECT defaultRect;
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight); @@ -703,7 +703,7 @@ HRESULT WINAPI BaseControlWindowImpl_GetMinIdealImageSize(IVideoWindow *iface, L
HRESULT WINAPI BaseControlWindowImpl_GetMaxIdealImageSize(IVideoWindow *iface, LONG *pWidth, LONG *pHeight) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface); RECT defaultRect;
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight); @@ -717,7 +717,7 @@ HRESULT WINAPI BaseControlWindowImpl_GetMaxIdealImageSize(IVideoWindow *iface, L
HRESULT WINAPI BaseControlWindowImpl_GetRestorePosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
@@ -726,7 +726,7 @@ HRESULT WINAPI BaseControlWindowImpl_GetRestorePosition(IVideoWindow *iface, LON
HRESULT WINAPI BaseControlWindowImpl_HideCursor(IVideoWindow *iface, LONG HideCursor) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor);
@@ -735,7 +735,7 @@ HRESULT WINAPI BaseControlWindowImpl_HideCursor(IVideoWindow *iface, LONG HideCu
HRESULT WINAPI BaseControlWindowImpl_IsCursorHidden(IVideoWindow *iface, LONG *CursorHidden) { - BaseControlWindow* This = impl_from_IVideoWindow(iface); + struct video_window *This = impl_from_IVideoWindow(iface);
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/quartz_private.h | 10 +++++----- dlls/quartz/videorenderer.c | 6 +++--- dlls/quartz/vmr9.c | 5 +++-- dlls/quartz/window.c | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index cf696f7936a..dafdc82d06f 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -93,21 +93,21 @@ typedef struct tagBaseWindow LONG Width; LONG Height;
- const struct BaseWindowFuncTable* pFuncsTable; + const struct video_window_ops *pFuncsTable; } BaseWindow;
typedef RECT (WINAPI *BaseWindow_GetDefaultRect)(BaseWindow *This); typedef BOOL (WINAPI *BaseWindow_OnSize)(BaseWindow *This, LONG Height, LONG Width);
-typedef struct BaseWindowFuncTable +struct video_window_ops { /* Required */ BaseWindow_GetDefaultRect pfnGetDefaultRect; /* Optional, WinProc Related */ BaseWindow_OnSize pfnOnSize; -} BaseWindowFuncTable; +};
-HRESULT WINAPI BaseWindow_Init(BaseWindow *pBaseWindow, const BaseWindowFuncTable* pFuncsTable) DECLSPEC_HIDDEN; +HRESULT WINAPI BaseWindow_Init(BaseWindow *pBaseWindow, const struct video_window_ops *pFuncsTable) DECLSPEC_HIDDEN; HRESULT WINAPI BaseWindow_Destroy(BaseWindow *pBaseWindow) DECLSPEC_HIDDEN;
HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This) DECLSPEC_HIDDEN; @@ -126,7 +126,7 @@ struct video_window };
HRESULT video_window_init(struct video_window *window, const IVideoWindowVtbl *vtbl, - struct strmbase_filter *filter, struct strmbase_pin *pin, const BaseWindowFuncTable *func_table) DECLSPEC_HIDDEN; + struct strmbase_filter *filter, struct strmbase_pin *pin, const struct video_window_ops *ops) DECLSPEC_HIDDEN; void video_window_unregister_class(void) DECLSPEC_HIDDEN; HRESULT WINAPI BaseControlWindow_Destroy(struct video_window *window) DECLSPEC_HIDDEN;
diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index ef27a8a87d1..24d734892c7 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -344,7 +344,8 @@ static const struct strmbase_renderer_ops renderer_ops = .renderer_pin_query_interface = video_renderer_pin_query_interface, };
-static const BaseWindowFuncTable renderer_BaseWindowFuncTable = { +static const struct video_window_ops window_ops = +{ VideoRenderer_GetDefaultRect, VideoRenderer_OnSize }; @@ -710,8 +711,7 @@ HRESULT video_renderer_create(IUnknown *outer, IUnknown **out) object->IOverlay_iface.lpVtbl = &overlay_vtbl;
hr = video_window_init(&object->baseControlWindow, &IVideoWindow_VTable, - &object->renderer.filter, &object->renderer.sink.pin, - &renderer_BaseWindowFuncTable); + &object->renderer.filter, &object->renderer.sink.pin, &window_ops); if (FAILED(hr)) goto fail;
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 3db6a82f6a2..3778a8cee0d 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -689,7 +689,8 @@ static BOOL WINAPI VMR9_OnSize(BaseWindow *This, LONG Width, LONG Height) return TRUE; }
-static const BaseWindowFuncTable renderer_BaseWindowFuncTable = { +static const struct video_window_ops window_ops = +{ VMR9_GetDefaultRect, VMR9_OnSize, }; @@ -2319,7 +2320,7 @@ static HRESULT vmr_create(IUnknown *outer, IUnknown **out, const CLSID *clsid) object->IOverlay_iface.lpVtbl = &overlay_vtbl;
hr = video_window_init(&object->baseControlWindow, &IVideoWindow_VTable, - &object->renderer.filter, &object->renderer.sink.pin, &renderer_BaseWindowFuncTable); + &object->renderer.filter, &object->renderer.sink.pin, &window_ops); if (FAILED(hr)) goto fail;
diff --git a/dlls/quartz/window.c b/dlls/quartz/window.c index 1144d2e3404..7aaf2ea2f8f 100644 --- a/dlls/quartz/window.c +++ b/dlls/quartz/window.c @@ -84,7 +84,7 @@ static LRESULT CALLBACK WndProcW(HWND hwnd, UINT message, WPARAM wparam, LPARAM return DefWindowProcW(hwnd, message, wparam, lparam); }
-HRESULT WINAPI BaseWindow_Init(BaseWindow *pBaseWindow, const BaseWindowFuncTable* pFuncsTable) +HRESULT WINAPI BaseWindow_Init(BaseWindow *pBaseWindow, const struct video_window_ops *pFuncsTable) { if (!pFuncsTable) return E_INVALIDARG; @@ -153,7 +153,7 @@ HRESULT WINAPI BaseWindowImpl_DoneWithWindow(BaseWindow *This)
HRESULT video_window_init(struct video_window *pControlWindow, const IVideoWindowVtbl *lpVtbl, struct strmbase_filter *owner, - struct strmbase_pin *pPin, const BaseWindowFuncTable *pFuncsTable) + struct strmbase_pin *pPin, const struct video_window_ops *pFuncsTable) { HRESULT hr;
From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/quartz_private.h | 43 ++--- dlls/quartz/videorenderer.c | 86 +++++---- dlls/quartz/vmr9.c | 62 +++--- dlls/quartz/window.c | 359 +++++++++++++++-------------------- 4 files changed, 240 insertions(+), 310 deletions(-)
diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h index dafdc82d06f..3274714eea1 100644 --- a/dlls/quartz/quartz_private.h +++ b/dlls/quartz/quartz_private.h @@ -87,50 +87,33 @@ extern void video_unregister_windowclass(void) DECLSPEC_HIDDEN;
BOOL get_media_type(const WCHAR *filename, GUID *majortype, GUID *subtype, GUID *source_clsid) DECLSPEC_HIDDEN;
-typedef struct tagBaseWindow -{ - HWND hWnd; - LONG Width; - LONG Height; - - const struct video_window_ops *pFuncsTable; -} BaseWindow; - -typedef RECT (WINAPI *BaseWindow_GetDefaultRect)(BaseWindow *This); -typedef BOOL (WINAPI *BaseWindow_OnSize)(BaseWindow *This, LONG Height, LONG Width); - -struct video_window_ops -{ - /* Required */ - BaseWindow_GetDefaultRect pfnGetDefaultRect; - /* Optional, WinProc Related */ - BaseWindow_OnSize pfnOnSize; -}; - -HRESULT WINAPI BaseWindow_Init(BaseWindow *pBaseWindow, const struct video_window_ops *pFuncsTable) DECLSPEC_HIDDEN; -HRESULT WINAPI BaseWindow_Destroy(BaseWindow *pBaseWindow) DECLSPEC_HIDDEN; - -HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This) DECLSPEC_HIDDEN; -HRESULT WINAPI BaseWindowImpl_DoneWithWindow(BaseWindow *This) DECLSPEC_HIDDEN; - struct video_window { - BaseWindow baseWindow; IVideoWindow IVideoWindow_iface;
+ HWND hwnd; + LONG width, height; BOOL AutoShow; HWND hwndDrain; HWND hwndOwner; struct strmbase_filter *pFilter; struct strmbase_pin *pPin; + const struct video_window_ops *ops; };
+struct video_window_ops +{ + /* Required */ + RECT (*get_default_rect)(struct video_window *window); + /* Optional, WinProc Related */ + BOOL (*resize)(struct video_window *window, LONG height, LONG width); +}; + +void video_window_cleanup(struct video_window *window) DECLSPEC_HIDDEN; +HRESULT video_window_create_window(struct video_window *window) DECLSPEC_HIDDEN; HRESULT video_window_init(struct video_window *window, const IVideoWindowVtbl *vtbl, struct strmbase_filter *filter, struct strmbase_pin *pin, const struct video_window_ops *ops) DECLSPEC_HIDDEN; void video_window_unregister_class(void) DECLSPEC_HIDDEN; -HRESULT WINAPI BaseControlWindow_Destroy(struct video_window *window) DECLSPEC_HIDDEN; - -BOOL WINAPI BaseControlWindowImpl_PossiblyEatMessage(BaseWindow *This, UINT uMsg, WPARAM wParam, LPARAM lParam) DECLSPEC_HIDDEN;
HRESULT WINAPI BaseControlWindowImpl_QueryInterface(IVideoWindow *iface, REFIID iid, void **out) DECLSPEC_HIDDEN; ULONG WINAPI BaseControlWindowImpl_AddRef(IVideoWindow *iface) DECLSPEC_HIDDEN; diff --git a/dlls/quartz/videorenderer.c b/dlls/quartz/videorenderer.c index 24d734892c7..3888d010e6e 100644 --- a/dlls/quartz/videorenderer.c +++ b/dlls/quartz/videorenderer.c @@ -59,9 +59,9 @@ struct video_renderer IMediaSample *current_sample; };
-static inline struct video_renderer *impl_from_BaseWindow(BaseWindow *iface) +static inline struct video_renderer *impl_from_video_window(struct video_window *iface) { - return CONTAINING_RECORD(iface, struct video_renderer, baseControlWindow.baseWindow); + return CONTAINING_RECORD(iface, struct video_renderer, baseControlWindow); }
static inline struct video_renderer *impl_from_strmbase_renderer(struct strmbase_renderer *iface) @@ -83,8 +83,8 @@ static void VideoRenderer_AutoShowWindow(struct video_renderer *This) { if (!This->init && (!This->WindowPos.right || !This->WindowPos.top)) { - DWORD style = GetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE); - DWORD style_ex = GetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_EXSTYLE); + DWORD style = GetWindowLongW(This->baseControlWindow.hwnd, GWL_STYLE); + DWORD style_ex = GetWindowLongW(This->baseControlWindow.hwnd, GWL_EXSTYLE);
if (!This->WindowPos.right) { @@ -116,20 +116,20 @@ static void VideoRenderer_AutoShowWindow(struct video_renderer *This) AdjustWindowRectEx(&This->WindowPos, style, FALSE, style_ex);
TRACE("WindowPos: %s\n", wine_dbgstr_rect(&This->WindowPos)); - SetWindowPos(This->baseControlWindow.baseWindow.hWnd, NULL, + SetWindowPos(This->baseControlWindow.hwnd, NULL, This->WindowPos.left, This->WindowPos.top, This->WindowPos.right - This->WindowPos.left, This->WindowPos.bottom - This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE);
- GetClientRect(This->baseControlWindow.baseWindow.hWnd, &This->DestRect); + GetClientRect(This->baseControlWindow.hwnd, &This->DestRect); } else if (!This->init) This->DestRect = This->WindowPos; This->init = TRUE; if (This->baseControlWindow.AutoShow) - ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_SHOW); + ShowWindow(This->baseControlWindow.hwnd, SW_SHOW); }
static HRESULT WINAPI VideoRenderer_ShouldDrawSampleNow(struct strmbase_renderer *filter, @@ -164,7 +164,7 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa else bih = &((VIDEOINFOHEADER2 *)mt->pbFormat)->bmiHeader;
- dc = GetDC(filter->baseControlWindow.baseWindow.hWnd); + dc = GetDC(filter->baseControlWindow.hwnd); StretchDIBits(dc, filter->DestRect.left, filter->DestRect.top, filter->DestRect.right - filter->DestRect.left, filter->DestRect.bottom - filter->DestRect.top, @@ -172,7 +172,7 @@ static HRESULT WINAPI VideoRenderer_DoRenderSample(struct strmbase_renderer *ifa filter->SourceRect.right - filter->SourceRect.left, filter->SourceRect.bottom - filter->SourceRect.top, pbSrcStream, (BITMAPINFO *)bih, DIB_RGB_COLORS, SRCCOPY); - ReleaseDC(filter->baseControlWindow.baseWindow.hWnd, dc); + ReleaseDC(filter->baseControlWindow.hwnd, dc);
if (filter->renderer.filter.state == State_Paused) { @@ -243,7 +243,7 @@ static void video_renderer_destroy(struct strmbase_renderer *iface) { struct video_renderer *filter = impl_from_strmbase_renderer(iface);
- BaseControlWindow_Destroy(&filter->baseControlWindow); + video_window_cleanup(&filter->baseControlWindow); CloseHandle(filter->run_event); strmbase_renderer_cleanup(&filter->renderer); free(filter); @@ -294,7 +294,7 @@ static void video_renderer_stop_stream(struct strmbase_renderer *iface)
if (This->baseControlWindow.AutoShow) /* Black it out */ - RedrawWindow(This->baseControlWindow.baseWindow.hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE); + RedrawWindow(This->baseControlWindow.hwnd, NULL, NULL, RDW_INVALIDATE | RDW_ERASE);
ResetEvent(This->run_event); } @@ -306,9 +306,9 @@ static void video_renderer_init_stream(struct strmbase_renderer *iface) VideoRenderer_AutoShowWindow(filter); }
-static RECT WINAPI VideoRenderer_GetDefaultRect(BaseWindow *iface) +static RECT video_renderer_get_default_rect(struct video_window *iface) { - struct video_renderer *This = impl_from_BaseWindow(iface); + struct video_renderer *This = impl_from_video_window(iface); static RECT defRect;
SetRect(&defRect, 0, 0, This->VideoWidth, This->VideoHeight); @@ -316,12 +316,12 @@ static RECT WINAPI VideoRenderer_GetDefaultRect(BaseWindow *iface) return defRect; }
-static BOOL WINAPI VideoRenderer_OnSize(BaseWindow *iface, LONG Width, LONG Height) +static BOOL video_renderer_resize(struct video_window *iface, LONG Width, LONG Height) { - struct video_renderer *This = impl_from_BaseWindow(iface); + struct video_renderer *This = impl_from_video_window(iface);
TRACE("WM_SIZE %d %d\n", Width, Height); - GetClientRect(iface->hWnd, &This->DestRect); + GetClientRect(iface->hwnd, &This->DestRect); TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n", This->DestRect.left, This->DestRect.top, @@ -346,8 +346,8 @@ static const struct strmbase_renderer_ops renderer_ops =
static const struct video_window_ops window_ops = { - VideoRenderer_GetDefaultRect, - VideoRenderer_OnSize + .get_default_rect = video_renderer_get_default_rect, + .resize = video_renderer_resize, };
static HRESULT WINAPI VideoRenderer_GetSourceRect(BaseControlVideo* iface, RECT *pSourceRect) @@ -467,7 +467,7 @@ static HRESULT WINAPI VideoRenderer_SetDefaultTargetRect(BaseControlVideo* iface struct video_renderer *This = impl_from_BaseControlVideo(iface); RECT rect;
- if (!GetClientRect(This->baseControlWindow.baseWindow.hWnd, &rect)) + if (!GetClientRect(This->baseControlWindow.hwnd, &rect)) return E_FAIL;
SetRect(&This->DestRect, 0, 0, rect.right, rect.bottom); @@ -517,30 +517,34 @@ static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface, return S_OK; }
-static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, - LONG FullScreenMode) +static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, LONG fullscreen) { - struct video_renderer *This = impl_from_IVideoWindow(iface); + struct video_renderer *filter = impl_from_IVideoWindow(iface);
- FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode); + FIXME("filter %p, fullscreen %d.\n", filter, fullscreen);
- if (FullScreenMode) { - This->saved_style = GetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE); - ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_HIDE); - SetParent(This->baseControlWindow.baseWindow.hWnd, 0); - SetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE, WS_POPUP); - SetWindowPos(This->baseControlWindow.baseWindow.hWnd,HWND_TOP,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),SWP_SHOWWINDOW); - GetWindowRect(This->baseControlWindow.baseWindow.hWnd, &This->DestRect); - This->WindowPos = This->DestRect; - } else { - ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_HIDE); - SetParent(This->baseControlWindow.baseWindow.hWnd, This->baseControlWindow.hwndOwner); - SetWindowLongW(This->baseControlWindow.baseWindow.hWnd, GWL_STYLE, This->saved_style); - GetClientRect(This->baseControlWindow.baseWindow.hWnd, &This->DestRect); - SetWindowPos(This->baseControlWindow.baseWindow.hWnd,0,This->DestRect.left,This->DestRect.top,This->DestRect.right,This->DestRect.bottom,SWP_NOZORDER|SWP_SHOWWINDOW); - This->WindowPos = This->DestRect; + if (fullscreen) + { + filter->saved_style = GetWindowLongW(filter->baseControlWindow.hwnd, GWL_STYLE); + ShowWindow(filter->baseControlWindow.hwnd, SW_HIDE); + SetParent(filter->baseControlWindow.hwnd, NULL); + SetWindowLongW(filter->baseControlWindow.hwnd, GWL_STYLE, WS_POPUP); + SetWindowPos(filter->baseControlWindow.hwnd, HWND_TOP, 0, 0, + GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN), SWP_SHOWWINDOW); + GetWindowRect(filter->baseControlWindow.hwnd, &filter->DestRect); + filter->WindowPos = filter->DestRect; + } + else + { + ShowWindow(filter->baseControlWindow.hwnd, SW_HIDE); + SetParent(filter->baseControlWindow.hwnd, filter->baseControlWindow.hwndOwner); + SetWindowLongW(filter->baseControlWindow.hwnd, GWL_STYLE, filter->saved_style); + GetClientRect(filter->baseControlWindow.hwnd, &filter->DestRect); + SetWindowPos(filter->baseControlWindow.hwnd, 0, filter->DestRect.left, filter->DestRect.top, + filter->DestRect.right, filter->DestRect.bottom, SWP_NOZORDER | SWP_SHOWWINDOW); + filter->WindowPos = filter->DestRect; } - This->FullScreenMode = FullScreenMode; + filter->FullScreenMode = fullscreen;
return S_OK; } @@ -654,7 +658,7 @@ static HRESULT WINAPI overlay_GetWindowHandle(IOverlay *iface, HWND *window)
TRACE("filter %p, window %p.\n", filter, window);
- *window = filter->baseControlWindow.baseWindow.hWnd; + *window = filter->baseControlWindow.hwnd; return S_OK; }
@@ -718,7 +722,7 @@ HRESULT video_renderer_create(IUnknown *outer, IUnknown **out) basic_video_init(&object->baseControlVideo, &object->renderer.filter, &object->renderer.sink.pin, &renderer_BaseControlVideoFuncTable);
- if (FAILED(hr = BaseWindowImpl_PrepareWindow(&object->baseControlWindow.baseWindow))) + if (FAILED(hr = video_window_create_window(&object->baseControlWindow))) goto fail;
object->run_event = CreateEventW(NULL, TRUE, FALSE, NULL); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 3778a8cee0d..82727adb870 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -91,9 +91,9 @@ struct quartz_vmr HANDLE run_event; };
-static inline struct quartz_vmr *impl_from_BaseWindow(BaseWindow *wnd) +static inline struct quartz_vmr *impl_from_video_window(struct video_window *iface) { - return CONTAINING_RECORD(wnd, struct quartz_vmr, baseControlWindow.baseWindow); + return CONTAINING_RECORD(iface, struct quartz_vmr, baseControlWindow); }
static inline struct quartz_vmr *impl_from_BaseControlVideo(BaseControlVideo *cvid) @@ -412,7 +412,7 @@ static HRESULT VMR9_maybe_init(struct quartz_vmr *filter, BOOL force, const AM_M };
TRACE("Initializing in mode %u, our window %p, clipping window %p.\n", - filter->mode, filter->baseControlWindow.baseWindow.hWnd, filter->hWndClippingWindow); + filter->mode, filter->baseControlWindow.hwnd, filter->hWndClippingWindow); if (filter->num_surfaces) return S_OK;
@@ -487,14 +487,14 @@ static void vmr_start_stream(struct strmbase_renderer *iface) if (This->renderer.sink.pin.peer) VMR9_maybe_init(This, TRUE, &This->renderer.sink.pin.mt); IVMRImagePresenter9_StartPresenting(This->presenter, This->cookie); - SetWindowPos(This->baseControlWindow.baseWindow.hWnd, NULL, + SetWindowPos(This->baseControlWindow.hwnd, NULL, This->source_rect.left, This->source_rect.top, This->source_rect.right - This->source_rect.left, This->source_rect.bottom - This->source_rect.top, SWP_NOZORDER|SWP_NOMOVE|SWP_DEFERERASE); - ShowWindow(This->baseControlWindow.baseWindow.hWnd, SW_SHOW); - GetClientRect(This->baseControlWindow.baseWindow.hWnd, &This->target_rect); + ShowWindow(This->baseControlWindow.hwnd, SW_SHOW); + GetClientRect(This->baseControlWindow.hwnd, &This->target_rect); SetEvent(This->run_event); }
@@ -579,7 +579,7 @@ static void vmr_destroy(struct strmbase_renderer *iface) { struct quartz_vmr *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
- BaseControlWindow_Destroy(&filter->baseControlWindow); + video_window_cleanup(&filter->baseControlWindow);
if (filter->allocator) IVMRSurfaceAllocatorEx9_Release(filter->allocator); @@ -595,7 +595,6 @@ static void vmr_destroy(struct strmbase_renderer *iface)
CloseHandle(filter->run_event); FreeLibrary(filter->hD3d9); - BaseControlWindow_Destroy(&filter->baseControlWindow); strmbase_renderer_cleanup(&filter->renderer); free(filter);
@@ -664,9 +663,9 @@ static const struct strmbase_renderer_ops renderer_ops = .renderer_pin_query_interface = vmr_pin_query_interface, };
-static RECT WINAPI VMR9_GetDefaultRect(BaseWindow *This) +static RECT vmr_get_default_rect(struct video_window *This) { - struct quartz_vmr* pVMR9 = impl_from_BaseWindow(This); + struct quartz_vmr *pVMR9 = impl_from_video_window(This); static RECT defRect;
SetRect(&defRect, 0, 0, pVMR9->VideoWidth, pVMR9->VideoHeight); @@ -674,12 +673,12 @@ static RECT WINAPI VMR9_GetDefaultRect(BaseWindow *This) return defRect; }
-static BOOL WINAPI VMR9_OnSize(BaseWindow *This, LONG Width, LONG Height) +static BOOL vmr_resize(struct video_window *This, LONG Width, LONG Height) { - struct quartz_vmr* pVMR9 = impl_from_BaseWindow(This); + struct quartz_vmr *pVMR9 = impl_from_video_window(This);
TRACE("WM_SIZE %d %d\n", Width, Height); - GetClientRect(This->hWnd, &pVMR9->target_rect); + GetClientRect(This->hwnd, &pVMR9->target_rect); TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n", pVMR9->target_rect.left, pVMR9->target_rect.top, @@ -691,8 +690,8 @@ static BOOL WINAPI VMR9_OnSize(BaseWindow *This, LONG Width, LONG Height)
static const struct video_window_ops window_ops = { - VMR9_GetDefaultRect, - VMR9_OnSize, + .get_default_rect = vmr_get_default_rect, + .resize = vmr_resize, };
static HRESULT WINAPI VMR9_GetSourceRect(BaseControlVideo* This, RECT *pSourceRect) @@ -828,7 +827,7 @@ static HRESULT WINAPI VMR9_SetDefaultTargetRect(BaseControlVideo* This) RECT rect; struct quartz_vmr* pVMR9 = impl_from_BaseControlVideo(This);
- if (!GetClientRect(pVMR9->baseControlWindow.baseWindow.hWnd, &rect)) + if (!GetClientRect(pVMR9->baseControlWindow.hwnd, &rect)) return E_FAIL;
SetRect(&pVMR9->target_rect, 0, 0, rect.right, rect.bottom); @@ -1602,7 +1601,7 @@ static HRESULT WINAPI VMR7WindowlessControl_SetVideoPosition(IVMRWindowlessContr { This->target_rect = *dest; FIXME("Output rectangle: %s.\n", wine_dbgstr_rect(dest)); - SetWindowPos(This->baseControlWindow.baseWindow.hWnd, NULL, + SetWindowPos(This->baseControlWindow.hwnd, NULL, dest->left, dest->top, dest->right - dest->left, dest->bottom-dest->top, SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOOWNERZORDER | SWP_NOREDRAW); } @@ -1803,7 +1802,7 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoPosition(IVMRWindowlessContr { This->target_rect = *dest; FIXME("Output rectangle: %s.\n", wine_dbgstr_rect(dest)); - SetWindowPos(This->baseControlWindow.baseWindow.hWnd, NULL, + SetWindowPos(This->baseControlWindow.hwnd, NULL, dest->left, dest->top, dest->right - dest->left, dest->bottom - dest->top, SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOOWNERZORDER | SWP_NOREDRAW); } @@ -1867,7 +1866,7 @@ static HRESULT WINAPI VMR9WindowlessControl_RepaintVideo(IVMRWindowlessControl9 FIXME("(%p/%p)->(...) semi-stub\n", iface, This);
EnterCriticalSection(&This->renderer.filter.csFilter); - if (hwnd != This->hWndClippingWindow && hwnd != This->baseControlWindow.baseWindow.hWnd) + if (hwnd != This->hWndClippingWindow && hwnd != This->baseControlWindow.hwnd) { ERR("Not handling changing windows yet!!!\n"); LeaveCriticalSection(&This->renderer.filter.csFilter); @@ -1882,7 +1881,7 @@ static HRESULT WINAPI VMR9WindowlessControl_RepaintVideo(IVMRWindowlessControl9 }
/* Windowless extension */ - hr = IDirect3DDevice9_Present(This->allocator_d3d9_dev, NULL, NULL, This->baseControlWindow.baseWindow.hWnd, NULL); + hr = IDirect3DDevice9_Present(This->allocator_d3d9_dev, NULL, NULL, This->baseControlWindow.hwnd, NULL); LeaveCriticalSection(&This->renderer.filter.csFilter);
return hr; @@ -2245,7 +2244,7 @@ static HRESULT WINAPI overlay_GetWindowHandle(IOverlay *iface, HWND *window)
TRACE("filter %p, window %p.\n", filter, window);
- *window = filter->baseControlWindow.baseWindow.hWnd; + *window = filter->baseControlWindow.hwnd; return S_OK; }
@@ -2324,7 +2323,7 @@ static HRESULT vmr_create(IUnknown *outer, IUnknown **out, const CLSID *clsid) if (FAILED(hr)) goto fail;
- if (FAILED(hr = BaseWindowImpl_PrepareWindow(&object->baseControlWindow.baseWindow))) + if (FAILED(hr = video_window_create_window(&object->baseControlWindow))) goto fail;
basic_video_init(&object->baseControlVideo, &object->renderer.filter, @@ -2337,7 +2336,6 @@ static HRESULT vmr_create(IUnknown *outer, IUnknown **out, const CLSID *clsid) return hr;
fail: - BaseWindowImpl_DoneWithWindow(&object->baseControlWindow.baseWindow); strmbase_renderer_cleanup(&object->renderer); FreeLibrary(object->hD3d9); free(object); @@ -2520,7 +2518,7 @@ static HRESULT WINAPI VMR9_ImagePresenter_PresentImage(IVMRImagePresenter9 *ifac BOOL render = FALSE;
TRACE("(%p/%p/%p)->(...) stub\n", iface, This, This->pVMR9); - GetWindowRect(This->pVMR9->baseControlWindow.baseWindow.hWnd, &output); + GetWindowRect(This->pVMR9->baseControlWindow.hwnd, &output); TRACE("Output rectangle: %s\n", wine_dbgstr_rect(&output));
/* This might happen if we don't have active focus (eg on a different virtual desktop) */ @@ -2545,7 +2543,7 @@ static HRESULT WINAPI VMR9_ImagePresenter_PresentImage(IVMRImagePresenter9 *ifac hr = IDirect3DDevice9_EndScene(This->d3d9_dev); if (render && SUCCEEDED(hr)) { - hr = IDirect3DDevice9_Present(This->d3d9_dev, NULL, NULL, This->pVMR9->baseControlWindow.baseWindow.hWnd, NULL); + hr = IDirect3DDevice9_Present(This->d3d9_dev, NULL, NULL, This->pVMR9->baseControlWindow.hwnd, NULL); if (FAILED(hr)) FIXME("Presenting image: %08x\n", hr); } @@ -2669,12 +2667,12 @@ static BOOL CreateRenderingWindow(struct default_presenter *This, VMR9Allocation TRACE("(%p)->()\n", This);
/* Obtain a monitor and d3d9 device */ - d3d9_adapter = d3d9_adapter_from_hwnd(This->d3d9_ptr, This->pVMR9->baseControlWindow.baseWindow.hWnd, &This->hMon); + d3d9_adapter = d3d9_adapter_from_hwnd(This->d3d9_ptr, This->pVMR9->baseControlWindow.hwnd, &This->hMon);
/* Now try to create the d3d9 device */ ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = TRUE; - d3dpp.hDeviceWindow = This->pVMR9->baseControlWindow.baseWindow.hWnd; + d3dpp.hDeviceWindow = This->pVMR9->baseControlWindow.hwnd; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferHeight = This->pVMR9->target_rect.bottom - This->pVMR9->target_rect.top; d3dpp.BackBufferWidth = This->pVMR9->target_rect.right - This->pVMR9->target_rect.left; @@ -2773,16 +2771,20 @@ static HRESULT VMR9_SurfaceAllocator_UpdateDeviceReset(struct default_presenter /* Now try to create the d3d9 device */ ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = TRUE; - d3dpp.hDeviceWindow = This->pVMR9->baseControlWindow.baseWindow.hWnd; + d3dpp.hDeviceWindow = This->pVMR9->baseControlWindow.hwnd; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
if (This->d3d9_dev) IDirect3DDevice9_Release(This->d3d9_dev); This->d3d9_dev = NULL; - hr = IDirect3D9_CreateDevice(This->d3d9_ptr, d3d9_adapter_from_hwnd(This->d3d9_ptr, This->pVMR9->baseControlWindow.baseWindow.hWnd, &This->hMon), D3DDEVTYPE_HAL, NULL, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &This->d3d9_dev); + hr = IDirect3D9_CreateDevice(This->d3d9_ptr, d3d9_adapter_from_hwnd(This->d3d9_ptr, + This->pVMR9->baseControlWindow.hwnd, &This->hMon), D3DDEVTYPE_HAL, NULL, + D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &This->d3d9_dev); if (FAILED(hr)) { - hr = IDirect3D9_CreateDevice(This->d3d9_ptr, d3d9_adapter_from_hwnd(This->d3d9_ptr, This->pVMR9->baseControlWindow.baseWindow.hWnd, &This->hMon), D3DDEVTYPE_HAL, NULL, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &This->d3d9_dev); + hr = IDirect3D9_CreateDevice(This->d3d9_ptr, d3d9_adapter_from_hwnd(This->d3d9_ptr, + This->pVMR9->baseControlWindow.hwnd, &This->hMon), D3DDEVTYPE_HAL, NULL, + D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &This->d3d9_dev); if (FAILED(hr)) { ERR("--> Creating device: %08x\n", hr); diff --git a/dlls/quartz/window.c b/dlls/quartz/window.c index 7aaf2ea2f8f..7e8aba8a263 100644 --- a/dlls/quartz/window.c +++ b/dlls/quartz/window.c @@ -29,17 +29,11 @@ static inline struct video_window *impl_from_IVideoWindow(IVideoWindow *iface) return CONTAINING_RECORD(iface, struct video_window, IVideoWindow_iface); }
-static inline struct video_window *impl_from_BaseWindow(BaseWindow *iface) -{ - return CONTAINING_RECORD(iface, struct video_window, baseWindow); -} - static LRESULT CALLBACK WndProcW(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) { - BaseWindow* This = (BaseWindow*)GetWindowLongPtrW(hwnd, 0); - struct video_window *window = impl_from_BaseWindow(This); + struct video_window *window = (struct video_window *)GetWindowLongPtrW(hwnd, 0);
- if (!This) + if (!window) return DefWindowProcW(hwnd, message, wparam, lparam);
switch (message) @@ -74,42 +68,22 @@ static LRESULT CALLBACK WndProcW(HWND hwnd, UINT message, WPARAM wparam, LPARAM } break; case WM_SIZE: - if (This->pFuncsTable->pfnOnSize) - return This->pFuncsTable->pfnOnSize(This, LOWORD(lparam), HIWORD(lparam)); + if (window->ops->resize) + return window->ops->resize(window, LOWORD(lparam), HIWORD(lparam));
- This->Width = LOWORD(lparam); - This->Height = HIWORD(lparam); + window->width = LOWORD(lparam); + window->height = HIWORD(lparam); }
return DefWindowProcW(hwnd, message, wparam, lparam); }
-HRESULT WINAPI BaseWindow_Init(BaseWindow *pBaseWindow, const struct video_window_ops *pFuncsTable) -{ - if (!pFuncsTable) - return E_INVALIDARG; - - ZeroMemory(pBaseWindow,sizeof(BaseWindow)); - pBaseWindow->pFuncsTable = pFuncsTable; - - return S_OK; -} - -HRESULT WINAPI BaseWindow_Destroy(BaseWindow *This) -{ - if (This->hWnd) - BaseWindowImpl_DoneWithWindow(This); - - HeapFree(GetProcessHeap(), 0, This); - return S_OK; -} - -HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This) +HRESULT video_window_create_window(struct video_window *window) { WNDCLASSW winclass = {0};
winclass.lpfnWndProc = WndProcW; - winclass.cbWndExtra = sizeof(BaseWindow*); + winclass.cbWndExtra = sizeof(window); winclass.hbrBackground = GetStockObject(BLACK_BRUSH); winclass.lpszClassName = class_name; if (!RegisterClassW(&winclass) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) @@ -118,64 +92,20 @@ HRESULT WINAPI BaseWindowImpl_PrepareWindow(BaseWindow *This) return E_FAIL; }
- This->hWnd = CreateWindowExW(0, class_name, L"ActiveMovie Window", + if (!(window->hwnd = CreateWindowExW(0, class_name, L"ActiveMovie Window", WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - NULL, NULL, NULL, NULL); - - if (!This->hWnd) + NULL, NULL, NULL, NULL))) { ERR("Unable to create window\n"); return E_FAIL; }
- SetWindowLongPtrW(This->hWnd, 0, (LONG_PTR)This); + SetWindowLongPtrW(window->hwnd, 0, (LONG_PTR)window);
return S_OK; }
-HRESULT WINAPI BaseWindowImpl_DoneWithWindow(BaseWindow *This) -{ - if (!This->hWnd) - return S_OK; - - /* Media Player Classic deadlocks if WM_PARENTNOTIFY is sent, so clear - * the child style first. Just like Windows, we don't actually unparent - * the window, to prevent extra focus events from being generated since - * it would become top-level for a brief period before being destroyed. */ - SetWindowLongW(This->hWnd, GWL_STYLE, GetWindowLongW(This->hWnd, GWL_STYLE) & ~WS_CHILD); - - SendMessageW(This->hWnd, WM_CLOSE, 0, 0); - This->hWnd = NULL; - - return S_OK; -} - -HRESULT video_window_init(struct video_window *pControlWindow, - const IVideoWindowVtbl *lpVtbl, struct strmbase_filter *owner, - struct strmbase_pin *pPin, const struct video_window_ops *pFuncsTable) -{ - HRESULT hr; - - hr = BaseWindow_Init(&pControlWindow->baseWindow, pFuncsTable); - if (SUCCEEDED(hr)) - { - pControlWindow->IVideoWindow_iface.lpVtbl = lpVtbl; - pControlWindow->AutoShow = OATRUE; - pControlWindow->hwndDrain = NULL; - pControlWindow->hwndOwner = NULL; - pControlWindow->pFilter = owner; - pControlWindow->pPin = pPin; - } - return hr; -} - -HRESULT WINAPI BaseControlWindow_Destroy(struct video_window *pControlWindow) -{ - BaseWindowImpl_DoneWithWindow(&pControlWindow->baseWindow); - return S_OK; -} - HRESULT WINAPI BaseControlWindowImpl_QueryInterface(IVideoWindow *iface, REFIID iid, void **out) { struct video_window *window = impl_from_IVideoWindow(iface); @@ -242,13 +172,13 @@ HRESULT WINAPI BaseControlWindowImpl_Invoke(IVideoWindow *iface, DISPID id, REFI return hr; }
-HRESULT WINAPI BaseControlWindowImpl_put_Caption(IVideoWindow *iface, BSTR strCaption) +HRESULT WINAPI BaseControlWindowImpl_put_Caption(IVideoWindow *iface, BSTR caption) { - struct video_window *This = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface);
- TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption); + TRACE("window %p, caption %s.\n", window, debugstr_w(caption));
- if (!SetWindowTextW(This->baseWindow.hWnd, strCaption)) + if (!SetWindowTextW(window->hwnd, caption)) return E_FAIL;
return S_OK; @@ -264,32 +194,28 @@ HRESULT WINAPI BaseControlWindowImpl_get_Caption(IVideoWindow *iface, BSTR *capt
*caption = NULL;
- len = GetWindowTextLengthW(window->baseWindow.hWnd) + 1; + len = GetWindowTextLengthW(window->hwnd) + 1; if (!(str = heap_alloc(len * sizeof(WCHAR)))) return E_OUTOFMEMORY;
- GetWindowTextW(window->baseWindow.hWnd, str, len); + GetWindowTextW(window->hwnd, str, len); *caption = SysAllocString(str); heap_free(str); return *caption ? S_OK : E_OUTOFMEMORY; }
-HRESULT WINAPI BaseControlWindowImpl_put_WindowStyle(IVideoWindow *iface, LONG WindowStyle) +HRESULT WINAPI BaseControlWindowImpl_put_WindowStyle(IVideoWindow *iface, LONG style) { - struct video_window *This = impl_from_IVideoWindow(iface); - LONG old; - - old = GetWindowLongW(This->baseWindow.hWnd, GWL_STYLE); + struct video_window *window = impl_from_IVideoWindow(iface);
- TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle); + TRACE("window %p, style %#x.\n", window, style);
- if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL)) + if (style & (WS_DISABLED|WS_HSCROLL|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL)) return E_INVALIDARG;
- SetWindowLongW(This->baseWindow.hWnd, GWL_STYLE, WindowStyle); - SetWindowPos(This->baseWindow.hWnd, 0, 0, 0, 0, 0, + SetWindowLongW(window->hwnd, GWL_STYLE, style); + SetWindowPos(window->hwnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED); - return S_OK; }
@@ -299,31 +225,28 @@ HRESULT WINAPI BaseControlWindowImpl_get_WindowStyle(IVideoWindow *iface, LONG *
TRACE("window %p, style %p.\n", window, style);
- *style = GetWindowLongW(window->baseWindow.hWnd, GWL_STYLE); - + *style = GetWindowLongW(window->hwnd, GWL_STYLE); return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_put_WindowStyleEx(IVideoWindow *iface, LONG WindowStyleEx) +HRESULT WINAPI BaseControlWindowImpl_put_WindowStyleEx(IVideoWindow *iface, LONG style) { - struct video_window *This = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface);
- TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx); + TRACE("window %p, style %#x.\n", window, style);
- if (!SetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE, WindowStyleEx)) + if (!SetWindowLongW(window->hwnd, GWL_EXSTYLE, style)) return E_FAIL; - return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_get_WindowStyleEx(IVideoWindow *iface, LONG *WindowStyleEx) +HRESULT WINAPI BaseControlWindowImpl_get_WindowStyleEx(IVideoWindow *iface, LONG *style) { - struct video_window *This = impl_from_IVideoWindow(iface); - - TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx); + struct video_window *window = impl_from_IVideoWindow(iface);
- *WindowStyleEx = GetWindowLongW(This->baseWindow.hWnd, GWL_EXSTYLE); + TRACE("window %p, style %p.\n", window, style);
+ *style = GetWindowLongW(window->hwnd, GWL_EXSTYLE); return S_OK; }
@@ -349,12 +272,13 @@ HRESULT WINAPI BaseControlWindowImpl_get_AutoShow(IVideoWindow *iface, LONG *Aut return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_put_WindowState(IVideoWindow *iface, LONG WindowState) +HRESULT WINAPI BaseControlWindowImpl_put_WindowState(IVideoWindow *iface, LONG state) { - struct video_window *This = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface);
- TRACE("(%p/%p)->(%d)\n", This, iface, WindowState); - ShowWindow(This->baseWindow.hWnd, WindowState); + TRACE("window %p, state %#x.\n", window, state); + + ShowWindow(window->hwnd, state); return S_OK; }
@@ -365,7 +289,7 @@ HRESULT WINAPI BaseControlWindowImpl_get_WindowState(IVideoWindow *iface, LONG *
TRACE("window %p, state %p.\n", window, state);
- style = GetWindowLongPtrW(window->baseWindow.hWnd, GWL_STYLE); + style = GetWindowLongPtrW(window->hwnd, GWL_STYLE); if (!(style & WS_VISIBLE)) *state = SW_HIDE; else if (style & WS_MINIMIZE) @@ -396,140 +320,132 @@ HRESULT WINAPI BaseControlWindowImpl_get_BackgroundPalette(IVideoWindow *iface, return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_put_Visible(IVideoWindow *iface, LONG Visible) +HRESULT WINAPI BaseControlWindowImpl_put_Visible(IVideoWindow *iface, LONG visible) { - struct video_window *This = impl_from_IVideoWindow(iface); - - TRACE("(%p/%p)->(%d)\n", This, iface, Visible); + struct video_window *window = impl_from_IVideoWindow(iface);
- ShowWindow(This->baseWindow.hWnd, Visible ? SW_SHOW : SW_HIDE); + TRACE("window %p, visible %d.\n", window, visible);
+ ShowWindow(window->hwnd, visible ? SW_SHOW : SW_HIDE); return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_get_Visible(IVideoWindow *iface, LONG *pVisible) +HRESULT WINAPI BaseControlWindowImpl_get_Visible(IVideoWindow *iface, LONG *visible) { - struct video_window *This = impl_from_IVideoWindow(iface); - - TRACE("(%p/%p)->(%p)\n", This, iface, pVisible); + struct video_window *window = impl_from_IVideoWindow(iface);
- *pVisible = IsWindowVisible(This->baseWindow.hWnd) ? OATRUE : OAFALSE; + TRACE("window %p, visible %p.\n", window, visible);
+ *visible = IsWindowVisible(window->hwnd) ? OATRUE : OAFALSE; return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_put_Left(IVideoWindow *iface, LONG Left) +HRESULT WINAPI BaseControlWindowImpl_put_Left(IVideoWindow *iface, LONG left) { - struct video_window *This = impl_from_IVideoWindow(iface); - RECT WindowPos; + struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
- TRACE("(%p/%p)->(%d)\n", This, iface, Left); + TRACE("window %p, left %d.\n", window, left);
- GetWindowRect(This->baseWindow.hWnd, &WindowPos); - if (!SetWindowPos(This->baseWindow.hWnd, NULL, Left, WindowPos.top, 0, 0, + GetWindowRect(window->hwnd, &rect); + if (!SetWindowPos(window->hwnd, NULL, left, rect.top, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE)) return E_FAIL;
return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_get_Left(IVideoWindow *iface, LONG *pLeft) +HRESULT WINAPI BaseControlWindowImpl_get_Left(IVideoWindow *iface, LONG *left) { - struct video_window *This = impl_from_IVideoWindow(iface); - RECT WindowPos; - - TRACE("(%p/%p)->(%p)\n", This, iface, pLeft); - GetWindowRect(This->baseWindow.hWnd, &WindowPos); + struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
- *pLeft = WindowPos.left; + TRACE("window %p, left %p.\n", window, left);
+ GetWindowRect(window->hwnd, &rect); + *left = rect.left; return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_put_Width(IVideoWindow *iface, LONG Width) +HRESULT WINAPI BaseControlWindowImpl_put_Width(IVideoWindow *iface, LONG width) { - struct video_window *This = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface);
- TRACE("(%p/%p)->(%d)\n", This, iface, Width); + TRACE("window %p, width %d.\n", window, width);
- if (!SetWindowPos(This->baseWindow.hWnd, NULL, 0, 0, Width, This->baseWindow.Height, + if (!SetWindowPos(window->hwnd, NULL, 0, 0, width, window->height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE)) return E_FAIL;
- This->baseWindow.Width = Width; - + window->width = width; return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_get_Width(IVideoWindow *iface, LONG *pWidth) +HRESULT WINAPI BaseControlWindowImpl_get_Width(IVideoWindow *iface, LONG *width) { - struct video_window *This = impl_from_IVideoWindow(iface); - - TRACE("(%p/%p)->(%p)\n", This, iface, pWidth); + struct video_window *window = impl_from_IVideoWindow(iface);
- *pWidth = This->baseWindow.Width; + TRACE("window %p, width %p.\n", window, width);
+ *width = window->width; return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_put_Top(IVideoWindow *iface, LONG Top) +HRESULT WINAPI BaseControlWindowImpl_put_Top(IVideoWindow *iface, LONG top) { - struct video_window *This = impl_from_IVideoWindow(iface); - RECT WindowPos; + struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
- TRACE("(%p/%p)->(%d)\n", This, iface, Top); - GetWindowRect(This->baseWindow.hWnd, &WindowPos); + TRACE("window %p, top %d.\n", window, top);
- if (!SetWindowPos(This->baseWindow.hWnd, NULL, WindowPos.left, Top, 0, 0, + GetWindowRect(window->hwnd, &rect); + if (!SetWindowPos(window->hwnd, NULL, rect.left, top, 0, 0, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSIZE)) return E_FAIL;
return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_get_Top(IVideoWindow *iface, LONG *pTop) +HRESULT WINAPI BaseControlWindowImpl_get_Top(IVideoWindow *iface, LONG *top) { - struct video_window *This = impl_from_IVideoWindow(iface); - RECT WindowPos; - - TRACE("(%p/%p)->(%p)\n", This, iface, pTop); - GetWindowRect(This->baseWindow.hWnd, &WindowPos); + struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
- *pTop = WindowPos.top; + TRACE("window %p, top %p.\n", window, top);
+ GetWindowRect(window->hwnd, &rect); + *top = rect.top; return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_put_Height(IVideoWindow *iface, LONG Height) +HRESULT WINAPI BaseControlWindowImpl_put_Height(IVideoWindow *iface, LONG height) { - struct video_window *This = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface);
- TRACE("(%p/%p)->(%d)\n", This, iface, Height); + TRACE("window %p, height %d.\n", window, height);
- if (!SetWindowPos(This->baseWindow.hWnd, NULL, 0, 0, This->baseWindow.Width, - Height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE)) + if (!SetWindowPos(window->hwnd, NULL, 0, 0, window->width, + height, SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOMOVE)) return E_FAIL;
- This->baseWindow.Height = Height; - + window->height = height; return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_get_Height(IVideoWindow *iface, LONG *pHeight) +HRESULT WINAPI BaseControlWindowImpl_get_Height(IVideoWindow *iface, LONG *height) { - struct video_window *This = impl_from_IVideoWindow(iface); - - TRACE("(%p/%p)->(%p)\n", This, iface, pHeight); + struct video_window *window = impl_from_IVideoWindow(iface);
- *pHeight = This->baseWindow.Height; + TRACE("window %p, height %p.\n", window, height);
+ *height = window->height; return S_OK; }
HRESULT WINAPI BaseControlWindowImpl_put_Owner(IVideoWindow *iface, OAHWND owner) { struct video_window *window = impl_from_IVideoWindow(iface); - HWND hwnd = window->baseWindow.hWnd; + HWND hwnd = window->hwnd;
TRACE("window %p, owner %#lx.\n", window, owner);
@@ -625,39 +541,39 @@ HRESULT WINAPI BaseControlWindowImpl_SetWindowForeground(IVideoWindow *iface, LO
if (!focus) flags |= SWP_NOACTIVATE; - SetWindowPos(window->baseWindow.hWnd, HWND_TOP, 0, 0, 0, 0, flags); + SetWindowPos(window->hwnd, HWND_TOP, 0, 0, 0, 0, flags);
return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_SetWindowPosition(IVideoWindow *iface, LONG Left, LONG Top, LONG Width, LONG Height) +HRESULT WINAPI BaseControlWindowImpl_SetWindowPosition(IVideoWindow *iface, + LONG left, LONG top, LONG width, LONG height) { - struct video_window *This = impl_from_IVideoWindow(iface); + struct video_window *window = impl_from_IVideoWindow(iface);
- TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height); + TRACE("window %p, left %d, top %d, width %d, height %d.\n", window, left, top, width, height);
- if (!SetWindowPos(This->baseWindow.hWnd, NULL, Left, Top, Width, Height, SWP_NOACTIVATE | SWP_NOZORDER)) + if (!SetWindowPos(window->hwnd, NULL, left, top, width, height, SWP_NOACTIVATE | SWP_NOZORDER)) return E_FAIL;
- This->baseWindow.Width = Width; - This->baseWindow.Height = Height; - + window->width = width; + window->height = height; return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_GetWindowPosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight) +HRESULT WINAPI BaseControlWindowImpl_GetWindowPosition(IVideoWindow *iface, + LONG *left, LONG *top, LONG *width, LONG *height) { - struct video_window *This = impl_from_IVideoWindow(iface); - RECT WindowPos; - - TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight); - GetWindowRect(This->baseWindow.hWnd, &WindowPos); + struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
- *pLeft = WindowPos.left; - *pTop = WindowPos.top; - *pWidth = This->baseWindow.Width; - *pHeight = This->baseWindow.Height; + TRACE("window %p, left %p, top %p, width %p, height %p.\n", window, left, top, width, height);
+ GetWindowRect(window->hwnd, &rect); + *left = rect.left; + *top = rect.top; + *width = window->width; + *height = window->height; return S_OK; }
@@ -680,38 +596,36 @@ HRESULT WINAPI BaseControlWindowImpl_NotifyOwnerMessage(IVideoWindow *iface, case WM_PALETTEISCHANGING: case WM_QUERYNEWPALETTE: case WM_SYSCOLORCHANGE: - SendMessageW(window->baseWindow.hWnd, message, wparam, lparam); + SendMessageW(window->hwnd, message, wparam, lparam); break; }
return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_GetMinIdealImageSize(IVideoWindow *iface, LONG *pWidth, LONG *pHeight) +HRESULT WINAPI BaseControlWindowImpl_GetMinIdealImageSize(IVideoWindow *iface, LONG *width, LONG *height) { - struct video_window *This = impl_from_IVideoWindow(iface); - RECT defaultRect; - - TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight); - defaultRect = This->baseWindow.pFuncsTable->pfnGetDefaultRect(&This->baseWindow); + struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
- *pWidth = defaultRect.right - defaultRect.left; - *pHeight = defaultRect.bottom - defaultRect.top; + TRACE("window %p, width %p, height %p.\n", window, width, height);
+ rect = window->ops->get_default_rect(window); + *width = rect.right - rect.left; + *height = rect.bottom - rect.top; return S_OK; }
-HRESULT WINAPI BaseControlWindowImpl_GetMaxIdealImageSize(IVideoWindow *iface, LONG *pWidth, LONG *pHeight) +HRESULT WINAPI BaseControlWindowImpl_GetMaxIdealImageSize(IVideoWindow *iface, LONG *width, LONG *height) { - struct video_window *This = impl_from_IVideoWindow(iface); - RECT defaultRect; - - TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight); - defaultRect = This->baseWindow.pFuncsTable->pfnGetDefaultRect(&This->baseWindow); + struct video_window *window = impl_from_IVideoWindow(iface); + RECT rect;
- *pWidth = defaultRect.right - defaultRect.left; - *pHeight = defaultRect.bottom - defaultRect.top; + TRACE("window %p, width %p, height %p.\n", window, width, height);
+ rect = window->ops->get_default_rect(window); + *width = rect.right - rect.left; + *height = rect.bottom - rect.top; return S_OK; }
@@ -747,3 +661,30 @@ void video_window_unregister_class(void) if (!UnregisterClassW(class_name, NULL) && GetLastError() != ERROR_CLASS_DOES_NOT_EXIST) ERR("Failed to unregister class, error %u.\n", GetLastError()); } + +HRESULT video_window_init(struct video_window *window, const IVideoWindowVtbl *vtbl, + struct strmbase_filter *owner, struct strmbase_pin *pin, const struct video_window_ops *ops) +{ + memset(window, 0, sizeof(*window)); + window->ops = ops; + window->IVideoWindow_iface.lpVtbl = vtbl; + window->AutoShow = OATRUE; + window->pFilter = owner; + window->pPin = pin; + return S_OK; +} + +void video_window_cleanup(struct video_window *window) +{ + if (window->hwnd) + { + /* Media Player Classic deadlocks if WM_PARENTNOTIFY is sent, so clear + * the child style first. Just like Windows, we don't actually unparent + * the window, to prevent extra focus events from being generated since + * it would become top-level for a brief period before being destroyed. */ + SetWindowLongW(window->hwnd, GWL_STYLE, GetWindowLongW(window->hwnd, GWL_STYLE) & ~WS_CHILD); + + SendMessageW(window->hwnd, WM_CLOSE, 0, 0); + window->hwnd = NULL; + } +}