]> git.vomp.tv Git - vompclient.git/blob - videomvp.h
SDTV support
[vompclient.git] / videomvp.h
1 /*\r
2     Copyright 2004-2005 Chris Tallon\r
3 \r
4     This file is part of VOMP.\r
5 \r
6     VOMP is free software; you can redistribute it and/or modify\r
7     it under the terms of the GNU General Public License as published by\r
8     the Free Software Foundation; either version 2 of the License, or\r
9     (at your option) any later version.\r
10 \r
11     VOMP is distributed in the hope that it will be useful,\r
12     but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14     GNU General Public License for more details.\r
15 \r
16     You should have received a copy of the GNU General Public License\r
17     along with VOMP; if not, write to the Free Software\r
18     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\r
19 */\r
20 \r
21 // Thanks to Jon Gettler and BtB of the MVPMC project for all the hardware information\r
22 \r
23 \r
24 #ifndef VIDEOMVP_H\r
25 #define VIDEOMVP_H\r
26 \r
27 // FIXME - check why so many things include unistd\r
28 \r
29 #include <stdio.h>\r
30 #include <unistd.h>\r
31 #include <fcntl.h>\r
32 #include <sys/ioctl.h>\r
33 #include <string.h>\r
34 \r
35 #include <stdint.h>\r
36 \r
37 #include "defines.h"\r
38 #include "video.h"\r
39 \r
40 typedef struct\r
41 {\r
42   int nleft;\r
43   int state;\r
44 } vid_state_regs_t;\r
45 \r
46 typedef struct\r
47 {\r
48   uint64_t stc;\r
49   uint64_t pts;\r
50 } sync_data_t;\r
51 \r
52 typedef struct\r
53 {\r
54   int y;\r
55   int x;\r
56   int w;\r
57   int h;\r
58 } vid_rect_t;\r
59 \r
60 typedef struct\r
61 {\r
62   vid_rect_t src;\r
63   vid_rect_t dest;\r
64 } vid_pos_regs_t;\r
65 \r
66 struct vid_regs\r
67 {\r
68   UCHAR dummy[44];\r
69 };\r
70 \r
71 #define AV_SET_VID_STOP         _IOW('v', 21, int)\r
72 #define AV_SET_VID_PLAY         _IOW('v', 22, int)\r
73 #define AV_SET_VID_FREEZE       _IOW('v', 23, int)\r
74 #define AV_SET_VID_RESUME       _IOW('v', 24, int)\r
75 #define AV_SET_VID_SRC          _IOW('v', 25, int)\r
76 #define AV_SET_VID_FB           _IOW('v', 26, int)\r
77 #define AV_GET_VID_STATE        _IOR('v', 27, vid_state_regs_t*)\r
78 #define AV_SET_VID_PAUSE        _IOW('v', 28, int)\r
79 #define AV_SET_VID_FFWD         _IOW('v', 29, int)\r
80 #define AV_SET_VID_SLOMO        _IOW('v', 30, int)\r
81 #define AV_SET_VID_BLANK        _IOW('v', 32, int)\r
82 #define AV_SET_VID_POSITION     _IOW('v', 36, vid_pos_regs_t*)\r
83 #define AV_SET_VID_SCALE_ON     _IOW('v', 37, int)\r
84 #define AV_SET_VID_SCALE_OFF    _IOW('v', 38, int)\r
85 #define AV_GET_VID_TIMESTAMPS   _IOR('v', 39, sync_data_t*)\r
86 #define AV_SET_VID_STC          _IOW('v', 40, uint64_t*)\r
87 #define AV_SET_VID_RATIO        _IOW('v', 41, int)\r
88 #define AV_SET_VID_SYNC         _IOW('v', 42, int)\r
89 #define AV_SET_VID_DISABLE_SYNC _IOW('v', 43, int)\r
90 #define AV_SET_VID_DISP_FMT     _IOW('v', 45, int)\r
91 #define AV_SET_VID_RESET        _IOW('v', 51, int)\r
92 #define AV_SET_VID_OUTPUT       _IOW('v', 57, int)\r
93 #define AV_SET_VID_MODE         _IOW('v', 58, int)\r
94 #define AV_GET_VID_REGS         _IOR('v', 61, struct vid_regs*)\r
95 #define AV_SET_VID_COLORBAR     _IOW('v', 62, int)\r
96 #define AV_SET_VID_DENC         _IOW('v', 63, int)\r
97 #define AV_CHK_SCART            _IOW('v', 64, int)\r
98 \r
99 #define WRITE_LENGTH (32*1024) // Consume up to 32K at a time from Stream\r
100 #define WRITE_PACKETS 16       // But no more than 16 packets\r
101 \r
102 class VideoMVP : public Video\r
103 {\r
104   public:\r
105     VideoMVP();\r
106     virtual ~VideoMVP();\r
107 \r
108     int init(UCHAR format);\r
109     int shutdown();\r
110 \r
111     UCHAR getSupportedFormats() { return COMPOSITERGB | SVIDEO;};\r
112     UINT supportedTVsize() { return ASPECT4X3|ASPECT16X9;};\r
113     UCHAR supportedTVFormats() { return 0;}; /* We cannot change this here\r
114 \r
115     int setFormat(UCHAR format);\r
116     int setConnection(UCHAR connection);\r
117     int setAspectRatio(UCHAR aspectRatio);   // This one does the pin 8 scart widescreen switching\r
118     int setMode(UCHAR mode);\r
119     int setTVsize(UCHAR size);               // Is the TV a widescreen?\r
120     int setDefaultAspect();\r
121     int setSource();\r
122     int setPosition(int x, int y);\r
123     int sync();\r
124     int play();\r
125     int stop();\r
126     int pause();\r
127     int unPause();\r
128     int fastForward();\r
129     int unFastForward();\r
130     int reset();\r
131     int blank();\r
132     int signalOn();\r
133     int signalOff();\r
134     int attachFrameBuffer(); // What does this do?\r
135     ULONG timecodeToFrameNumber(ULLONG timecode);\r
136     ULLONG getCurrentTimestamp();\r
137     bool displayIFrame(const UCHAR* buffer, UINT length);\r
138 \r
139     // Writing Data to Videodevice\r
140     virtual void PrepareMediaSample(const MediaPacketList&, UINT samplepos);\r
141     virtual UINT DeliverMediaSample( UCHAR* buffer, UINT* samplepos);\r
142     virtual long long SetStartOffset(long long curreftime, bool *rsync)\r
143     { return 0; };\r
144     virtual void ResetTimeOffsets();\r
145 \r
146 #ifdef DEV\r
147     int test();\r
148     int test2();\r
149 #endif\r
150 \r
151   private:\r
152     int checkSCART();\r
153     void setLetterboxBorder(char* border);\r
154 \r
155     UINT deliver_start, deliver_length, deliver_count;\r
156     UINT mediapacket_len[WRITE_PACKETS];\r
157 };\r
158 \r
159 #endif\r