]> git.vomp.tv Git - vompclient.git/blob - video.h
Preparations for dynamic mode switching
[vompclient.git] / video.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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
19 */\r
20 \r
21 #ifndef VIDEO_H\r
22 #define VIDEO_H\r
23 \r
24 #include <stdio.h>\r
25 #include "defines.h"\r
26 #include "draintarget.h"\r
27 #include "abstractoption.h"\r
28 \r
29 typedef struct _hmsf\r
30 {\r
31   UINT hours;\r
32   UINT minutes;\r
33   UINT seconds;\r
34   UINT frames;\r
35 } hmsf;\r
36 \r
37 class Video: public DrainTarget, public AbstractOption\r
38 {\r
39   public:\r
40     Video();\r
41     virtual ~Video();\r
42     static Video* getInstance();\r
43     //static void setInstance(Video*);\r
44 \r
45     virtual int init(UCHAR format)=0;\r
46     virtual int shutdown()=0;\r
47     virtual int setFormat(UCHAR format)=0;\r
48     virtual UCHAR getSupportedFormats() { return COMPOSITERGB | SVIDEO;}; // if it returns zero there are no different formats\r
49     virtual UINT supportedTVsize() { return 0;}; // if no selection is allowed\r
50     virtual UCHAR supportedTVFormats() { return 0;}; // if no selection is allowed\r
51 \r
52     virtual int setConnection(UCHAR connection)=0;\r
53     virtual int setAspectRatio(UCHAR aspectRatio)=0;   // This one does the pin 8 scart widescreen switching\r
54     virtual int setMode(UCHAR mode)=0;\r
55     virtual int setTVsize(UCHAR size)=0;               // Is the TV a widescreen?\r
56     virtual void executePendingModeChanges() {}; // This is called if you change the output mode and the device take a while for reinitialization\r
57     virtual int setDefaultAspect()=0;\r
58     virtual int setSource()=0;\r
59     virtual int setPosition(int x, int y)=0;\r
60     virtual int sync()=0;\r
61     virtual int play()=0;\r
62     virtual int stop()=0;\r
63     virtual int pause()=0;\r
64     virtual int unPause()=0;\r
65     virtual int fastForward()=0;\r
66     virtual int unFastForward()=0;\r
67     virtual int reset()=0;\r
68     virtual int blank()=0;\r
69     virtual int signalOn()=0;\r
70     virtual int signalOff()=0;\r
71     virtual int attachFrameBuffer()=0; // What does this do?\r
72 //    virtual ULONG timecodeToFrameNumber(ULLONG timecode)=0; //Obsolete and not HD compatible\r
73     virtual ULLONG getCurrentTimestamp()=0;\r
74     virtual bool displayIFrame(const UCHAR* buffer, UINT length)=0;\r
75     virtual int EnterIframePlayback() {return 1;}; // Must not be implemented\r
76 \r
77         virtual bool supportsh264(){return false;};\r
78         virtual void seth264mode(bool ish264) {h264=ish264;};\r
79         virtual int getTeletextBufferFaktor(){return 1;};\r
80 \r
81         virtual bool independentAVStartUp() {return true;};\r
82 \r
83 \r
84         //Tells, if the device allows an independent startup of audio and video\r
85         // this needs internal buffers in device and is possible for windows and mvp\r
86 \r
87         virtual bool PTSIFramePlayback() {return false;};\r
88         // Tells, if the iframe playback is realized using a manipulation of the pts of the packets\r
89         //android does it like this...\r
90 \r
91         virtual bool blockingDrainTarget() { return false;};\r
92         // if the draintargets blocks, the feed has to be stop when pausing\r
93 \r
94 \r
95     virtual void turnVideoOn(){};\r
96     virtual void turnVideoOff(){};\r
97 //    virtual ULLONG frameNumberToTimecode(ULONG timecode) { return 0; };//Obsolete and not HD compatible\r
98 \r
99 #ifdef DEV\r
100     virtual int test() { return 0; }\r
101     virtual int test2() { return 0; }\r
102 #endif\r
103 \r
104     int getMode()           { return mode; }\r
105     UCHAR getFormat()       { return format; }\r
106     UINT getScreenWidth()   { return screenWidth; }\r
107     UINT getScreenHeight()  { return screenHeight; }\r
108     UCHAR getTVsize()       { return tvsize; }\r
109 \r
110 \r
111 \r
112     //hmsf framesToHMSF(ULONG frames,double fps);\r
113    // UINT getFPS(); //removed\r
114 \r
115     // Video formats - AV_SET_VID_DISP_FMT\r
116     const static UCHAR NTSC = 0;\r
117     const static UCHAR PAL = 1;\r
118     const static UCHAR PAL_M = 2;\r
119     const static UCHAR NTSC_J = 4;\r
120 \r
121     // Video connections - AV_SET_VID_OUTPUT\r
122     const static UCHAR COMPOSITERGB = 1;\r
123     const static UCHAR SVIDEO = 2;\r
124     const static UCHAR HDMI = 4;\r
125     const static UCHAR HDMI3D = 16; //For future use\r
126 \r
127     // Video aspect ratios - AV_SET_VID_RATIO\r
128     const static UCHAR ASPECT4X3 = 0;\r
129     const static UCHAR ASPECT16X9 = 1;\r
130     const static UCHAR ASPECT14X9 = 2; //future use\r
131 \r
132     // Video modes - AV_SET_VID_MODE\r
133     const static UCHAR NORMAL = 0;\r
134     const static UCHAR LETTERBOX = 1;\r
135 /*\r
136     Actual Source Aspect      Aspect IOCTL       Mode IOCTL       MODE A            MODE B\r
137 \r
138           4:3                     4:3             NORMAL          fullframe43       fullframe43\r
139           4:3                     16:9            NORMAL          fullframe43       fullframe43      -- invalid?\r
140           4:3                     4:3             LETTERBOX       fullframe43       fullframe43\r
141           4:3                     16:9            LETTERBOX       fullframe43       fullframe43      -- invalid?\r
142           16:9                    4:3             NORMAL          chop sides        fullframe169\r
143           16:9                    16:9            NORMAL          chop sides        fullframe169\r
144           16:9                    4:3             LETTERBOX       letterbox         letterbox\r
145           16:9                    16:9            LETTERBOX       chop sides        fullframe169\r
146 \r
147     Conclusions\r
148 \r
149     1. There are two chip modes - accessible by reopening the fd\r
150     2. The video chip knows the aspect ratio purely from the incoming MPEG\r
151     3. MODE A is for 4:3 TVs, MODE B is for 16:9 TVs\r
152 \r
153     To switch to MODE A, set the aspect ioctl to 4:3 and reopen the FD.\r
154     To switch to MODE B, set the aspect ioctl to 16:9 and reopen the FD.\r
155 */\r
156 \r
157     const static UCHAR UNKNOWN2 = 2;\r
158     const static UCHAR QUARTER = 3;\r
159     const static UCHAR EIGHTH = 4;\r
160     const static UCHAR ZOOM = 5;\r
161     const static UCHAR UNKNOWN6 = 6;\r
162 \r
163   protected:\r
164     static Video* instance;\r
165     int initted;\r
166     int fdVideo;\r
167 \r
168     UCHAR tvsize;\r
169     UCHAR format;\r
170     UCHAR connection;\r
171     UCHAR aspectRatio;\r
172     UCHAR mode;\r
173         bool h264;\r
174 \r
175     UINT screenWidth;\r
176     UINT screenHeight;\r
177 };\r
178 \r
179 #endif\r