]> git.vomp.tv Git - vompclient.git/blob - videowin.h
Add -s option to select server
[vompclient.git] / videowin.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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #ifndef VIDEOWIN_H
22 #define VIDEOWIN_H
23
24 #include <stdio.h>
25 #include <string.h>
26 #include <winsock2.h>
27 #include <dshow.h>
28 #include <d3d9.h>
29 #include <vmr9.h>
30 #include <vector>
31
32 #include "defines.h"
33 #include "video.h"
34
35 //#define DS_DEBUG
36 #define NEW_DS_MECHANISMENS
37
38 #ifdef NEW_DS_MECHANISMENS
39 struct VideoFilterDesc {
40     char * displayname;
41     char * friendlyname;
42     bool vmr9;
43     bool vmr9tested;
44 };
45 using namespace std;
46 typedef vector<VideoFilterDesc> VideoFilterDescList;
47 #endif
48
49 class DsSourceFilter;
50 class DsAllocator;
51
52 class VideoWin : public Video
53 {
54   public:
55     VideoWin();
56     ~VideoWin();
57
58     int init(UCHAR format);
59     int shutdown();
60
61     int setFormat(UCHAR format);
62     int setConnection(UCHAR connection);
63     int setAspectRatio(UCHAR aspectRatio);   // This one does the pin 8 scart widescreen switching
64   UCHAR getAspectRatio(){return aspectRatio;};
65   UCHAR getMode(){return mode;};
66   UCHAR getPseudoTVsize() {return pseudotvsize;};
67   int setMode(UCHAR mode);
68     int setTVsize(UCHAR size);               // Is the TV a widescreen?
69     int setDefaultAspect();
70     int setSource();
71     int setPosition(int x, int y);
72     int sync();
73     int play();
74     bool loadOptionsfromServer(VDR* vdr);
75     bool saveOptionstoServer();
76     bool addOptionPagesToWTB(WTabBar *wtb);
77   int dsplay();
78   bool InIframemode() {return iframemode;};
79     int stop();
80   int dsstop();
81     int pause();
82   int dspause();
83     int unPause();
84   int dsunPause();
85     int fastForward();
86     int unFastForward();
87     int reset();
88   int dsreset();
89     int blank();
90     int signalOn();
91     int signalOff();
92     int attachFrameBuffer(); // What does this do?
93     ULONG timecodeToFrameNumber(ULLONG timecode);
94   ULLONG frameNumberToTimecode(ULONG framenumber);
95     ULLONG getCurrentTimestamp();
96
97     //Writing Data to Videodevice
98     virtual void PrepareMediaSample(const MediaPacketList&, UINT samplepos);
99     virtual UINT DeliverMediaSample(const UCHAR* buffer, UINT *samplepos);
100     UINT DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, UINT *samplepos);
101
102     virtual bool supportsAc3();
103  
104     
105   private:
106     MediaPacket mediapacket;
107   public:
108
109     int getCurrentAudioMediaSample(IMediaSample** ms);
110     int DeliverAudioMediaSample();
111
112     int getCurrentVideoMediaSample(IMediaSample** ms);
113     int DeliverVideoMediaSample();
114     int setAudioStreamType(UCHAR type);
115
116     virtual long long SetStartOffset(long long curreftime, bool *rsync);
117     long long SetStartAudioOffset(long long curreftime, bool *rsync);
118   virtual void ResetTimeOffsets();
119
120     void SetAudioState(bool state){audioon=state;};
121   void SetAudioVolume(long volume);
122
123     void turnVideoOn(){videoon=true;};
124     void turnVideoOff(){videoon=false;};
125
126     virtual void displayIFrame(const UCHAR* buffer, UINT length);
127
128   unsigned int getPosx() {return videoposx;};
129   unsigned int getPosy() {return videoposy;};
130   bool isVideoOn() {return videoon;};
131   bool isdsinited() {return dsinited;};
132   int lastAType() {return lastaudiomode;};
133   bool changeAType(int type,IMediaSample* ms);
134
135
136   const VideoFilterDescList *getVideoFilterList(int &selected);
137   bool selectVideoFilter(int filter);
138   DsSourceFilter* getSourceFilter() {return sourcefilter;};
139
140 #ifdef DEV
141     int test();
142     int test2();
143 #endif
144 private:
145   int EnterIframePlayback();
146 #ifdef NEW_DS_MECHANISMENS
147   void dstest();  
148    void initFilterDatabase();
149   IBaseFilter *getVideoFilter();  VideoFilterDescList videofilterlist;
150   int  videofilterselected;
151 #endif
152   int dsInitVideoFilter();
153   IMediaControl* dsmediacontrol;
154
155   IGraphBuilder* dsgraphbuilder;
156   IMediaSample* cur_audio_media_sample;
157   IMediaSample* cur_video_media_sample;
158   IBaseFilter* dsvmrrenderer;
159   IVMRSurfaceAllocatorNotify9  *dsvmrsurfnotify;
160   IReferenceClock *dsrefclock;
161   IMediaFilter* dsmediafilter;
162   IBasicAudio* dsbasicaudio;
163   REFERENCE_TIME cr_time;
164
165   DsSourceFilter* sourcefilter;
166   DsAllocator* allocatorvmr;
167   HANDLE filtermutex;
168   void CleanupDS();
169   bool offsetnotset;
170   bool offsetvideonotset;
171   bool offsetaudionotset;
172   long long startoffset;
173   long long lastrefvideotime;
174   long long lastrefaudiotime;
175   bool dsinited;
176   bool firstsynched;
177   bool audioon;
178   bool videoon;
179   bool iframemode;
180   UCHAR pseudotvsize;
181   REFERENCE_TIME lastreftimeRT;
182   ULLONG lastreftimePTS;
183   unsigned int videoposx;
184   unsigned int videoposy;
185   int lastaudiomode;
186   int audiovolume;
187   UCHAR aud_type;
188 #ifdef DS_DEBUG
189   DWORD graphidentifier;
190 #endif
191 };
192
193 #endif
194
195
196