]> git.vomp.tv Git - vompclient.git/blob - videowin.h
Completion of move recording code. Fixes for dir counts, other bugs.
[vompclient.git] / videowin.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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19 */\r
20 \r
21 #ifndef VIDEOWIN_H\r
22 #define VIDEOWIN_H\r
23 \r
24 #include <stdio.h>\r
25 #include <string.h>\r
26 #include <winsock2.h>\r
27 #include <dshow.h>\r
28 #include <d3d9.h>\r
29 #include <vmr9.h>\r
30 \r
31 #include "defines.h"\r
32 #include "video.h"\r
33 \r
34 //#define DS_DEBUG\r
35 \r
36 class DsSourceFilter;\r
37 class DsAllocator;\r
38 \r
39 class VideoWin : public Video\r
40 {\r
41   public:\r
42     VideoWin();\r
43     ~VideoWin();\r
44 \r
45     int init(UCHAR format);\r
46     int shutdown();\r
47 \r
48     int setFormat(UCHAR format);\r
49     int setConnection(UCHAR connection);\r
50     int setAspectRatio(UCHAR aspectRatio);   // This one does the pin 8 scart widescreen switching\r
51   UCHAR getAspectRatio(){return aspectRatio;};\r
52   UCHAR getMode(){return mode;};\r
53   UCHAR getPseudoTVsize() {return pseudotvsize;};\r
54   int setMode(UCHAR mode);\r
55     int setTVsize(UCHAR size);               // Is the TV a widescreen?\r
56     int setDefaultAspect();\r
57     int setSource();\r
58     int setPosition(int x, int y);\r
59     int sync();\r
60     int play();\r
61     int stop();\r
62     int pause();\r
63     int unPause();\r
64     int fastForward();\r
65     int unFastForward();\r
66     int reset();\r
67     int blank();\r
68     int signalOn();\r
69     int signalOff();\r
70     int attachFrameBuffer(); // What does this do?\r
71     ULONG timecodeToFrameNumber(ULLONG timecode);\r
72   ULLONG frameNumberToTimecode(ULONG framenumber);\r
73     ULLONG getCurrentTimestamp();\r
74 \r
75     //Writing Data to Videodevice\r
76     virtual UINT DeliverMediaSample(MediaPacket packet, UCHAR* buffer, UINT *samplepos);\r
77 \r
78     int getCurrentAudioMediaSample(IMediaSample** ms);\r
79     int DeliverAudioMediaSample();\r
80 \r
81     int getCurrentVideoMediaSample(IMediaSample** ms);\r
82     int DeliverVideoMediaSample();\r
83 \r
84     virtual long long SetStartOffset(long long curreftime, bool *rsync);\r
85     long long SetStartAudioOffset(long long curreftime, bool *rsync);\r
86   virtual void ResetTimeOffsets();\r
87 \r
88     void SetAudioState(bool state){audioon=state;};\r
89         void SetAudioVolume(long volume);\r
90 \r
91     void turnVideoOn(){videoon=true;};\r
92     void turnVideoOff(){videoon=false;};\r
93 \r
94   unsigned int getPosx() {return videoposx;};\r
95   unsigned int getPosy() {return videoposy;};\r
96   bool isVideoOn() {return videoon;};\r
97 \r
98 #ifdef DEV\r
99     int test();\r
100     int test2();\r
101 #endif\r
102 private:\r
103   IMediaControl* dsmediacontrol;\r
104 \r
105   IGraphBuilder* dsgraphbuilder;\r
106   IMediaSample* cur_audio_media_sample;\r
107   IMediaSample* cur_video_media_sample;\r
108   IBaseFilter* dsvmrrenderer;\r
109   IVMRSurfaceAllocatorNotify9  *dsvmrsurfnotify;\r
110   IReferenceClock *dsrefclock;\r
111   IMediaFilter* dsmediafilter;\r
112   IBasicAudio* dsbasicaudio;\r
113   REFERENCE_TIME cr_time;\r
114 \r
115   DsSourceFilter* sourcefilter;\r
116   DsAllocator* allocatorvmr;\r
117   HANDLE filtermutex;\r
118   void CleanupDS();\r
119   bool offsetnotset;\r
120   bool offsetvideonotset;\r
121   bool offsetaudionotset;\r
122   long long startoffset;\r
123   long long lastrefvideotime;\r
124   long long lastrefaudiotime;\r
125 \r
126   bool firstsynched;\r
127   bool audioon;\r
128   bool videoon;\r
129   UCHAR pseudotvsize;\r
130   REFERENCE_TIME lastreftimeRT;\r
131   ULLONG lastreftimeBYTE;\r
132   unsigned int videoposx;\r
133   unsigned int videoposy;\r
134 #ifdef DS_DEBUG\r
135   DWORD graphidentifier;\r
136 #endif\r
137 };\r
138 \r
139 #endif\r
140 \r