]> git.vomp.tv Git - vompclient.git/blob - videomvp.h
Windows updates
[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., 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 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     ~VideoMVP();
107
108     int init(UCHAR format);
109     int shutdown();
110
111     int setFormat(UCHAR format);
112     int setConnection(UCHAR connection);
113     int setAspectRatio(UCHAR aspectRatio);   // This one does the pin 8 scart widescreen switching
114     int setMode(UCHAR mode);
115     int setTVsize(UCHAR size);               // Is the TV a widescreen?
116     int setDefaultAspect();
117     int setSource();
118     int setPosition(int x, int y);
119     int sync();
120     int play();
121     int stop();
122     int pause();
123     int unPause();
124     int fastForward();
125     int unFastForward();
126     int reset();
127     int blank();
128     int signalOn();
129     int signalOff();
130     int attachFrameBuffer(); // What does this do?
131     ULONG timecodeToFrameNumber(ULLONG timecode);
132     ULLONG getCurrentTimestamp();
133     void displayIFrame(const UCHAR* buffer, UINT length);
134
135     // Writing Data to Videodevice
136     virtual void PrepareMediaSample(const MediaPacketList&, UINT samplepos);
137     virtual UINT DeliverMediaSample(const UCHAR* buffer, UINT* samplepos);
138     virtual long long SetStartOffset(long long curreftime, bool *rsync)
139     { return 0; };
140     virtual void ResetTimeOffsets();
141
142 #ifdef DEV
143     int test();
144     int test2();
145 #endif
146
147   private:
148     int checkSCART();
149     void setLetterboxBorder(char* border);
150
151     UINT deliver_start, deliver_length, deliver_count;
152     UINT mediapacket_len[WRITE_PACKETS];
153 };
154
155 #endif