quartz: Implement SetVideoClippingWindow() and PresentImage() in the VMR7 presenter.
This commit is contained in:
parent
69f8118883
commit
e428afe4ae
1 changed files with 55 additions and 4 deletions
|
@ -33,6 +33,8 @@ struct vmr7_presenter
|
|||
|
||||
IDirectDraw7 *ddraw;
|
||||
IDirectDrawSurface7 *frontbuffer;
|
||||
IDirectDrawSurface7 *primary;
|
||||
HWND window;
|
||||
};
|
||||
|
||||
static struct vmr7_presenter *impl_from_IVMRImagePresenter(IVMRImagePresenter *iface)
|
||||
|
@ -82,6 +84,7 @@ static ULONG WINAPI image_presenter_Release(IVMRImagePresenter *iface)
|
|||
{
|
||||
if (presenter->frontbuffer)
|
||||
IDirectDrawSurface7_Release(presenter->frontbuffer);
|
||||
IDirectDrawSurface7_Release(presenter->primary);
|
||||
IDirectDraw7_Release(presenter->ddraw);
|
||||
free(presenter);
|
||||
}
|
||||
|
@ -103,8 +106,31 @@ static HRESULT WINAPI image_presenter_StopPresenting(IVMRImagePresenter *iface,
|
|||
static HRESULT WINAPI image_presenter_PresentImage(IVMRImagePresenter *iface,
|
||||
DWORD_PTR cookie, VMRPRESENTATIONINFO *info)
|
||||
{
|
||||
FIXME("iface %p, cookie %#Ix, info %p, stub!\n", iface, cookie, info);
|
||||
return E_NOTIMPL;
|
||||
struct vmr7_presenter *presenter = impl_from_IVMRImagePresenter(iface);
|
||||
POINT point;
|
||||
HRESULT hr;
|
||||
RECT rect;
|
||||
|
||||
TRACE("iface %p, cookie %#Ix, info %p.\n", iface, cookie, info);
|
||||
|
||||
TRACE("flags %#lx, surface %p, start %s, end %s, aspect ratio %ldx%ld,\n",
|
||||
info->dwFlags, info->lpSurf, debugstr_time(info->rtStart),
|
||||
debugstr_time(info->rtEnd), info->szAspectRatio.cx, info->szAspectRatio.cy);
|
||||
TRACE("src %s, dst %s, type-specific flags %#lx, interlace flags %#lx.\n",
|
||||
wine_dbgstr_rect(&info->rcSrc), wine_dbgstr_rect(&info->rcDst),
|
||||
info->dwTypeSpecificFlags, info->dwInterlaceFlags);
|
||||
|
||||
if (info->dwFlags & VMRSample_SrcDstRectsValid)
|
||||
FIXME("Ignoring src/dst rects.\n");
|
||||
|
||||
GetClientRect(presenter->window, &rect);
|
||||
point.x = point.y = 0;
|
||||
ClientToScreen(presenter->window, &point);
|
||||
OffsetRect(&rect, point.x, point.y);
|
||||
if (FAILED(hr = IDirectDrawSurface7_Blt(presenter->primary, &rect, info->lpSurf, NULL, DDBLT_WAIT, NULL)))
|
||||
ERR("Failed to blit, hr %#lx.\n", hr);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static const IVMRImagePresenterVtbl image_presenter_vtbl =
|
||||
|
@ -310,8 +336,23 @@ static HRESULT WINAPI windowless_control_SetAspectRatioMode(
|
|||
static HRESULT WINAPI windowless_control_SetVideoClippingWindow(
|
||||
IVMRWindowlessControl *iface, HWND window)
|
||||
{
|
||||
FIXME("iface %p, window %p, stub!.\n", iface, window);
|
||||
return E_NOTIMPL;
|
||||
struct vmr7_presenter *presenter = impl_from_IVMRWindowlessControl(iface);
|
||||
IDirectDrawClipper *clipper;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, window %p.\n", iface, window);
|
||||
|
||||
if (FAILED(hr = IDirectDraw7_CreateClipper(presenter->ddraw, 0, &clipper, NULL)))
|
||||
ERR("Failed to create clipper, hr %#lx.\n", hr);
|
||||
if (FAILED(hr = IDirectDrawClipper_SetHWnd(clipper, 0, window)))
|
||||
ERR("Failed to set clip window, hr %#lx.\n", hr);
|
||||
if (FAILED(hr = IDirectDrawSurface7_SetClipper(presenter->primary, clipper)))
|
||||
ERR("Failed to set clipper, hr %#lx.\n", hr);
|
||||
IDirectDrawClipper_Release(clipper);
|
||||
|
||||
presenter->window = window;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI windowless_control_RepaintVideo(
|
||||
|
@ -384,6 +425,13 @@ HRESULT vmr7_presenter_create(IUnknown *outer, IUnknown **out)
|
|||
struct vmr7_presenter *object;
|
||||
HRESULT hr;
|
||||
|
||||
DDSURFACEDESC2 primary_desc =
|
||||
{
|
||||
.dwSize = sizeof(DDSURFACEDESC2),
|
||||
.dwFlags = DDSD_CAPS,
|
||||
.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE,
|
||||
};
|
||||
|
||||
TRACE("outer %p, out %p.\n", outer, out);
|
||||
|
||||
if (outer)
|
||||
|
@ -406,6 +454,9 @@ HRESULT vmr7_presenter_create(IUnknown *outer, IUnknown **out)
|
|||
if (FAILED(hr = IDirectDraw7_SetCooperativeLevel(object->ddraw, NULL, DDSCL_NORMAL)))
|
||||
ERR("Failed to set cooperative level, hr %#lx.\n", hr);
|
||||
|
||||
if (FAILED(hr = IDirectDraw7_CreateSurface(object->ddraw, &primary_desc, &object->primary, NULL)))
|
||||
ERR("Failed to create primary surface, hr %#lx.\n", hr);
|
||||
|
||||
TRACE("Created VMR7 default presenter %p.\n", object);
|
||||
*out = (IUnknown *)&object->IVMRSurfaceAllocator_iface;
|
||||
return S_OK;
|
||||
|
|
Loading…
Add table
Reference in a new issue