]> git.vomp.tv Git - vompclient.git/blob - videowin.h
Windows updates
[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 dsplay();\r
62   bool InIframemode() {return iframemode;};\r
63     int stop();\r
64   int dsstop();\r
65     int pause();\r
66   int dspause();\r
67     int unPause();\r
68   int dsunPause();\r
69     int fastForward();\r
70     int unFastForward();\r
71     int reset();\r
72   int dsreset();\r
73     int blank();\r
74     int signalOn();\r
75     int signalOff();\r
76     int attachFrameBuffer(); // What does this do?\r
77     ULONG timecodeToFrameNumber(ULLONG timecode);\r
78   ULLONG frameNumberToTimecode(ULONG framenumber);\r
79     ULLONG getCurrentTimestamp();\r
80 \r
81     //Writing Data to Videodevice\r
82     virtual void PrepareMediaSample(const MediaPacketList&, UINT samplepos);\r
83     virtual UINT DeliverMediaSample(const UCHAR* buffer, UINT *samplepos);\r
84     UINT DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, UINT *samplepos);\r
85   private:\r
86     MediaPacket mediapacket;\r
87   public:\r
88 \r
89     int getCurrentAudioMediaSample(IMediaSample** ms);\r
90     int DeliverAudioMediaSample();\r
91 \r
92     int getCurrentVideoMediaSample(IMediaSample** ms);\r
93     int DeliverVideoMediaSample();\r
94 \r
95     virtual long long SetStartOffset(long long curreftime, bool *rsync);\r
96     long long SetStartAudioOffset(long long curreftime, bool *rsync);\r
97   virtual void ResetTimeOffsets();\r
98 \r
99     void SetAudioState(bool state){audioon=state;};\r
100   void SetAudioVolume(long volume);\r
101 \r
102     void turnVideoOn(){videoon=true;};\r
103     void turnVideoOff(){videoon=false;};\r
104 \r
105     virtual void displayIFrame(const UCHAR* buffer, UINT length);\r
106 \r
107   unsigned int getPosx() {return videoposx;};\r
108   unsigned int getPosy() {return videoposy;};\r
109   bool isVideoOn() {return videoon;};\r
110   bool isdsinited() {return dsinited;};\r
111 \r
112 #ifdef DEV\r
113     int test();\r
114     int test2();\r
115 #endif\r
116 private:\r
117   int EnterIframePlayback();\r
118   IMediaControl* dsmediacontrol;\r
119 \r
120   IGraphBuilder* dsgraphbuilder;\r
121   IMediaSample* cur_audio_media_sample;\r
122   IMediaSample* cur_video_media_sample;\r
123   IBaseFilter* dsvmrrenderer;\r
124   IVMRSurfaceAllocatorNotify9  *dsvmrsurfnotify;\r
125   IReferenceClock *dsrefclock;\r
126   IMediaFilter* dsmediafilter;\r
127   IBasicAudio* dsbasicaudio;\r
128   REFERENCE_TIME cr_time;\r
129 \r
130   DsSourceFilter* sourcefilter;\r
131   DsAllocator* allocatorvmr;\r
132   HANDLE filtermutex;\r
133   void CleanupDS();\r
134   bool offsetnotset;\r
135   bool offsetvideonotset;\r
136   bool offsetaudionotset;\r
137   long long startoffset;\r
138   long long lastrefvideotime;\r
139   long long lastrefaudiotime;\r
140   bool dsinited;\r
141   bool firstsynched;\r
142   bool audioon;\r
143   bool videoon;\r
144   bool iframemode;\r
145   UCHAR pseudotvsize;\r
146   REFERENCE_TIME lastreftimeRT;\r
147   ULLONG lastreftimePTS;\r
148   unsigned int videoposx;\r
149   unsigned int videoposy;\r
150 #ifdef DS_DEBUG\r
151   DWORD graphidentifier;\r
152 #endif\r
153 };\r
154 \r
155 #endif\r
156 \r
157 \r
158 \r