| 1 | /*  This file is part of the KDE project.
 | 
|---|
| 2 | 
 | 
|---|
| 3 | Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
 | 
|---|
| 4 | 
 | 
|---|
| 5 | This library is free software: you can redistribute it and/or modify
 | 
|---|
| 6 | it under the terms of the GNU Lesser General Public License as published by
 | 
|---|
| 7 | the Free Software Foundation, either version 2.1 or 3 of the License.
 | 
|---|
| 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
 | 
|---|
| 12 | GNU Lesser General Public License for more details.
 | 
|---|
| 13 | 
 | 
|---|
| 14 | You should have received a copy of the GNU Lesser General Public License
 | 
|---|
| 15 | along with this library.  If not, see <http://www.gnu.org/licenses/>.
 | 
|---|
| 16 | */
 | 
|---|
| 17 | 
 | 
|---|
| 18 | #include <d3d9.h>
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #define DXVA2_ProcAmp_Brightness 1
 | 
|---|
| 21 | #define DXVA2_ProcAmp_Contrast   2
 | 
|---|
| 22 | #define DXVA2_ProcAmp_Hue        4
 | 
|---|
| 23 | #define DXVA2_ProcAmp_Saturation 8
 | 
|---|
| 24 | 
 | 
|---|
| 25 | typedef enum {
 | 
|---|
| 26 |     MFVideoARMode_None             = 0x00000000,
 | 
|---|
| 27 |     MFVideoARMode_PreservePicture  = 0x00000001,
 | 
|---|
| 28 |     MFVideoARMode_PreservePixel    = 0x00000002,
 | 
|---|
| 29 |     MFVideoARMode_NonLinearStretch = 0x00000004,
 | 
|---|
| 30 |     MFVideoARMode_Mask             = 0x00000007
 | 
|---|
| 31 | } MFVideoAspectRatioMode;
 | 
|---|
| 32 | 
 | 
|---|
| 33 | typedef struct {
 | 
|---|
| 34 |     float  left;
 | 
|---|
| 35 |     float  top;
 | 
|---|
| 36 |     float  right;
 | 
|---|
| 37 |     float  bottom;
 | 
|---|
| 38 | } MFVideoNormalizedRect;
 | 
|---|
| 39 | 
 | 
|---|
| 40 | typedef struct {
 | 
|---|
| 41 |     UINT    DeviceCaps;
 | 
|---|
| 42 |     D3DPOOL InputPool;
 | 
|---|
| 43 |     UINT    NumForwardRefSamples;
 | 
|---|
| 44 |     UINT    NumBackwardRefSamples;
 | 
|---|
| 45 |     UINT    Reserved;
 | 
|---|
| 46 |     UINT    DeinterlaceTechnology;
 | 
|---|
| 47 |     UINT    ProcAmpControlCaps;
 | 
|---|
| 48 |     UINT    VideoProcessorOperations;
 | 
|---|
| 49 |     UINT    NoiseFilterTechnology;
 | 
|---|
| 50 |     UINT    DetailFilterTechnology;
 | 
|---|
| 51 | } DXVA2_VideoProcessorCaps;
 | 
|---|
| 52 | 
 | 
|---|
| 53 | typedef struct {
 | 
|---|
| 54 |     union {
 | 
|---|
| 55 |         struct {
 | 
|---|
| 56 |             USHORT Fraction;
 | 
|---|
| 57 |             SHORT  Value;
 | 
|---|
| 58 |         };
 | 
|---|
| 59 |         LONG ll;
 | 
|---|
| 60 |     };
 | 
|---|
| 61 | } DXVA2_Fixed32;
 | 
|---|
| 62 | 
 | 
|---|
| 63 | typedef struct {
 | 
|---|
| 64 |     DXVA2_Fixed32 MinValue;
 | 
|---|
| 65 |     DXVA2_Fixed32 MaxValue;
 | 
|---|
| 66 |     DXVA2_Fixed32 DefaultValue;
 | 
|---|
| 67 |     DXVA2_Fixed32 StepSize;
 | 
|---|
| 68 | } DXVA2_ValueRange;
 | 
