1/* 2 * Copyright (C) 2008 Maarten Lankhorst 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Lesser General Public 6 * License as published by the Free Software Foundation; either 7 * version 2.1 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Lesser General Public License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public 15 * License along with this library; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 17 */ 18 19cpp_quote("#if 0") 20typedef DWORD IDirectDrawSurface7; 21typedef DWORD IDirectDraw7; 22typedef DWORD *LPBITMAPINFOHEADER; 23typedef DWORD *LPDDPIXELFORMAT; 24typedef struct { DWORD dw1, dw2; } DDCOLORKEY; 25cpp_quote("#endif") 26cpp_quote("#include <ddraw.h>") 27 28interface IVMRSurface; 29interface IVMRSurfaceAllocator; 30interface IVMRSurfaceAllocatorNotify; 31interface IVMRImagePresenter; 32interface IVMRImagePresenterNotify; 33interface IVMRWindowlessControl; 34interface IVMRMixerControl; 35interface IVMRMixerBitmap; 36interface IVMRFilterConfig; 37interface IVMRAspectRatioControl; 38interface IVMRDeinterlaceControl; 39interface IVMRMonitorConfig; 40interface IVMRImageCompositor; 41interface IVMRVideoStreamControl; 42 43typedef enum _VMRPresentationFlags 44{ 45 VMRSample_SyncPoint = 0x01, 46 VMRSample_Preroll = 0x02, 47 VMRSample_Discontinuity = 0x04, 48 VMRSample_TimeValid = 0x08, 49 VMRSample_SrcDstRectsValid = 0x10 50} VMRPresentationFlags; 51 52typedef struct tagVMRPRESENTATIONINFO 53{ 54 DWORD dwFlags; 55 IDirectDrawSurface7 *lpSurf; 56 REFERENCE_TIME rtStart, rtEnd; 57 SIZE szAspectRatio; 58 RECT rcSrc, rcDst; 59 DWORD dwTypeSpecificFlags; 60 DWORD dwInterlaceFlags; 61} VMRPRESENTATIONINFO; 62 63[ 64 local, 65 object, 66 uuid(ce704fe7-e71e-41fb-baa2-c4403e1182f5), 67 helpstring("IVMRImagePresenter interface"), 68 pointer_default(unique) 69] 70interface IVMRImagePresenter : IUnknown 71{ 72 HRESULT StartPresenting([in] DWORD_PTR id); 73 HRESULT StopPresenting([in] DWORD_PTR id); 74 HRESULT PresentImage([in] DWORD_PTR id, [in] VMRPRESENTATIONINFO *info); 75}; 76 77typedef enum _VMRSurfaceAllocationFlags 78{ 79 AMAP_PIXELFORMAT_VALID = 0x01, 80 AMAP_3D_TARGET = 0x02, 81 AMAP_ALLOW_SYSMEM = 0x04, 82 AMAP_FORCE_SYSMEM = 0x08, 83 AMAP_DIRECTED_FLIP = 0x10, 84 AMAP_DXVA_TARGET = 0x20 85} VMRSurfaceAllocationFlags; 86 87typedef struct tagVMRALLOCATIONINFO 88{ 89 DWORD dwFlags; 90 LPBITMAPINFOHEADER lpHdr; 91 LPDDPIXELFORMAT lpPixFmt; 92 SIZE szAspectRatio; 93 DWORD dwMinBuffers; 94 DWORD dwMaxBuffers; 95 DWORD dwInterlaceFlags; 96 SIZE szNativeSize; 97} VMRALLOCATIONINFO; 98 99[ 100 local, 101 object, 102 uuid(31ce832e-4484-458b-8cca-f4d7e3db0b52), 103 helpstring("IVMRSurfaceAllocator interface"), 104 pointer_default(unique) 105] 106interface IVMRSurfaceAllocator : IUnknown 107{ 108 HRESULT AllocateSurface([in] DWORD_PTR id, [in] VMRALLOCATIONINFO *allocinfo, [in, out] DWORD *buffers, IDirectDrawSurface7 **surface); 109 HRESULT FreeSurface([in] DWORD_PTR id); 110 HRESULT PrepareSurface([in] DWORD_PTR id, [in] IDirectDrawSurface7 *surface, [in] DWORD dwSurfaceFlags); 111 HRESULT AdviseNotify([in] IVMRSurfaceAllocatorNotify *notify); 112}; 113 114[ 115 local, 116 object, 117 uuid(aada05a8-5a4e-4729-af0b-cea27aed51e2), 118 helpstring("IVMRSurfaceAllocatorNotify interface"), 119 pointer_default(unique) 120] 121interface IVMRSurfaceAllocatorNotify : IUnknown 122{ 123 HRESULT AdviseSurfaceAllocator([in] DWORD_PTR id, [in] IVMRSurfaceAllocator *allocator); 124 HRESULT SetDDrawDevice([in] IDirectDraw7 *device, [in] HMONITOR monitor); 125 HRESULT ChangeDDrawDevice([in] IDirectDraw7 *device, [in] HMONITOR monitor); 126 HRESULT RestoreDDrawSurfaces(); 127 HRESULT NotifyEvent([in] LONG EventCode, [in] LONG_PTR p1, [in] LONG_PTR p2); 128 HRESULT SetBorderColor([in] COLORREF border); 129}; 130 131typedef enum _VMR_ASPECT_RATIO_MODE 132{ 133 VMR_ARMODE_NONE, 134 VMR_ARMODE_LETTER_BOX 135} VMR_ASPECT_RATIO_MODE; 136 137[ 138 local, 139 object, 140 uuid(0eb1088c-4dcd-46f0-878f-39dae86a51b7), 141 helpstring("IVMRWindowlessControl interface"), 142 pointer_default(unique) 143] 144interface IVMRWindowlessControl : IUnknown 145{ 146 HRESULT GetNativeVideoSize([out] LONG *width, [out] LONG *height, [out] LONG *ar_width, [out] LONG *ar_height); 147 HRESULT GetMinIdealVideoSize([out] LONG *width, [out] LONG *height); 148 HRESULT GetMaxIdealVideoSize([out] LONG *width, [out] LONG *height); 149 HRESULT SetVideoPosition([in] const RECT *src_rect, [in] const RECT *dst_rect); 150 HRESULT GetVideoPosition([out] RECT *src_rect, [out] RECT *dst_rect); 151 HRESULT GetAspectRatioMode([out] DWORD *mode); 152 HRESULT SetAspectRatioMode([in] DWORD mode); 153 HRESULT SetVideoClippingWindow([in] HWND hwnd); 154 HRESULT RepaintVideo([in] HWND hwnd, [in] HDC hdc); 155 HRESULT DisplayModeChanged(); 156 HRESULT GetCurrentImage([out] BYTE **data); 157 HRESULT SetBorderColor([in] COLORREF border); 158 HRESULT GetBorderColor([out] COLORREF *border); 159 HRESULT SetColorKey([in] COLORREF key); 160 HRESULT GetColorKey([out] COLORREF *key); 161}; 162 163typedef enum _VMRMixerPrefs 164{ 165 MixerPref_NoDecimation = 0x0001, 166 MixerPref_DecimateOutput = 0x0002, 167 MixerPref_ARAdjustXorY = 0x0004, 168 MixerPref_DecimationReserved = 0x0008, 169 MixerPref_DecimateMask = 0x000f, 170 171 MixerPref_BiLinearFiltering = 0x0010, 172 MixerPref_PointFiltering = 0x0020, 173 MixerPref_FinteringMask = 0x00f0, 174 175 MixerPref_RenderTargetRGB = 0x0100, 176 MixerPref_RenderTargetYUV = 0x1000, 177 MixerPref_RenderTargetYUV420 = 0x0200, 178 MixerPref_RenderTargetYUV422 = 0x0400, 179 MixerPref_RenderTargetYUV444 = 0x0800, 180 MixerPref_RenderTargetReserved = 0xe000, 181 MixerPref_RenderTargetMask = 0xff00, 182 183 MixerPref_DynamicSwitchToBOB = 0x10000, 184 MixerPref_DynamicDecimateBy2 = 0x20000, 185 MixerPref_DynamicReserved = 0xc0000, 186 MixerPref_DynamicMask = 0xf0000 187} VMRMixerPrefs; 188 189typedef struct _NORMALIZEDRECT 190{ 191 FLOAT left, top, right, bottom; 192} NORMALIZEDRECT; 193 194[ 195 local, 196 object, 197 uuid(1c1a17b0-bed0-415d-974b-dc6696131599), 198 helpstring("IVMRMixerControl interface"), 199 pointer_default(unique) 200] 201interface IVMRMixerControl : IUnknown 202{ 203 HRESULT SetAlpha([in] DWORD id, [in] FLOAT alpha); 204 HRESULT GetAlpha([in] DWORD id, [out] FLOAT *alpha); 205 HRESULT SetZOrder([in] DWORD id, [in] DWORD z); 206 HRESULT GetZOrder([in] DWORD id, [out] DWORD *z); 207 HRESULT SetOutputRect([in] DWORD id, [in] const NORMALIZEDRECT *rect); 208 HRESULT SetBackgroundClr([in] COLORREF background); 209 HRESULT GetBackgroundClr([out] COLORREF *background); 210 HRESULT SetMixingPrefs([in] DWORD prefs); 211 HRESULT GetMixingPrefs([out] DWORD *prefs); 212}; 213 214typedef struct tagVMRGUID 215{ 216 struct _GUID *pGUID, GUID; 217} VMRGUID; 218 219#define VMRDEVICENAMELEN 32 220#define VMRDEVICEDESCRIPTIONLEN 256 221 222typedef struct tagVMRMONITORINFO 223{ 224 VMRGUID guid; 225 RECT rcMonitor; 226 HMONITOR hMon; 227 DWORD dwFlags; 228 WCHAR szDevice[VMRDEVICENAMELEN]; 229 WCHAR szDescription[VMRDEVICEDESCRIPTIONLEN]; 230 LARGE_INTEGER liDriverVersion; 231 DWORD dwVendorId; 232 DWORD dwDeviceId; 233 DWORD dwSubSysId; 234 DWORD dwRevision; 235} VMRMONITORINFO; 236 237[ 238 local, 239 object, 240 uuid(9cf0b1b6-fbaa-4b7f-88cf-cf1f130a0dce), 241 helpstring("IVMRMonitorConfig interface"), 242 pointer_default(unique) 243] 244interface IVMRMonitorConfig : IUnknown 245{ 246 HRESULT SetMonitor([in] const VMRGUID *vmrguid); 247 HRESULT GetMonitor([out] VMRGUID *vmrguid); 248 HRESULT SetDefaultMonitor([in] const VMRGUID *vmrguid); 249 HRESULT GetDefaultMonitor([out] VMRGUID *vmrguid); 250 HRESULT GetAvailableMonitors([out, size_is(array_size)] VMRMONITORINFO *info, [in] DWORD array_size, [out] DWORD *retrieved); 251} 252 253typedef enum _VMRRenderPrefs 254{ 255 RenderPrefs_RestrictToInitialMonitor = 0x00, 256 RenderPrefs_ForceOffScreen = 0x01, 257 RenderPrefs_ForceOverlays = 0x02, 258 RenderPrefs_AllowOverlays = 0x00, 259 RenderPrefs_AllowOffscreen = 0x00, 260 RenderPrefs_DoNotRenderColorKeyAndBorder = 0x08, 261 RenderPrefs_Reserved = 0x10, 262 RenderPrefs_PreferAGPMemWhenMixing = 0x20, 263 RenderPrefs_Mask = 0x3f 264} VMRRenderPrefs; 265 266typedef enum _VMRMode 267{ 268 VMRMode_Windowed = 0x1, 269 VMRMode_Windowless = 0x2, 270 VMRMode_Renderless = 0x4, 271 VMRMode_Mask = 0x7 272} VMRMode; 273 274enum { MAX_NUMBER_OF_STREAMS = 16 }; 275 276[ 277 local, 278 object, 279 uuid(9e5530c5-7034-48b4-bb46-0b8a6efc8e36), 280 helpstring("IVMRFilterConfig interface"), 281 pointer_default(unique) 282] 283interface IVMRFilterConfig : IUnknown 284{ 285 HRESULT SetImageCompositor([in] IVMRImageCompositor *compositor); 286 HRESULT SetNumberOfStreams([in] DWORD streams); 287 HRESULT GetNumberOfStreams([out] DWORD *streams); 288 HRESULT SetRenderingPrefs([in] DWORD prefs); 289 HRESULT GetRenderingPrefs([out] DWORD *prefs); 290 HRESULT SetRenderingMode([in] DWORD mode); 291 HRESULT GetRenderingMode([out] DWORD *mode); 292}; 293 294[ 295 local, 296 object, 297 uuid(ede80b5c-bad6-4623-b537-65586c9f8dfd), 298 helpstring("IVMRAspectRatioControl interface"), 299 pointer_default(unique) 300] 301interface IVMRAspectRatioControl : IUnknown 302{ 303 HRESULT GetAspectRatioMode([out] DWORD *armode); 304 HRESULT SetAspectRatioMode([in] DWORD armode); 305}; 306 307typedef enum _VMRDeinterlacePrefs 308{ 309 DeinterlacePref_NextBest = 0x1, 310 DeinterlacePref_BOB = 0x2, 311 DeinterlacePref_Weave = 0x4, 312 DeinterlacePref_Mask = 0x7 313} VMRDeinterlacePrefs; 314 315typedef enum _VMRDeinterlaceTech 316{ 317 DeinterlaceTech_Unknown = 0x00, 318 DeinterlaceTech_BOBLineReplicate = 0x01, 319 DeinterlaceTech_BOBVerticalStretch = 0x02, 320 DeinterlaceTech_MedianFiltering = 0x04, 321 DeinterlaceTech_EdgeFiltering = 0x08, 322 DeinterlaceTech_FieldAdaptive = 0x10, 323 DeinterlaceTech_PixelAdaptive = 0x20, 324 DeinterlaceTech_MotionVectorSteered = 0x80 325} VMRDeinterlaceTech; 326 327typedef struct _VMRFrequency 328{ 329 DWORD dwNumerator, dwDenominator; 330} VMRFrequency; 331 332typedef struct _VMRVideoDesc 333{ 334 DWORD dwSize; 335 DWORD dwSampleWidth; 336 DWORD dwSampleHeight; 337 BOOL SingleFieldPerSample; 338 DWORD dwFourCC; 339 VMRFrequency InputSampleFreq; 340 VMRFrequency OutputFrameFreq; 341} VMRVideoDesc; 342 343typedef struct _VMRDeinterlaceCaps 344{ 345 DWORD dwSize; 346 DWORD dwNumPreviousOutputFrames; 347 DWORD dwNumForwardRefSamples; 348 DWORD dwNumBackwardRefSamples; 349 VMRDeinterlaceTech DeinterlaceTechnology; 350} VMRDeinterlaceCaps; 351 352[ 353 local, 354 object, 355 uuid(bb057577-0db8-4e6a-87a7-1a8c9a505a0f), 356 helpstring("IVMRDeinterlaceControl interface"), 357 pointer_default(unique) 358] 359interface IVMRDeinterlaceControl : IUnknown 360{ 361 HRESULT GetNumberOfDeinterlaceModes([in] VMRVideoDesc *desc, [in, out] DWORD *num_modes, [out] GUID *modes); 362 HRESULT GetDeinterlaceModeCaps([in] GUID *mode, [in] VMRVideoDesc *desc, [in, out] VMRDeinterlaceCaps *caps); 363 HRESULT GetDeinterlaceMode([in] DWORD id, [out] GUID *mode); 364 HRESULT SetDeinterlaceMode([in] DWORD id, [in] GUID *mode); 365 HRESULT GetDeinterlacePrefs([out] DWORD *prefs); 366 HRESULT SetDeinterlacePrefs([in] DWORD prefs); 367 HRESULT GetActualDeinterlaceMode([in] DWORD id, [out] GUID *mode); 368}; 369 370typedef struct _VMRALPHABITMAP 371{ 372 DWORD dwFlags; 373 HDC hdc; 374 IDirectDrawSurface7 *pDDS; 375 RECT rSrc; 376 RECT rDest; 377 FLOAT fAlpha; 378 COLORREF clrSrcKey; 379} VMRALPHABITMAP, *PVMRALPHABITMAP; 380 381cpp_quote("#define VMRBITMAP_DISABLE (0x01)") 382cpp_quote("#define VMRBITMAP_HDC (0x02)") 383cpp_quote("#define VMRBITMAP_ENTIREDDS (0x04)") 384cpp_quote("#define VMRBITMAP_SRCCOLORKEY (0x08)") 385cpp_quote("#define VMRBITMAP_SRCRECT (0x10)") 386 387[ 388 local, 389 object, 390 uuid(1e673275-0257-40aa-af20-7c608d4a0428), 391 helpstring("IVMRMixerBitmap interface"), 392 pointer_default(unique) 393] 394interface IVMRMixerBitmap : IUnknown 395{ 396 HRESULT SetAlphaBitmap([in] const VMRALPHABITMAP *params); 397 HRESULT UpdateAlphaBitmapParameters([in] VMRALPHABITMAP *params); 398 HRESULT GetAlphaBitmapParameters([out] VMRALPHABITMAP *params); 399}; 400 401typedef struct _VMRVIDEOSTREAMINFO 402{ 403 IDirectDrawSurface7 *pddsVideoSurface; 404 DWORD dwWidth; 405 DWORD dwHeight; 406 DWORD dwStrmID; 407 FLOAT fAlpha; 408 DDCOLORKEY ddClrKey; 409 NORMALIZEDRECT rNormal; 410} VMRVIDEOSTREAMINFO; 411 412[ 413 local, 414 object, 415 uuid(7a4fb5af-479f-4074-bb40-ce6722e43c82), 416 helpstring("IVMRImageCompositor interface"), 417 pointer_default(unique) 418] 419interface IVMRImageCompositor : IUnknown 420{ 421 HRESULT InitCompositionTarget([in] IUnknown *d3ddev, [in] IDirectDrawSurface7 *rendertarget); 422 HRESULT TermCompositionTarget([in] IUnknown *d3ddev, [in] IDirectDrawSurface7 *rendertarget); 423 HRESULT SetStreamMediaType([in] DWORD id, [in] AM_MEDIA_TYPE *pmt, [in] BOOL texture); 424 HRESULT CompositeImage([in] IUnknown *d3ddev, [in] IDirectDrawSurface7 *rendertarget, 425 [in] AM_MEDIA_TYPE *pmt, [in] REFERENCE_TIME start, [in] REFERENCE_TIME stop, 426 [in] DWORD backgrnd, [in] VMRVIDEOSTREAMINFO *info, [in] UINT streams); 427}; 428 429[ 430 local, 431 object, 432 uuid(058d1f11-2a54-4bef-bd54-df706626b727), 433 helpstring("IVMRVideoStreamControl interface"), 434 pointer_default(unique) 435] 436interface IVMRVideoStreamControl : IUnknown 437{ 438 HRESULT SetColorKey([in] DDCOLORKEY *key); 439 HRESULT GetColorKey([out] DDCOLORKEY *key); 440 HRESULT SetStreamActiveState([in] BOOL active); 441 HRESULT GetStreamActiveState([out] BOOL *active); 442}; 443 444[ 445 local, 446 object, 447 uuid(9f3a1c85-8555-49ba-935f-be5b5b29d178), 448 helpstring("IVMRImagePresenterConfig interface"), 449 pointer_default(unique) 450] 451interface IVMRImagePresenterConfig : IUnknown 452{ 453 HRESULT SetRenderingPrefs([in] DWORD prefs); 454 HRESULT GetRenderingPrefs([out] DWORD *prefs); 455}; 456 457[ 458 local, 459 object, 460 uuid(e6f7ce40-4673-44f1-8f77-5499d68cb4ea), 461 helpstring("IVMRImagePresenterExclModeConfig interface"), 462 pointer_default(unique) 463] 464interface IVMRImagePresenterExclModeConfig : IVMRImagePresenterConfig 465{ 466 HRESULT SetXlcModeDDObjAndPrimarySurface([in] IDirectDraw7 *dddev, [in] IDirectDrawSurface7 *ddsurface); 467 HRESULT GetXlcModeDDObjAndPrimarySurface([out] IDirectDraw7 **dddev, [out] IDirectDrawSurface7 **ddsurface); 468}; 469 470[ 471 local, 472 object, 473 uuid(aac18c18-e186-46d2-825d-a1f8dc8e395a), 474 helpstring("IVPManager interface"), 475 pointer_default(unique) 476] 477interface IVPManager : IUnknown 478{ 479 HRESULT SetVideoPortIndex([in] DWORD index); 480 HRESULT GetVideoPortIndex([out] DWORD *index); 481}; 482