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