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