|---|
| 69 | 
 | 
|---|
| 70 | typedef struct {
 | 
|---|
| 71 |     DXVA2_Fixed32 Brightness;
 | 
|---|
| 72 |     DXVA2_Fixed32 Contrast;
 | 
|---|
| 73 |     DXVA2_Fixed32 Hue;
 | 
|---|
| 74 |     DXVA2_Fixed32 Saturation;
 | 
|---|
| 75 | } DXVA2_ProcAmpValues;
 | 
|---|
| 76 | 
 | 
|---|
| 77 | DXVA2_Fixed32 DXVA2FloatToFixed(const float _float_)
 | 
|---|
| 78 | {
 | 
|---|
| 79 |     DXVA2_Fixed32 _fixed_;
 | 
|---|
| 80 |     _fixed_.Fraction = LOWORD(_float_ * 0x10000);
 | 
|---|
| 81 |     _fixed_.Value = HIWORD(_float_ * 0x10000);
 | 
|---|
| 82 |     return _fixed_;
 | 
|---|
| 83 | }
 | 
|---|
| 84 | 
 | 
|---|
| 85 | float DXVA2FixedToFloat(const DXVA2_Fixed32 _fixed_)
 | 
|---|
| 86 | {
 | 
|---|
| 87 |     return (FLOAT)_fixed_.Value + (FLOAT)_fixed_.Fraction / 0x10000;
 | 
|---|
| 88 | }
 | 
|---|
| 89 | 
 | 
|---|
| 90 | #undef INTERFACE
 | 
|---|
| 91 | #define INTERFACE IMFVideoDisplayControl
 | 
|---|
| 92 | DECLARE_INTERFACE_(IMFVideoDisplayControl, IUnknown)
 | 
|---|
| 93 | {
 | 
|---|
| 94 |     STDMETHOD(GetNativeVideoSize)(THIS_ SIZE* pszVideo, SIZE* pszARVideo) PURE;
 | 
|---|
| 95 |     STDMETHOD(GetIdealVideoSize)(THIS_ SIZE* pszMin, SIZE* pszMax) PURE;
 | 
|---|
| 96 |     STDMETHOD(SetVideoPosition)(THIS_ const MFVideoNormalizedRect* pnrcSource, const LPRECT prcDest) PURE;
 | 
|---|
| 97 |     STDMETHOD(GetVideoPosition)(THIS_ MFVideoNormalizedRect* pnrcSource, LPRECT prcDest) PURE;
 | 
|---|
| 98 |     STDMETHOD(SetAspectRatioMode)(THIS_ DWORD dwAspectRatioMode) PURE;
 | 
|---|
| 99 |     STDMETHOD(GetAspectRatioMode)(THIS_ DWORD* pdwAspectRatioMode) PURE;
 | 
|---|
| 100 |     STDMETHOD(SetVideoWindow)(THIS_ HWND hwndVideo) PURE;
 | 
|---|
| 101 |     STDMETHOD(GetVideoWindow)(THIS_ HWND* phwndVideo) PURE;
 | 
|---|
| 102 |     STDMETHOD(RepaintVideo)(THIS_) PURE;
 | 
|---|
| 103 |     STDMETHOD(GetCurrentImage)(THIS_ BITMAPINFOHEADER* pBih, BYTE** pDib, DWORD* pcbDib, LONGLONG* pTimeStamp) PURE;
 | 
|---|
| 104 |     STDMETHOD(SetBorderColor)(THIS_ COLORREF Clr) PURE;
 | 
|---|
| 105 |     STDMETHOD(GetBorderColor)(THIS_ COLORREF* pClr) PURE;
 | 
|---|
| 106 |     STDMETHOD(SetRenderingPrefs)(THIS_ DWORD dwRenderFlags) PURE;
 | 
|---|
| 107 |     STDMETHOD(GetRenderingPrefs)(THIS_ DWORD* pdwRenderFlags) PURE;
 | 
|---|
| 108 |     STDMETHOD(SetFullScreen)(THIS_ BOOL fFullscreen) PURE;
 | 
|---|
| 109 |     STDMETHOD(GetFullScreen)(THIS_ BOOL* pfFullscreen) PURE;
 | 
|---|
| 110 | };
 | 
