]> git.vomp.tv Git - vompclient.git/blob - video.h
Widescreen version 2...
[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
34 #include "defines.h"
35 #include "stb.h"
36
37 class Video
38 {
39   public:
40     Video();
41     ~Video();
42     static Video* getInstance();
43
44     int init(UCHAR format);
45     int shutdown();
46
47     // Video formats - AV_SET_VID_DISP_FMT
48     const static UCHAR NTSC = 0;
49     const static UCHAR PAL = 1;
50
51     // Video connections - AV_SET_VID_OUTPUT
52     const static UCHAR COMPOSITERGB = 1;
53     const static UCHAR SVIDEO = 2;
54
55     // Video aspect ratios - AV_SET_VID_RATIO
56     const static UCHAR ASPECT4X3 = 0;
57     const static UCHAR ASPECT16X9 = 1;
58
59     // Video modes - AV_SET_VID_MODE
60     const static UCHAR NORMAL = 0;
61     const static UCHAR LETTERBOX = 1;
62 /*
63     Actual Source Aspect      Aspect IOCTL       Mode IOCTL       MODE A            MODE B
64
65           4:3                     4:3             NORMAL          fullframe43       fullframe43
66           4:3                     16:9            NORMAL          fullframe43       fullframe43
67           4:3                     4:3             LETTERBOX       fullframe43       fullframe43
68           4:3                     16:9            LETTERBOX       fullframe43       fullframe43
69           16:9                    4:3             NORMAL          chop sides        fullframe169
70           16:9                    16:9            NORMAL          chop sides        fullframe169
71           16:9                    4:3             LETTERBOX       letterbox         letterbox
72           16:9                    16:9            LETTERBOX       chop sides        fullframe169
73
74     Conclusions
75
76     1. There are two chip modes - accessible by reopening the fd
77     2. The video chip knows the aspect ratio purely from the incoming MPEG
78
79     To switch to MODE A, set the aspect ioctl to 4:3 and reopen the FD.
80     To switch to MODE B, set the aspect ioctl to 16:9 and reopen the FD.
81 */
82
83     const static UCHAR UNKNOWN2 = 2;
84     const static UCHAR QUARTER = 3;
85     const static UCHAR EIGHTH = 4;
86     const static UCHAR ZOOM = 5;
87     const static UCHAR UNKNOWN6 = 6;
88
89     int setFormat(UCHAR format);
90     int setConnection(UCHAR connection);
91     int setAspectRatio(UCHAR aspectRatio);   // This one does the pin 8 scart widescreen switching
92 //    UCHAR getAspectRatio();
93     int setTVsize(UCHAR size);
94     int setDefaultAspect();
95     int setMode(UCHAR mode);
96     int setSource();
97     int setPosition(int x, int y);
98     int sync();
99     int play();
100     int stop();
101     int pause();
102     int unPause();
103     int fastForward();
104     int unFastForward();
105     int reset();
106     int blank();
107     int signalOn();
108     int signalOff();
109
110 #ifdef DEV
111     int test();
112     int test2();
113 #endif
114
115     int attachFrameBuffer(); // What does this do?
116
117     int getFD();
118     UCHAR getFormat();
119     UINT getScreenWidth();
120     UINT getScreenHeight();
121
122   private:
123     int checkSCART();
124
125     static Video* instance;
126     int initted;
127
128     int fdVideo;
129
130     UCHAR tvsize;
131     UCHAR format;
132     UCHAR connection;
133     UCHAR aspectRatio;
134     UCHAR mode;
135
136     UINT screenWidth;
137     UINT screenHeight;
138 };
139
140 #endif