]> git.vomp.tv Git - vompclient.git/blob - videowin.h
Translation updates
[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
31 #include "defines.h"
32 #include "video.h"
33
34 //#define DS_DEBUG
35
36 class DsSourceFilter;
37 class DsAllocator;
38
39 class VideoWin : public Video
40 {
41   public:
42     VideoWin();
43     ~VideoWin();
44
45     int init(UCHAR format);
46     int shutdown();
47
48     int setFormat(UCHAR format);
49     int setConnection(UCHAR connection);
50     int setAspectRatio(UCHAR aspectRatio);   // This one does the pin 8 scart widescreen switching
51   UCHAR getAspectRatio(){return aspectRatio;};
52   UCHAR getMode(){return mode;};
53   UCHAR getPseudoTVsize() {return pseudotvsize;};
54   int setMode(UCHAR mode);
55     int setTVsize(UCHAR size);               // Is the TV a widescreen?
56     int setDefaultAspect();
57     int setSource();
58     int setPosition(int x, int y);
59     int sync();
60     int play();
61   int dsplay();
62   bool InIframemode() {return iframemode;};
63     int stop();
64   int dsstop();
65     int pause();
66   int dspause();
67     int unPause();
68   int dsunPause();
69     int fastForward();
70     int unFastForward();
71     int reset();
72   int dsreset();
73     int blank();
74     int signalOn();
75     int signalOff();
76     int attachFrameBuffer(); // What does this do?
77     ULONG timecodeToFrameNumber(ULLONG timecode);
78   ULLONG frameNumberToTimecode(ULONG framenumber);
79     ULLONG getCurrentTimestamp();
80
81     //Writing Data to Videodevice
82     virtual void PrepareMediaSample(const MediaPacketList&, UINT samplepos);
83     virtual UINT DeliverMediaSample(const UCHAR* buffer, UINT *samplepos);
84     UINT DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, UINT *samplepos);
85   private:
86     MediaPacket mediapacket;
87   public:
88
89     int getCurrentAudioMediaSample(IMediaSample** ms);
90     int DeliverAudioMediaSample();
91
92     int getCurrentVideoMediaSample(IMediaSample** ms);
93     int DeliverVideoMediaSample();
94
95     virtual long long SetStartOffset(long long curreftime, bool *rsync);
96     long long SetStartAudioOffset(long long curreftime, bool *rsync);
97   virtual void ResetTimeOffsets();
98
99     void SetAudioState(bool state){audioon=state;};
100   void SetAudioVolume(long volume);
101
102     void turnVideoOn(){videoon=true;};
103     void turnVideoOff(){videoon=false;};
104
105     virtual void displayIFrame(const UCHAR* buffer, UINT length);
106
107   unsigned int getPosx() {return videoposx;};
108   unsigned int getPosy() {return videoposy;};
109   bool isVideoOn() {return videoon;};
110   bool isdsinited() {return dsinited;};
111
112 #ifdef DEV
113     int test();
114     int test2();
115 #endif
116 private:
117   int EnterIframePlayback();
118   IMediaControl* dsmediacontrol;
119
120   IGraphBuilder* dsgraphbuilder;
121   IMediaSample* cur_audio_media_sample;
122   IMediaSample* cur_video_media_sample;
123   IBaseFilter* dsvmrrenderer;
124   IVMRSurfaceAllocatorNotify9  *dsvmrsurfnotify;
125   IReferenceClock *dsrefclock;
126   IMediaFilter* dsmediafilter;
127   IBasicAudio* dsbasicaudio;
128   REFERENCE_TIME cr_time;
129
130   DsSourceFilter* sourcefilter;
131   DsAllocator* allocatorvmr;
132   HANDLE filtermutex;
133   void CleanupDS();
134   bool offsetnotset;
135   bool offsetvideonotset;
136   bool offsetaudionotset;
137   long long startoffset;
138   long long lastrefvideotime;
139   long long lastrefaudiotime;
140   bool dsinited;
141   bool firstsynched;
142   bool audioon;
143   bool videoon;
144   bool iframemode;
145   UCHAR pseudotvsize;
146   REFERENCE_TIME lastreftimeRT;
147   ULLONG lastreftimePTS;
148   unsigned int videoposx;
149   unsigned int videoposy;
150 #ifdef DS_DEBUG
151   DWORD graphidentifier;
152 #endif
153 };
154
155 #endif
156
157
158