]> git.vomp.tv Git - vompclient.git/blob - video.h
HDTV for Windows
[vompclient.git] / video.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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #ifndef VIDEO_H
22 #define VIDEO_H
23
24 #include <stdio.h>
25 #include "defines.h"
26 #include "draintarget.h"
27 #include "abstractoption.h"
28
29 typedef struct _hmsf
30 {
31   UINT hours;
32   UINT minutes;
33   UINT seconds;
34   UINT frames;
35 } hmsf;
36
37 class Video: public DrainTarget, public AbstractOption
38 {
39   public:
40     Video();
41     virtual ~Video();
42     static Video* getInstance();
43
44     virtual int init(UCHAR format)=0;
45     virtual int shutdown()=0;
46     virtual int setFormat(UCHAR format)=0;
47     virtual int setConnection(UCHAR connection)=0;
48     virtual int setAspectRatio(UCHAR aspectRatio)=0;   // This one does the pin 8 scart widescreen switching
49     virtual int setMode(UCHAR mode)=0;
50     virtual int setTVsize(UCHAR size)=0;               // Is the TV a widescreen?
51     virtual int setDefaultAspect()=0;
52     virtual int setSource()=0;
53     virtual int setPosition(int x, int y)=0;
54     virtual int sync()=0;
55     virtual int play()=0;
56     virtual int stop()=0;
57     virtual int pause()=0;
58     virtual int unPause()=0;
59     virtual int fastForward()=0;
60     virtual int unFastForward()=0;
61     virtual int reset()=0;
62     virtual int blank()=0;
63     virtual int signalOn()=0;
64     virtual int signalOff()=0;
65     virtual int attachFrameBuffer()=0; // What does this do?
66 //    virtual ULONG timecodeToFrameNumber(ULLONG timecode)=0; //Obsolete and not HD compatible
67     virtual ULLONG getCurrentTimestamp()=0;
68     virtual void displayIFrame(const UCHAR* buffer, UINT length)=0;
69
70         virtual bool supportsh264(){return false;};
71         virtual void seth264mode(bool ish264) {h264=ish264;};
72
73     virtual void turnVideoOn(){};
74     virtual void turnVideoOff(){};
75 //    virtual ULLONG frameNumberToTimecode(ULONG timecode) { return 0; };//Obsolete and not HD compatible
76
77 #ifdef DEV
78     virtual int test() { return 0; }
79     virtual int test2() { return 0; }
80 #endif
81
82     int getMode()           { return mode; }
83     UCHAR getFormat()       { return format; }
84     UINT getScreenWidth()   { return screenWidth; }
85     UINT getScreenHeight()  { return screenHeight; }
86     UCHAR getTVsize()       { return tvsize; }
87
88     //hmsf framesToHMSF(ULONG frames,double fps);
89    // UINT getFPS(); //removed
90
91     // Video formats - AV_SET_VID_DISP_FMT
92     const static UCHAR NTSC = 0;
93     const static UCHAR PAL = 1;
94
95     // Video connections - AV_SET_VID_OUTPUT
96     const static UCHAR COMPOSITERGB = 1;
97     const static UCHAR SVIDEO = 2;
98
99     // Video aspect ratios - AV_SET_VID_RATIO
100     const static UCHAR ASPECT4X3 = 0;
101     const static UCHAR ASPECT16X9 = 1;
102
103     // Video modes - AV_SET_VID_MODE
104     const static UCHAR NORMAL = 0;
105     const static UCHAR LETTERBOX = 1;
106 /*
107     Actual Source Aspect      Aspect IOCTL       Mode IOCTL       MODE A            MODE B
108
109           4:3                     4:3             NORMAL          fullframe43       fullframe43
110           4:3                     16:9            NORMAL          fullframe43       fullframe43      -- invalid?
111           4:3                     4:3             LETTERBOX       fullframe43       fullframe43
112           4:3                     16:9            LETTERBOX       fullframe43       fullframe43      -- invalid?
113           16:9                    4:3             NORMAL          chop sides        fullframe169
114           16:9                    16:9            NORMAL          chop sides        fullframe169
115           16:9                    4:3             LETTERBOX       letterbox         letterbox
116           16:9                    16:9            LETTERBOX       chop sides        fullframe169
117
118     Conclusions
119
120     1. There are two chip modes - accessible by reopening the fd
121     2. The video chip knows the aspect ratio purely from the incoming MPEG
122     3. MODE A is for 4:3 TVs, MODE B is for 16:9 TVs
123
124     To switch to MODE A, set the aspect ioctl to 4:3 and reopen the FD.
125     To switch to MODE B, set the aspect ioctl to 16:9 and reopen the FD.
126 */
127
128     const static UCHAR UNKNOWN2 = 2;
129     const static UCHAR QUARTER = 3;
130     const static UCHAR EIGHTH = 4;
131     const static UCHAR ZOOM = 5;
132     const static UCHAR UNKNOWN6 = 6;
133
134   protected:
135     static Video* instance;
136     int initted;
137     int fdVideo;
138
139     UCHAR tvsize;
140     UCHAR format;
141     UCHAR connection;
142     UCHAR aspectRatio;
143     UCHAR mode;
144         bool h264;
145
146     UINT screenWidth;
147     UINT screenHeight;
148 };
149
150 #endif