2004-08-24 02:28:35 +00:00
|
|
|
/*
|
|
|
|
* Video Renderer (Fullscreen and Windowed using Direct Draw)
|
|
|
|
*
|
|
|
|
* Copyright 2004 Christian Costa
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-08-24 02:28:35 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#define NONAMELESSSTRUCT
|
|
|
|
#define NONAMELESSUNION
|
|
|
|
#include "quartz_private.h"
|
|
|
|
#include "control_private.h"
|
|
|
|
#include "pin.h"
|
|
|
|
|
|
|
|
#include "uuids.h"
|
|
|
|
#include "vfwmsgs.h"
|
|
|
|
#include "amvideo.h"
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "dshow.h"
|
2005-03-02 10:12:12 +00:00
|
|
|
#include "evcode.h"
|
2004-08-24 02:28:35 +00:00
|
|
|
#include "strmif.h"
|
|
|
|
#include "ddraw.h"
|
2008-04-11 22:10:19 +00:00
|
|
|
#include "dvdmedia.h"
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2008-07-26 17:12:32 +00:00
|
|
|
#include <assert.h>
|
2004-08-24 02:28:35 +00:00
|
|
|
#include "wine/unicode.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
static BOOL wnd_class_registered = FALSE;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
|
|
|
|
|
|
|
|
static const IBaseFilterVtbl VideoRenderer_Vtbl;
|
2007-12-13 11:16:27 +00:00
|
|
|
static const IUnknownVtbl IInner_VTable;
|
2005-06-06 19:50:35 +00:00
|
|
|
static const IBasicVideoVtbl IBasicVideo_VTable;
|
|
|
|
static const IVideoWindowVtbl IVideoWindow_VTable;
|
2004-08-24 02:28:35 +00:00
|
|
|
static const IPinVtbl VideoRenderer_InputPin_Vtbl;
|
2010-11-04 16:02:24 +00:00
|
|
|
static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl;
|
2010-11-05 22:19:13 +00:00
|
|
|
static const IQualityControlVtbl VideoRenderer_QualityControl_Vtbl = {
|
|
|
|
QualityControlImpl_QueryInterface,
|
|
|
|
QualityControlImpl_AddRef,
|
|
|
|
QualityControlImpl_Release,
|
|
|
|
QualityControlImpl_Notify,
|
|
|
|
QualityControlImpl_SetSink
|
|
|
|
};
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
typedef struct VideoRendererImpl
|
|
|
|
{
|
2010-10-07 19:47:33 +00:00
|
|
|
BaseFilter filter;
|
2005-06-06 19:50:35 +00:00
|
|
|
const IBasicVideoVtbl * IBasicVideo_vtbl;
|
|
|
|
const IVideoWindowVtbl * IVideoWindow_vtbl;
|
2007-12-13 11:16:27 +00:00
|
|
|
const IUnknownVtbl * IInner_vtbl;
|
2010-11-04 16:02:24 +00:00
|
|
|
const IAMFilterMiscFlagsVtbl *IAMFilterMiscFlags_vtbl;
|
2010-05-22 13:58:15 +00:00
|
|
|
IUnknown *seekthru_unk;
|
2010-11-05 22:19:13 +00:00
|
|
|
QualityControlImpl qcimpl;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-10-05 19:38:11 +00:00
|
|
|
BaseInputPin *pInputPin;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
BOOL init;
|
|
|
|
HANDLE hThread;
|
2008-07-04 08:33:04 +00:00
|
|
|
HANDLE blocked;
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
DWORD ThreadID;
|
|
|
|
HANDLE hEvent;
|
|
|
|
BOOL ThreadResult;
|
|
|
|
HWND hWnd;
|
|
|
|
HWND hWndMsgDrain;
|
2010-11-24 23:11:53 +00:00
|
|
|
HWND hWndOwner;
|
2005-06-13 11:37:55 +00:00
|
|
|
BOOL AutoShow;
|
|
|
|
RECT SourceRect;
|
|
|
|
RECT DestRect;
|
|
|
|
RECT WindowPos;
|
2010-05-19 19:46:50 +00:00
|
|
|
LONG VideoWidth;
|
|
|
|
LONG VideoHeight;
|
2007-12-13 11:16:27 +00:00
|
|
|
IUnknown * pUnkOuter;
|
|
|
|
BOOL bUnkOuterValid;
|
|
|
|
BOOL bAggregatable;
|
2010-09-24 13:53:14 +00:00
|
|
|
LONG WindowStyle;
|
2008-06-10 16:45:25 +00:00
|
|
|
|
|
|
|
/* During pause we can hold a single sample, for use in GetCurrentImage */
|
|
|
|
IMediaSample *sample_held;
|
2004-08-24 02:28:35 +00:00
|
|
|
} VideoRendererImpl;
|
|
|
|
|
2010-12-03 08:38:13 +00:00
|
|
|
static LRESULT CALLBACK VideoWndProcW(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
2005-06-13 11:37:55 +00:00
|
|
|
{
|
2009-01-08 16:30:57 +00:00
|
|
|
VideoRendererImpl* pVideoRenderer = (VideoRendererImpl*)GetWindowLongPtrW(hwnd, 0);
|
2005-06-13 11:37:55 +00:00
|
|
|
LPRECT lprect = (LPRECT)lParam;
|
|
|
|
|
|
|
|
if (pVideoRenderer && pVideoRenderer->hWndMsgDrain)
|
|
|
|
{
|
|
|
|
switch(uMsg)
|
|
|
|
{
|
|
|
|
case WM_KEYDOWN:
|
|
|
|
case WM_KEYUP:
|
|
|
|
case WM_LBUTTONDBLCLK:
|
|
|
|
case WM_LBUTTONDOWN:
|
|
|
|
case WM_LBUTTONUP:
|
|
|
|
case WM_MBUTTONDBLCLK:
|
|
|
|
case WM_MBUTTONDOWN:
|
|
|
|
case WM_MBUTTONUP:
|
|
|
|
case WM_MOUSEACTIVATE:
|
|
|
|
case WM_MOUSEMOVE:
|
|
|
|
case WM_NCLBUTTONDBLCLK:
|
|
|
|
case WM_NCLBUTTONDOWN:
|
|
|
|
case WM_NCLBUTTONUP:
|
|
|
|
case WM_NCMBUTTONDBLCLK:
|
|
|
|
case WM_NCMBUTTONDOWN:
|
|
|
|
case WM_NCMBUTTONUP:
|
|
|
|
case WM_NCMOUSEMOVE:
|
|
|
|
case WM_NCRBUTTONDBLCLK:
|
|
|
|
case WM_NCRBUTTONDOWN:
|
|
|
|
case WM_NCRBUTTONUP:
|
|
|
|
case WM_RBUTTONDBLCLK:
|
|
|
|
case WM_RBUTTONDOWN:
|
|
|
|
case WM_RBUTTONUP:
|
2010-12-03 08:38:13 +00:00
|
|
|
PostMessageW(pVideoRenderer->hWndMsgDrain, uMsg, wParam, lParam);
|
2005-06-13 11:37:55 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(uMsg)
|
|
|
|
{
|
|
|
|
case WM_SIZING:
|
2006-10-12 18:57:23 +00:00
|
|
|
/* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */
|
2005-06-13 11:37:55 +00:00
|
|
|
SetWindowPos(hwnd, NULL, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top, SWP_NOZORDER);
|
|
|
|
GetClientRect(hwnd, &pVideoRenderer->DestRect);
|
2007-06-19 16:47:32 +00:00
|
|
|
TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
|
|
|
|
pVideoRenderer->DestRect.left,
|
|
|
|
pVideoRenderer->DestRect.top,
|
|
|
|
pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
|
|
|
|
pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
|
|
|
|
return TRUE;
|
|
|
|
case WM_SIZE:
|
|
|
|
TRACE("WM_SIZE %d %d\n", LOWORD(lParam), HIWORD(lParam));
|
|
|
|
GetClientRect(hwnd, &pVideoRenderer->DestRect);
|
|
|
|
TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n",
|
|
|
|
pVideoRenderer->DestRect.left,
|
|
|
|
pVideoRenderer->DestRect.top,
|
|
|
|
pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left,
|
|
|
|
pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top);
|
2005-06-13 11:37:55 +00:00
|
|
|
return TRUE;
|
|
|
|
default:
|
2010-12-03 08:38:13 +00:00
|
|
|
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
|
2005-06-13 11:37:55 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-12-03 08:38:13 +00:00
|
|
|
static const WCHAR classnameW[] = { 'W','i','n','e',' ','A','c','t','i','v','e','M','o','v','i','e',' ','C','l','a','s','s',0 };
|
|
|
|
static const WCHAR windownameW[] = { 'A','c','t','i','v','e','M','o','v','i','e',' ','W','i','n','d','o','w',0 };
|
|
|
|
|
2010-11-29 09:44:16 +00:00
|
|
|
static BOOL video_register_windowclass(void) {
|
2010-12-03 08:38:13 +00:00
|
|
|
WNDCLASSW winclass;
|
2010-11-29 09:44:16 +00:00
|
|
|
if (wnd_class_registered)
|
|
|
|
return 1;
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
winclass.style = 0;
|
2010-12-03 08:38:13 +00:00
|
|
|
winclass.lpfnWndProc = VideoWndProcW;
|
2005-06-13 11:37:55 +00:00
|
|
|
winclass.cbClsExtra = 0;
|
|
|
|
winclass.cbWndExtra = sizeof(VideoRendererImpl*);
|
|
|
|
winclass.hInstance = NULL;
|
|
|
|
winclass.hIcon = NULL;
|
|
|
|
winclass.hCursor = NULL;
|
2005-10-10 10:44:54 +00:00
|
|
|
winclass.hbrBackground = GetStockObject(BLACK_BRUSH);
|
2005-06-13 11:37:55 +00:00
|
|
|
winclass.lpszMenuName = NULL;
|
2010-12-03 08:38:13 +00:00
|
|
|
winclass.lpszClassName = classnameW;
|
|
|
|
if (!RegisterClassW(&winclass))
|
2005-06-13 11:37:55 +00:00
|
|
|
{
|
2010-11-29 09:44:16 +00:00
|
|
|
ERR("Unable to register window class: %u\n", GetLastError());
|
|
|
|
return FALSE;
|
2005-06-13 11:37:55 +00:00
|
|
|
}
|
2010-11-29 09:44:16 +00:00
|
|
|
wnd_class_registered = 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void video_unregister_windowclass(void) {
|
|
|
|
if (!wnd_class_registered)
|
|
|
|
return;
|
2010-12-03 08:38:13 +00:00
|
|
|
UnregisterClassW(classnameW, NULL);
|
2010-11-29 09:44:16 +00:00
|
|
|
}
|
2005-06-13 11:37:55 +00:00
|
|
|
|
2010-11-29 09:44:16 +00:00
|
|
|
static BOOL CreateRenderingWindow(VideoRendererImpl* This)
|
|
|
|
{
|
|
|
|
TRACE("(%p)->()\n", This);
|
|
|
|
if (!video_register_windowclass())
|
|
|
|
return FALSE;
|
2010-12-03 08:38:13 +00:00
|
|
|
This->hWnd = CreateWindowExW(0, classnameW, windownameW, WS_SIZEBOX,
|
2005-06-13 11:37:55 +00:00
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL,
|
|
|
|
NULL, NULL, NULL);
|
|
|
|
|
|
|
|
if (!This->hWnd)
|
|
|
|
{
|
|
|
|
ERR("Unable to create window\n");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2009-01-08 16:30:57 +00:00
|
|
|
SetWindowLongPtrW(This->hWnd, 0, (LONG_PTR)This);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD WINAPI MessageLoop(LPVOID lpParameter)
|
|
|
|
{
|
2009-01-29 10:14:55 +00:00
|
|
|
VideoRendererImpl* This = lpParameter;
|
2005-06-13 11:37:55 +00:00
|
|
|
MSG msg;
|
|
|
|
BOOL fGotMessage;
|
|
|
|
|
|
|
|
TRACE("Starting message loop\n");
|
|
|
|
|
|
|
|
if (!CreateRenderingWindow(This))
|
|
|
|
{
|
|
|
|
This->ThreadResult = FALSE;
|
|
|
|
SetEvent(This->hEvent);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
This->ThreadResult = TRUE;
|
|
|
|
SetEvent(This->hEvent);
|
|
|
|
|
2010-12-03 08:38:13 +00:00
|
|
|
while ((fGotMessage = GetMessageW(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1)
|
2005-06-13 11:37:55 +00:00
|
|
|
{
|
|
|
|
TranslateMessage(&msg);
|
2010-12-03 08:38:13 +00:00
|
|
|
DispatchMessageW(&msg);
|
2005-06-13 11:37:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("End of message loop\n");
|
|
|
|
|
|
|
|
return msg.wParam;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CreateRenderingSubsystem(VideoRendererImpl* This)
|
|
|
|
{
|
2008-07-04 08:33:04 +00:00
|
|
|
This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
|
2005-06-13 11:37:55 +00:00
|
|
|
if (!This->hEvent)
|
|
|
|
return FALSE;
|
|
|
|
|
2009-01-29 10:14:55 +00:00
|
|
|
This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID);
|
2005-06-13 11:37:55 +00:00
|
|
|
if (!This->hThread)
|
|
|
|
{
|
|
|
|
CloseHandle(This->hEvent);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
WaitForSingleObject(This->hEvent, INFINITE);
|
|
|
|
|
|
|
|
if (!This->ThreadResult)
|
|
|
|
{
|
2008-07-04 08:33:04 +00:00
|
|
|
CloseHandle(This->hEvent);
|
2005-06-13 11:37:55 +00:00
|
|
|
CloseHandle(This->hThread);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-11-11 13:03:29 +00:00
|
|
|
static void VideoRenderer_AutoShowWindow(VideoRendererImpl *This) {
|
|
|
|
if (!This->init && (!This->WindowPos.right || !This->WindowPos.top))
|
|
|
|
{
|
|
|
|
DWORD style = GetWindowLongW(This->hWnd, GWL_STYLE);
|
|
|
|
DWORD style_ex = GetWindowLongW(This->hWnd, GWL_EXSTYLE);
|
|
|
|
|
|
|
|
if (!This->WindowPos.right)
|
|
|
|
{
|
|
|
|
This->WindowPos.left = This->SourceRect.left;
|
|
|
|
This->WindowPos.right = This->SourceRect.right;
|
|
|
|
}
|
|
|
|
if (!This->WindowPos.bottom)
|
|
|
|
{
|
|
|
|
This->WindowPos.top = This->SourceRect.top;
|
|
|
|
This->WindowPos.bottom = This->SourceRect.bottom;
|
|
|
|
}
|
|
|
|
|
|
|
|
AdjustWindowRectEx(&This->WindowPos, style, TRUE, style_ex);
|
|
|
|
|
|
|
|
TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom);
|
|
|
|
SetWindowPos(This->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->hWnd, &This->DestRect);
|
|
|
|
}
|
|
|
|
else if (!This->init)
|
|
|
|
This->DestRect = This->WindowPos;
|
|
|
|
This->init = TRUE;
|
|
|
|
if (This->AutoShow)
|
|
|
|
ShowWindow(This->hWnd, SW_SHOW);
|
|
|
|
}
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size)
|
|
|
|
{
|
|
|
|
AM_MEDIA_TYPE amt;
|
|
|
|
HRESULT hr = S_OK;
|
2008-04-25 21:25:49 +00:00
|
|
|
DDSURFACEDESC sdesc;
|
2005-06-13 11:37:55 +00:00
|
|
|
HDC hDC;
|
2008-04-11 22:10:19 +00:00
|
|
|
BITMAPINFOHEADER *bmiHeader;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2008-12-29 11:00:10 +00:00
|
|
|
TRACE("(%p)->(%p, %d)\n", This, data, size);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2008-04-25 21:25:49 +00:00
|
|
|
sdesc.dwSize = sizeof(sdesc);
|
|
|
|
hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt);
|
2004-08-24 02:28:35 +00:00
|
|
|
if (FAILED(hr)) {
|
2005-06-13 11:37:55 +00:00
|
|
|
ERR("Unable to retrieve media type\n");
|
|
|
|
return hr;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
2008-04-11 22:10:19 +00:00
|
|
|
|
|
|
|
if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo))
|
|
|
|
{
|
|
|
|
bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2))
|
|
|
|
{
|
|
|
|
bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype));
|
|
|
|
return VFW_E_RUNTIME_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("biSize = %d\n", bmiHeader->biSize);
|
|
|
|
TRACE("biWidth = %d\n", bmiHeader->biWidth);
|
|
|
|
TRACE("biHeight = %d\n", bmiHeader->biHeight);
|
|
|
|
TRACE("biPlanes = %d\n", bmiHeader->biPlanes);
|
|
|
|
TRACE("biBitCount = %d\n", bmiHeader->biBitCount);
|
|
|
|
TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4));
|
|
|
|
TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
hDC = GetDC(This->hWnd);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
if (!hDC) {
|
|
|
|
ERR("Cannot get DC from window!\n");
|
|
|
|
return E_FAIL;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom);
|
|
|
|
TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left,
|
|
|
|
This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top,
|
|
|
|
This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top,
|
2008-04-11 22:10:19 +00:00
|
|
|
data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
ReleaseDC(This->hWnd, hDC);
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-10-13 16:02:01 +00:00
|
|
|
static HRESULT WINAPI VideoRenderer_Receive(BaseInputPin* pin, IMediaSample * pSample)
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
2010-10-05 19:38:11 +00:00
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
|
2004-08-24 02:28:35 +00:00
|
|
|
LPBYTE pbSrcStream = NULL;
|
2010-05-19 23:14:09 +00:00
|
|
|
LONG cbSrcStream = 0;
|
2004-08-24 02:28:35 +00:00
|
|
|
REFERENCE_TIME tStart, tStop;
|
|
|
|
HRESULT hr;
|
2008-12-02 19:29:48 +00:00
|
|
|
|
2010-10-13 16:02:01 +00:00
|
|
|
TRACE("(%p)->(%p)\n", pin, pSample);
|
2008-12-29 11:00:10 +00:00
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
2008-12-02 19:29:48 +00:00
|
|
|
|
2008-07-04 23:59:22 +00:00
|
|
|
if (This->pInputPin->flushing || This->pInputPin->end_of_stream)
|
2008-12-02 19:29:48 +00:00
|
|
|
{
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-12-02 19:29:48 +00:00
|
|
|
return S_FALSE;
|
|
|
|
}
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
if (This->filter.state == State_Stopped)
|
2008-07-04 23:59:22 +00:00
|
|
|
{
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-07-03 03:09:33 +00:00
|
|
|
return VFW_E_WRONG_STATE;
|
2008-07-04 23:59:22 +00:00
|
|
|
}
|
2008-04-16 21:24:34 +00:00
|
|
|
|
2010-11-09 22:42:39 +00:00
|
|
|
if (IMediaSample_GetMediaTime(pSample, &tStart, &tStop) == S_OK)
|
|
|
|
MediaSeekingPassThru_RegisterMediaTime(This->seekthru_unk, tStart);
|
|
|
|
|
2008-04-17 18:16:13 +00:00
|
|
|
/* Preroll means the sample isn't shown, this is used for key frames and things like that */
|
2010-11-09 22:42:50 +00:00
|
|
|
if (IMediaSample_IsPreroll(pSample) == S_OK) {
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-04-17 18:16:13 +00:00
|
|
|
return S_OK;
|
2008-04-28 22:00:51 +00:00
|
|
|
}
|
2008-04-17 18:16:13 +00:00
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
hr = IMediaSample_GetPointer(pSample, &pbSrcStream);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
2006-10-12 18:57:23 +00:00
|
|
|
ERR("Cannot get pointer to sample data (%x)\n", hr);
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2005-06-13 11:37:55 +00:00
|
|
|
return hr;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cbSrcStream = IMediaSample_GetActualDataLength(pSample);
|
|
|
|
|
2010-05-19 23:14:09 +00:00
|
|
|
TRACE("val %p %d\n", pbSrcStream, cbSrcStream);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
#if 0 /* For debugging purpose */
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for(i = 0; i < cbSrcStream; i++)
|
|
|
|
{
|
2005-06-13 11:37:55 +00:00
|
|
|
if ((i!=0) && !(i%16))
|
2005-09-25 15:23:21 +00:00
|
|
|
TRACE("\n");
|
|
|
|
TRACE("%02x ", pbSrcStream[i]);
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
2005-09-25 15:23:21 +00:00
|
|
|
TRACE("\n");
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
|
|
|
#endif
|
2008-04-25 21:25:49 +00:00
|
|
|
|
2008-07-04 08:33:04 +00:00
|
|
|
SetEvent(This->hEvent);
|
2010-10-07 19:47:33 +00:00
|
|
|
if (This->filter.state == State_Paused)
|
2008-06-10 16:45:25 +00:00
|
|
|
{
|
2010-11-09 22:42:50 +00:00
|
|
|
VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
|
2008-06-10 16:45:25 +00:00
|
|
|
This->sample_held = pSample;
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-07-04 08:33:04 +00:00
|
|
|
WaitForSingleObject(This->blocked, INFINITE);
|
2010-10-07 19:47:33 +00:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
2010-12-10 15:06:56 +00:00
|
|
|
SetEvent(This->hEvent);
|
2008-07-04 08:33:04 +00:00
|
|
|
This->sample_held = NULL;
|
2010-10-07 19:47:33 +00:00
|
|
|
if (This->filter.state == State_Paused)
|
2008-07-04 23:59:22 +00:00
|
|
|
{
|
2008-07-04 08:33:04 +00:00
|
|
|
/* Flushing */
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-07-04 08:33:04 +00:00
|
|
|
return S_OK;
|
2008-07-04 23:59:22 +00:00
|
|
|
}
|
2010-10-07 19:47:33 +00:00
|
|
|
if (This->filter.state == State_Stopped)
|
2008-07-04 23:59:22 +00:00
|
|
|
{
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-07-04 08:33:04 +00:00
|
|
|
return VFW_E_WRONG_STATE;
|
2008-07-04 23:59:22 +00:00
|
|
|
}
|
2010-11-09 22:42:50 +00:00
|
|
|
} else {
|
|
|
|
hr = QualityControlRender_WaitFor(&This->qcimpl, pSample, This->blocked);
|
|
|
|
if (hr == S_OK) {
|
|
|
|
QualityControlRender_BeginRender(&This->qcimpl);
|
|
|
|
VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream);
|
|
|
|
QualityControlRender_EndRender(&This->qcimpl);
|
2008-04-28 22:00:51 +00:00
|
|
|
}
|
2010-11-09 22:42:50 +00:00
|
|
|
QualityControlRender_DoQOS(&This->qcimpl);
|
2008-04-28 22:00:51 +00:00
|
|
|
}
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-10-13 16:02:01 +00:00
|
|
|
static HRESULT WINAPI VideoRenderer_CheckMediaType(BasePin *iface, const AM_MEDIA_TYPE * pmt)
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
2010-10-05 19:38:11 +00:00
|
|
|
BaseInputPin* pin = (BaseInputPin*)iface;
|
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)pin->pin.pinInfo.pFilter;
|
|
|
|
|
2005-10-10 10:44:54 +00:00
|
|
|
if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video))
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) ||
|
|
|
|
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) ||
|
|
|
|
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) ||
|
|
|
|
IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8))
|
2005-06-13 11:37:55 +00:00
|
|
|
{
|
2010-05-19 19:46:50 +00:00
|
|
|
LONG height;
|
2005-10-10 10:44:54 +00:00
|
|
|
|
2008-04-11 22:10:19 +00:00
|
|
|
if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo))
|
|
|
|
{
|
|
|
|
VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat;
|
|
|
|
This->SourceRect.left = 0;
|
|
|
|
This->SourceRect.top = 0;
|
|
|
|
This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth;
|
2010-05-19 19:46:50 +00:00
|
|
|
height = format->bmiHeader.biHeight;
|
|
|
|
if (height < 0)
|
|
|
|
This->SourceRect.bottom = This->VideoHeight = -height;
|
|
|
|
else
|
|
|
|
This->SourceRect.bottom = This->VideoHeight = height;
|
2008-04-11 22:10:19 +00:00
|
|
|
}
|
|
|
|
else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2))
|
|
|
|
{
|
|
|
|
VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat;
|
|
|
|
|
|
|
|
This->SourceRect.left = 0;
|
|
|
|
This->SourceRect.top = 0;
|
|
|
|
This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth;
|
2010-05-19 19:46:50 +00:00
|
|
|
height = format2->bmiHeader.biHeight;
|
|
|
|
if (height < 0)
|
|
|
|
This->SourceRect.bottom = This->VideoHeight = -height;
|
|
|
|
else
|
|
|
|
This->SourceRect.bottom = This->VideoHeight = height;
|
2008-04-11 22:10:19 +00:00
|
|
|
}
|
|
|
|
else
|
2005-10-10 10:44:54 +00:00
|
|
|
{
|
|
|
|
WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype));
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
2005-06-13 11:37:55 +00:00
|
|
|
}
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
2010-10-13 16:02:01 +00:00
|
|
|
static IPin* WINAPI VideoRenderer_GetPin(BaseFilter *iface, int pos)
|
2010-10-07 19:48:01 +00:00
|
|
|
{
|
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
|
|
|
|
|
|
|
if (pos >= 1 || pos < 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
IPin_AddRef((IPin *)This->pInputPin);
|
|
|
|
return (IPin *)This->pInputPin;
|
|
|
|
}
|
|
|
|
|
2010-10-13 16:02:01 +00:00
|
|
|
static LONG WINAPI VideoRenderer_GetPinCount(BaseFilter *iface)
|
2010-10-07 19:48:01 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-10-13 16:02:01 +00:00
|
|
|
static const BaseFilterFuncTable BaseFuncTable = {
|
|
|
|
VideoRenderer_GetPin,
|
|
|
|
VideoRenderer_GetPinCount
|
|
|
|
};
|
|
|
|
|
|
|
|
static const BasePinFuncTable input_BaseFuncTable = {
|
|
|
|
VideoRenderer_CheckMediaType,
|
2010-10-13 16:02:08 +00:00
|
|
|
NULL,
|
|
|
|
BasePinImpl_GetMediaTypeVersion,
|
|
|
|
BasePinImpl_GetMediaType
|
2010-10-13 16:02:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const BaseInputPinFuncTable input_BaseInputFuncTable = {
|
|
|
|
VideoRenderer_Receive
|
|
|
|
};
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
PIN_INFO piInput;
|
|
|
|
VideoRendererImpl * pVideoRenderer;
|
2010-05-22 13:58:15 +00:00
|
|
|
ISeekingPassThru *passthru;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
TRACE("(%p, %p)\n", pUnkOuter, ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl));
|
2007-12-13 11:16:27 +00:00
|
|
|
pVideoRenderer->pUnkOuter = pUnkOuter;
|
|
|
|
pVideoRenderer->bUnkOuterValid = FALSE;
|
|
|
|
pVideoRenderer->bAggregatable = FALSE;
|
|
|
|
pVideoRenderer->IInner_vtbl = &IInner_VTable;
|
2010-11-04 16:02:24 +00:00
|
|
|
pVideoRenderer->IAMFilterMiscFlags_vtbl = &IAMFilterMiscFlags_Vtbl;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-10-13 16:02:01 +00:00
|
|
|
BaseFilter_Init(&pVideoRenderer->filter, &VideoRenderer_Vtbl, &CLSID_VideoRenderer, (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"), &BaseFuncTable);
|
2010-10-07 19:47:33 +00:00
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable;
|
|
|
|
pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable;
|
2010-10-07 19:47:33 +00:00
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
pVideoRenderer->init = 0;
|
2005-06-13 11:37:55 +00:00
|
|
|
pVideoRenderer->AutoShow = 1;
|
2008-05-21 22:48:32 +00:00
|
|
|
ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT));
|
|
|
|
ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT));
|
|
|
|
ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT));
|
2010-11-24 23:11:53 +00:00
|
|
|
pVideoRenderer->hWndMsgDrain = pVideoRenderer->hWndOwner = NULL;
|
2010-09-24 13:53:14 +00:00
|
|
|
pVideoRenderer->WindowStyle = WS_OVERLAPPED;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
/* construct input pin */
|
|
|
|
piInput.dir = PINDIR_INPUT;
|
|
|
|
piInput.pFilter = (IBaseFilter *)pVideoRenderer;
|
2005-03-28 14:17:51 +00:00
|
|
|
lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0]));
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-10-13 16:02:01 +00:00
|
|
|
hr = BaseInputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, &input_BaseFuncTable, &input_BaseInputFuncTable, &pVideoRenderer->filter.csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2010-05-22 13:58:15 +00:00
|
|
|
hr = CoCreateInstance(&CLSID_SeekingPassThru, pUnkOuter ? pUnkOuter : (IUnknown*)&pVideoRenderer->IInner_vtbl, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void**)&pVideoRenderer->seekthru_unk);
|
|
|
|
if (FAILED(hr)) {
|
|
|
|
IPin_Release((IPin*)pVideoRenderer->pInputPin);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
IUnknown_QueryInterface(pVideoRenderer->seekthru_unk, &IID_ISeekingPassThru, (void**)&passthru);
|
|
|
|
ISeekingPassThru_Init(passthru, TRUE, (IPin*)pVideoRenderer->pInputPin);
|
|
|
|
ISeekingPassThru_Release(passthru);
|
2008-06-10 16:45:25 +00:00
|
|
|
pVideoRenderer->sample_held = NULL;
|
2009-01-29 10:14:55 +00:00
|
|
|
*ppv = pVideoRenderer;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
2010-05-22 13:58:15 +00:00
|
|
|
if (FAILED(hr))
|
|
|
|
goto fail;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-11-05 22:19:13 +00:00
|
|
|
QualityControlImpl_init(&pVideoRenderer->qcimpl, (IPin*)pVideoRenderer->pInputPin, (IBaseFilter*)pVideoRenderer);
|
|
|
|
pVideoRenderer->qcimpl.lpVtbl = &VideoRenderer_QualityControl_Vtbl;
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
if (!CreateRenderingSubsystem(pVideoRenderer))
|
|
|
|
return E_FAIL;
|
2008-07-04 08:33:04 +00:00
|
|
|
|
|
|
|
pVideoRenderer->blocked = CreateEventW(NULL, FALSE, FALSE, NULL);
|
|
|
|
if (!pVideoRenderer->blocked)
|
|
|
|
{
|
|
|
|
hr = HRESULT_FROM_WIN32(GetLastError());
|
|
|
|
IUnknown_Release((IUnknown *)pVideoRenderer);
|
|
|
|
}
|
|
|
|
|
2010-05-22 13:58:15 +00:00
|
|
|
return hr;
|
|
|
|
fail:
|
2010-10-07 19:47:33 +00:00
|
|
|
BaseFilterImpl_Release((IBaseFilter*)pVideoRenderer);
|
2010-05-22 13:58:15 +00:00
|
|
|
CoTaskMemFree(pVideoRenderer);
|
2004-08-24 02:28:35 +00:00
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2008-02-02 09:47:34 +00:00
|
|
|
HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv)
|
|
|
|
{
|
2008-04-11 02:17:14 +00:00
|
|
|
/* TODO: Attempt to use the VMR-7 renderer instead when possible */
|
2008-02-02 09:47:34 +00:00
|
|
|
return VideoRenderer_create(pUnkOuter, ppv);
|
|
|
|
}
|
|
|
|
|
2007-12-13 23:05:58 +00:00
|
|
|
static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv)
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
2007-12-13 11:16:27 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
|
2004-08-24 02:28:35 +00:00
|
|
|
TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
|
|
|
|
|
2007-12-13 11:16:27 +00:00
|
|
|
if (This->bAggregatable)
|
|
|
|
This->bUnkOuterValid = TRUE;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown))
|
2009-01-29 10:14:55 +00:00
|
|
|
*ppv = &This->IInner_vtbl;
|
2004-08-24 02:28:35 +00:00
|
|
|
else if (IsEqualIID(riid, &IID_IPersist))
|
2009-01-29 10:14:55 +00:00
|
|
|
*ppv = This;
|
2004-08-24 02:28:35 +00:00
|
|
|
else if (IsEqualIID(riid, &IID_IMediaFilter))
|
2009-01-29 10:14:55 +00:00
|
|
|
*ppv = This;
|
2004-08-24 02:28:35 +00:00
|
|
|
else if (IsEqualIID(riid, &IID_IBaseFilter))
|
2009-01-29 10:14:55 +00:00
|
|
|
*ppv = This;
|
2004-08-24 02:28:35 +00:00
|
|
|
else if (IsEqualIID(riid, &IID_IBasicVideo))
|
2009-01-29 10:14:55 +00:00
|
|
|
*ppv = &This->IBasicVideo_vtbl;
|
2004-08-24 02:28:35 +00:00
|
|
|
else if (IsEqualIID(riid, &IID_IVideoWindow))
|
2009-01-29 10:14:55 +00:00
|
|
|
*ppv = &This->IVideoWindow_vtbl;
|
2008-06-10 16:40:09 +00:00
|
|
|
else if (IsEqualIID(riid, &IID_IMediaSeeking))
|
2010-05-22 13:58:15 +00:00
|
|
|
return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
|
2010-11-04 16:02:24 +00:00
|
|
|
else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
|
|
|
|
*ppv = &This->IAMFilterMiscFlags_vtbl;
|
2010-11-05 22:19:13 +00:00
|
|
|
else if (IsEqualIID(riid, &IID_IQualityControl))
|
|
|
|
*ppv = &This->qcimpl;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
if (*ppv)
|
|
|
|
{
|
|
|
|
IUnknown_AddRef((IUnknown *)(*ppv));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2008-03-21 22:36:51 +00:00
|
|
|
if (!IsEqualIID(riid, &IID_IPin))
|
|
|
|
FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2007-12-13 23:05:58 +00:00
|
|
|
static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface)
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
2007-12-13 11:16:27 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
|
2010-10-07 19:47:33 +00:00
|
|
|
ULONG refCount = InterlockedIncrement(&This->filter.refCount);
|
2004-12-27 17:15:58 +00:00
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1);
|
2004-12-27 17:15:58 +00:00
|
|
|
|
2005-01-06 19:36:47 +00:00
|
|
|
return refCount;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
|
|
|
|
2007-12-13 23:05:58 +00:00
|
|
|
static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface)
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
2007-12-13 11:16:27 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface);
|
2010-10-07 19:47:33 +00:00
|
|
|
ULONG refCount = InterlockedDecrement(&This->filter.refCount);
|
2004-12-27 17:15:58 +00:00
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1);
|
2004-12-27 17:15:58 +00:00
|
|
|
|
2005-01-06 19:36:47 +00:00
|
|
|
if (!refCount)
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
2007-03-13 17:47:47 +00:00
|
|
|
IPin *pConnectedTo;
|
|
|
|
|
2010-12-03 08:38:10 +00:00
|
|
|
if (This->hWnd)
|
|
|
|
SendMessageW(This->hWnd, WM_CLOSE, 0, 0);
|
2010-12-03 08:38:13 +00:00
|
|
|
PostThreadMessageW(This->ThreadID, WM_QUIT, 0, 0);
|
2005-06-13 11:37:55 +00:00
|
|
|
WaitForSingleObject(This->hThread, INFINITE);
|
|
|
|
CloseHandle(This->hThread);
|
2008-07-04 08:33:04 +00:00
|
|
|
CloseHandle(This->hEvent);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
2008-04-25 21:25:49 +00:00
|
|
|
if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo)))
|
2007-03-13 17:47:47 +00:00
|
|
|
{
|
|
|
|
IPin_Disconnect(pConnectedTo);
|
|
|
|
IPin_Release(pConnectedTo);
|
|
|
|
}
|
2008-04-25 21:25:49 +00:00
|
|
|
IPin_Disconnect((IPin *)This->pInputPin);
|
|
|
|
|
|
|
|
IPin_Release((IPin *)This->pInputPin);
|
2007-03-13 17:47:47 +00:00
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
This->filter.lpVtbl = NULL;
|
2010-05-22 13:58:15 +00:00
|
|
|
IUnknown_Release(This->seekthru_unk);
|
2010-10-07 19:47:33 +00:00
|
|
|
This->filter.csFilter.DebugInfo->Spare[0] = 0;
|
|
|
|
DeleteCriticalSection(&This->filter.csFilter);
|
2007-03-19 20:26:09 +00:00
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
TRACE("Destroying Video Renderer\n");
|
|
|
|
CoTaskMemFree(This);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else
|
2005-01-06 19:36:47 +00:00
|
|
|
return refCount;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
|
|
|
|
2007-12-13 11:16:27 +00:00
|
|
|
static const IUnknownVtbl IInner_VTable =
|
|
|
|
{
|
2007-12-13 23:05:58 +00:00
|
|
|
VideoRendererInner_QueryInterface,
|
|
|
|
VideoRendererInner_AddRef,
|
|
|
|
VideoRendererInner_Release
|
2007-12-13 11:16:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
|
|
|
|
|
|
|
if (This->bAggregatable)
|
|
|
|
This->bUnkOuterValid = TRUE;
|
|
|
|
|
|
|
|
if (This->pUnkOuter)
|
|
|
|
{
|
|
|
|
if (This->bAggregatable)
|
|
|
|
return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv);
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown))
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
|
|
|
|
hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
|
|
|
|
IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
|
|
|
|
This->bAggregatable = TRUE;
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
|
|
|
|
|
|
|
if (This->pUnkOuter && This->bUnkOuterValid)
|
|
|
|
return IUnknown_AddRef(This->pUnkOuter);
|
|
|
|
return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl));
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface)
|
|
|
|
{
|
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
|
|
|
|
|
|
|
if (This->pUnkOuter && This->bUnkOuterValid)
|
|
|
|
return IUnknown_Release(This->pUnkOuter);
|
|
|
|
return IUnknown_Release((IUnknown *)&(This->IInner_vtbl));
|
|
|
|
}
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
/** IMediaFilter methods **/
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface)
|
|
|
|
{
|
2004-09-08 01:50:37 +00:00
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
2010-10-07 19:47:33 +00:00
|
|
|
This->filter.state = State_Stopped;
|
2008-07-04 08:33:04 +00:00
|
|
|
SetEvent(This->hEvent);
|
|
|
|
SetEvent(This->blocked);
|
2010-05-22 13:58:15 +00:00
|
|
|
MediaSeekingPassThru_ResetMediaTime(This->seekthru_unk);
|
2010-11-11 13:03:29 +00:00
|
|
|
if (This->AutoShow)
|
|
|
|
/* Black it out */
|
|
|
|
RedrawWindow(This->hWnd, NULL, NULL, RDW_INVALIDATE|RDW_ERASE);
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-06-10 16:45:25 +00:00
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface)
|
|
|
|
{
|
2004-09-08 01:50:37 +00:00
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
|
|
|
if (This->filter.state != State_Paused)
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
2010-10-07 19:47:33 +00:00
|
|
|
if (This->filter.state == State_Stopped)
|
2008-07-04 08:33:04 +00:00
|
|
|
{
|
2008-04-04 23:27:29 +00:00
|
|
|
This->pInputPin->end_of_stream = 0;
|
2008-07-04 08:33:04 +00:00
|
|
|
ResetEvent(This->hEvent);
|
2010-11-11 13:03:29 +00:00
|
|
|
VideoRenderer_AutoShowWindow(This);
|
2008-07-04 08:33:04 +00:00
|
|
|
}
|
2008-04-04 23:27:29 +00:00
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
This->filter.state = State_Paused;
|
2008-07-04 08:33:04 +00:00
|
|
|
ResetEvent(This->blocked);
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2010-11-09 22:42:50 +00:00
|
|
|
static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock) {
|
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
|
|
|
QualityControlRender_SetClock(&This->qcimpl, clock);
|
|
|
|
hr = BaseFilterImpl_SetSyncSource(iface, clock);
|
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
|
|
|
|
{
|
2010-11-04 16:02:23 +00:00
|
|
|
HRESULT hr = S_OK;
|
2004-09-08 01:50:37 +00:00
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart));
|
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
2010-12-06 13:16:42 +00:00
|
|
|
This->filter.rtStreamStart = tStart;
|
2010-11-04 16:02:23 +00:00
|
|
|
if (This->filter.state == State_Running)
|
|
|
|
goto out;
|
2010-11-24 17:23:55 +00:00
|
|
|
QualityControlRender_Start(&This->qcimpl, tStart);
|
|
|
|
if (This->pInputPin->pin.pConnectedTo && (This->filter.state == State_Stopped || !This->pInputPin->end_of_stream))
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
2010-10-07 19:47:33 +00:00
|
|
|
if (This->filter.state == State_Stopped)
|
2008-07-04 08:33:04 +00:00
|
|
|
{
|
|
|
|
ResetEvent(This->hEvent);
|
2010-11-11 13:03:29 +00:00
|
|
|
VideoRenderer_AutoShowWindow(This);
|
2010-11-24 17:23:55 +00:00
|
|
|
This->pInputPin->end_of_stream = 0;
|
2008-07-04 08:33:04 +00:00
|
|
|
}
|
|
|
|
SetEvent(This->blocked);
|
2010-11-04 16:02:23 +00:00
|
|
|
} else if (This->filter.filterInfo.pGraph) {
|
|
|
|
IMediaEventSink *pEventSink;
|
|
|
|
hr = IFilterGraph_QueryInterface(This->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)This);
|
|
|
|
IMediaEventSink_Release(pEventSink);
|
|
|
|
}
|
|
|
|
hr = S_OK;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
2010-11-04 16:02:23 +00:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
This->filter.state = State_Running;
|
|
|
|
out:
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-11-04 16:02:23 +00:00
|
|
|
return hr;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
|
|
|
|
{
|
2004-09-08 01:50:37 +00:00
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
2008-07-04 08:33:04 +00:00
|
|
|
HRESULT hr;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2008-07-04 08:33:04 +00:00
|
|
|
if (WaitForSingleObject(This->hEvent, dwMilliSecsTimeout) == WAIT_TIMEOUT)
|
|
|
|
hr = VFW_S_STATE_INTERMEDIATE;
|
|
|
|
else
|
|
|
|
hr = S_OK;
|
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
BaseFilterImpl_GetState(iface, dwMilliSecsTimeout, pState);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2008-07-04 08:33:04 +00:00
|
|
|
return hr;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/** IBaseFilter implementation **/
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin)
|
|
|
|
{
|
2004-09-08 01:50:37 +00:00
|
|
|
VideoRendererImpl *This = (VideoRendererImpl *)iface;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2008-12-29 11:00:10 +00:00
|
|
|
FIXME("(%p/%p)->(%p,%p): stub !!!\n", This, iface, debugstr_w(Id), ppPin);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
/* FIXME: critical section */
|
|
|
|
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IBaseFilterVtbl VideoRenderer_Vtbl =
|
|
|
|
{
|
|
|
|
VideoRenderer_QueryInterface,
|
|
|
|
VideoRenderer_AddRef,
|
|
|
|
VideoRenderer_Release,
|
2010-10-07 19:47:33 +00:00
|
|
|
BaseFilterImpl_GetClassID,
|
2004-08-24 02:28:35 +00:00
|
|
|
VideoRenderer_Stop,
|
|
|
|
VideoRenderer_Pause,
|
|
|
|
VideoRenderer_Run,
|
|
|
|
VideoRenderer_GetState,
|
2010-11-09 22:42:50 +00:00
|
|
|
VideoRenderer_SetSyncSource,
|
2010-10-07 19:47:33 +00:00
|
|
|
BaseFilterImpl_GetSyncSource,
|
2010-10-07 19:48:01 +00:00
|
|
|
BaseFilterImpl_EnumPins,
|
2004-08-24 02:28:35 +00:00
|
|
|
VideoRenderer_FindPin,
|
2010-10-07 19:47:33 +00:00
|
|
|
BaseFilterImpl_QueryFilterInfo,
|
|
|
|
BaseFilterImpl_JoinFilterGraph,
|
|
|
|
BaseFilterImpl_QueryVendorInfo
|
2004-08-24 02:28:35 +00:00
|
|
|
};
|
|
|
|
|
2005-03-02 10:12:12 +00:00
|
|
|
static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface)
|
|
|
|
{
|
2010-10-05 19:38:11 +00:00
|
|
|
BaseInputPin* This = (BaseInputPin*)iface;
|
2010-05-22 13:58:15 +00:00
|
|
|
VideoRendererImpl *pFilter;
|
2005-03-02 10:12:12 +00:00
|
|
|
IMediaEventSink* pEventSink;
|
2010-11-09 22:42:41 +00:00
|
|
|
HRESULT hr = S_OK;
|
2005-03-02 10:12:12 +00:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2010-11-09 22:42:41 +00:00
|
|
|
EnterCriticalSection(This->pin.pCritSec);
|
2010-05-22 13:58:15 +00:00
|
|
|
pFilter = (VideoRendererImpl*)This->pin.pinInfo.pFilter;
|
2010-11-09 22:42:41 +00:00
|
|
|
if (This->flushing || This->end_of_stream)
|
|
|
|
goto out;
|
2010-10-07 19:47:33 +00:00
|
|
|
hr = IFilterGraph_QueryInterface(pFilter->filter.filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink);
|
2005-03-02 10:12:12 +00:00
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
2010-11-04 16:02:23 +00:00
|
|
|
hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, (LONG_PTR)pFilter);
|
2005-03-02 10:12:12 +00:00
|
|
|
IMediaEventSink_Release(pEventSink);
|
|
|
|
}
|
2010-05-22 13:58:15 +00:00
|
|
|
MediaSeekingPassThru_EOS(pFilter->seekthru_unk);
|
2010-11-09 22:42:41 +00:00
|
|
|
This->end_of_stream = 1;
|
|
|
|
out:
|
|
|
|
LeaveCriticalSection(This->pin.pCritSec);
|
2005-03-02 10:12:12 +00:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2008-07-04 08:33:04 +00:00
|
|
|
static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface)
|
|
|
|
{
|
2010-10-05 19:38:11 +00:00
|
|
|
BaseInputPin* This = (BaseInputPin*)iface;
|
2008-07-04 08:33:04 +00:00
|
|
|
VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
2010-11-09 22:42:40 +00:00
|
|
|
SetEvent(pVideoRenderer->blocked);
|
|
|
|
return BaseInputPinImpl_BeginFlush(iface);
|
2008-07-04 08:33:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface)
|
|
|
|
{
|
2010-10-05 19:38:11 +00:00
|
|
|
BaseInputPin* This = (BaseInputPin*)iface;
|
2008-07-04 08:33:04 +00:00
|
|
|
VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter;
|
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
|
|
|
EnterCriticalSection(This->pin.pCritSec);
|
2010-12-10 15:06:56 +00:00
|
|
|
|
|
|
|
if (pVideoRenderer->sample_held) {
|
|
|
|
SetEvent(pVideoRenderer->blocked);
|
|
|
|
ResetEvent(pVideoRenderer->hEvent);
|
|
|
|
LeaveCriticalSection(This->pin.pCritSec);
|
|
|
|
WaitForSingleObject(pVideoRenderer->hEvent, INFINITE);
|
|
|
|
EnterCriticalSection(This->pin.pCritSec);
|
|
|
|
ResetEvent(pVideoRenderer->blocked);
|
|
|
|
}
|
2010-11-10 23:14:19 +00:00
|
|
|
if (pVideoRenderer->filter.state == State_Paused) {
|
2008-07-04 08:33:04 +00:00
|
|
|
ResetEvent(pVideoRenderer->blocked);
|
2010-11-10 23:14:19 +00:00
|
|
|
ResetEvent(pVideoRenderer->hEvent);
|
|
|
|
}
|
2008-07-04 08:33:04 +00:00
|
|
|
|
2010-11-09 22:42:50 +00:00
|
|
|
QualityControlRender_Start(&pVideoRenderer->qcimpl, pVideoRenderer->filter.rtStreamStart);
|
2010-10-05 19:38:11 +00:00
|
|
|
hr = BaseInputPinImpl_EndFlush(iface);
|
2008-07-04 08:33:04 +00:00
|
|
|
LeaveCriticalSection(This->pin.pCritSec);
|
2010-05-22 13:58:15 +00:00
|
|
|
MediaSeekingPassThru_ResetMediaTime(pVideoRenderer->seekthru_unk);
|
2008-07-04 08:33:04 +00:00
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
static const IPinVtbl VideoRenderer_InputPin_Vtbl =
|
|
|
|
{
|
2010-10-05 19:38:11 +00:00
|
|
|
BaseInputPinImpl_QueryInterface,
|
2010-10-05 19:37:42 +00:00
|
|
|
BasePinImpl_AddRef,
|
2010-10-05 19:38:11 +00:00
|
|
|
BaseInputPinImpl_Release,
|
|
|
|
BaseInputPinImpl_Connect,
|
|
|
|
BaseInputPinImpl_ReceiveConnection,
|
2010-10-05 19:37:42 +00:00
|
|
|
BasePinImpl_Disconnect,
|
|
|
|
BasePinImpl_ConnectedTo,
|
|
|
|
BasePinImpl_ConnectionMediaType,
|
|
|
|
BasePinImpl_QueryPinInfo,
|
|
|
|
BasePinImpl_QueryDirection,
|
|
|
|
BasePinImpl_QueryId,
|
2010-10-05 19:38:11 +00:00
|
|
|
BaseInputPinImpl_QueryAccept,
|
2010-10-05 19:37:42 +00:00
|
|
|
BasePinImpl_EnumMediaTypes,
|
|
|
|
BasePinImpl_QueryInternalConnections,
|
2005-03-02 10:12:12 +00:00
|
|
|
VideoRenderer_InputPin_EndOfStream,
|
2008-07-04 08:33:04 +00:00
|
|
|
VideoRenderer_InputPin_BeginFlush,
|
|
|
|
VideoRenderer_InputPin_EndFlush,
|
2010-10-05 19:38:11 +00:00
|
|
|
BaseInputPinImpl_NewSegment
|
2004-08-24 02:28:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID*ppvObj) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
|
|
|
|
|
|
|
|
return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
|
|
|
return VideoRenderer_AddRef((IBaseFilter*)This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
|
|
|
return VideoRenderer_Release((IBaseFilter*)This);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IDispatch methods ***/
|
|
|
|
static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface,
|
|
|
|
UINT*pctinfo) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface,
|
|
|
|
UINT iTInfo,
|
|
|
|
LCID lcid,
|
|
|
|
ITypeInfo**ppTInfo) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface,
|
|
|
|
REFIID riid,
|
|
|
|
LPOLESTR*rgszNames,
|
|
|
|
UINT cNames,
|
|
|
|
LCID lcid,
|
|
|
|
DISPID*rgDispId) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface,
|
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS*pDispParams,
|
|
|
|
VARIANT*pVarResult,
|
|
|
|
EXCEPINFO*pExepInfo,
|
|
|
|
UINT*puArgErr) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
FIXME("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IBasicVideo methods ***/
|
|
|
|
static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface,
|
|
|
|
REFTIME *pAvgTimePerFrame) {
|
2010-05-17 19:32:32 +00:00
|
|
|
AM_MEDIA_TYPE *pmt;
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2010-05-17 19:32:32 +00:00
|
|
|
if (!This->pInputPin->pin.pConnectedTo)
|
|
|
|
return VFW_E_NOT_CONNECTED;
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
|
|
|
|
|
|
|
|
pmt = &This->pInputPin->pin.mtCurrent;
|
|
|
|
if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) {
|
|
|
|
VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat;
|
|
|
|
*pAvgTimePerFrame = vih->AvgTimePerFrame;
|
|
|
|
} else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) {
|
|
|
|
VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat;
|
|
|
|
*pAvgTimePerFrame = vih->AvgTimePerFrame;
|
|
|
|
} else {
|
|
|
|
ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype));
|
|
|
|
*pAvgTimePerFrame = 0;
|
|
|
|
}
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pBitRate) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pBitErrorRate) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pVideoWidth) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
|
|
|
|
|
|
|
|
*pVideoWidth = This->VideoWidth;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pVideoHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
|
|
|
|
|
|
|
|
*pVideoHeight = This->VideoHeight;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG SourceLeft) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
This->SourceRect.left = SourceLeft;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pSourceLeft) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
|
|
|
|
|
|
|
|
*pSourceLeft = This->SourceRect.left;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG SourceWidth) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
This->SourceRect.right = This->SourceRect.left + SourceWidth;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pSourceWidth) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
*pSourceWidth = This->SourceRect.right - This->SourceRect.left;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG SourceTop) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
This->SourceRect.top = SourceTop;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pSourceTop) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
|
|
|
|
|
|
|
|
*pSourceTop = This->SourceRect.top;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG SourceHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
This->SourceRect.bottom = This->SourceRect.top + SourceHeight;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pSourceHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
|
|
|
|
|
|
|
|
*pSourceHeight = This->SourceRect.bottom - This->SourceRect.top;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG DestinationLeft) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
This->DestRect.left = DestinationLeft;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pDestinationLeft) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
|
|
|
|
|
|
|
|
*pDestinationLeft = This->DestRect.left;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG DestinationWidth) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
This->DestRect.right = This->DestRect.left + DestinationWidth;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pDestinationWidth) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
|
|
|
|
|
|
|
|
*pDestinationWidth = This->DestRect.right - This->DestRect.left;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG DestinationTop) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
This->DestRect.top = DestinationTop;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pDestinationTop) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
|
|
|
|
|
|
|
|
*pDestinationTop = This->DestRect.top;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG DestinationHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
This->DestRect.right = This->DestRect.left + DestinationHeight;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pDestinationHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
|
|
|
|
|
|
|
|
*pDestinationHeight = This->DestRect.right - This->DestRect.left;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Left,
|
|
|
|
LONG Top,
|
|
|
|
LONG Width,
|
|
|
|
LONG Height) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
This->SourceRect.left = Left;
|
|
|
|
This->SourceRect.top = Top;
|
|
|
|
This->SourceRect.right = Left + Width;
|
|
|
|
This->SourceRect.bottom = Top + Height;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pLeft,
|
|
|
|
LONG *pTop,
|
|
|
|
LONG *pWidth,
|
|
|
|
LONG *pHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
*pLeft = This->SourceRect.left;
|
|
|
|
*pTop = This->SourceRect.top;
|
|
|
|
*pWidth = This->SourceRect.right - This->SourceRect.left;
|
|
|
|
*pHeight = This->SourceRect.bottom - This->SourceRect.top;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
|
|
|
This->SourceRect.left = 0;
|
|
|
|
This->SourceRect.top = 0;
|
|
|
|
This->SourceRect.right = This->VideoWidth;
|
|
|
|
This->SourceRect.bottom = This->VideoHeight;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Left,
|
|
|
|
LONG Top,
|
|
|
|
LONG Width,
|
|
|
|
LONG Height) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
This->DestRect.left = Left;
|
|
|
|
This->DestRect.top = Top;
|
|
|
|
This->DestRect.right = Left + Width;
|
|
|
|
This->DestRect.bottom = Top + Height;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pLeft,
|
|
|
|
LONG *pTop,
|
|
|
|
LONG *pWidth,
|
|
|
|
LONG *pHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
|
|
|
|
|
|
|
*pLeft = This->DestRect.left;
|
|
|
|
*pTop = This->DestRect.top;
|
|
|
|
*pWidth = This->DestRect.right - This->DestRect.left;
|
|
|
|
*pHeight = This->DestRect.bottom - This->DestRect.top;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
2005-06-13 11:37:55 +00:00
|
|
|
RECT rect;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
if (!GetClientRect(This->hWnd, &rect))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
This->SourceRect.left = 0;
|
|
|
|
This->SourceRect.top = 0;
|
|
|
|
This->SourceRect.right = rect.right;
|
|
|
|
This->SourceRect.bottom = rect.bottom;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pWidth,
|
|
|
|
LONG *pHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
*pWidth = This->VideoWidth;
|
|
|
|
*pHeight = This->VideoHeight;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG StartIndex,
|
|
|
|
LONG Entries,
|
|
|
|
LONG *pRetrieved,
|
|
|
|
LONG *pPalette) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2010-11-10 23:14:18 +00:00
|
|
|
TRACE("(%p/%p)->(%d, %d, %p, %p)\n", This, iface, StartIndex, Entries, pRetrieved, pPalette);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-11-10 23:14:18 +00:00
|
|
|
if (pRetrieved)
|
|
|
|
*pRetrieved = 0;
|
|
|
|
return VFW_E_NO_PALETTE_AVAILABLE;
|
2004-08-24 02:28:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pBufferSize,
|
|
|
|
LONG *pDIBImage) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
2008-06-10 16:45:25 +00:00
|
|
|
BITMAPINFOHEADER *bmiHeader;
|
|
|
|
LONG needed_size;
|
|
|
|
AM_MEDIA_TYPE *amt = &This->pInputPin->pin.mtCurrent;
|
|
|
|
char *ptr;
|
|
|
|
|
2008-12-29 11:00:10 +00:00
|
|
|
FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage);
|
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
EnterCriticalSection(&This->filter.csFilter);
|
2008-06-10 16:45:25 +00:00
|
|
|
|
|
|
|
if (!This->sample_held)
|
|
|
|
{
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
|
|
|
return (This->filter.state == State_Paused ? E_UNEXPECTED : VFW_E_NOT_PAUSED);
|
2008-06-10 16:45:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo))
|
|
|
|
{
|
|
|
|
bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo2))
|
|
|
|
{
|
|
|
|
bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FIXME("Unknown type %s\n", debugstr_guid(&amt->subtype));
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-06-10 16:45:25 +00:00
|
|
|
return VFW_E_RUNTIME_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
needed_size = bmiHeader->biSize;
|
|
|
|
needed_size += IMediaSample_GetActualDataLength(This->sample_held);
|
|
|
|
|
|
|
|
if (!pDIBImage)
|
|
|
|
{
|
|
|
|
*pBufferSize = needed_size;
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-06-10 16:45:25 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (needed_size < *pBufferSize)
|
|
|
|
{
|
2009-03-10 23:31:26 +00:00
|
|
|
ERR("Buffer too small %u/%u\n", needed_size, *pBufferSize);
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2008-06-10 16:45:25 +00:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
*pBufferSize = needed_size;
|
|
|
|
|
|
|
|
memcpy(pDIBImage, bmiHeader, bmiHeader->biSize);
|
|
|
|
IMediaSample_GetPointer(This->sample_held, (BYTE **)&ptr);
|
|
|
|
memcpy((char *)pDIBImage + bmiHeader->biSize, ptr, IMediaSample_GetActualDataLength(This->sample_held));
|
|
|
|
|
2010-10-07 19:47:33 +00:00
|
|
|
LeaveCriticalSection(&This->filter.csFilter);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(): stub !!!\n", This, iface);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(): stub !!!\n", This, iface);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-06-06 19:50:35 +00:00
|
|
|
static const IBasicVideoVtbl IBasicVideo_VTable =
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
|
|
|
Basicvideo_QueryInterface,
|
|
|
|
Basicvideo_AddRef,
|
|
|
|
Basicvideo_Release,
|
|
|
|
Basicvideo_GetTypeInfoCount,
|
|
|
|
Basicvideo_GetTypeInfo,
|
|
|
|
Basicvideo_GetIDsOfNames,
|
|
|
|
Basicvideo_Invoke,
|
|
|
|
Basicvideo_get_AvgTimePerFrame,
|
|
|
|
Basicvideo_get_BitRate,
|
|
|
|
Basicvideo_get_BitErrorRate,
|
|
|
|
Basicvideo_get_VideoWidth,
|
|
|
|
Basicvideo_get_VideoHeight,
|
|
|
|
Basicvideo_put_SourceLeft,
|
|
|
|
Basicvideo_get_SourceLeft,
|
|
|
|
Basicvideo_put_SourceWidth,
|
|
|
|
Basicvideo_get_SourceWidth,
|
|
|
|
Basicvideo_put_SourceTop,
|
|
|
|
Basicvideo_get_SourceTop,
|
|
|
|
Basicvideo_put_SourceHeight,
|
|
|
|
Basicvideo_get_SourceHeight,
|
|
|
|
Basicvideo_put_DestinationLeft,
|
|
|
|
Basicvideo_get_DestinationLeft,
|
|
|
|
Basicvideo_put_DestinationWidth,
|
|
|
|
Basicvideo_get_DestinationWidth,
|
|
|
|
Basicvideo_put_DestinationTop,
|
|
|
|
Basicvideo_get_DestinationTop,
|
|
|
|
Basicvideo_put_DestinationHeight,
|
|
|
|
Basicvideo_get_DestinationHeight,
|
|
|
|
Basicvideo_SetSourcePosition,
|
|
|
|
Basicvideo_GetSourcePosition,
|
|
|
|
Basicvideo_SetDefaultSourcePosition,
|
|
|
|
Basicvideo_SetDestinationPosition,
|
|
|
|
Basicvideo_GetDestinationPosition,
|
|
|
|
Basicvideo_SetDefaultDestinationPosition,
|
|
|
|
Basicvideo_GetVideoSize,
|
|
|
|
Basicvideo_GetVideoPaletteEntries,
|
|
|
|
Basicvideo_GetCurrentImage,
|
|
|
|
Basicvideo_IsUsingDefaultSource,
|
|
|
|
Basicvideo_IsUsingDefaultDestination
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface,
|
|
|
|
REFIID riid,
|
|
|
|
LPVOID*ppvObj) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj);
|
|
|
|
|
|
|
|
return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
|
|
|
return VideoRenderer_AddRef((IBaseFilter*)This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
|
|
|
TRACE("(%p/%p)->()\n", This, iface);
|
|
|
|
|
|
|
|
return VideoRenderer_Release((IBaseFilter*)This);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IDispatch methods ***/
|
|
|
|
static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface,
|
|
|
|
UINT*pctinfo) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface,
|
|
|
|
UINT iTInfo,
|
|
|
|
LCID lcid,
|
|
|
|
ITypeInfo**ppTInfo) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface,
|
|
|
|
REFIID riid,
|
|
|
|
LPOLESTR*rgszNames,
|
|
|
|
UINT cNames,
|
|
|
|
LCID lcid,
|
|
|
|
DISPID*rgDispId) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface,
|
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS*pDispParams,
|
|
|
|
VARIANT*pVarResult,
|
|
|
|
EXCEPINFO*pExepInfo,
|
|
|
|
UINT*puArgErr) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
FIXME("(%p/%p)->(%d, %s (%p), %d, %04x, %p, %p, %p, %p): stub !!!\n", This, iface, dispIdMember, debugstr_guid(riid), riid, lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IVideoWindow methods ***/
|
|
|
|
static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface,
|
|
|
|
BSTR strCaption) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
|
|
|
|
|
|
|
|
if (!SetWindowTextW(This->hWnd, strCaption))
|
|
|
|
return E_FAIL;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface,
|
|
|
|
BSTR *strCaption) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
|
|
|
|
|
|
|
|
GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG WindowStyle) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
2005-06-13 11:37:55 +00:00
|
|
|
LONG old;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-12-03 08:38:13 +00:00
|
|
|
old = GetWindowLongW(This->hWnd, GWL_STYLE);
|
2009-03-10 23:31:26 +00:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL))
|
|
|
|
return E_INVALIDARG;
|
2010-09-24 13:53:14 +00:00
|
|
|
|
2010-12-03 08:38:13 +00:00
|
|
|
SetWindowLongW(This->hWnd, GWL_STYLE, WindowStyle);
|
2010-09-24 13:53:14 +00:00
|
|
|
SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
|
|
|
|
This->WindowStyle = WindowStyle;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *WindowStyle) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
|
|
|
|
|
2010-09-24 13:53:14 +00:00
|
|
|
*WindowStyle = This->WindowStyle;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG WindowStyleEx) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
2010-12-03 08:38:13 +00:00
|
|
|
if (!SetWindowLongW(This->hWnd, GWL_EXSTYLE, WindowStyleEx))
|
2005-06-13 11:37:55 +00:00
|
|
|
return E_FAIL;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *WindowStyleEx) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
|
|
|
|
|
2010-12-03 08:38:13 +00:00
|
|
|
*WindowStyleEx = GetWindowLongW(This->hWnd, GWL_EXSTYLE);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG AutoShow) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
2010-05-19 22:01:05 +00:00
|
|
|
This->AutoShow = AutoShow;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *AutoShow) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
|
|
|
|
|
|
|
|
*AutoShow = This->AutoShow;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG WindowState) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2010-05-18 18:17:53 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, WindowState);
|
|
|
|
ShowWindow(This->hWnd, WindowState);
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *WindowState) {
|
2010-05-18 18:17:53 +00:00
|
|
|
WINDOWPLACEMENT place;
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2010-05-18 18:17:53 +00:00
|
|
|
place.length = sizeof(place);
|
|
|
|
GetWindowPlacement(This->hWnd, &place);
|
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
|
|
|
|
*WindowState = place.showCmd;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG BackgroundPalette) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pBackgroundPalette) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Visible) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, Visible);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pVisible) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
|
|
|
|
|
|
|
|
*pVisible = IsWindowVisible(This->hWnd);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Left) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, Left);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
This->WindowPos.left = Left;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pLeft) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
|
|
|
|
|
|
|
|
*pLeft = This->WindowPos.left;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Width) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, Width);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
This->WindowPos.right = This->WindowPos.left + Width;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pWidth) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
|
|
|
|
|
|
|
|
*pWidth = This->WindowPos.right - This->WindowPos.left;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Top) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, Top);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
This->WindowPos.top = Top;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pTop) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
|
|
|
|
|
|
|
|
*pTop = This->WindowPos.top;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Height) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, Height);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
This->WindowPos.bottom = This->WindowPos.top + Height;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
|
|
|
|
|
|
|
|
*pHeight = This->WindowPos.bottom - This->WindowPos.top;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface,
|
|
|
|
OAHWND Owner) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
2010-11-24 23:11:53 +00:00
|
|
|
This->hWndOwner = (HWND)Owner;
|
|
|
|
SetParent(This->hWnd, This->hWndOwner);
|
2010-09-24 13:53:14 +00:00
|
|
|
if (This->WindowStyle & WS_CHILD)
|
|
|
|
{
|
2010-12-03 08:38:13 +00:00
|
|
|
LONG old = GetWindowLongW(This->hWnd, GWL_STYLE);
|
2010-09-24 13:53:14 +00:00
|
|
|
if (old != This->WindowStyle)
|
|
|
|
{
|
2010-12-03 08:38:13 +00:00
|
|
|
SetWindowLongW(This->hWnd, GWL_STYLE, This->WindowStyle);
|
2010-09-24 13:53:14 +00:00
|
|
|
SetWindowPos(This->hWnd,0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOSIZE|SWP_NOZORDER);
|
|
|
|
}
|
|
|
|
}
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface,
|
|
|
|
OAHWND *Owner) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-01-08 12:17:49 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
2010-11-24 23:11:53 +00:00
|
|
|
*(HWND*)Owner = This->hWndOwner;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface,
|
|
|
|
OAHWND Drain) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2006-10-12 18:57:23 +00:00
|
|
|
TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
This->hWndMsgDrain = (HWND)Drain;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface,
|
|
|
|
OAHWND *Drain) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
|
|
|
|
|
|
|
|
*Drain = (OAHWND)This->hWndMsgDrain;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *Color) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Color) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *FullScreenMode) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG FullScreenMode) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-11-24 23:11:53 +00:00
|
|
|
if (FullScreenMode) {
|
|
|
|
ShowWindow(This->hWnd, SW_HIDE);
|
|
|
|
SetParent(This->hWnd, 0);
|
2010-12-03 08:38:13 +00:00
|
|
|
SetWindowLongW(This->hWnd, GWL_STYLE, WS_POPUP);
|
2010-11-24 23:11:53 +00:00
|
|
|
SetWindowPos(This->hWnd,HWND_TOP,0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),SWP_SHOWWINDOW);
|
|
|
|
GetWindowRect(This->hWnd, &This->DestRect);
|
|
|
|
This->WindowPos = This->DestRect;
|
|
|
|
} else {
|
|
|
|
ShowWindow(This->hWnd, SW_HIDE);
|
|
|
|
SetParent(This->hWnd, This->hWndOwner);
|
2010-12-03 08:38:13 +00:00
|
|
|
SetWindowLongW(This->hWnd, GWL_STYLE, This->WindowStyle);
|
2010-11-24 23:11:53 +00:00
|
|
|
GetClientRect(This->hWnd, &This->DestRect);
|
|
|
|
SetWindowPos(This->hWnd,0,This->DestRect.left,This->DestRect.top,This->DestRect.right,This->DestRect.bottom,SWP_NOZORDER|SWP_SHOWWINDOW);
|
|
|
|
This->WindowPos = This->DestRect;
|
|
|
|
}
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Focus) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
2005-06-13 11:37:55 +00:00
|
|
|
BOOL ret;
|
|
|
|
IPin* pPin;
|
|
|
|
HRESULT hr;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%d)\n", This, iface, Focus);
|
2005-06-13 11:37:55 +00:00
|
|
|
|
|
|
|
if ((Focus != FALSE) && (Focus != TRUE))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2008-04-25 21:25:49 +00:00
|
|
|
hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin);
|
2005-06-13 11:37:55 +00:00
|
|
|
if ((hr != S_OK) || !pPin)
|
|
|
|
return VFW_E_NOT_CONNECTED;
|
|
|
|
|
|
|
|
if (Focus)
|
|
|
|
ret = SetForegroundWindow(This->hWnd);
|
|
|
|
else
|
|
|
|
ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE);
|
|
|
|
|
|
|
|
if (!ret)
|
|
|
|
return E_FAIL;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface,
|
|
|
|
OAHWND hwnd,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG uMsg,
|
2004-08-24 02:28:35 +00:00
|
|
|
LONG_PTR wParam,
|
|
|
|
LONG_PTR lParam) {
|
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2010-12-03 08:38:13 +00:00
|
|
|
if (!PostMessageW(This->hWnd, uMsg, wParam, lParam))
|
2005-06-13 11:37:55 +00:00
|
|
|
return E_FAIL;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG Left,
|
|
|
|
LONG Top,
|
|
|
|
LONG Width,
|
|
|
|
LONG Height) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
2009-03-10 23:31:26 +00:00
|
|
|
|
|
|
|
TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
This->WindowPos.left = Left;
|
|
|
|
This->WindowPos.top = Top;
|
|
|
|
This->WindowPos.right = Left + Width;
|
|
|
|
This->WindowPos.bottom = Top + Height;
|
|
|
|
|
2004-08-24 02:28:35 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pLeft,
|
|
|
|
LONG *pTop,
|
|
|
|
LONG *pWidth,
|
|
|
|
LONG *pHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
|
|
|
|
|
|
|
*pLeft = This->WindowPos.left;
|
|
|
|
*pTop = This->WindowPos.top;
|
|
|
|
*pWidth = This->WindowPos.right - This->WindowPos.left;
|
|
|
|
*pHeight = This->WindowPos.bottom - This->WindowPos.top;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pWidth,
|
|
|
|
LONG *pHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
|
|
|
|
|
|
|
|
*pWidth = This->VideoWidth;
|
|
|
|
*pHeight = This->VideoHeight;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pWidth,
|
|
|
|
LONG *pHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight);
|
|
|
|
|
|
|
|
*pWidth = This->VideoWidth;
|
|
|
|
*pHeight = This->VideoHeight;
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *pLeft,
|
|
|
|
LONG *pTop,
|
|
|
|
LONG *pWidth,
|
|
|
|
LONG *pHeight) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG HideCursor) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2009-03-10 23:31:26 +00:00
|
|
|
FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface,
|
2009-03-10 23:31:26 +00:00
|
|
|
LONG *CursorHidden) {
|
2004-08-24 02:28:35 +00:00
|
|
|
ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface);
|
|
|
|
|
2005-06-13 11:37:55 +00:00
|
|
|
FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden);
|
2004-08-24 02:28:35 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2005-06-06 19:50:35 +00:00
|
|
|
static const IVideoWindowVtbl IVideoWindow_VTable =
|
2004-08-24 02:28:35 +00:00
|
|
|
{
|
|
|
|
Videowindow_QueryInterface,
|
|
|
|
Videowindow_AddRef,
|
|
|
|
Videowindow_Release,
|
|
|
|
Videowindow_GetTypeInfoCount,
|
|
|
|
Videowindow_GetTypeInfo,
|
|
|
|
Videowindow_GetIDsOfNames,
|
|
|
|
Videowindow_Invoke,
|
|
|
|
Videowindow_put_Caption,
|
|
|
|
Videowindow_get_Caption,
|
|
|
|
Videowindow_put_WindowStyle,
|
|
|
|
Videowindow_get_WindowStyle,
|
|
|
|
Videowindow_put_WindowStyleEx,
|
|
|
|
Videowindow_get_WindowStyleEx,
|
|
|
|
Videowindow_put_AutoShow,
|
|
|
|
Videowindow_get_AutoShow,
|
|
|
|
Videowindow_put_WindowState,
|
|
|
|
Videowindow_get_WindowState,
|
|
|
|
Videowindow_put_BackgroundPalette,
|
|
|
|
Videowindow_get_BackgroundPalette,
|
|
|
|
Videowindow_put_Visible,
|
|
|
|
Videowindow_get_Visible,
|
|
|
|
Videowindow_put_Left,
|
|
|
|
Videowindow_get_Left,
|
|
|
|
Videowindow_put_Width,
|
|
|
|
Videowindow_get_Width,
|
|
|
|
Videowindow_put_Top,
|
|
|
|
Videowindow_get_Top,
|
|
|
|
Videowindow_put_Height,
|
|
|
|
Videowindow_get_Height,
|
|
|
|
Videowindow_put_Owner,
|
|
|
|
Videowindow_get_Owner,
|
|
|
|
Videowindow_put_MessageDrain,
|
|
|
|
Videowindow_get_MessageDrain,
|
|
|
|
Videowindow_get_BorderColor,
|
|
|
|
Videowindow_put_BorderColor,
|
|
|
|
Videowindow_get_FullScreenMode,
|
|
|
|
Videowindow_put_FullScreenMode,
|
|
|
|
Videowindow_SetWindowForeground,
|
|
|
|
Videowindow_NotifyOwnerMessage,
|
|
|
|
Videowindow_SetWindowPosition,
|
|
|
|
Videowindow_GetWindowPosition,
|
|
|
|
Videowindow_GetMinIdealImageSize,
|
|
|
|
Videowindow_GetMaxIdealImageSize,
|
|
|
|
Videowindow_GetRestorePosition,
|
|
|
|
Videowindow_HideCursor,
|
|
|
|
Videowindow_IsCursorHidden
|
|
|
|
};
|
2010-11-04 16:02:24 +00:00
|
|
|
|
|
|
|
static VideoRendererImpl *from_IAMFilterMiscFlags(IAMFilterMiscFlags *iface) {
|
|
|
|
return (VideoRendererImpl*)((char*)iface - offsetof(VideoRendererImpl, IAMFilterMiscFlags_vtbl));
|
|
|
|
}
|
|
|
|
|
2011-03-14 04:32:52 +00:00
|
|
|
static HRESULT WINAPI AMFilterMiscFlags_QueryInterface(IAMFilterMiscFlags *iface, REFIID riid, void **ppv) {
|
2010-11-04 16:02:24 +00:00
|
|
|
VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
|
|
|
|
return IUnknown_QueryInterface((IUnknown*)This, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMFilterMiscFlags_AddRef(IAMFilterMiscFlags *iface) {
|
|
|
|
VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
|
|
|
|
return IUnknown_AddRef((IUnknown*)This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMFilterMiscFlags_Release(IAMFilterMiscFlags *iface) {
|
|
|
|
VideoRendererImpl *This = from_IAMFilterMiscFlags(iface);
|
|
|
|
return IUnknown_Release((IUnknown*)This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI AMFilterMiscFlags_GetMiscFlags(IAMFilterMiscFlags *iface) {
|
|
|
|
return AM_FILTER_MISC_FLAGS_IS_RENDERER;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IAMFilterMiscFlagsVtbl IAMFilterMiscFlags_Vtbl = {
|
|
|
|
AMFilterMiscFlags_QueryInterface,
|
|
|
|
AMFilterMiscFlags_AddRef,
|
|
|
|
AMFilterMiscFlags_Release,
|
|
|
|
AMFilterMiscFlags_GetMiscFlags
|
|
|
|
};
|