Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Video Renderer (Fullscreen and Windowed using Direct Draw) |
| 3 | * |
| 4 | * Copyright 2004 Christian Costa |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Lesser General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2.1 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Lesser General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Lesser General Public |
| 17 | * License along with this library; if not, write to the Free Software |
Jonathan Ernst | 360a3f9 | 2006-05-18 14:49:52 +0200 | [diff] [blame] | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 19 | */ |
| 20 | |
| 21 | #include "config.h" |
| 22 | |
| 23 | #define NONAMELESSSTRUCT |
| 24 | #define NONAMELESSUNION |
| 25 | #include "quartz_private.h" |
| 26 | #include "control_private.h" |
| 27 | #include "pin.h" |
| 28 | |
| 29 | #include "uuids.h" |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 30 | #include "vfwmsgs.h" |
| 31 | #include "amvideo.h" |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 32 | #include "windef.h" |
| 33 | #include "winbase.h" |
| 34 | #include "dshow.h" |
Christian Costa | 7dea79c | 2005-03-02 10:12:12 +0000 | [diff] [blame] | 35 | #include "evcode.h" |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 36 | #include "strmif.h" |
| 37 | #include "ddraw.h" |
Maarten Lankhorst | 3e9cee0 | 2008-04-11 15:10:19 -0700 | [diff] [blame] | 38 | #include "dvdmedia.h" |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 39 | |
Francois Gouget | a516f27 | 2008-07-26 19:12:32 +0200 | [diff] [blame] | 40 | #include <assert.h> |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 41 | #include "wine/unicode.h" |
| 42 | #include "wine/debug.h" |
| 43 | |
| 44 | WINE_DEFAULT_DEBUG_CHANNEL(quartz); |
| 45 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 46 | static BOOL wnd_class_registered = FALSE; |
| 47 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 48 | static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0}; |
| 49 | |
| 50 | static const IBaseFilterVtbl VideoRenderer_Vtbl; |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 51 | static const IUnknownVtbl IInner_VTable; |
Dmitry Timoshkov | eba47f1 | 2005-06-06 19:50:35 +0000 | [diff] [blame] | 52 | static const IBasicVideoVtbl IBasicVideo_VTable; |
| 53 | static const IVideoWindowVtbl IVideoWindow_VTable; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 54 | static const IPinVtbl VideoRenderer_InputPin_Vtbl; |
| 55 | |
| 56 | typedef struct VideoRendererImpl |
| 57 | { |
| 58 | const IBaseFilterVtbl * lpVtbl; |
Dmitry Timoshkov | eba47f1 | 2005-06-06 19:50:35 +0000 | [diff] [blame] | 59 | const IBasicVideoVtbl * IBasicVideo_vtbl; |
| 60 | const IVideoWindowVtbl * IVideoWindow_vtbl; |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 61 | const IUnknownVtbl * IInner_vtbl; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 62 | |
Mike McCormack | 0791d06 | 2005-07-12 19:21:36 +0000 | [diff] [blame] | 63 | LONG refCount; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 64 | CRITICAL_SECTION csFilter; |
| 65 | FILTER_STATE state; |
| 66 | REFERENCE_TIME rtStreamStart; |
| 67 | IReferenceClock * pClock; |
| 68 | FILTER_INFO filterInfo; |
| 69 | |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 70 | InputPin *pInputPin; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 71 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 72 | BOOL init; |
| 73 | HANDLE hThread; |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 74 | HANDLE blocked; |
| 75 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 76 | DWORD ThreadID; |
| 77 | HANDLE hEvent; |
| 78 | BOOL ThreadResult; |
| 79 | HWND hWnd; |
| 80 | HWND hWndMsgDrain; |
| 81 | BOOL AutoShow; |
| 82 | RECT SourceRect; |
| 83 | RECT DestRect; |
| 84 | RECT WindowPos; |
| 85 | long VideoWidth; |
| 86 | long VideoHeight; |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 87 | IUnknown * pUnkOuter; |
| 88 | BOOL bUnkOuterValid; |
| 89 | BOOL bAggregatable; |
Maarten Lankhorst | 37847b0 | 2008-04-28 15:00:51 -0700 | [diff] [blame] | 90 | REFERENCE_TIME rtLastStop; |
Maarten Lankhorst | 2eb6637 | 2008-06-10 18:40:09 +0200 | [diff] [blame] | 91 | MediaSeekingImpl mediaSeeking; |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 92 | |
| 93 | /* During pause we can hold a single sample, for use in GetCurrentImage */ |
| 94 | IMediaSample *sample_held; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 95 | } VideoRendererImpl; |
| 96 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 97 | static LRESULT CALLBACK VideoWndProcA(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) |
| 98 | { |
Alexandre Julliard | 8c33528 | 2009-01-08 17:30:57 +0100 | [diff] [blame] | 99 | VideoRendererImpl* pVideoRenderer = (VideoRendererImpl*)GetWindowLongPtrW(hwnd, 0); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 100 | LPRECT lprect = (LPRECT)lParam; |
| 101 | |
| 102 | if (pVideoRenderer && pVideoRenderer->hWndMsgDrain) |
| 103 | { |
| 104 | switch(uMsg) |
| 105 | { |
| 106 | case WM_KEYDOWN: |
| 107 | case WM_KEYUP: |
| 108 | case WM_LBUTTONDBLCLK: |
| 109 | case WM_LBUTTONDOWN: |
| 110 | case WM_LBUTTONUP: |
| 111 | case WM_MBUTTONDBLCLK: |
| 112 | case WM_MBUTTONDOWN: |
| 113 | case WM_MBUTTONUP: |
| 114 | case WM_MOUSEACTIVATE: |
| 115 | case WM_MOUSEMOVE: |
| 116 | case WM_NCLBUTTONDBLCLK: |
| 117 | case WM_NCLBUTTONDOWN: |
| 118 | case WM_NCLBUTTONUP: |
| 119 | case WM_NCMBUTTONDBLCLK: |
| 120 | case WM_NCMBUTTONDOWN: |
| 121 | case WM_NCMBUTTONUP: |
| 122 | case WM_NCMOUSEMOVE: |
| 123 | case WM_NCRBUTTONDBLCLK: |
| 124 | case WM_NCRBUTTONDOWN: |
| 125 | case WM_NCRBUTTONUP: |
| 126 | case WM_RBUTTONDBLCLK: |
| 127 | case WM_RBUTTONDOWN: |
| 128 | case WM_RBUTTONUP: |
| 129 | PostMessageA(pVideoRenderer->hWndMsgDrain, uMsg, wParam, lParam); |
| 130 | break; |
| 131 | default: |
| 132 | break; |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | switch(uMsg) |
| 137 | { |
| 138 | case WM_SIZING: |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 139 | /* TRACE("WM_SIZING %d %d %d %d\n", lprect->left, lprect->top, lprect->right, lprect->bottom); */ |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 140 | SetWindowPos(hwnd, NULL, lprect->left, lprect->top, lprect->right - lprect->left, lprect->bottom - lprect->top, SWP_NOZORDER); |
| 141 | GetClientRect(hwnd, &pVideoRenderer->DestRect); |
Alex VillacÃs Lasso | fb8df8e | 2007-06-19 11:47:32 -0500 | [diff] [blame] | 142 | TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n", |
| 143 | pVideoRenderer->DestRect.left, |
| 144 | pVideoRenderer->DestRect.top, |
| 145 | pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left, |
| 146 | pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top); |
| 147 | return TRUE; |
| 148 | case WM_SIZE: |
| 149 | TRACE("WM_SIZE %d %d\n", LOWORD(lParam), HIWORD(lParam)); |
| 150 | GetClientRect(hwnd, &pVideoRenderer->DestRect); |
| 151 | TRACE("WM_SIZING: DestRect=(%d,%d),(%d,%d)\n", |
| 152 | pVideoRenderer->DestRect.left, |
| 153 | pVideoRenderer->DestRect.top, |
| 154 | pVideoRenderer->DestRect.right - pVideoRenderer->DestRect.left, |
| 155 | pVideoRenderer->DestRect.bottom - pVideoRenderer->DestRect.top); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 156 | return TRUE; |
| 157 | default: |
| 158 | return DefWindowProcA(hwnd, uMsg, wParam, lParam); |
| 159 | } |
| 160 | return 0; |
| 161 | } |
| 162 | |
| 163 | static BOOL CreateRenderingWindow(VideoRendererImpl* This) |
| 164 | { |
| 165 | WNDCLASSA winclass; |
| 166 | |
| 167 | TRACE("(%p)->()\n", This); |
| 168 | |
| 169 | winclass.style = 0; |
| 170 | winclass.lpfnWndProc = VideoWndProcA; |
| 171 | winclass.cbClsExtra = 0; |
| 172 | winclass.cbWndExtra = sizeof(VideoRendererImpl*); |
| 173 | winclass.hInstance = NULL; |
| 174 | winclass.hIcon = NULL; |
| 175 | winclass.hCursor = NULL; |
Christian Costa | b82d94e | 2005-10-10 10:44:54 +0000 | [diff] [blame] | 176 | winclass.hbrBackground = GetStockObject(BLACK_BRUSH); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 177 | winclass.lpszMenuName = NULL; |
| 178 | winclass.lpszClassName = "Wine ActiveMovie Class"; |
| 179 | |
| 180 | if (!wnd_class_registered) |
| 181 | { |
| 182 | if (!RegisterClassA(&winclass)) |
| 183 | { |
Francois Gouget | 4fb03d9 | 2007-01-05 13:05:20 +0100 | [diff] [blame] | 184 | ERR("Unable to register window %u\n", GetLastError()); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 185 | return FALSE; |
| 186 | } |
| 187 | wnd_class_registered = TRUE; |
| 188 | } |
| 189 | |
| 190 | This->hWnd = CreateWindowExA(0, "Wine ActiveMovie Class", "Wine ActiveMovie Window", WS_SIZEBOX, |
| 191 | CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, |
| 192 | NULL, NULL, NULL); |
| 193 | |
| 194 | if (!This->hWnd) |
| 195 | { |
| 196 | ERR("Unable to create window\n"); |
| 197 | return FALSE; |
| 198 | } |
| 199 | |
Alexandre Julliard | 8c33528 | 2009-01-08 17:30:57 +0100 | [diff] [blame] | 200 | SetWindowLongPtrW(This->hWnd, 0, (LONG_PTR)This); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 201 | |
| 202 | return TRUE; |
| 203 | } |
| 204 | |
| 205 | static DWORD WINAPI MessageLoop(LPVOID lpParameter) |
| 206 | { |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 207 | VideoRendererImpl* This = lpParameter; |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 208 | MSG msg; |
| 209 | BOOL fGotMessage; |
| 210 | |
| 211 | TRACE("Starting message loop\n"); |
| 212 | |
| 213 | if (!CreateRenderingWindow(This)) |
| 214 | { |
| 215 | This->ThreadResult = FALSE; |
| 216 | SetEvent(This->hEvent); |
| 217 | return 0; |
| 218 | } |
| 219 | |
| 220 | This->ThreadResult = TRUE; |
| 221 | SetEvent(This->hEvent); |
| 222 | |
Francois Gouget | 7706560 | 2005-06-17 20:55:27 +0000 | [diff] [blame] | 223 | while ((fGotMessage = GetMessageA(&msg, NULL, 0, 0)) != 0 && fGotMessage != -1) |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 224 | { |
| 225 | TranslateMessage(&msg); |
| 226 | DispatchMessageA(&msg); |
| 227 | } |
| 228 | |
| 229 | TRACE("End of message loop\n"); |
| 230 | |
| 231 | return msg.wParam; |
| 232 | } |
| 233 | |
| 234 | static BOOL CreateRenderingSubsystem(VideoRendererImpl* This) |
| 235 | { |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 236 | This->hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 237 | if (!This->hEvent) |
| 238 | return FALSE; |
| 239 | |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 240 | This->hThread = CreateThread(NULL, 0, MessageLoop, This, 0, &This->ThreadID); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 241 | if (!This->hThread) |
| 242 | { |
| 243 | CloseHandle(This->hEvent); |
| 244 | return FALSE; |
| 245 | } |
| 246 | |
| 247 | WaitForSingleObject(This->hEvent, INFINITE); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 248 | |
| 249 | if (!This->ThreadResult) |
| 250 | { |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 251 | CloseHandle(This->hEvent); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 252 | CloseHandle(This->hThread); |
| 253 | return FALSE; |
| 254 | } |
| 255 | |
| 256 | return TRUE; |
| 257 | } |
| 258 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 259 | static DWORD VideoRenderer_SendSampleData(VideoRendererImpl* This, LPBYTE data, DWORD size) |
| 260 | { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 261 | AM_MEDIA_TYPE amt; |
| 262 | HRESULT hr = S_OK; |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 263 | DDSURFACEDESC sdesc; |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 264 | HDC hDC; |
Maarten Lankhorst | 3e9cee0 | 2008-04-11 15:10:19 -0700 | [diff] [blame] | 265 | BITMAPINFOHEADER *bmiHeader; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 266 | |
Christian Costa | c83e4f1 | 2008-12-29 12:00:10 +0100 | [diff] [blame] | 267 | TRACE("(%p)->(%p, %d)\n", This, data, size); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 268 | |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 269 | sdesc.dwSize = sizeof(sdesc); |
| 270 | hr = IPin_ConnectionMediaType((IPin *)This->pInputPin, &amt); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 271 | if (FAILED(hr)) { |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 272 | ERR("Unable to retrieve media type\n"); |
| 273 | return hr; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 274 | } |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 275 | |
Maarten Lankhorst | 3e9cee0 | 2008-04-11 15:10:19 -0700 | [diff] [blame] | 276 | if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo)) |
| 277 | { |
| 278 | bmiHeader = &((VIDEOINFOHEADER *)amt.pbFormat)->bmiHeader; |
| 279 | } |
| 280 | else if (IsEqualIID(&amt.formattype, &FORMAT_VideoInfo2)) |
| 281 | { |
| 282 | bmiHeader = &((VIDEOINFOHEADER2 *)amt.pbFormat)->bmiHeader; |
| 283 | } |
| 284 | else |
| 285 | { |
| 286 | FIXME("Unknown type %s\n", debugstr_guid(&amt.subtype)); |
| 287 | return VFW_E_RUNTIME_ERROR; |
| 288 | } |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 289 | |
Maarten Lankhorst | 3e9cee0 | 2008-04-11 15:10:19 -0700 | [diff] [blame] | 290 | |
| 291 | TRACE("biSize = %d\n", bmiHeader->biSize); |
| 292 | TRACE("biWidth = %d\n", bmiHeader->biWidth); |
| 293 | TRACE("biHeight = %d\n", bmiHeader->biHeight); |
| 294 | TRACE("biPlanes = %d\n", bmiHeader->biPlanes); |
| 295 | TRACE("biBitCount = %d\n", bmiHeader->biBitCount); |
| 296 | TRACE("biCompression = %s\n", debugstr_an((LPSTR)&(bmiHeader->biCompression), 4)); |
| 297 | TRACE("biSizeImage = %d\n", bmiHeader->biSizeImage); |
| 298 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 299 | if (!This->init) |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 300 | { |
Henri Verbeet | 166db1e | 2009-02-19 08:53:50 +0100 | [diff] [blame] | 301 | DWORD style = GetWindowLongW(This->hWnd, GWL_STYLE); |
| 302 | DWORD style_ex = GetWindowLongW(This->hWnd, GWL_EXSTYLE); |
| 303 | |
Maarten Lankhorst | 3e9cee0 | 2008-04-11 15:10:19 -0700 | [diff] [blame] | 304 | if (!This->WindowPos.right || !This->WindowPos.bottom) |
| 305 | This->WindowPos = This->SourceRect; |
| 306 | |
Henri Verbeet | 166db1e | 2009-02-19 08:53:50 +0100 | [diff] [blame] | 307 | AdjustWindowRectEx(&This->WindowPos, style, TRUE, style_ex); |
| 308 | |
Alex VillacÃs Lasso | fb8df8e | 2007-06-19 11:47:32 -0500 | [diff] [blame] | 309 | TRACE("WindowPos: %d %d %d %d\n", This->WindowPos.left, This->WindowPos.top, This->WindowPos.right, This->WindowPos.bottom); |
| 310 | SetWindowPos(This->hWnd, NULL, |
| 311 | This->WindowPos.left, |
| 312 | This->WindowPos.top, |
| 313 | This->WindowPos.right - This->WindowPos.left, |
| 314 | This->WindowPos.bottom - This->WindowPos.top, |
| 315 | SWP_NOZORDER|SWP_NOMOVE); |
Maarten Lankhorst | 3e9cee0 | 2008-04-11 15:10:19 -0700 | [diff] [blame] | 316 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 317 | GetClientRect(This->hWnd, &This->DestRect); |
Maarten Lankhorst | 3e9cee0 | 2008-04-11 15:10:19 -0700 | [diff] [blame] | 318 | This->init = TRUE; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 319 | } |
| 320 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 321 | hDC = GetDC(This->hWnd); |
| 322 | |
| 323 | if (!hDC) { |
| 324 | ERR("Cannot get DC from window!\n"); |
| 325 | return E_FAIL; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 326 | } |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 327 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 328 | TRACE("Src Rect: %d %d %d %d\n", This->SourceRect.left, This->SourceRect.top, This->SourceRect.right, This->SourceRect.bottom); |
| 329 | TRACE("Dst Rect: %d %d %d %d\n", This->DestRect.left, This->DestRect.top, This->DestRect.right, This->DestRect.bottom); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 330 | |
| 331 | StretchDIBits(hDC, This->DestRect.left, This->DestRect.top, This->DestRect.right -This->DestRect.left, |
| 332 | This->DestRect.bottom - This->DestRect.top, This->SourceRect.left, This->SourceRect.top, |
| 333 | This->SourceRect.right - This->SourceRect.left, This->SourceRect.bottom - This->SourceRect.top, |
Maarten Lankhorst | 3e9cee0 | 2008-04-11 15:10:19 -0700 | [diff] [blame] | 334 | data, (BITMAPINFO *)bmiHeader, DIB_RGB_COLORS, SRCCOPY); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 335 | |
| 336 | ReleaseDC(This->hWnd, hDC); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 337 | if (This->AutoShow) |
| 338 | ShowWindow(This->hWnd, SW_SHOW); |
| 339 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 340 | return S_OK; |
| 341 | } |
| 342 | |
| 343 | static HRESULT VideoRenderer_Sample(LPVOID iface, IMediaSample * pSample) |
| 344 | { |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 345 | VideoRendererImpl *This = iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 346 | LPBYTE pbSrcStream = NULL; |
| 347 | long cbSrcStream = 0; |
| 348 | REFERENCE_TIME tStart, tStop; |
| 349 | HRESULT hr; |
Christian Costa | 50fda76 | 2008-12-02 20:29:48 +0100 | [diff] [blame] | 350 | |
Christian Costa | c83e4f1 | 2008-12-29 12:00:10 +0100 | [diff] [blame] | 351 | TRACE("(%p)->(%p)\n", iface, pSample); |
| 352 | |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 353 | EnterCriticalSection(&This->csFilter); |
Christian Costa | 50fda76 | 2008-12-02 20:29:48 +0100 | [diff] [blame] | 354 | |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 355 | if (This->pInputPin->flushing || This->pInputPin->end_of_stream) |
Christian Costa | 50fda76 | 2008-12-02 20:29:48 +0100 | [diff] [blame] | 356 | { |
| 357 | LeaveCriticalSection(&This->csFilter); |
| 358 | return S_FALSE; |
| 359 | } |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 360 | |
Maarten Lankhorst | 3dc8384 | 2008-04-16 14:24:34 -0700 | [diff] [blame] | 361 | if (This->state == State_Stopped) |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 362 | { |
| 363 | LeaveCriticalSection(&This->csFilter); |
Maarten Lankhorst | 28c7b23 | 2008-07-02 20:09:33 -0700 | [diff] [blame] | 364 | return VFW_E_WRONG_STATE; |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 365 | } |
Maarten Lankhorst | 3dc8384 | 2008-04-16 14:24:34 -0700 | [diff] [blame] | 366 | |
Maarten Lankhorst | 37847b0 | 2008-04-28 15:00:51 -0700 | [diff] [blame] | 367 | hr = IMediaSample_GetTime(pSample, &tStart, &tStop); |
| 368 | if (FAILED(hr)) |
| 369 | ERR("Cannot get sample time (%x)\n", hr); |
| 370 | |
| 371 | if (This->rtLastStop != tStart) |
| 372 | { |
| 373 | if (IMediaSample_IsDiscontinuity(pSample) == S_FALSE) |
| 374 | ERR("Unexpected discontinuity: Last: %u.%03u, tStart: %u.%03u\n", |
| 375 | (DWORD)(This->rtLastStop / 10000000), |
| 376 | (DWORD)((This->rtLastStop / 10000)%1000), |
| 377 | (DWORD)(tStart / 10000000), (DWORD)((tStart / 10000)%1000)); |
| 378 | This->rtLastStop = tStart; |
| 379 | } |
| 380 | |
Maarten Lankhorst | 458b09a | 2008-04-17 11:16:13 -0700 | [diff] [blame] | 381 | /* Preroll means the sample isn't shown, this is used for key frames and things like that */ |
| 382 | if (IMediaSample_IsPreroll(pSample) == S_OK) |
Maarten Lankhorst | 37847b0 | 2008-04-28 15:00:51 -0700 | [diff] [blame] | 383 | { |
| 384 | This->rtLastStop = tStop; |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 385 | LeaveCriticalSection(&This->csFilter); |
Maarten Lankhorst | 458b09a | 2008-04-17 11:16:13 -0700 | [diff] [blame] | 386 | return S_OK; |
Maarten Lankhorst | 37847b0 | 2008-04-28 15:00:51 -0700 | [diff] [blame] | 387 | } |
Maarten Lankhorst | 458b09a | 2008-04-17 11:16:13 -0700 | [diff] [blame] | 388 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 389 | hr = IMediaSample_GetPointer(pSample, &pbSrcStream); |
| 390 | if (FAILED(hr)) |
| 391 | { |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 392 | ERR("Cannot get pointer to sample data (%x)\n", hr); |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 393 | LeaveCriticalSection(&This->csFilter); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 394 | return hr; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 395 | } |
| 396 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 397 | cbSrcStream = IMediaSample_GetActualDataLength(pSample); |
| 398 | |
| 399 | TRACE("val %p %ld\n", pbSrcStream, cbSrcStream); |
| 400 | |
| 401 | #if 0 /* For debugging purpose */ |
| 402 | { |
| 403 | int i; |
| 404 | for(i = 0; i < cbSrcStream; i++) |
| 405 | { |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 406 | if ((i!=0) && !(i%16)) |
Alexandre Julliard | 9f85969 | 2005-09-25 15:23:21 +0000 | [diff] [blame] | 407 | TRACE("\n"); |
| 408 | TRACE("%02x ", pbSrcStream[i]); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 409 | } |
Alexandre Julliard | 9f85969 | 2005-09-25 15:23:21 +0000 | [diff] [blame] | 410 | TRACE("\n"); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 411 | } |
| 412 | #endif |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 413 | |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 414 | SetEvent(This->hEvent); |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 415 | if (This->state == State_Paused) |
| 416 | { |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 417 | This->sample_held = pSample; |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 418 | LeaveCriticalSection(&This->csFilter); |
| 419 | WaitForSingleObject(This->blocked, INFINITE); |
| 420 | EnterCriticalSection(&This->csFilter); |
| 421 | This->sample_held = NULL; |
| 422 | if (This->state == State_Paused) |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 423 | { |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 424 | /* Flushing */ |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 425 | LeaveCriticalSection(&This->csFilter); |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 426 | return S_OK; |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 427 | } |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 428 | if (This->state == State_Stopped) |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 429 | { |
| 430 | LeaveCriticalSection(&This->csFilter); |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 431 | return VFW_E_WRONG_STATE; |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 432 | } |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 433 | } |
| 434 | |
Maarten Lankhorst | 37847b0 | 2008-04-28 15:00:51 -0700 | [diff] [blame] | 435 | if (This->pClock && This->state == State_Running) |
| 436 | { |
| 437 | REFERENCE_TIME time, trefstart, trefstop; |
| 438 | LONG delta; |
| 439 | |
| 440 | /* Perhaps I <SHOULD> use the reference clock AdviseTime function here |
| 441 | * I'm not going to! When I tried, it seemed to generate lag and |
| 442 | * it caused instability. |
| 443 | */ |
| 444 | IReferenceClock_GetTime(This->pClock, &time); |
| 445 | |
| 446 | trefstart = This->rtStreamStart; |
| 447 | trefstop = (REFERENCE_TIME)((double)(tStop - tStart) / This->pInputPin->dRate) + This->rtStreamStart; |
| 448 | delta = (LONG)((trefstart-time)/10000); |
| 449 | This->rtStreamStart = trefstop; |
| 450 | This->rtLastStop = tStop; |
| 451 | |
| 452 | if (delta > 0) |
| 453 | { |
| 454 | TRACE("Sleeping for %u ms\n", delta); |
| 455 | Sleep(delta); |
| 456 | } |
| 457 | else if (time > trefstop) |
| 458 | { |
Alexandre Julliard | aa68258 | 2008-06-30 12:50:07 +0200 | [diff] [blame] | 459 | TRACE("Dropping sample: Time: %u.%03u ms trefstop: %u.%03u ms!\n", |
| 460 | (DWORD)(time / 10000000), (DWORD)((time / 10000)%1000), |
| 461 | (DWORD)(trefstop / 10000000), (DWORD)((trefstop / 10000)%1000) ); |
Maarten Lankhorst | 37847b0 | 2008-04-28 15:00:51 -0700 | [diff] [blame] | 462 | This->rtLastStop = tStop; |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 463 | LeaveCriticalSection(&This->csFilter); |
Maarten Lankhorst | 37847b0 | 2008-04-28 15:00:51 -0700 | [diff] [blame] | 464 | return S_OK; |
| 465 | } |
| 466 | } |
| 467 | This->rtLastStop = tStop; |
| 468 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 469 | VideoRenderer_SendSampleData(This, pbSrcStream, cbSrcStream); |
| 470 | |
Maarten Lankhorst | 992fb02 | 2008-07-04 16:59:22 -0700 | [diff] [blame] | 471 | LeaveCriticalSection(&This->csFilter); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 472 | return S_OK; |
| 473 | } |
| 474 | |
| 475 | static HRESULT VideoRenderer_QueryAccept(LPVOID iface, const AM_MEDIA_TYPE * pmt) |
| 476 | { |
Christian Costa | b82d94e | 2005-10-10 10:44:54 +0000 | [diff] [blame] | 477 | if (!IsEqualIID(&pmt->majortype, &MEDIATYPE_Video)) |
| 478 | return S_FALSE; |
| 479 | |
| 480 | if (IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB32) || |
| 481 | IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB24) || |
| 482 | IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB565) || |
| 483 | IsEqualIID(&pmt->subtype, &MEDIASUBTYPE_RGB8)) |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 484 | { |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 485 | VideoRendererImpl* This = iface; |
Christian Costa | b82d94e | 2005-10-10 10:44:54 +0000 | [diff] [blame] | 486 | |
Maarten Lankhorst | 3e9cee0 | 2008-04-11 15:10:19 -0700 | [diff] [blame] | 487 | if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) |
| 488 | { |
| 489 | VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pmt->pbFormat; |
| 490 | This->SourceRect.left = 0; |
| 491 | This->SourceRect.top = 0; |
| 492 | This->SourceRect.right = This->VideoWidth = format->bmiHeader.biWidth; |
| 493 | This->SourceRect.bottom = This->VideoHeight = format->bmiHeader.biHeight; |
| 494 | } |
| 495 | else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) |
| 496 | { |
| 497 | VIDEOINFOHEADER2 *format2 = (VIDEOINFOHEADER2 *)pmt->pbFormat; |
| 498 | |
| 499 | This->SourceRect.left = 0; |
| 500 | This->SourceRect.top = 0; |
| 501 | This->SourceRect.right = This->VideoWidth = format2->bmiHeader.biWidth; |
| 502 | This->SourceRect.bottom = This->VideoHeight = format2->bmiHeader.biHeight; |
| 503 | } |
| 504 | else |
Christian Costa | b82d94e | 2005-10-10 10:44:54 +0000 | [diff] [blame] | 505 | { |
| 506 | WARN("Format type %s not supported\n", debugstr_guid(&pmt->formattype)); |
| 507 | return S_FALSE; |
| 508 | } |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 509 | return S_OK; |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 510 | } |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 511 | return S_FALSE; |
| 512 | } |
| 513 | |
Maarten Lankhorst | 2eb6637 | 2008-06-10 18:40:09 +0200 | [diff] [blame] | 514 | static inline VideoRendererImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) |
| 515 | { |
| 516 | return (VideoRendererImpl *)((char*)iface - FIELD_OFFSET(VideoRendererImpl, mediaSeeking.lpVtbl)); |
| 517 | } |
| 518 | |
| 519 | static HRESULT WINAPI VideoRendererImpl_Seeking_QueryInterface(IMediaSeeking * iface, REFIID riid, LPVOID * ppv) |
| 520 | { |
| 521 | VideoRendererImpl *This = impl_from_IMediaSeeking(iface); |
| 522 | |
| 523 | return IUnknown_QueryInterface((IUnknown *)This, riid, ppv); |
| 524 | } |
| 525 | |
| 526 | static ULONG WINAPI VideoRendererImpl_Seeking_AddRef(IMediaSeeking * iface) |
| 527 | { |
| 528 | VideoRendererImpl *This = impl_from_IMediaSeeking(iface); |
| 529 | |
| 530 | return IUnknown_AddRef((IUnknown *)This); |
| 531 | } |
| 532 | |
| 533 | static ULONG WINAPI VideoRendererImpl_Seeking_Release(IMediaSeeking * iface) |
| 534 | { |
| 535 | VideoRendererImpl *This = impl_from_IMediaSeeking(iface); |
| 536 | |
| 537 | return IUnknown_Release((IUnknown *)This); |
| 538 | } |
| 539 | |
| 540 | static const IMediaSeekingVtbl VideoRendererImpl_Seeking_Vtbl = |
| 541 | { |
| 542 | VideoRendererImpl_Seeking_QueryInterface, |
| 543 | VideoRendererImpl_Seeking_AddRef, |
| 544 | VideoRendererImpl_Seeking_Release, |
| 545 | MediaSeekingImpl_GetCapabilities, |
| 546 | MediaSeekingImpl_CheckCapabilities, |
| 547 | MediaSeekingImpl_IsFormatSupported, |
| 548 | MediaSeekingImpl_QueryPreferredFormat, |
| 549 | MediaSeekingImpl_GetTimeFormat, |
| 550 | MediaSeekingImpl_IsUsingTimeFormat, |
| 551 | MediaSeekingImpl_SetTimeFormat, |
| 552 | MediaSeekingImpl_GetDuration, |
| 553 | MediaSeekingImpl_GetStopPosition, |
| 554 | MediaSeekingImpl_GetCurrentPosition, |
| 555 | MediaSeekingImpl_ConvertTimeFormat, |
| 556 | MediaSeekingImpl_SetPositions, |
| 557 | MediaSeekingImpl_GetPositions, |
| 558 | MediaSeekingImpl_GetAvailable, |
| 559 | MediaSeekingImpl_SetRate, |
| 560 | MediaSeekingImpl_GetRate, |
| 561 | MediaSeekingImpl_GetPreroll |
| 562 | }; |
| 563 | |
| 564 | static HRESULT VideoRendererImpl_Change(IBaseFilter *iface) |
| 565 | { |
Christian Costa | c83e4f1 | 2008-12-29 12:00:10 +0100 | [diff] [blame] | 566 | TRACE("(%p)->()\n", iface); |
Maarten Lankhorst | 2eb6637 | 2008-06-10 18:40:09 +0200 | [diff] [blame] | 567 | return S_OK; |
| 568 | } |
| 569 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 570 | HRESULT VideoRenderer_create(IUnknown * pUnkOuter, LPVOID * ppv) |
| 571 | { |
| 572 | HRESULT hr; |
| 573 | PIN_INFO piInput; |
| 574 | VideoRendererImpl * pVideoRenderer; |
| 575 | |
| 576 | TRACE("(%p, %p)\n", pUnkOuter, ppv); |
| 577 | |
| 578 | *ppv = NULL; |
| 579 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 580 | pVideoRenderer = CoTaskMemAlloc(sizeof(VideoRendererImpl)); |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 581 | pVideoRenderer->pUnkOuter = pUnkOuter; |
| 582 | pVideoRenderer->bUnkOuterValid = FALSE; |
| 583 | pVideoRenderer->bAggregatable = FALSE; |
| 584 | pVideoRenderer->IInner_vtbl = &IInner_VTable; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 585 | |
| 586 | pVideoRenderer->lpVtbl = &VideoRenderer_Vtbl; |
| 587 | pVideoRenderer->IBasicVideo_vtbl = &IBasicVideo_VTable; |
| 588 | pVideoRenderer->IVideoWindow_vtbl = &IVideoWindow_VTable; |
| 589 | |
| 590 | pVideoRenderer->refCount = 1; |
| 591 | InitializeCriticalSection(&pVideoRenderer->csFilter); |
Jan Zerebecki | b5619e8 | 2007-03-10 22:10:20 +0100 | [diff] [blame] | 592 | pVideoRenderer->csFilter.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": VideoRendererImpl.csFilter"); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 593 | pVideoRenderer->state = State_Stopped; |
| 594 | pVideoRenderer->pClock = NULL; |
| 595 | pVideoRenderer->init = 0; |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 596 | pVideoRenderer->AutoShow = 1; |
Maarten Lankhorst | 37847b0 | 2008-04-28 15:00:51 -0700 | [diff] [blame] | 597 | pVideoRenderer->rtLastStop = -1; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 598 | ZeroMemory(&pVideoRenderer->filterInfo, sizeof(FILTER_INFO)); |
Maarten Lankhorst | 5026c25 | 2008-05-21 15:48:32 -0700 | [diff] [blame] | 599 | ZeroMemory(&pVideoRenderer->SourceRect, sizeof(RECT)); |
| 600 | ZeroMemory(&pVideoRenderer->DestRect, sizeof(RECT)); |
| 601 | ZeroMemory(&pVideoRenderer->WindowPos, sizeof(RECT)); |
| 602 | pVideoRenderer->hWndMsgDrain = NULL; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 603 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 604 | /* construct input pin */ |
| 605 | piInput.dir = PINDIR_INPUT; |
| 606 | piInput.pFilter = (IBaseFilter *)pVideoRenderer; |
Peter Berg Larsen | e732fc0 | 2005-03-28 14:17:51 +0000 | [diff] [blame] | 607 | lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0])); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 608 | |
Maarten Lankhorst | e870540 | 2008-06-10 17:57:41 +0200 | [diff] [blame] | 609 | hr = InputPin_Construct(&VideoRenderer_InputPin_Vtbl, &piInput, VideoRenderer_Sample, (LPVOID)pVideoRenderer, VideoRenderer_QueryAccept, NULL, &pVideoRenderer->csFilter, NULL, (IPin **)&pVideoRenderer->pInputPin); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 610 | |
| 611 | if (SUCCEEDED(hr)) |
| 612 | { |
Maarten Lankhorst | 2eb6637 | 2008-06-10 18:40:09 +0200 | [diff] [blame] | 613 | MediaSeekingImpl_Init((IBaseFilter*)pVideoRenderer, VideoRendererImpl_Change, VideoRendererImpl_Change, VideoRendererImpl_Change, &pVideoRenderer->mediaSeeking, &pVideoRenderer->csFilter); |
| 614 | pVideoRenderer->mediaSeeking.lpVtbl = &VideoRendererImpl_Seeking_Vtbl; |
| 615 | |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 616 | pVideoRenderer->sample_held = NULL; |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 617 | *ppv = pVideoRenderer; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 618 | } |
| 619 | else |
| 620 | { |
Jan Zerebecki | b5619e8 | 2007-03-10 22:10:20 +0100 | [diff] [blame] | 621 | pVideoRenderer->csFilter.DebugInfo->Spare[0] = 0; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 622 | DeleteCriticalSection(&pVideoRenderer->csFilter); |
| 623 | CoTaskMemFree(pVideoRenderer); |
| 624 | } |
| 625 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 626 | if (!CreateRenderingSubsystem(pVideoRenderer)) |
| 627 | return E_FAIL; |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 628 | |
| 629 | pVideoRenderer->blocked = CreateEventW(NULL, FALSE, FALSE, NULL); |
| 630 | if (!pVideoRenderer->blocked) |
| 631 | { |
| 632 | hr = HRESULT_FROM_WIN32(GetLastError()); |
| 633 | IUnknown_Release((IUnknown *)pVideoRenderer); |
| 634 | } |
| 635 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 636 | return hr; |
| 637 | } |
| 638 | |
Lei Zhang | 9742724 | 2008-02-02 01:47:34 -0800 | [diff] [blame] | 639 | HRESULT VideoRendererDefault_create(IUnknown * pUnkOuter, LPVOID * ppv) |
| 640 | { |
Austin English | 313a85f | 2008-04-10 21:17:14 -0500 | [diff] [blame] | 641 | /* TODO: Attempt to use the VMR-7 renderer instead when possible */ |
Lei Zhang | 9742724 | 2008-02-02 01:47:34 -0800 | [diff] [blame] | 642 | return VideoRenderer_create(pUnkOuter, ppv); |
| 643 | } |
| 644 | |
Lei Zhang | 63df94b | 2007-12-13 15:05:58 -0800 | [diff] [blame] | 645 | static HRESULT WINAPI VideoRendererInner_QueryInterface(IUnknown * iface, REFIID riid, LPVOID * ppv) |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 646 | { |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 647 | ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 648 | TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv); |
| 649 | |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 650 | if (This->bAggregatable) |
| 651 | This->bUnkOuterValid = TRUE; |
| 652 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 653 | *ppv = NULL; |
| 654 | |
| 655 | if (IsEqualIID(riid, &IID_IUnknown)) |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 656 | *ppv = &This->IInner_vtbl; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 657 | else if (IsEqualIID(riid, &IID_IPersist)) |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 658 | *ppv = This; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 659 | else if (IsEqualIID(riid, &IID_IMediaFilter)) |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 660 | *ppv = This; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 661 | else if (IsEqualIID(riid, &IID_IBaseFilter)) |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 662 | *ppv = This; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 663 | else if (IsEqualIID(riid, &IID_IBasicVideo)) |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 664 | *ppv = &This->IBasicVideo_vtbl; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 665 | else if (IsEqualIID(riid, &IID_IVideoWindow)) |
Michael Stefaniuc | cc7fc4a | 2009-01-29 11:14:55 +0100 | [diff] [blame] | 666 | *ppv = &This->IVideoWindow_vtbl; |
Maarten Lankhorst | 2eb6637 | 2008-06-10 18:40:09 +0200 | [diff] [blame] | 667 | else if (IsEqualIID(riid, &IID_IMediaSeeking)) |
| 668 | *ppv = &This->mediaSeeking; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 669 | |
| 670 | if (*ppv) |
| 671 | { |
| 672 | IUnknown_AddRef((IUnknown *)(*ppv)); |
| 673 | return S_OK; |
| 674 | } |
| 675 | |
Maarten Lankhorst | db8b2ca | 2008-03-21 15:36:51 -0700 | [diff] [blame] | 676 | if (!IsEqualIID(riid, &IID_IPin)) |
| 677 | FIXME("No interface for %s!\n", qzdebugstr_guid(riid)); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 678 | |
| 679 | return E_NOINTERFACE; |
| 680 | } |
| 681 | |
Lei Zhang | 63df94b | 2007-12-13 15:05:58 -0800 | [diff] [blame] | 682 | static ULONG WINAPI VideoRendererInner_AddRef(IUnknown * iface) |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 683 | { |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 684 | ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface); |
Paul Vriens | c6559a1 | 2005-01-06 19:36:47 +0000 | [diff] [blame] | 685 | ULONG refCount = InterlockedIncrement(&This->refCount); |
Christian Costa | 9b8d5c6 | 2004-12-27 17:15:58 +0000 | [diff] [blame] | 686 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 687 | TRACE("(%p/%p)->() AddRef from %d\n", This, iface, refCount - 1); |
Christian Costa | 9b8d5c6 | 2004-12-27 17:15:58 +0000 | [diff] [blame] | 688 | |
Paul Vriens | c6559a1 | 2005-01-06 19:36:47 +0000 | [diff] [blame] | 689 | return refCount; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 690 | } |
| 691 | |
Lei Zhang | 63df94b | 2007-12-13 15:05:58 -0800 | [diff] [blame] | 692 | static ULONG WINAPI VideoRendererInner_Release(IUnknown * iface) |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 693 | { |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 694 | ICOM_THIS_MULTI(VideoRendererImpl, IInner_vtbl, iface); |
Paul Vriens | c6559a1 | 2005-01-06 19:36:47 +0000 | [diff] [blame] | 695 | ULONG refCount = InterlockedDecrement(&This->refCount); |
Christian Costa | 9b8d5c6 | 2004-12-27 17:15:58 +0000 | [diff] [blame] | 696 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 697 | TRACE("(%p/%p)->() Release from %d\n", This, iface, refCount + 1); |
Christian Costa | 9b8d5c6 | 2004-12-27 17:15:58 +0000 | [diff] [blame] | 698 | |
Paul Vriens | c6559a1 | 2005-01-06 19:36:47 +0000 | [diff] [blame] | 699 | if (!refCount) |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 700 | { |
Chris Robinson | 809f684 | 2007-03-13 10:47:47 -0700 | [diff] [blame] | 701 | IPin *pConnectedTo; |
| 702 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 703 | DestroyWindow(This->hWnd); |
| 704 | PostThreadMessageA(This->ThreadID, WM_QUIT, 0, 0); |
| 705 | WaitForSingleObject(This->hThread, INFINITE); |
| 706 | CloseHandle(This->hThread); |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 707 | CloseHandle(This->hEvent); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 708 | |
Christian Costa | cb6e4a1 | 2005-06-04 09:37:35 +0000 | [diff] [blame] | 709 | if (This->pClock) |
| 710 | IReferenceClock_Release(This->pClock); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 711 | |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 712 | if (SUCCEEDED(IPin_ConnectedTo((IPin *)This->pInputPin, &pConnectedTo))) |
Chris Robinson | 809f684 | 2007-03-13 10:47:47 -0700 | [diff] [blame] | 713 | { |
| 714 | IPin_Disconnect(pConnectedTo); |
| 715 | IPin_Release(pConnectedTo); |
| 716 | } |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 717 | IPin_Disconnect((IPin *)This->pInputPin); |
Chris Robinson | 809f684 | 2007-03-13 10:47:47 -0700 | [diff] [blame] | 718 | |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 719 | IPin_Release((IPin *)This->pInputPin); |
| 720 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 721 | This->lpVtbl = NULL; |
| 722 | |
Chris Robinson | 6bd3b15 | 2007-03-19 13:26:09 -0700 | [diff] [blame] | 723 | This->csFilter.DebugInfo->Spare[0] = 0; |
| 724 | DeleteCriticalSection(&This->csFilter); |
| 725 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 726 | TRACE("Destroying Video Renderer\n"); |
| 727 | CoTaskMemFree(This); |
| 728 | |
| 729 | return 0; |
| 730 | } |
| 731 | else |
Paul Vriens | c6559a1 | 2005-01-06 19:36:47 +0000 | [diff] [blame] | 732 | return refCount; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 733 | } |
| 734 | |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 735 | static const IUnknownVtbl IInner_VTable = |
| 736 | { |
Lei Zhang | 63df94b | 2007-12-13 15:05:58 -0800 | [diff] [blame] | 737 | VideoRendererInner_QueryInterface, |
| 738 | VideoRendererInner_AddRef, |
| 739 | VideoRendererInner_Release |
Lei Zhang | 932cc2d | 2007-12-13 03:16:27 -0800 | [diff] [blame] | 740 | }; |
| 741 | |
| 742 | static HRESULT WINAPI VideoRenderer_QueryInterface(IBaseFilter * iface, REFIID riid, LPVOID * ppv) |
| 743 | { |
| 744 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
| 745 | |
| 746 | if (This->bAggregatable) |
| 747 | This->bUnkOuterValid = TRUE; |
| 748 | |
| 749 | if (This->pUnkOuter) |
| 750 | { |
| 751 | if (This->bAggregatable) |
| 752 | return IUnknown_QueryInterface(This->pUnkOuter, riid, ppv); |
| 753 | |
| 754 | if (IsEqualIID(riid, &IID_IUnknown)) |
| 755 | { |
| 756 | HRESULT hr; |
| 757 | |
| 758 | IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl)); |
| 759 | hr = IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv); |
| 760 | IUnknown_Release((IUnknown *)&(This->IInner_vtbl)); |
| 761 | This->bAggregatable = TRUE; |
| 762 | return hr; |
| 763 | } |
| 764 | |
| 765 | *ppv = NULL; |
| 766 | return E_NOINTERFACE; |
| 767 | } |
| 768 | |
| 769 | return IUnknown_QueryInterface((IUnknown *)&(This->IInner_vtbl), riid, ppv); |
| 770 | } |
| 771 | |
| 772 | static ULONG WINAPI VideoRenderer_AddRef(IBaseFilter * iface) |
| 773 | { |
| 774 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
| 775 | |
| 776 | if (This->pUnkOuter && This->bUnkOuterValid) |
| 777 | return IUnknown_AddRef(This->pUnkOuter); |
| 778 | return IUnknown_AddRef((IUnknown *)&(This->IInner_vtbl)); |
| 779 | } |
| 780 | |
| 781 | static ULONG WINAPI VideoRenderer_Release(IBaseFilter * iface) |
| 782 | { |
| 783 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
| 784 | |
| 785 | if (This->pUnkOuter && This->bUnkOuterValid) |
| 786 | return IUnknown_Release(This->pUnkOuter); |
| 787 | return IUnknown_Release((IUnknown *)&(This->IInner_vtbl)); |
| 788 | } |
| 789 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 790 | /** IPersist methods **/ |
| 791 | |
| 792 | static HRESULT WINAPI VideoRenderer_GetClassID(IBaseFilter * iface, CLSID * pClsid) |
| 793 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 794 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 795 | |
| 796 | TRACE("(%p/%p)->(%p)\n", This, iface, pClsid); |
| 797 | |
| 798 | *pClsid = CLSID_VideoRenderer; |
| 799 | |
| 800 | return S_OK; |
| 801 | } |
| 802 | |
| 803 | /** IMediaFilter methods **/ |
| 804 | |
| 805 | static HRESULT WINAPI VideoRenderer_Stop(IBaseFilter * iface) |
| 806 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 807 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 808 | |
| 809 | TRACE("(%p/%p)->()\n", This, iface); |
| 810 | |
| 811 | EnterCriticalSection(&This->csFilter); |
| 812 | { |
| 813 | This->state = State_Stopped; |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 814 | SetEvent(This->hEvent); |
| 815 | SetEvent(This->blocked); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 816 | } |
| 817 | LeaveCriticalSection(&This->csFilter); |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 818 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 819 | return S_OK; |
| 820 | } |
| 821 | |
| 822 | static HRESULT WINAPI VideoRenderer_Pause(IBaseFilter * iface) |
| 823 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 824 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 825 | |
| 826 | TRACE("(%p/%p)->()\n", This, iface); |
| 827 | |
| 828 | EnterCriticalSection(&This->csFilter); |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 829 | if (This->state != State_Paused) |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 830 | { |
Maarten Lankhorst | 01c6e64 | 2008-04-04 16:27:29 -0700 | [diff] [blame] | 831 | if (This->state == State_Stopped) |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 832 | { |
Maarten Lankhorst | 01c6e64 | 2008-04-04 16:27:29 -0700 | [diff] [blame] | 833 | This->pInputPin->end_of_stream = 0; |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 834 | ResetEvent(This->hEvent); |
| 835 | } |
Maarten Lankhorst | 01c6e64 | 2008-04-04 16:27:29 -0700 | [diff] [blame] | 836 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 837 | This->state = State_Paused; |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 838 | ResetEvent(This->blocked); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 839 | } |
| 840 | LeaveCriticalSection(&This->csFilter); |
| 841 | |
| 842 | return S_OK; |
| 843 | } |
| 844 | |
| 845 | static HRESULT WINAPI VideoRenderer_Run(IBaseFilter * iface, REFERENCE_TIME tStart) |
| 846 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 847 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 848 | |
| 849 | TRACE("(%p/%p)->(%s)\n", This, iface, wine_dbgstr_longlong(tStart)); |
| 850 | |
| 851 | EnterCriticalSection(&This->csFilter); |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 852 | if (This->state != State_Running) |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 853 | { |
Maarten Lankhorst | 01c6e64 | 2008-04-04 16:27:29 -0700 | [diff] [blame] | 854 | if (This->state == State_Stopped) |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 855 | { |
Maarten Lankhorst | 01c6e64 | 2008-04-04 16:27:29 -0700 | [diff] [blame] | 856 | This->pInputPin->end_of_stream = 0; |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 857 | ResetEvent(This->hEvent); |
| 858 | } |
| 859 | SetEvent(This->blocked); |
Maarten Lankhorst | 01c6e64 | 2008-04-04 16:27:29 -0700 | [diff] [blame] | 860 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 861 | This->rtStreamStart = tStart; |
| 862 | This->state = State_Running; |
| 863 | } |
| 864 | LeaveCriticalSection(&This->csFilter); |
| 865 | |
| 866 | return S_OK; |
| 867 | } |
| 868 | |
| 869 | static HRESULT WINAPI VideoRenderer_GetState(IBaseFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState) |
| 870 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 871 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 872 | HRESULT hr; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 873 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 874 | TRACE("(%p/%p)->(%d, %p)\n", This, iface, dwMilliSecsTimeout, pState); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 875 | |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 876 | if (WaitForSingleObject(This->hEvent, dwMilliSecsTimeout) == WAIT_TIMEOUT) |
| 877 | hr = VFW_S_STATE_INTERMEDIATE; |
| 878 | else |
| 879 | hr = S_OK; |
| 880 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 881 | EnterCriticalSection(&This->csFilter); |
| 882 | { |
| 883 | *pState = This->state; |
| 884 | } |
| 885 | LeaveCriticalSection(&This->csFilter); |
| 886 | |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 887 | return hr; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 888 | } |
| 889 | |
| 890 | static HRESULT WINAPI VideoRenderer_SetSyncSource(IBaseFilter * iface, IReferenceClock *pClock) |
| 891 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 892 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 893 | |
| 894 | TRACE("(%p/%p)->(%p)\n", This, iface, pClock); |
| 895 | |
| 896 | EnterCriticalSection(&This->csFilter); |
| 897 | { |
| 898 | if (This->pClock) |
| 899 | IReferenceClock_Release(This->pClock); |
| 900 | This->pClock = pClock; |
| 901 | if (This->pClock) |
| 902 | IReferenceClock_AddRef(This->pClock); |
| 903 | } |
| 904 | LeaveCriticalSection(&This->csFilter); |
| 905 | |
| 906 | return S_OK; |
| 907 | } |
| 908 | |
| 909 | static HRESULT WINAPI VideoRenderer_GetSyncSource(IBaseFilter * iface, IReferenceClock **ppClock) |
| 910 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 911 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 912 | |
| 913 | TRACE("(%p/%p)->(%p)\n", This, iface, ppClock); |
| 914 | |
| 915 | EnterCriticalSection(&This->csFilter); |
| 916 | { |
| 917 | *ppClock = This->pClock; |
Maarten Lankhorst | f9c2d8e | 2008-04-19 15:19:32 -0700 | [diff] [blame] | 918 | if (This->pClock) |
| 919 | IReferenceClock_AddRef(This->pClock); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 920 | } |
| 921 | LeaveCriticalSection(&This->csFilter); |
| 922 | |
| 923 | return S_OK; |
| 924 | } |
| 925 | |
| 926 | /** IBaseFilter implementation **/ |
| 927 | |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 928 | static HRESULT VideoRenderer_GetPin(IBaseFilter *iface, ULONG pos, IPin **pin, DWORD *lastsynctick) |
| 929 | { |
| 930 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
| 931 | |
| 932 | /* Our pins are static, not changing so setting static tick count is ok */ |
| 933 | *lastsynctick = 0; |
| 934 | |
| 935 | if (pos >= 1) |
| 936 | return S_FALSE; |
| 937 | |
| 938 | *pin = (IPin *)This->pInputPin; |
| 939 | IPin_AddRef(*pin); |
| 940 | return S_OK; |
| 941 | } |
| 942 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 943 | static HRESULT WINAPI VideoRenderer_EnumPins(IBaseFilter * iface, IEnumPins **ppEnum) |
| 944 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 945 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 946 | |
| 947 | TRACE("(%p/%p)->(%p)\n", This, iface, ppEnum); |
| 948 | |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 949 | return IEnumPinsImpl_Construct(ppEnum, VideoRenderer_GetPin, iface); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 950 | } |
| 951 | |
| 952 | static HRESULT WINAPI VideoRenderer_FindPin(IBaseFilter * iface, LPCWSTR Id, IPin **ppPin) |
| 953 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 954 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 955 | |
Christian Costa | c83e4f1 | 2008-12-29 12:00:10 +0100 | [diff] [blame] | 956 | FIXME("(%p/%p)->(%p,%p): stub !!!\n", This, iface, debugstr_w(Id), ppPin); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 957 | |
| 958 | /* FIXME: critical section */ |
| 959 | |
| 960 | return E_NOTIMPL; |
| 961 | } |
| 962 | |
| 963 | static HRESULT WINAPI VideoRenderer_QueryFilterInfo(IBaseFilter * iface, FILTER_INFO *pInfo) |
| 964 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 965 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 966 | |
| 967 | TRACE("(%p/%p)->(%p)\n", This, iface, pInfo); |
| 968 | |
| 969 | strcpyW(pInfo->achName, This->filterInfo.achName); |
| 970 | pInfo->pGraph = This->filterInfo.pGraph; |
| 971 | |
| 972 | if (pInfo->pGraph) |
| 973 | IFilterGraph_AddRef(pInfo->pGraph); |
| 974 | |
| 975 | return S_OK; |
| 976 | } |
| 977 | |
| 978 | static HRESULT WINAPI VideoRenderer_JoinFilterGraph(IBaseFilter * iface, IFilterGraph *pGraph, LPCWSTR pName) |
| 979 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 980 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 981 | |
| 982 | TRACE("(%p/%p)->(%p, %s)\n", This, iface, pGraph, debugstr_w(pName)); |
| 983 | |
| 984 | EnterCriticalSection(&This->csFilter); |
| 985 | { |
| 986 | if (pName) |
| 987 | strcpyW(This->filterInfo.achName, pName); |
| 988 | else |
| 989 | *This->filterInfo.achName = '\0'; |
| 990 | This->filterInfo.pGraph = pGraph; /* NOTE: do NOT increase ref. count */ |
| 991 | } |
| 992 | LeaveCriticalSection(&This->csFilter); |
| 993 | |
| 994 | return S_OK; |
| 995 | } |
| 996 | |
| 997 | static HRESULT WINAPI VideoRenderer_QueryVendorInfo(IBaseFilter * iface, LPWSTR *pVendorInfo) |
| 998 | { |
Alexandre Julliard | f5f7a18 | 2004-09-08 01:50:37 +0000 | [diff] [blame] | 999 | VideoRendererImpl *This = (VideoRendererImpl *)iface; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1000 | TRACE("(%p/%p)->(%p)\n", This, iface, pVendorInfo); |
| 1001 | return E_NOTIMPL; |
| 1002 | } |
| 1003 | |
| 1004 | static const IBaseFilterVtbl VideoRenderer_Vtbl = |
| 1005 | { |
| 1006 | VideoRenderer_QueryInterface, |
| 1007 | VideoRenderer_AddRef, |
| 1008 | VideoRenderer_Release, |
| 1009 | VideoRenderer_GetClassID, |
| 1010 | VideoRenderer_Stop, |
| 1011 | VideoRenderer_Pause, |
| 1012 | VideoRenderer_Run, |
| 1013 | VideoRenderer_GetState, |
| 1014 | VideoRenderer_SetSyncSource, |
| 1015 | VideoRenderer_GetSyncSource, |
| 1016 | VideoRenderer_EnumPins, |
| 1017 | VideoRenderer_FindPin, |
| 1018 | VideoRenderer_QueryFilterInfo, |
| 1019 | VideoRenderer_JoinFilterGraph, |
| 1020 | VideoRenderer_QueryVendorInfo |
| 1021 | }; |
| 1022 | |
Christian Costa | 7dea79c | 2005-03-02 10:12:12 +0000 | [diff] [blame] | 1023 | static HRESULT WINAPI VideoRenderer_InputPin_EndOfStream(IPin * iface) |
| 1024 | { |
| 1025 | InputPin* This = (InputPin*)iface; |
| 1026 | IMediaEventSink* pEventSink; |
| 1027 | HRESULT hr; |
| 1028 | |
| 1029 | TRACE("(%p/%p)->()\n", This, iface); |
| 1030 | |
| 1031 | hr = IFilterGraph_QueryInterface(((VideoRendererImpl*)This->pin.pinInfo.pFilter)->filterInfo.pGraph, &IID_IMediaEventSink, (LPVOID*)&pEventSink); |
| 1032 | if (SUCCEEDED(hr)) |
| 1033 | { |
| 1034 | hr = IMediaEventSink_Notify(pEventSink, EC_COMPLETE, S_OK, 0); |
| 1035 | IMediaEventSink_Release(pEventSink); |
| 1036 | } |
| 1037 | |
| 1038 | return hr; |
| 1039 | } |
| 1040 | |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 1041 | static HRESULT WINAPI VideoRenderer_InputPin_BeginFlush(IPin * iface) |
| 1042 | { |
| 1043 | InputPin* This = (InputPin*)iface; |
| 1044 | VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter; |
| 1045 | HRESULT hr; |
| 1046 | |
| 1047 | TRACE("(%p/%p)->()\n", This, iface); |
| 1048 | |
| 1049 | EnterCriticalSection(This->pin.pCritSec); |
| 1050 | if (pVideoRenderer->state == State_Paused) |
| 1051 | SetEvent(pVideoRenderer->blocked); |
| 1052 | |
| 1053 | hr = InputPin_BeginFlush(iface); |
| 1054 | LeaveCriticalSection(This->pin.pCritSec); |
| 1055 | |
| 1056 | return hr; |
| 1057 | } |
| 1058 | |
| 1059 | static HRESULT WINAPI VideoRenderer_InputPin_EndFlush(IPin * iface) |
| 1060 | { |
| 1061 | InputPin* This = (InputPin*)iface; |
| 1062 | VideoRendererImpl *pVideoRenderer = (VideoRendererImpl *)This->pin.pinInfo.pFilter; |
| 1063 | HRESULT hr; |
| 1064 | |
| 1065 | TRACE("(%p/%p)->()\n", This, iface); |
| 1066 | |
| 1067 | EnterCriticalSection(This->pin.pCritSec); |
| 1068 | if (pVideoRenderer->state == State_Paused) |
| 1069 | ResetEvent(pVideoRenderer->blocked); |
| 1070 | |
| 1071 | hr = InputPin_EndFlush(iface); |
| 1072 | LeaveCriticalSection(This->pin.pCritSec); |
| 1073 | |
| 1074 | return hr; |
| 1075 | } |
| 1076 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1077 | static const IPinVtbl VideoRenderer_InputPin_Vtbl = |
| 1078 | { |
| 1079 | InputPin_QueryInterface, |
| 1080 | IPinImpl_AddRef, |
| 1081 | InputPin_Release, |
| 1082 | InputPin_Connect, |
| 1083 | InputPin_ReceiveConnection, |
| 1084 | IPinImpl_Disconnect, |
| 1085 | IPinImpl_ConnectedTo, |
| 1086 | IPinImpl_ConnectionMediaType, |
| 1087 | IPinImpl_QueryPinInfo, |
| 1088 | IPinImpl_QueryDirection, |
| 1089 | IPinImpl_QueryId, |
| 1090 | IPinImpl_QueryAccept, |
| 1091 | IPinImpl_EnumMediaTypes, |
| 1092 | IPinImpl_QueryInternalConnections, |
Christian Costa | 7dea79c | 2005-03-02 10:12:12 +0000 | [diff] [blame] | 1093 | VideoRenderer_InputPin_EndOfStream, |
Maarten Lankhorst | 9985f2e | 2008-07-04 01:33:04 -0700 | [diff] [blame] | 1094 | VideoRenderer_InputPin_BeginFlush, |
| 1095 | VideoRenderer_InputPin_EndFlush, |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1096 | InputPin_NewSegment |
| 1097 | }; |
| 1098 | |
| 1099 | /*** IUnknown methods ***/ |
| 1100 | static HRESULT WINAPI Basicvideo_QueryInterface(IBasicVideo *iface, |
| 1101 | REFIID riid, |
| 1102 | LPVOID*ppvObj) { |
| 1103 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1104 | |
| 1105 | TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj); |
| 1106 | |
| 1107 | return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj); |
| 1108 | } |
| 1109 | |
| 1110 | static ULONG WINAPI Basicvideo_AddRef(IBasicVideo *iface) { |
| 1111 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1112 | |
| 1113 | TRACE("(%p/%p)->()\n", This, iface); |
| 1114 | |
| 1115 | return VideoRenderer_AddRef((IBaseFilter*)This); |
| 1116 | } |
| 1117 | |
| 1118 | static ULONG WINAPI Basicvideo_Release(IBasicVideo *iface) { |
| 1119 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1120 | |
| 1121 | TRACE("(%p/%p)->()\n", This, iface); |
| 1122 | |
| 1123 | return VideoRenderer_Release((IBaseFilter*)This); |
| 1124 | } |
| 1125 | |
| 1126 | /*** IDispatch methods ***/ |
| 1127 | static HRESULT WINAPI Basicvideo_GetTypeInfoCount(IBasicVideo *iface, |
| 1128 | UINT*pctinfo) { |
| 1129 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1130 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1131 | FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1132 | |
| 1133 | return S_OK; |
| 1134 | } |
| 1135 | |
| 1136 | static HRESULT WINAPI Basicvideo_GetTypeInfo(IBasicVideo *iface, |
| 1137 | UINT iTInfo, |
| 1138 | LCID lcid, |
| 1139 | ITypeInfo**ppTInfo) { |
| 1140 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1141 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 1142 | FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1143 | |
| 1144 | return S_OK; |
| 1145 | } |
| 1146 | |
| 1147 | static HRESULT WINAPI Basicvideo_GetIDsOfNames(IBasicVideo *iface, |
| 1148 | REFIID riid, |
| 1149 | LPOLESTR*rgszNames, |
| 1150 | UINT cNames, |
| 1151 | LCID lcid, |
| 1152 | DISPID*rgDispId) { |
| 1153 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1154 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 1155 | FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1156 | |
| 1157 | return S_OK; |
| 1158 | } |
| 1159 | |
| 1160 | static HRESULT WINAPI Basicvideo_Invoke(IBasicVideo *iface, |
| 1161 | DISPID dispIdMember, |
| 1162 | REFIID riid, |
| 1163 | LCID lcid, |
| 1164 | WORD wFlags, |
| 1165 | DISPPARAMS*pDispParams, |
| 1166 | VARIANT*pVarResult, |
| 1167 | EXCEPINFO*pExepInfo, |
| 1168 | UINT*puArgErr) { |
| 1169 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1170 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 1171 | 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); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1172 | |
| 1173 | return S_OK; |
| 1174 | } |
| 1175 | |
| 1176 | /*** IBasicVideo methods ***/ |
| 1177 | static HRESULT WINAPI Basicvideo_get_AvgTimePerFrame(IBasicVideo *iface, |
| 1178 | REFTIME *pAvgTimePerFrame) { |
Maarten Lankhorst | 44827a0 | 2010-05-17 21:32:32 +0200 | [diff] [blame] | 1179 | AM_MEDIA_TYPE *pmt; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1180 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1181 | |
Maarten Lankhorst | 44827a0 | 2010-05-17 21:32:32 +0200 | [diff] [blame] | 1182 | if (!This->pInputPin->pin.pConnectedTo) |
| 1183 | return VFW_E_NOT_CONNECTED; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1184 | |
Maarten Lankhorst | 44827a0 | 2010-05-17 21:32:32 +0200 | [diff] [blame] | 1185 | TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame); |
| 1186 | |
| 1187 | pmt = &This->pInputPin->pin.mtCurrent; |
| 1188 | if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo)) { |
| 1189 | VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*)pmt->pbFormat; |
| 1190 | *pAvgTimePerFrame = vih->AvgTimePerFrame; |
| 1191 | } else if (IsEqualIID(&pmt->formattype, &FORMAT_VideoInfo2)) { |
| 1192 | VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2*)pmt->pbFormat; |
| 1193 | *pAvgTimePerFrame = vih->AvgTimePerFrame; |
| 1194 | } else { |
| 1195 | ERR("Unknown format type %s\n", qzdebugstr_guid(&pmt->formattype)); |
| 1196 | *pAvgTimePerFrame = 0; |
| 1197 | } |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1198 | return S_OK; |
| 1199 | } |
| 1200 | |
| 1201 | static HRESULT WINAPI Basicvideo_get_BitRate(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1202 | LONG *pBitRate) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1203 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1204 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1205 | FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitRate); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1206 | |
| 1207 | return S_OK; |
| 1208 | } |
| 1209 | |
| 1210 | static HRESULT WINAPI Basicvideo_get_BitErrorRate(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1211 | LONG *pBitErrorRate) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1212 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1213 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1214 | FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBitErrorRate); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1215 | |
| 1216 | return S_OK; |
| 1217 | } |
| 1218 | |
| 1219 | static HRESULT WINAPI Basicvideo_get_VideoWidth(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1220 | LONG *pVideoWidth) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1221 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1222 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1223 | TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth); |
| 1224 | |
| 1225 | *pVideoWidth = This->VideoWidth; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1226 | |
| 1227 | return S_OK; |
| 1228 | } |
| 1229 | |
| 1230 | static HRESULT WINAPI Basicvideo_get_VideoHeight(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1231 | LONG *pVideoHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1232 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1233 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1234 | TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight); |
| 1235 | |
| 1236 | *pVideoHeight = This->VideoHeight; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1237 | |
| 1238 | return S_OK; |
| 1239 | } |
| 1240 | |
| 1241 | static HRESULT WINAPI Basicvideo_put_SourceLeft(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1242 | LONG SourceLeft) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1243 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1244 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1245 | TRACE("(%p/%p)->(%d)\n", This, iface, SourceLeft); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1246 | |
| 1247 | This->SourceRect.left = SourceLeft; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1248 | |
| 1249 | return S_OK; |
| 1250 | } |
| 1251 | |
| 1252 | static HRESULT WINAPI Basicvideo_get_SourceLeft(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1253 | LONG *pSourceLeft) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1254 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1255 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1256 | TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft); |
| 1257 | |
| 1258 | *pSourceLeft = This->SourceRect.left; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1259 | |
| 1260 | return S_OK; |
| 1261 | } |
| 1262 | |
| 1263 | static HRESULT WINAPI Basicvideo_put_SourceWidth(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1264 | LONG SourceWidth) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1265 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1266 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1267 | TRACE("(%p/%p)->(%d)\n", This, iface, SourceWidth); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1268 | |
| 1269 | This->SourceRect.right = This->SourceRect.left + SourceWidth; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1270 | |
| 1271 | return S_OK; |
| 1272 | } |
| 1273 | |
| 1274 | static HRESULT WINAPI Basicvideo_get_SourceWidth(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1275 | LONG *pSourceWidth) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1276 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1277 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1278 | TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1279 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1280 | *pSourceWidth = This->SourceRect.right - This->SourceRect.left; |
| 1281 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1282 | return S_OK; |
| 1283 | } |
| 1284 | |
| 1285 | static HRESULT WINAPI Basicvideo_put_SourceTop(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1286 | LONG SourceTop) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1287 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1288 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1289 | TRACE("(%p/%p)->(%d)\n", This, iface, SourceTop); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1290 | |
| 1291 | This->SourceRect.top = SourceTop; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1292 | |
| 1293 | return S_OK; |
| 1294 | } |
| 1295 | |
| 1296 | static HRESULT WINAPI Basicvideo_get_SourceTop(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1297 | LONG *pSourceTop) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1298 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1299 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1300 | TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop); |
| 1301 | |
| 1302 | *pSourceTop = This->SourceRect.top; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1303 | |
| 1304 | return S_OK; |
| 1305 | } |
| 1306 | |
| 1307 | static HRESULT WINAPI Basicvideo_put_SourceHeight(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1308 | LONG SourceHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1309 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1310 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1311 | TRACE("(%p/%p)->(%d)\n", This, iface, SourceHeight); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1312 | |
| 1313 | This->SourceRect.bottom = This->SourceRect.top + SourceHeight; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1314 | |
| 1315 | return S_OK; |
| 1316 | } |
| 1317 | |
| 1318 | static HRESULT WINAPI Basicvideo_get_SourceHeight(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1319 | LONG *pSourceHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1320 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1321 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1322 | TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight); |
| 1323 | |
| 1324 | *pSourceHeight = This->SourceRect.bottom - This->SourceRect.top; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1325 | |
| 1326 | return S_OK; |
| 1327 | } |
| 1328 | |
| 1329 | static HRESULT WINAPI Basicvideo_put_DestinationLeft(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1330 | LONG DestinationLeft) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1331 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1332 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1333 | TRACE("(%p/%p)->(%d)\n", This, iface, DestinationLeft); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1334 | |
| 1335 | This->DestRect.left = DestinationLeft; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1336 | |
| 1337 | return S_OK; |
| 1338 | } |
| 1339 | |
| 1340 | static HRESULT WINAPI Basicvideo_get_DestinationLeft(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1341 | LONG *pDestinationLeft) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1342 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1343 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1344 | TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft); |
| 1345 | |
| 1346 | *pDestinationLeft = This->DestRect.left; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1347 | |
| 1348 | return S_OK; |
| 1349 | } |
| 1350 | |
| 1351 | static HRESULT WINAPI Basicvideo_put_DestinationWidth(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1352 | LONG DestinationWidth) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1353 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1354 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1355 | TRACE("(%p/%p)->(%d)\n", This, iface, DestinationWidth); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1356 | |
| 1357 | This->DestRect.right = This->DestRect.left + DestinationWidth; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1358 | |
| 1359 | return S_OK; |
| 1360 | } |
| 1361 | |
| 1362 | static HRESULT WINAPI Basicvideo_get_DestinationWidth(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1363 | LONG *pDestinationWidth) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1364 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1365 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1366 | TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth); |
| 1367 | |
| 1368 | *pDestinationWidth = This->DestRect.right - This->DestRect.left; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1369 | |
| 1370 | return S_OK; |
| 1371 | } |
| 1372 | |
| 1373 | static HRESULT WINAPI Basicvideo_put_DestinationTop(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1374 | LONG DestinationTop) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1375 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1376 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1377 | TRACE("(%p/%p)->(%d)\n", This, iface, DestinationTop); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1378 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1379 | This->DestRect.top = DestinationTop; |
| 1380 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1381 | return S_OK; |
| 1382 | } |
| 1383 | |
| 1384 | static HRESULT WINAPI Basicvideo_get_DestinationTop(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1385 | LONG *pDestinationTop) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1386 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1387 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1388 | TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop); |
| 1389 | |
| 1390 | *pDestinationTop = This->DestRect.top; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1391 | |
| 1392 | return S_OK; |
| 1393 | } |
| 1394 | |
| 1395 | static HRESULT WINAPI Basicvideo_put_DestinationHeight(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1396 | LONG DestinationHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1397 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1398 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1399 | TRACE("(%p/%p)->(%d)\n", This, iface, DestinationHeight); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1400 | |
| 1401 | This->DestRect.right = This->DestRect.left + DestinationHeight; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1402 | |
| 1403 | return S_OK; |
| 1404 | } |
| 1405 | |
| 1406 | static HRESULT WINAPI Basicvideo_get_DestinationHeight(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1407 | LONG *pDestinationHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1408 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1409 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1410 | TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight); |
| 1411 | |
| 1412 | *pDestinationHeight = This->DestRect.right - This->DestRect.left; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1413 | |
| 1414 | return S_OK; |
| 1415 | } |
| 1416 | |
| 1417 | static HRESULT WINAPI Basicvideo_SetSourcePosition(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1418 | LONG Left, |
| 1419 | LONG Top, |
| 1420 | LONG Width, |
| 1421 | LONG Height) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1422 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1423 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1424 | TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1425 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1426 | This->SourceRect.left = Left; |
| 1427 | This->SourceRect.top = Top; |
| 1428 | This->SourceRect.right = Left + Width; |
| 1429 | This->SourceRect.bottom = Top + Height; |
| 1430 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1431 | return S_OK; |
| 1432 | } |
| 1433 | |
| 1434 | static HRESULT WINAPI Basicvideo_GetSourcePosition(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1435 | LONG *pLeft, |
| 1436 | LONG *pTop, |
| 1437 | LONG *pWidth, |
| 1438 | LONG *pHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1439 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1440 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1441 | TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1442 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1443 | *pLeft = This->SourceRect.left; |
| 1444 | *pTop = This->SourceRect.top; |
| 1445 | *pWidth = This->SourceRect.right - This->SourceRect.left; |
| 1446 | *pHeight = This->SourceRect.bottom - This->SourceRect.top; |
| 1447 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1448 | return S_OK; |
| 1449 | } |
| 1450 | |
| 1451 | static HRESULT WINAPI Basicvideo_SetDefaultSourcePosition(IBasicVideo *iface) { |
| 1452 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1453 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1454 | TRACE("(%p/%p)->()\n", This, iface); |
| 1455 | |
| 1456 | This->SourceRect.left = 0; |
| 1457 | This->SourceRect.top = 0; |
| 1458 | This->SourceRect.right = This->VideoWidth; |
| 1459 | This->SourceRect.bottom = This->VideoHeight; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1460 | |
| 1461 | return S_OK; |
| 1462 | } |
| 1463 | |
| 1464 | static HRESULT WINAPI Basicvideo_SetDestinationPosition(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1465 | LONG Left, |
| 1466 | LONG Top, |
| 1467 | LONG Width, |
| 1468 | LONG Height) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1469 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1470 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1471 | TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1472 | |
| 1473 | This->DestRect.left = Left; |
| 1474 | This->DestRect.top = Top; |
| 1475 | This->DestRect.right = Left + Width; |
| 1476 | This->DestRect.bottom = Top + Height; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1477 | |
| 1478 | return S_OK; |
| 1479 | } |
| 1480 | |
| 1481 | static HRESULT WINAPI Basicvideo_GetDestinationPosition(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1482 | LONG *pLeft, |
| 1483 | LONG *pTop, |
| 1484 | LONG *pWidth, |
| 1485 | LONG *pHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1486 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1487 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1488 | TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight); |
| 1489 | |
| 1490 | *pLeft = This->DestRect.left; |
| 1491 | *pTop = This->DestRect.top; |
| 1492 | *pWidth = This->DestRect.right - This->DestRect.left; |
| 1493 | *pHeight = This->DestRect.bottom - This->DestRect.top; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1494 | |
| 1495 | return S_OK; |
| 1496 | } |
| 1497 | |
| 1498 | static HRESULT WINAPI Basicvideo_SetDefaultDestinationPosition(IBasicVideo *iface) { |
| 1499 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1500 | RECT rect; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1501 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1502 | TRACE("(%p/%p)->()\n", This, iface); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1503 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1504 | if (!GetClientRect(This->hWnd, &rect)) |
| 1505 | return E_FAIL; |
| 1506 | |
| 1507 | This->SourceRect.left = 0; |
| 1508 | This->SourceRect.top = 0; |
| 1509 | This->SourceRect.right = rect.right; |
| 1510 | This->SourceRect.bottom = rect.bottom; |
| 1511 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1512 | return S_OK; |
| 1513 | } |
| 1514 | |
| 1515 | static HRESULT WINAPI Basicvideo_GetVideoSize(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1516 | LONG *pWidth, |
| 1517 | LONG *pHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1518 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1519 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1520 | TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1521 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1522 | *pWidth = This->VideoWidth; |
| 1523 | *pHeight = This->VideoHeight; |
| 1524 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1525 | return S_OK; |
| 1526 | } |
| 1527 | |
| 1528 | static HRESULT WINAPI Basicvideo_GetVideoPaletteEntries(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1529 | LONG StartIndex, |
| 1530 | LONG Entries, |
| 1531 | LONG *pRetrieved, |
| 1532 | LONG *pPalette) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1533 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1534 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1535 | FIXME("(%p/%p)->(%d, %d, %p, %p): stub !!!\n", This, iface, StartIndex, Entries, pRetrieved, pPalette); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1536 | |
| 1537 | return S_OK; |
| 1538 | } |
| 1539 | |
| 1540 | static HRESULT WINAPI Basicvideo_GetCurrentImage(IBasicVideo *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1541 | LONG *pBufferSize, |
| 1542 | LONG *pDIBImage) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1543 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 1544 | BITMAPINFOHEADER *bmiHeader; |
| 1545 | LONG needed_size; |
| 1546 | AM_MEDIA_TYPE *amt = &This->pInputPin->pin.mtCurrent; |
| 1547 | char *ptr; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1548 | |
Christian Costa | c83e4f1 | 2008-12-29 12:00:10 +0100 | [diff] [blame] | 1549 | FIXME("(%p/%p)->(%p, %p): partial stub\n", This, iface, pBufferSize, pDIBImage); |
| 1550 | |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 1551 | EnterCriticalSection(&This->csFilter); |
| 1552 | |
| 1553 | if (!This->sample_held) |
| 1554 | { |
| 1555 | LeaveCriticalSection(&This->csFilter); |
| 1556 | return (This->state == State_Paused ? E_UNEXPECTED : VFW_E_NOT_PAUSED); |
| 1557 | } |
| 1558 | |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 1559 | if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo)) |
| 1560 | { |
| 1561 | bmiHeader = &((VIDEOINFOHEADER *)amt->pbFormat)->bmiHeader; |
| 1562 | } |
| 1563 | else if (IsEqualIID(&amt->formattype, &FORMAT_VideoInfo2)) |
| 1564 | { |
| 1565 | bmiHeader = &((VIDEOINFOHEADER2 *)amt->pbFormat)->bmiHeader; |
| 1566 | } |
| 1567 | else |
| 1568 | { |
| 1569 | FIXME("Unknown type %s\n", debugstr_guid(&amt->subtype)); |
| 1570 | LeaveCriticalSection(&This->csFilter); |
| 1571 | return VFW_E_RUNTIME_ERROR; |
| 1572 | } |
| 1573 | |
| 1574 | needed_size = bmiHeader->biSize; |
| 1575 | needed_size += IMediaSample_GetActualDataLength(This->sample_held); |
| 1576 | |
| 1577 | if (!pDIBImage) |
| 1578 | { |
| 1579 | *pBufferSize = needed_size; |
| 1580 | LeaveCriticalSection(&This->csFilter); |
| 1581 | return S_OK; |
| 1582 | } |
| 1583 | |
| 1584 | if (needed_size < *pBufferSize) |
| 1585 | { |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1586 | ERR("Buffer too small %u/%u\n", needed_size, *pBufferSize); |
Maarten Lankhorst | dae09d0 | 2008-06-10 18:45:25 +0200 | [diff] [blame] | 1587 | LeaveCriticalSection(&This->csFilter); |
| 1588 | return E_FAIL; |
| 1589 | } |
| 1590 | *pBufferSize = needed_size; |
| 1591 | |
| 1592 | memcpy(pDIBImage, bmiHeader, bmiHeader->biSize); |
| 1593 | IMediaSample_GetPointer(This->sample_held, (BYTE **)&ptr); |
| 1594 | memcpy((char *)pDIBImage + bmiHeader->biSize, ptr, IMediaSample_GetActualDataLength(This->sample_held)); |
| 1595 | |
| 1596 | LeaveCriticalSection(&This->csFilter); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1597 | |
| 1598 | return S_OK; |
| 1599 | } |
| 1600 | |
| 1601 | static HRESULT WINAPI Basicvideo_IsUsingDefaultSource(IBasicVideo *iface) { |
| 1602 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1603 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1604 | FIXME("(%p/%p)->(): stub !!!\n", This, iface); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1605 | |
| 1606 | return S_OK; |
| 1607 | } |
| 1608 | |
| 1609 | static HRESULT WINAPI Basicvideo_IsUsingDefaultDestination(IBasicVideo *iface) { |
| 1610 | ICOM_THIS_MULTI(VideoRendererImpl, IBasicVideo_vtbl, iface); |
| 1611 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1612 | FIXME("(%p/%p)->(): stub !!!\n", This, iface); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1613 | |
| 1614 | return S_OK; |
| 1615 | } |
| 1616 | |
| 1617 | |
Dmitry Timoshkov | eba47f1 | 2005-06-06 19:50:35 +0000 | [diff] [blame] | 1618 | static const IBasicVideoVtbl IBasicVideo_VTable = |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1619 | { |
| 1620 | Basicvideo_QueryInterface, |
| 1621 | Basicvideo_AddRef, |
| 1622 | Basicvideo_Release, |
| 1623 | Basicvideo_GetTypeInfoCount, |
| 1624 | Basicvideo_GetTypeInfo, |
| 1625 | Basicvideo_GetIDsOfNames, |
| 1626 | Basicvideo_Invoke, |
| 1627 | Basicvideo_get_AvgTimePerFrame, |
| 1628 | Basicvideo_get_BitRate, |
| 1629 | Basicvideo_get_BitErrorRate, |
| 1630 | Basicvideo_get_VideoWidth, |
| 1631 | Basicvideo_get_VideoHeight, |
| 1632 | Basicvideo_put_SourceLeft, |
| 1633 | Basicvideo_get_SourceLeft, |
| 1634 | Basicvideo_put_SourceWidth, |
| 1635 | Basicvideo_get_SourceWidth, |
| 1636 | Basicvideo_put_SourceTop, |
| 1637 | Basicvideo_get_SourceTop, |
| 1638 | Basicvideo_put_SourceHeight, |
| 1639 | Basicvideo_get_SourceHeight, |
| 1640 | Basicvideo_put_DestinationLeft, |
| 1641 | Basicvideo_get_DestinationLeft, |
| 1642 | Basicvideo_put_DestinationWidth, |
| 1643 | Basicvideo_get_DestinationWidth, |
| 1644 | Basicvideo_put_DestinationTop, |
| 1645 | Basicvideo_get_DestinationTop, |
| 1646 | Basicvideo_put_DestinationHeight, |
| 1647 | Basicvideo_get_DestinationHeight, |
| 1648 | Basicvideo_SetSourcePosition, |
| 1649 | Basicvideo_GetSourcePosition, |
| 1650 | Basicvideo_SetDefaultSourcePosition, |
| 1651 | Basicvideo_SetDestinationPosition, |
| 1652 | Basicvideo_GetDestinationPosition, |
| 1653 | Basicvideo_SetDefaultDestinationPosition, |
| 1654 | Basicvideo_GetVideoSize, |
| 1655 | Basicvideo_GetVideoPaletteEntries, |
| 1656 | Basicvideo_GetCurrentImage, |
| 1657 | Basicvideo_IsUsingDefaultSource, |
| 1658 | Basicvideo_IsUsingDefaultDestination |
| 1659 | }; |
| 1660 | |
| 1661 | |
| 1662 | /*** IUnknown methods ***/ |
| 1663 | static HRESULT WINAPI Videowindow_QueryInterface(IVideoWindow *iface, |
| 1664 | REFIID riid, |
| 1665 | LPVOID*ppvObj) { |
| 1666 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1667 | |
| 1668 | TRACE("(%p/%p)->(%s (%p), %p)\n", This, iface, debugstr_guid(riid), riid, ppvObj); |
| 1669 | |
| 1670 | return VideoRenderer_QueryInterface((IBaseFilter*)This, riid, ppvObj); |
| 1671 | } |
| 1672 | |
| 1673 | static ULONG WINAPI Videowindow_AddRef(IVideoWindow *iface) { |
| 1674 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1675 | |
| 1676 | TRACE("(%p/%p)->()\n", This, iface); |
| 1677 | |
| 1678 | return VideoRenderer_AddRef((IBaseFilter*)This); |
| 1679 | } |
| 1680 | |
| 1681 | static ULONG WINAPI Videowindow_Release(IVideoWindow *iface) { |
| 1682 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1683 | |
| 1684 | TRACE("(%p/%p)->()\n", This, iface); |
| 1685 | |
| 1686 | return VideoRenderer_Release((IBaseFilter*)This); |
| 1687 | } |
| 1688 | |
| 1689 | /*** IDispatch methods ***/ |
| 1690 | static HRESULT WINAPI Videowindow_GetTypeInfoCount(IVideoWindow *iface, |
| 1691 | UINT*pctinfo) { |
| 1692 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1693 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1694 | FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pctinfo); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1695 | |
| 1696 | return S_OK; |
| 1697 | } |
| 1698 | |
| 1699 | static HRESULT WINAPI Videowindow_GetTypeInfo(IVideoWindow *iface, |
| 1700 | UINT iTInfo, |
| 1701 | LCID lcid, |
| 1702 | ITypeInfo**ppTInfo) { |
| 1703 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1704 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 1705 | FIXME("(%p/%p)->(%d, %d, %p): stub !!!\n", This, iface, iTInfo, lcid, ppTInfo); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1706 | |
| 1707 | return S_OK; |
| 1708 | } |
| 1709 | |
| 1710 | static HRESULT WINAPI Videowindow_GetIDsOfNames(IVideoWindow *iface, |
| 1711 | REFIID riid, |
| 1712 | LPOLESTR*rgszNames, |
| 1713 | UINT cNames, |
| 1714 | LCID lcid, |
| 1715 | DISPID*rgDispId) { |
| 1716 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1717 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 1718 | FIXME("(%p/%p)->(%s (%p), %p, %d, %d, %p): stub !!!\n", This, iface, debugstr_guid(riid), riid, rgszNames, cNames, lcid, rgDispId); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1719 | |
| 1720 | return S_OK; |
| 1721 | } |
| 1722 | |
| 1723 | static HRESULT WINAPI Videowindow_Invoke(IVideoWindow *iface, |
| 1724 | DISPID dispIdMember, |
| 1725 | REFIID riid, |
| 1726 | LCID lcid, |
| 1727 | WORD wFlags, |
| 1728 | DISPPARAMS*pDispParams, |
| 1729 | VARIANT*pVarResult, |
| 1730 | EXCEPINFO*pExepInfo, |
| 1731 | UINT*puArgErr) { |
| 1732 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1733 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 1734 | 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); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1735 | |
| 1736 | return S_OK; |
| 1737 | } |
| 1738 | |
| 1739 | /*** IVideoWindow methods ***/ |
| 1740 | static HRESULT WINAPI Videowindow_put_Caption(IVideoWindow *iface, |
| 1741 | BSTR strCaption) { |
| 1742 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1743 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1744 | TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption); |
| 1745 | |
| 1746 | if (!SetWindowTextW(This->hWnd, strCaption)) |
| 1747 | return E_FAIL; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1748 | |
| 1749 | return S_OK; |
| 1750 | } |
| 1751 | |
| 1752 | static HRESULT WINAPI Videowindow_get_Caption(IVideoWindow *iface, |
| 1753 | BSTR *strCaption) { |
| 1754 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1755 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1756 | TRACE("(%p/%p)->(%p)\n", This, iface, strCaption); |
| 1757 | |
| 1758 | GetWindowTextW(This->hWnd, (LPWSTR)strCaption, 100); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1759 | |
| 1760 | return S_OK; |
| 1761 | } |
| 1762 | |
| 1763 | static HRESULT WINAPI Videowindow_put_WindowStyle(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1764 | LONG WindowStyle) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1765 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1766 | LONG old; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1767 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1768 | old = GetWindowLongA(This->hWnd, GWL_STYLE); |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1769 | |
| 1770 | TRACE("(%p/%p)->(%x -> %x)\n", This, iface, old, WindowStyle); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1771 | |
| 1772 | if (WindowStyle & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL)) |
| 1773 | return E_INVALIDARG; |
| 1774 | |
| 1775 | SetWindowLongA(This->hWnd, GWL_STYLE, WindowStyle); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1776 | |
| 1777 | return S_OK; |
| 1778 | } |
| 1779 | |
| 1780 | static HRESULT WINAPI Videowindow_get_WindowStyle(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1781 | LONG *WindowStyle) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1782 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1783 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1784 | TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle); |
| 1785 | |
| 1786 | *WindowStyle = GetWindowLongA(This->hWnd, GWL_STYLE); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1787 | |
| 1788 | return S_OK; |
| 1789 | } |
| 1790 | |
| 1791 | static HRESULT WINAPI Videowindow_put_WindowStyleEx(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1792 | LONG WindowStyleEx) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1793 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1794 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1795 | TRACE("(%p/%p)->(%d)\n", This, iface, WindowStyleEx); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1796 | |
| 1797 | if (WindowStyleEx & (WS_DISABLED|WS_HSCROLL|WS_ICONIC|WS_MAXIMIZE|WS_MINIMIZE|WS_VSCROLL)) |
| 1798 | return E_INVALIDARG; |
| 1799 | |
| 1800 | if (!SetWindowLongA(This->hWnd, GWL_EXSTYLE, WindowStyleEx)) |
| 1801 | return E_FAIL; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1802 | |
| 1803 | return S_OK; |
| 1804 | } |
| 1805 | |
| 1806 | static HRESULT WINAPI Videowindow_get_WindowStyleEx(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1807 | LONG *WindowStyleEx) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1808 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1809 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1810 | TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx); |
| 1811 | |
| 1812 | *WindowStyleEx = GetWindowLongA(This->hWnd, GWL_EXSTYLE); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1813 | |
| 1814 | return S_OK; |
| 1815 | } |
| 1816 | |
| 1817 | static HRESULT WINAPI Videowindow_put_AutoShow(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1818 | LONG AutoShow) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1819 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1820 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1821 | TRACE("(%p/%p)->(%d)\n", This, iface, AutoShow); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1822 | |
Christian Costa | c83e4f1 | 2008-12-29 12:00:10 +0100 | [diff] [blame] | 1823 | This->AutoShow = 1; /* FIXME: Should be AutoShow */; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1824 | |
| 1825 | return S_OK; |
| 1826 | } |
| 1827 | |
| 1828 | static HRESULT WINAPI Videowindow_get_AutoShow(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1829 | LONG *AutoShow) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1830 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1831 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1832 | TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow); |
| 1833 | |
| 1834 | *AutoShow = This->AutoShow; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1835 | |
| 1836 | return S_OK; |
| 1837 | } |
| 1838 | |
| 1839 | static HRESULT WINAPI Videowindow_put_WindowState(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1840 | LONG WindowState) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1841 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1842 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1843 | FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, WindowState); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1844 | |
| 1845 | return S_OK; |
| 1846 | } |
| 1847 | |
| 1848 | static HRESULT WINAPI Videowindow_get_WindowState(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1849 | LONG *WindowState) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1850 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1851 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1852 | FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, WindowState); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1853 | |
| 1854 | return S_OK; |
| 1855 | } |
| 1856 | |
| 1857 | static HRESULT WINAPI Videowindow_put_BackgroundPalette(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1858 | LONG BackgroundPalette) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1859 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1860 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1861 | FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, BackgroundPalette); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1862 | |
| 1863 | return S_OK; |
| 1864 | } |
| 1865 | |
| 1866 | static HRESULT WINAPI Videowindow_get_BackgroundPalette(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1867 | LONG *pBackgroundPalette) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1868 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1869 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1870 | FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pBackgroundPalette); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1871 | |
| 1872 | return S_OK; |
| 1873 | } |
| 1874 | |
| 1875 | static HRESULT WINAPI Videowindow_put_Visible(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1876 | LONG Visible) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1877 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1878 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1879 | TRACE("(%p/%p)->(%d)\n", This, iface, Visible); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1880 | |
| 1881 | ShowWindow(This->hWnd, Visible ? SW_SHOW : SW_HIDE); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1882 | |
| 1883 | return S_OK; |
| 1884 | } |
| 1885 | |
| 1886 | static HRESULT WINAPI Videowindow_get_Visible(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1887 | LONG *pVisible) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1888 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1889 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1890 | TRACE("(%p/%p)->(%p)\n", This, iface, pVisible); |
| 1891 | |
| 1892 | *pVisible = IsWindowVisible(This->hWnd); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1893 | |
| 1894 | return S_OK; |
| 1895 | } |
| 1896 | |
| 1897 | static HRESULT WINAPI Videowindow_put_Left(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1898 | LONG Left) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1899 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1900 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1901 | TRACE("(%p/%p)->(%d)\n", This, iface, Left); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1902 | |
| 1903 | if (!SetWindowPos(This->hWnd, NULL, Left, This->WindowPos.top, 0, 0, SWP_NOZORDER|SWP_NOSIZE)) |
| 1904 | return E_FAIL; |
| 1905 | |
| 1906 | This->WindowPos.left = Left; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1907 | |
| 1908 | return S_OK; |
| 1909 | } |
| 1910 | |
| 1911 | static HRESULT WINAPI Videowindow_get_Left(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1912 | LONG *pLeft) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1913 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1914 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1915 | TRACE("(%p/%p)->(%p)\n", This, iface, pLeft); |
| 1916 | |
| 1917 | *pLeft = This->WindowPos.left; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1918 | |
| 1919 | return S_OK; |
| 1920 | } |
| 1921 | |
| 1922 | static HRESULT WINAPI Videowindow_put_Width(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1923 | LONG Width) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1924 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1925 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1926 | TRACE("(%p/%p)->(%d)\n", This, iface, Width); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1927 | |
| 1928 | if (!SetWindowPos(This->hWnd, NULL, 0, 0, Width, This->WindowPos.bottom-This->WindowPos.top, SWP_NOZORDER|SWP_NOMOVE)) |
| 1929 | return E_FAIL; |
| 1930 | |
| 1931 | This->WindowPos.right = This->WindowPos.left + Width; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1932 | |
| 1933 | return S_OK; |
| 1934 | } |
| 1935 | |
| 1936 | static HRESULT WINAPI Videowindow_get_Width(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1937 | LONG *pWidth) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1938 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1939 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1940 | TRACE("(%p/%p)->(%p)\n", This, iface, pWidth); |
| 1941 | |
| 1942 | *pWidth = This->WindowPos.right - This->WindowPos.left; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1943 | |
| 1944 | return S_OK; |
| 1945 | } |
| 1946 | |
| 1947 | static HRESULT WINAPI Videowindow_put_Top(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1948 | LONG Top) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1949 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1950 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1951 | TRACE("(%p/%p)->(%d)\n", This, iface, Top); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1952 | |
| 1953 | if (!SetWindowPos(This->hWnd, NULL, This->WindowPos.left, Top, 0, 0, SWP_NOZORDER|SWP_NOSIZE)) |
| 1954 | return E_FAIL; |
| 1955 | |
| 1956 | This->WindowPos.top = Top; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1957 | |
| 1958 | return S_OK; |
| 1959 | } |
| 1960 | |
| 1961 | static HRESULT WINAPI Videowindow_get_Top(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1962 | LONG *pTop) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1963 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1964 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1965 | TRACE("(%p/%p)->(%p)\n", This, iface, pTop); |
| 1966 | |
| 1967 | *pTop = This->WindowPos.top; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1968 | |
| 1969 | return S_OK; |
| 1970 | } |
| 1971 | |
| 1972 | static HRESULT WINAPI Videowindow_put_Height(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1973 | LONG Height) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1974 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1975 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1976 | TRACE("(%p/%p)->(%d)\n", This, iface, Height); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1977 | |
| 1978 | if (!SetWindowPos(This->hWnd, NULL, 0, 0, This->WindowPos.right-This->WindowPos.left, Height, SWP_NOZORDER|SWP_NOMOVE)) |
| 1979 | return E_FAIL; |
| 1980 | |
| 1981 | This->WindowPos.bottom = This->WindowPos.top + Height; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1982 | |
| 1983 | return S_OK; |
| 1984 | } |
| 1985 | |
| 1986 | static HRESULT WINAPI Videowindow_get_Height(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 1987 | LONG *pHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1988 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 1989 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 1990 | TRACE("(%p/%p)->(%p)\n", This, iface, pHeight); |
| 1991 | |
| 1992 | *pHeight = This->WindowPos.bottom - This->WindowPos.top; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 1993 | |
| 1994 | return S_OK; |
| 1995 | } |
| 1996 | |
| 1997 | static HRESULT WINAPI Videowindow_put_Owner(IVideoWindow *iface, |
| 1998 | OAHWND Owner) { |
| 1999 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2000 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 2001 | TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Owner); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2002 | |
| 2003 | SetParent(This->hWnd, (HWND)Owner); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2004 | |
| 2005 | return S_OK; |
| 2006 | } |
| 2007 | |
| 2008 | static HRESULT WINAPI Videowindow_get_Owner(IVideoWindow *iface, |
| 2009 | OAHWND *Owner) { |
| 2010 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2011 | |
Alexandre Julliard | 0014046 | 2009-01-08 13:17:49 +0100 | [diff] [blame] | 2012 | TRACE("(%p/%p)->(%p)\n", This, iface, Owner); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2013 | |
| 2014 | *(HWND*)Owner = GetParent(This->hWnd); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2015 | |
| 2016 | return S_OK; |
| 2017 | } |
| 2018 | |
| 2019 | static HRESULT WINAPI Videowindow_put_MessageDrain(IVideoWindow *iface, |
| 2020 | OAHWND Drain) { |
| 2021 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2022 | |
Hans Leidekker | cfbb859 | 2006-10-12 20:57:23 +0200 | [diff] [blame] | 2023 | TRACE("(%p/%p)->(%08x)\n", This, iface, (DWORD) Drain); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2024 | |
| 2025 | This->hWndMsgDrain = (HWND)Drain; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2026 | |
| 2027 | return S_OK; |
| 2028 | } |
| 2029 | |
| 2030 | static HRESULT WINAPI Videowindow_get_MessageDrain(IVideoWindow *iface, |
| 2031 | OAHWND *Drain) { |
| 2032 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2033 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2034 | TRACE("(%p/%p)->(%p)\n", This, iface, Drain); |
| 2035 | |
| 2036 | *Drain = (OAHWND)This->hWndMsgDrain; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2037 | |
| 2038 | return S_OK; |
| 2039 | } |
| 2040 | |
| 2041 | static HRESULT WINAPI Videowindow_get_BorderColor(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2042 | LONG *Color) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2043 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2044 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2045 | FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, Color); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2046 | |
| 2047 | return S_OK; |
| 2048 | } |
| 2049 | |
| 2050 | static HRESULT WINAPI Videowindow_put_BorderColor(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2051 | LONG Color) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2052 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2053 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2054 | FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, Color); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2055 | |
| 2056 | return S_OK; |
| 2057 | } |
| 2058 | |
| 2059 | static HRESULT WINAPI Videowindow_get_FullScreenMode(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2060 | LONG *FullScreenMode) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2061 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2062 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2063 | FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, FullScreenMode); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2064 | |
| 2065 | return S_OK; |
| 2066 | } |
| 2067 | |
| 2068 | static HRESULT WINAPI Videowindow_put_FullScreenMode(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2069 | LONG FullScreenMode) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2070 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2071 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2072 | FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, FullScreenMode); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2073 | |
| 2074 | return S_OK; |
| 2075 | } |
| 2076 | |
| 2077 | static HRESULT WINAPI Videowindow_SetWindowForeground(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2078 | LONG Focus) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2079 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2080 | BOOL ret; |
| 2081 | IPin* pPin; |
| 2082 | HRESULT hr; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2083 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2084 | TRACE("(%p/%p)->(%d)\n", This, iface, Focus); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2085 | |
| 2086 | if ((Focus != FALSE) && (Focus != TRUE)) |
| 2087 | return E_INVALIDARG; |
| 2088 | |
Maarten Lankhorst | 7934951 | 2008-04-25 14:25:49 -0700 | [diff] [blame] | 2089 | hr = IPin_ConnectedTo((IPin *)This->pInputPin, &pPin); |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2090 | if ((hr != S_OK) || !pPin) |
| 2091 | return VFW_E_NOT_CONNECTED; |
| 2092 | |
| 2093 | if (Focus) |
| 2094 | ret = SetForegroundWindow(This->hWnd); |
| 2095 | else |
| 2096 | ret = SetWindowPos(This->hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); |
| 2097 | |
| 2098 | if (!ret) |
| 2099 | return E_FAIL; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2100 | |
| 2101 | return S_OK; |
| 2102 | } |
| 2103 | |
| 2104 | static HRESULT WINAPI Videowindow_NotifyOwnerMessage(IVideoWindow *iface, |
| 2105 | OAHWND hwnd, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2106 | LONG uMsg, |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2107 | LONG_PTR wParam, |
| 2108 | LONG_PTR lParam) { |
| 2109 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2110 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2111 | TRACE("(%p/%p)->(%08lx, %d, %08lx, %08lx)\n", This, iface, hwnd, uMsg, wParam, lParam); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2112 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2113 | if (!PostMessageA(This->hWnd, uMsg, wParam, lParam)) |
| 2114 | return E_FAIL; |
| 2115 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2116 | return S_OK; |
| 2117 | } |
| 2118 | |
| 2119 | static HRESULT WINAPI Videowindow_SetWindowPosition(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2120 | LONG Left, |
| 2121 | LONG Top, |
| 2122 | LONG Width, |
| 2123 | LONG Height) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2124 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2125 | |
| 2126 | TRACE("(%p/%p)->(%d, %d, %d, %d)\n", This, iface, Left, Top, Width, Height); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2127 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2128 | if (!SetWindowPos(This->hWnd, NULL, Left, Top, Width, Height, SWP_NOZORDER)) |
| 2129 | return E_FAIL; |
| 2130 | |
| 2131 | This->WindowPos.left = Left; |
| 2132 | This->WindowPos.top = Top; |
| 2133 | This->WindowPos.right = Left + Width; |
| 2134 | This->WindowPos.bottom = Top + Height; |
| 2135 | |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2136 | return S_OK; |
| 2137 | } |
| 2138 | |
| 2139 | static HRESULT WINAPI Videowindow_GetWindowPosition(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2140 | LONG *pLeft, |
| 2141 | LONG *pTop, |
| 2142 | LONG *pWidth, |
| 2143 | LONG *pHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2144 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2145 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2146 | TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight); |
| 2147 | |
| 2148 | *pLeft = This->WindowPos.left; |
| 2149 | *pTop = This->WindowPos.top; |
| 2150 | *pWidth = This->WindowPos.right - This->WindowPos.left; |
| 2151 | *pHeight = This->WindowPos.bottom - This->WindowPos.top; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2152 | |
| 2153 | return S_OK; |
| 2154 | } |
| 2155 | |
| 2156 | static HRESULT WINAPI Videowindow_GetMinIdealImageSize(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2157 | LONG *pWidth, |
| 2158 | LONG *pHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2159 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2160 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2161 | FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight); |
| 2162 | |
| 2163 | *pWidth = This->VideoWidth; |
| 2164 | *pHeight = This->VideoHeight; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2165 | |
| 2166 | return S_OK; |
| 2167 | } |
| 2168 | |
| 2169 | static HRESULT WINAPI Videowindow_GetMaxIdealImageSize(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2170 | LONG *pWidth, |
| 2171 | LONG *pHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2172 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2173 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2174 | FIXME("(%p/%p)->(%p, %p): semi stub !!!\n", This, iface, pWidth, pHeight); |
| 2175 | |
| 2176 | *pWidth = This->VideoWidth; |
| 2177 | *pHeight = This->VideoHeight; |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2178 | |
| 2179 | return S_OK; |
| 2180 | } |
| 2181 | |
| 2182 | static HRESULT WINAPI Videowindow_GetRestorePosition(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2183 | LONG *pLeft, |
| 2184 | LONG *pTop, |
| 2185 | LONG *pWidth, |
| 2186 | LONG *pHeight) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2187 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2188 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2189 | FIXME("(%p/%p)->(%p, %p, %p, %p): stub !!!\n", This, iface, pLeft, pTop, pWidth, pHeight); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2190 | |
| 2191 | return S_OK; |
| 2192 | } |
| 2193 | |
| 2194 | static HRESULT WINAPI Videowindow_HideCursor(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2195 | LONG HideCursor) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2196 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2197 | |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2198 | FIXME("(%p/%p)->(%d): stub !!!\n", This, iface, HideCursor); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2199 | |
| 2200 | return S_OK; |
| 2201 | } |
| 2202 | |
| 2203 | static HRESULT WINAPI Videowindow_IsCursorHidden(IVideoWindow *iface, |
Michael Stefaniuc | a3269bd | 2009-03-11 00:31:26 +0100 | [diff] [blame] | 2204 | LONG *CursorHidden) { |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2205 | ICOM_THIS_MULTI(VideoRendererImpl, IVideoWindow_vtbl, iface); |
| 2206 | |
Christian Costa | acb2ff2 | 2005-06-13 11:37:55 +0000 | [diff] [blame] | 2207 | FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, CursorHidden); |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2208 | |
| 2209 | return S_OK; |
| 2210 | } |
| 2211 | |
Dmitry Timoshkov | eba47f1 | 2005-06-06 19:50:35 +0000 | [diff] [blame] | 2212 | static const IVideoWindowVtbl IVideoWindow_VTable = |
Christian Costa | f096fa3 | 2004-08-24 02:28:35 +0000 | [diff] [blame] | 2213 | { |
| 2214 | Videowindow_QueryInterface, |
| 2215 | Videowindow_AddRef, |
| 2216 | Videowindow_Release, |
| 2217 | Videowindow_GetTypeInfoCount, |
| 2218 | Videowindow_GetTypeInfo, |
| 2219 | Videowindow_GetIDsOfNames, |
| 2220 | Videowindow_Invoke, |
| 2221 | Videowindow_put_Caption, |
| 2222 | Videowindow_get_Caption, |
| 2223 | Videowindow_put_WindowStyle, |
| 2224 | Videowindow_get_WindowStyle, |
| 2225 | Videowindow_put_WindowStyleEx, |
| 2226 | Videowindow_get_WindowStyleEx, |
| 2227 | Videowindow_put_AutoShow, |
| 2228 | Videowindow_get_AutoShow, |
| 2229 | Videowindow_put_WindowState, |
| 2230 | Videowindow_get_WindowState, |
| 2231 | Videowindow_put_BackgroundPalette, |
| 2232 | Videowindow_get_BackgroundPalette, |
| 2233 | Videowindow_put_Visible, |
| 2234 | Videowindow_get_Visible, |
| 2235 | Videowindow_put_Left, |
| 2236 | Videowindow_get_Left, |
| 2237 | Videowindow_put_Width, |
| 2238 | Videowindow_get_Width, |
| 2239 | Videowindow_put_Top, |
| 2240 | Videowindow_get_Top, |
| 2241 | Videowindow_put_Height, |
| 2242 | Videowindow_get_Height, |
| 2243 | Videowindow_put_Owner, |
| 2244 | Videowindow_get_Owner, |
| 2245 | Videowindow_put_MessageDrain, |
| 2246 | Videowindow_get_MessageDrain, |
| 2247 | Videowindow_get_BorderColor, |
| 2248 | Videowindow_put_BorderColor, |
| 2249 | Videowindow_get_FullScreenMode, |
| 2250 | Videowindow_put_FullScreenMode, |
| 2251 | Videowindow_SetWindowForeground, |
| 2252 | Videowindow_NotifyOwnerMessage, |
| 2253 | Videowindow_SetWindowPosition, |
| 2254 | Videowindow_GetWindowPosition, |
| 2255 | Videowindow_GetMinIdealImageSize, |
| 2256 | Videowindow_GetMaxIdealImageSize, |
| 2257 | Videowindow_GetRestorePosition, |
| 2258 | Videowindow_HideCursor, |
| 2259 | Videowindow_IsCursorHidden |
| 2260 | }; |