]> git.vomp.tv Git - vompclient.git/blob - video.h
Half way through recording playback OSD stuff
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 // Thanks to Jon Gettler and BtB of the MVPMC project for all the hardware information
22
23
24 #ifndef VIDEO_H
25 #define VIDEO_H
26
27 // FIXME - check why so many things include unistd
28
29 #include <stdio.h>
30 #include <unistd.h>
31 #include <fcntl.h>
32 #include <sys/ioctl.h>
33 #include <string.h>
34
35 #include "defines.h"
36 #include "stb.h"
37
38 class Video
39 {
40   public:
41     Video();
42     ~Video();
43     static Video* getInstance();
44
45     int init(UCHAR format);
46     int shutdown();
47
48     // Video formats - AV_SET_VID_DISP_FMT
49     const static UCHAR NTSC = 0;
50     const static UCHAR PAL = 1;
51
52     // Video connections - AV_SET_VID_OUTPUT
53     const static UCHAR COMPOSITERGB = 1;
54     const static UCHAR SVIDEO = 2;
55
56     // Video aspect ratios - AV_SET_VID_RATIO
57     const static UCHAR ASPECT4X3 = 0;
58     const static UCHAR ASPECT16X9 = 1;
59
60     // Video modes - AV_SET_VID_MODE
61     const static UCHAR NORMAL = 0;
62     const static UCHAR LETTERBOX = 1;
63 /*
64     Actual Source Aspect      Aspect IOCTL       Mode IOCTL       MODE A            MODE B
65
66           4:3                     4:3             NORMAL          fullframe43       fullframe43
67           4:3                     16:9            NORMAL          fullframe43       fullframe43      -- invalid?
68           4:3                     4:3             LETTERBOX       fullframe43       fullframe43
69           4:3                     16:9            LETTERBOX       fullframe43       fullframe43      -- invalid?
70           16:9                    4:3             NORMAL          chop sides        fullframe169
71           16:9                    16:9            NORMAL          chop sides        fullframe169
72           16:9                    4:3             LETTERBOX       letterbox         letterbox
73           16:9                    16:9            LETTERBOX       chop sides        fullframe169
74
75     Conclusions
76
77     1. There are two chip modes - accessible by reopening the fd
78     2. The video chip knows the aspect ratio purely from the incoming MPEG
79     3. MODE A is for 4:3 TVs, MODE B is for 16:9 TVs
80
81     To switch to MODE A, set the aspect ioctl to 4:3 and reopen the FD.
82     To switch to MODE B, set the aspect ioctl to 16:9 and reopen the FD.
83 */
84
85     const static UCHAR UNKNOWN2 = 2;
86     const static UCHAR QUARTER = 3;
87     const static UCHAR EIGHTH = 4;
88     const static UCHAR ZOOM = 5;
89     const static UCHAR UNKNOWN6 = 6;
90
91     int setFormat(UCHAR format);
92     int setConnection(UCHAR connection);
93     int setAspectRatio(UCHAR aspectRatio);   // This one does the pin 8 scart widescreen switching
94     int setMode(UCHAR mode);
95     int setTVsize(UCHAR size);               // Is the TV a widescreen?
96     int setDefaultAspect();
97     int setSource();
98     int setPosition(int x, int y);
99     int sync();
100     int play();
101     int stop();
102     int pause();
103     int unPause();
104     int fastForward();
105     int unFastForward();
106     int reset();
107     int blank();
108     int signalOn();
109     int signalOff();
110     int attachFrameBuffer(); // What does this do?
111
112 #ifdef DEV
113     int test();
114     int test2();
115 #endif
116
117     int getMode();
118     int getFD();
119     UCHAR getFormat();
120     UINT getScreenWidth();
121     UINT getScreenHeight();
122     UCHAR getTVsize();
123     ULLONG getCurrentTimestamp();
124
125   private:
126     int checkSCART();
127     void setLetterboxBorder(char* border);
128
129     static Video* instance;
130     int initted;
131
132     int fdVideo;
133
134     UCHAR tvsize;
135     UCHAR format;
136     UCHAR connection;
137     UCHAR aspectRatio;
138     UCHAR mode;
139
140     UINT screenWidth;
141     UINT screenHeight;
142 };
143
144 #endif