]> git.vomp.tv Git - vompclient.git/blob - video.h
Initial import of patches for ARM/Android/Raspeberry pi
[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 int setConnection(UCHAR connection)=0;\r
49     virtual int setAspectRatio(UCHAR aspectRatio)=0;   // This one does the pin 8 scart widescreen switching\r
50     virtual int setMode(UCHAR mode)=0;\r
51     virtual int setTVsize(UCHAR size)=0;               // Is the TV a widescreen?\r
52     virtual int setDefaultAspect()=0;\r
53     virtual int setSource()=0;\r
54     virtual int setPosition(int x, int y)=0;\r
55     virtual int sync()=0;\r
56     virtual int play()=0;\r
57     virtual int stop()=0;\r
58     virtual int pause()=0;\r
59     virtual int unPause()=0;\r
60     virtual int fastForward()=0;\r
61     virtual int unFastForward()=0;\r
62     virtual int reset()=0;\r
63     virtual int blank()=0;\r
64     virtual int signalOn()=0;\r
65     virtual int signalOff()=0;\r
66     virtual int attachFrameBuffer()=0; // What does this do?\r
67 //    virtual ULONG timecodeToFrameNumber(ULLONG timecode)=0; //Obsolete and not HD compatible\r
68     virtual ULLONG getCurrentTimestamp()=0;\r
69     virtual bool displayIFrame(const UCHAR* buffer, UINT length)=0;\r
70     virtual int EnterIframePlayback() {return 1;}; // Must not be implemented\r
71 \r
72         virtual bool supportsh264(){return false;};\r
73         virtual void seth264mode(bool ish264) {h264=ish264;};\r
74         virtual int getTeletextBufferFaktor(){return 1;};\r
75 \r
76         virtual bool independentAVStartUp() {return true;};\r
77 \r
78 \r
79         //Tells, if the device allows an independent startup of audio and video\r
80         // this needs internal buffers in device and is possible for windows and mvp\r
81 \r
82         virtual bool PTSIFramePlayback() {return false;};\r
83         // Tells, if the iframe playback is realized using a manipulation of the pts of the packets\r
84         //android does it like this...\r
85 \r
86         virtual bool blockingDrainTarget() { return false;};\r
87         // if the draintargets blocks, the feed has to be stop when pausing\r
88 \r
89 \r
90     virtual void turnVideoOn(){};\r
91     virtual void turnVideoOff(){};\r
92 //    virtual ULLONG frameNumberToTimecode(ULONG timecode) { return 0; };//Obsolete and not HD compatible\r
93 \r
94 #ifdef DEV\r
95     virtual int test() { return 0; }\r
96     virtual int test2() { return 0; }\r
97 #endif\r
98 \r
99     int getMode()           { return mode; }\r
100     UCHAR getFormat()       { return format; }\r
101     UINT getScreenWidth()   { return screenWidth; }\r
102     UINT getScreenHeight()  { return screenHeight; }\r
103     UCHAR getTVsize()       { return tvsize; }\r
104 \r
105     //hmsf framesToHMSF(ULONG frames,double fps);\r
106    // UINT getFPS(); //removed\r
107 \r
108     // Video formats - AV_SET_VID_DISP_FMT\r
109     const static UCHAR NTSC = 0;\r
110     const static UCHAR PAL = 1;\r
111 \r
112     // Video connections - AV_SET_VID_OUTPUT\r
113     const static UCHAR COMPOSITERGB = 1;\r
114     const static UCHAR SVIDEO = 2;\r
115 \r
116     // Video aspect ratios - AV_SET_VID_RATIO\r
117     const static UCHAR ASPECT4X3 = 0;\r
118     const static UCHAR ASPECT16X9 = 1;\r
119 \r
120     // Video modes - AV_SET_VID_MODE\r
121     const static UCHAR NORMAL = 0;\r
122     const static UCHAR LETTERBOX = 1;\r
123 /*\r
124     Actual Source Aspect      Aspect IOCTL       Mode IOCTL       MODE A            MODE B\r
125 \r
126           4:3                     4:3             NORMAL          fullframe43       fullframe43\r
127           4:3                     16:9            NORMAL          fullframe43       fullframe43      -- invalid?\r
128           4:3                     4:3             LETTERBOX       fullframe43       fullframe43\r
129           4:3                     16:9            LETTERBOX       fullframe43       fullframe43      -- invalid?\r
130           16:9                    4:3             NORMAL          chop sides        fullframe169\r
131           16:9                    16:9            NORMAL          chop sides        fullframe169\r
132           16:9                    4:3             LETTERBOX       letterbox         letterbox\r
133           16:9                    16:9            LETTERBOX       chop sides        fullframe169\r
134 \r
135     Conclusions\r
136 \r
137     1. There are two chip modes - accessible by reopening the fd\r
138     2. The video chip knows the aspect ratio purely from the incoming MPEG\r
139     3. MODE A is for 4:3 TVs, MODE B is for 16:9 TVs\r
140 \r
141     To switch to MODE A, set the aspect ioctl to 4:3 and reopen the FD.\r
142     To switch to MODE B, set the aspect ioctl to 16:9 and reopen the FD.\r
143 */\r
144 \r
145     const static UCHAR UNKNOWN2 = 2;\r
146     const static UCHAR QUARTER = 3;\r
147     const static UCHAR EIGHTH = 4;\r
148     const static UCHAR ZOOM = 5;\r
149     const static UCHAR UNKNOWN6 = 6;\r
150 \r
151   protected:\r
152     static Video* instance;\r
153     int initted;\r
154     int fdVideo;\r
155 \r
156     UCHAR tvsize;\r
157     UCHAR format;\r
158     UCHAR connection;\r
159     UCHAR aspectRatio;\r
160     UCHAR mode;\r
161         bool h264;\r
162 \r
163     UINT screenWidth;\r
164     UINT screenHeight;\r
165 };\r
166 \r
167 #endif\r