]> git.vomp.tv Git - vompclient.git/blob - osdwin.h
Add static icons in menu
[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
34 struct OSDVERTEX
35 {
36         FLOAT x,y,z,rhw;
37         DWORD c;
38         FLOAT u,v;
39 };
40
41 #define D3DFVF_OSDVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE| D3DFVF_TEX1)
42
43 class DsAllocator;
44
45
46
47 class OsdWin : public Osd, public ThreadWin
48 {
49   public:
50     OsdWin();
51     ~OsdWin();
52
53     int init(void* device);
54     int shutdown();
55
56     int getFD();
57
58     void screenShot(const char* fileName);
59
60     Surface * createNewSurface();
61
62         void threadMethod();
63     void threadPostStopCleanup();
64
65         LPDIRECT3DDEVICE9 getD3dDev() ;
66         LPDIRECT3D9 getD3d() ;
67         // This function is called from the WinMain function in order to get Screen updates
68         void Render();
69         void RenderDS(LPDIRECT3DSURFACE9 present);
70         void BeginPainting();
71         void EndPainting();
72         void setExternalDriving(DsAllocator* dsall,DWORD width, DWORD height);
73         void Blank();
74     DWORD getFilterCaps();
75     DWORD getFilterType(){return filter_type;};
76     void setFilterType(D3DTEXTUREFILTERTYPE type) {filter_type=type;};
77
78
79
80         
81
82         enum EVR_state {
83                 EVR_pres_off=0,
84                 EVR_pres_started,
85                 EVR_pres_pause
86         };
87
88         void SetEVRStatus(EVR_state new_state){evrstate=new_state;};
89         
90         IDirect3DDeviceManager9 * getD3dMan() {return d3ddevman;};
91         bool IsEvrSupported() {return evrsupported;};
92         HWND getWindow() {return window;};
93
94 private:
95         void LockDevice();
96         void UnlockDevice();
97
98           LPDIRECT3D9 d3d;
99           LPDIRECT3DDEVICE9 d3ddevice;
100 //        LPDIRECT3DVERTEXBUFFER9 d3dvb;
101           LPDIRECT3DSURFACE9 d3drtsurf;
102           LPDIRECT3DSWAPCHAIN9 swappy;
103           LPDIRECT3DSURFACE9 swapsurf;
104           DsAllocator* dsallocator;
105         // This indicates, that currently a video is played, thus the osd updates are driven by the Directshow Filtersystem
106         bool external_driving;
107         HANDLE d3dmutex;
108         DWORD lastrendertime;
109         void InternalRendering(LPDIRECT3DSURFACE9 present);
110         bool DoLost();
111         LPDIRECT3DVERTEXBUFFER9 InitVertexBuffer(DWORD width, DWORD height);
112         OSDVERTEX osdvertices[4];
113         HANDLE event;
114         D3DTEXTUREFILTERTYPE filter_type;
115         EVR_state evrstate;
116         bool evrsupported;
117         HWND window;
118
119         UINT dxvatoken;
120         IDirect3DDeviceManager9 *d3ddevman;
121         HANDLE  dxvadevicehandle;
122 };
123
124 #endif