]> git.vomp.tv Git - vompclient.git/blob - osdwin.h
Preparations for dynamic mode switching
[vompclient.git] / osdwin.h
1 /*\r
2     Copyright 2004-2005 Chris Tallon\r
3 \r
4     This file is part of VOMP.\r
5 \r
6     VOMP is free software; you can redistribute it and/or modify\r
7     it under the terms of the GNU General Public License as published by\r
8     the Free Software Foundation; either version 2 of the License, or\r
9     (at your option) any later version.\r
10 \r
11     VOMP is distributed in the hope that it will be useful,\r
12     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14     GNU General Public License for more details.\r
15 \r
16     You should have received a copy of the GNU General Public License\r
17     along with VOMP; if not, write to the Free Software\r
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
19 */\r
20 \r
21 #ifndef OSDWIN_H\r
22 #define OSDWIN_H\r
23 \r
24 #include <stdio.h>\r
25 \r
26 #include "osd.h"\r
27 #include "defines.h"\r
28 #include "log.h"\r
29 #include "threadwin.h"\r
30 #include <winsock2.h>\r
31 #include <d3d9.h>\r
32 #include <Dxva2api.h>\r
33 \r
34 struct OSDVERTEX\r
35 {\r
36         FLOAT x,y,z,rhw;\r
37         DWORD c;\r
38         FLOAT u,v;\r
39 };\r
40 \r
41 #define D3DFVF_OSDVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE| D3DFVF_TEX1)\r
42 \r
43 class DsAllocator;\r
44 \r
45 \r
46 \r
47 class OsdWin : public Osd, public ThreadWin\r
48 {\r
49   public:\r
50     OsdWin();\r
51     ~OsdWin();\r
52 \r
53     int init(void* device);\r
54     int shutdown();\r
55 \r
56     int getFD();\r
57 \r
58     void screenShot(const char* fileName);\r
59 \r
60     Surface * createNewSurface();\r
61 \r
62         void threadMethod();\r
63     void threadPostStopCleanup();\r
64 \r
65         LPDIRECT3DDEVICE9 getD3dDev() ;\r
66         LPDIRECT3D9 getD3d() ;\r
67         // This function is called from the WinMain function in order to get Screen updates\r
68         void Render();\r
69         void RenderDS(LPDIRECT3DSURFACE9 present);\r
70         void BeginPainting();\r
71         void EndPainting();\r
72         void setExternalDriving(DsAllocator* dsall,DWORD width, DWORD height);\r
73         void Blank();\r
74     DWORD getFilterCaps();\r
75     DWORD getFilterType(){return filter_type;};\r
76     void setFilterType(D3DTEXTUREFILTERTYPE type) {filter_type=type;};\r
77 \r
78 \r
79 \r
80         \r
81 \r
82         enum EVR_state {\r
83                 EVR_pres_off=0,\r
84                 EVR_pres_started,\r
85                 EVR_pres_pause\r
86         };\r
87 \r
88         void SetEVRStatus(EVR_state new_state){evrstate=new_state;};\r
89         \r
90         IDirect3DDeviceManager9 * getD3dMan() {return d3ddevman;};\r
91         bool IsEvrSupported() {return evrsupported;};\r
92         HWND getWindow() {return window;};\r
93 \r
94 private:\r
95         void LockDevice();\r
96         void UnlockDevice();\r
97 \r
98           LPDIRECT3D9 d3d;\r
99           LPDIRECT3DDEVICE9 d3ddevice;\r
100 //        LPDIRECT3DVERTEXBUFFER9 d3dvb;\r
101           LPDIRECT3DSURFACE9 d3drtsurf;\r
102           LPDIRECT3DSWAPCHAIN9 swappy;\r
103           LPDIRECT3DSURFACE9 swapsurf;\r
104           DsAllocator* dsallocator;\r
105         // This indicates, that currently a video is played, thus the osd updates are driven by the Directshow Filtersystem\r
106         bool external_driving;\r
107         HANDLE d3dmutex;\r
108         DWORD lastrendertime;\r
109         void InternalRendering(LPDIRECT3DSURFACE9 present);\r
110         bool DoLost();\r
111         LPDIRECT3DVERTEXBUFFER9 InitVertexBuffer(DWORD width, DWORD height);\r
112         OSDVERTEX osdvertices[4];\r
113         HANDLE event;\r
114         D3DTEXTUREFILTERTYPE filter_type;\r
115         EVR_state evrstate;\r
116         bool evrsupported;\r
117         HWND window;\r
118 \r
119         UINT dxvatoken;\r
120         IDirect3DDeviceManager9 *d3ddevman;\r
121         HANDLE  dxvadevicehandle;\r
122 };\r
123 \r
124 #endif\r