|---|
| 111 | #undef INTERFACE
 | 
|---|
| 112 | #define INTERFACE IMFVideoMixerControl
 | 
|---|
| 113 | DECLARE_INTERFACE_(IMFVideoMixerControl, IUnknown)
 | 
|---|
| 114 | {
 | 
|---|
| 115 |     STDMETHOD(SetStreamZOrder)(THIS_ DWORD dwStreamID, DWORD dwZ) PURE;
 | 
|---|
| 116 |     STDMETHOD(GetStreamZOrder)(THIS_ DWORD dwStreamID, DWORD* pdwZ) PURE;
 | 
|---|
| 117 |     STDMETHOD(SetStreamOutputRect)(THIS_ DWORD dwStreamID, const MFVideoNormalizedRect* pnrcOutput) PURE;
 | 
|---|
| 118 |     STDMETHOD(GetStreamOutputRect)(THIS_ DWORD dwStreamID, MFVideoNormalizedRect* pnrcOutput) PURE;
 | 
|---|
| 119 | };
 | 
|---|
| 120 | #undef INTERFACE
 | 
|---|
| 121 | #define INTERFACE IMFVideoProcessor
 | 
|---|
| 122 | DECLARE_INTERFACE_(IMFVideoProcessor, IUnknown)
 | 
|---|
| 123 | {
 | 
|---|
| 124 |     STDMETHOD(GetAvailableVideoProcessorModes)(THIS_ UINT* lpdwNumProcessingModes, GUID** ppVideoProcessingModes) PURE;
 | 
|---|
| 125 |     STDMETHOD(GetVideoProcessorCaps)(THIS_ LPGUID lpVideoProcessorMode, DXVA2_VideoProcessorCaps* lpVideoProcessorCaps) PURE;
 | 
|---|
| 126 |     STDMETHOD(GetVideoProcessorMode)(THIS_ LPGUID lpMode) PURE;
 | 
|---|
| 127 |     STDMETHOD(SetVideoProcessorMode)(THIS_ LPGUID lpMode) PURE;
 | 
|---|
| 128 |     STDMETHOD(GetProcAmpRange)(THIS_ DWORD dwProperty, DXVA2_ValueRange* pPropRange) PURE;
 | 
|---|
| 129 |     STDMETHOD(GetProcAmpValues)(THIS_ DWORD dwFlags, DXVA2_ProcAmpValues* Values) PURE;
 | 
|---|
| 130 |     STDMETHOD(SetProcAmpValues)(THIS_ DWORD  dwFlags, DXVA2_ProcAmpValues*  pValues) PURE;
 | 
|---|
| 131 |     STDMETHOD(GetFilteringRange)(THIS_ DWORD dwProperty, DXVA2_ValueRange* pPropRange) PURE;
 | 
|---|
| 132 |     STDMETHOD(GetFilteringValue)(THIS_ DWORD dwProperty, DXVA2_Fixed32* pValue) PURE;
 | 
|---|
| 133 |     STDMETHOD(SetFilteringValue)(THIS_ DWORD dwProperty, DXVA2_Fixed32* pValue) PURE;
 | 
|---|
| 134 |     STDMETHOD(GetBackgroundColor)(THIS_ COLORREF* lpClrBkg) PURE;
 | 
|---|
| 135 |     STDMETHOD(SetBackgroundColor)(THIS_ COLORREF ClrBkg) PURE;
 | 
|---|
| 136 | };
 | 
|---|
| 137 | #undef INTERFACE
 | 
|---|
| 138 | #define INTERFACE IMFGetService
 | 
|---|
| 139 | DECLARE_INTERFACE_(IMFGetService, IUnknown)
 | 
|---|
| 140 | {
 | 
|---|
| 141 |     STDMETHOD(GetService)(THIS_ REFGUID guidService, REFIID riid, LPVOID* ppvObject) PURE;
 | 
|---|
| 142 | };
 | 
|---|
| 143 | #undef INTERFACE
 | 
|---|