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