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