]> git.vomp.tv Git - vompclient.git/blob - videomvp.h
Compile fix for MVP re: location change of hmsf
[vompclient.git] / videomvp.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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 // Thanks to Jon Gettler and BtB of the MVPMC project for all the hardware information
22
23
24 #ifndef VIDEOMVP_H
25 #define VIDEOMVP_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 <stdint.h>
36
37 #include "defines.h"
38 #include "video.h"
39
40 typedef struct
41 {
42   int nleft;
43   int state;
44 } vid_state_regs_t;
45
46 typedef struct
47 {
48   uint64_t stc;
49   uint64_t pts;
50 } sync_data_t;
51
52 typedef struct
53 {
54   int y;
55   int x;
56   int w;
57   int h;
58 } vid_rect_t;
59
60 typedef struct
61 {
62   vid_rect_t src;
63   vid_rect_t dest;
64 } vid_pos_regs_t;
65
66 struct vid_regs
67 {
68   UCHAR dummy[44];
69 };
70
71 #define AV_SET_VID_STOP         _IOW('v', 21, int)
72 #define AV_SET_VID_PLAY         _IOW('v', 22, int)
73 #define AV_SET_VID_FREEZE       _IOW('v', 23, int)
74 #define AV_SET_VID_RESUME       _IOW('v', 24, int)
75 #define AV_SET_VID_SRC          _IOW('v', 25, int)
76 #define AV_SET_VID_FB           _IOW('v', 26, int)
77 #define AV_GET_VID_STATE        _IOR('v', 27, vid_state_regs_t*)
78 #define AV_SET_VID_PAUSE        _IOW('v', 28, int)
79 #define AV_SET_VID_FFWD         _IOW('v', 29, int)
80 #define AV_SET_VID_SLOMO        _IOW('v', 30, int)
81 #define AV_SET_VID_BLANK        _IOW('v', 32, int)
82 #define AV_SET_VID_POSITION     _IOW('v', 36, vid_pos_regs_t*)
83 #define AV_SET_VID_SCALE_ON     _IOW('v', 37, int)
84 #define AV_SET_VID_SCALE_OFF    _IOW('v', 38, int)
85 #define AV_GET_VID_TIMESTAMPS   _IOR('v', 39, sync_data_t*)
86 #define AV_SET_VID_STC          _IOW('v', 40, uint64_t*)
87 #define AV_SET_VID_RATIO        _IOW('v', 41, int)
88 #define AV_SET_VID_SYNC         _IOW('v', 42, int)
89 #define AV_SET_VID_DISABLE_SYNC _IOW('v', 43, int)
90 #define AV_SET_VID_DISP_FMT     _IOW('v', 45, int)
91 #define AV_SET_VID_RESET        _IOW('v', 51, int)
92 #define AV_SET_VID_OUTPUT       _IOW('v', 57, int)
93 #define AV_SET_VID_MODE         _IOW('v', 58, int)
94 #define AV_GET_VID_REGS         _IOR('v', 61, struct vid_regs*)
95 #define AV_SET_VID_COLORBAR     _IOW('v', 62, int)
96 #define AV_SET_VID_DENC         _IOW('v', 63, int)
97 #define AV_CHK_SCART            _IOW('v', 64, int)
98
99 #define WRITE_LENGTH (32*1024) // Consume up to 32K at a time from Stream
100 #define WRITE_PACKETS 16       // But no more than 16 packets
101
102 class VideoMVP : public Video
103 {
104   public:
105     VideoMVP();
106     virtual ~VideoMVP();
107
108     int init(UCHAR format);
109     int shutdown();
110
111     UCHAR getSupportedFormats() { return COMPOSITERGB | SVIDEO;};
112     UINT supportedTVsize() { return ASPECT4X3|ASPECT16X9;};
113     UCHAR supportedTVFormats() { return 0;}; // We cannot change this here
114
115     int setFormat(UCHAR format);
116     int setConnection(UCHAR connection);
117     int setAspectRatio(UCHAR aspectRatio, int tparx,int tpary);   // This one does the pin 8 scart widescreen switching
118     int setMode(UCHAR mode);
119     int setTVsize(UCHAR size);               // Is the TV a widescreen?
120     int setDefaultAspect();
121     int setSource();
122     int sync();
123     int play();
124     int stop();
125     int pause();
126     int unPause();
127     int fastForward();
128     int unFastForward();
129     int reset();
130     int blank();
131     int signalOn();
132     int signalOff();
133     int attachFrameBuffer(); // What does this do?
134     ULONG timecodeToFrameNumber(ULLONG timecode);
135     ULLONG getCurrentTimestamp();
136     bool displayIFrame(const UCHAR* buffer, UINT length);
137
138     // Writing Data to Videodevice
139     virtual void PrepareMediaSample(const MediaPacketList&, UINT samplepos);
140     virtual UINT DeliverMediaSample( UCHAR* buffer, UINT* samplepos);
141     virtual long long SetStartOffset(long long curreftime, bool *rsync)
142     { return 0; };
143     virtual void ResetTimeOffsets();
144
145 #ifdef DEV
146     int test();
147     int test2();
148 #endif
149
150
151   protected:
152   int setPosition(int x, int y); // legacy api do not use
153
154   private:
155     int checkSCART();
156     void setLetterboxBorder(char* border);
157
158     UINT deliver_start, deliver_length, deliver_count;
159     UINT mediapacket_len[WRITE_PACKETS];
160 };
161
162 #endif