annotate vidix/vidix.h @ 3991:dcc632dd2097

preliminary version
author nick
date Sat, 05 Jan 2002 10:13:25 +0000
parents
children 0d9de811e312
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3991
dcc632dd2097 preliminary version
nick
parents:
diff changeset
1 /*
dcc632dd2097 preliminary version
nick
parents:
diff changeset
2 * vidix.h
dcc632dd2097 preliminary version
nick
parents:
diff changeset
3 * VIDIX - VIDeo Interface for *niX
dcc632dd2097 preliminary version
nick
parents:
diff changeset
4 * This interface is introduced as universal one to MPEG decoder,
dcc632dd2097 preliminary version
nick
parents:
diff changeset
5 * BES == Back End Scaler and YUV2RGB hw accelerators.
dcc632dd2097 preliminary version
nick
parents:
diff changeset
6 * In the future it may be expanded up to capturing and audio things.
dcc632dd2097 preliminary version
nick
parents:
diff changeset
7 * Main goal of this this interface imlpementation is providing DGA
dcc632dd2097 preliminary version
nick
parents:
diff changeset
8 * everywhere where it's possible (unlike X11 and other).
dcc632dd2097 preliminary version
nick
parents:
diff changeset
9 * Copyright 2002 Nick Kurshev
dcc632dd2097 preliminary version
nick
parents:
diff changeset
10 * Licence: GPL
dcc632dd2097 preliminary version
nick
parents:
diff changeset
11 * This interface is based on v4l2, fbvid.h, mga_vid.h projects
dcc632dd2097 preliminary version
nick
parents:
diff changeset
12 * and personally my ideas.
dcc632dd2097 preliminary version
nick
parents:
diff changeset
13 * NOTE: This interface is introduces as driver interface.
dcc632dd2097 preliminary version
nick
parents:
diff changeset
14 * Don't use it for APP.
dcc632dd2097 preliminary version
nick
parents:
diff changeset
15 */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
16 #ifndef VIDIX_H
dcc632dd2097 preliminary version
nick
parents:
diff changeset
17 #define VIDIX_H
dcc632dd2097 preliminary version
nick
parents:
diff changeset
18
dcc632dd2097 preliminary version
nick
parents:
diff changeset
19 #ifdef __cplusplus
dcc632dd2097 preliminary version
nick
parents:
diff changeset
20 extern "C" {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
21 #endif
dcc632dd2097 preliminary version
nick
parents:
diff changeset
22
dcc632dd2097 preliminary version
nick
parents:
diff changeset
23 #define VIDIX_VERSION 100
dcc632dd2097 preliminary version
nick
parents:
diff changeset
24
dcc632dd2097 preliminary version
nick
parents:
diff changeset
25 /* returns driver version */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
26 extern unsigned vixGetVersion( void );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
27
dcc632dd2097 preliminary version
nick
parents:
diff changeset
28 /* Probes video hw. Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
29 extern int vixProbe( void );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
30 /* Initializes driver. Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
31 extern int vixInit( void );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
32 /* Destroys driver */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
33 extern void vixDestroy( void );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
34
dcc632dd2097 preliminary version
nick
parents:
diff changeset
35 typedef struct vidix_capability_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
36 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
37 char name[32]; /* Driver name */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
38 #define TYPE_OUTPUT 0x00000000 /* Is a video capture device */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
39 #define TYPE_CAPTURE 0x00000001 /* Is a CODEC device */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
40 #define TYPE_CODEC 0x00000002 /* Is a video output device */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
41 #define TYPE_FX 0x00000004 /* Is a video effects device */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
42 int type; /* Device type, see below */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
43 int inputs; /* Num video inputs */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
44 int outputs; /* Num video outputs */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
45 int in_audios; /* Num audio inputs */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
46 int out_audios; /* Num audio outputs */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
47 int maxwidth;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
48 int maxheight;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
49 int minwidth;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
50 int minheight;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
51 int maxframerate; /* -1 if unlimited */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
52 #define FLAG_NONE 0x00000000 /* No flags defined */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
53 #define FLAG_DMA 0x00000001 /* Card can use DMA */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
54 #define FLAG_UPSCALER 0x00000010 /* Card supports hw upscaling */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
55 #define FLAG_DOWNSCALER 0x00000020 /* Card supports hw downscaling */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
56 #define FLAG_SUBPIC 0x00001000 /* Card supports DVD subpictures */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
57 unsigned flags; /* Feature flags, see below */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
58 unsigned short vendor_id;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
59 unsigned short device_id;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
60 unsigned reserved[4];
dcc632dd2097 preliminary version
nick
parents:
diff changeset
61 }vidix_capability_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
62
dcc632dd2097 preliminary version
nick
parents:
diff changeset
63 /* Should fill at least type before init.
dcc632dd2097 preliminary version
nick
parents:
diff changeset
64 Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
65 extern int vixGetCapability(vidix_capability_t *);
dcc632dd2097 preliminary version
nick
parents:
diff changeset
66
dcc632dd2097 preliminary version
nick
parents:
diff changeset
67 typedef struct vidix_fourcc_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
68 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
69 unsigned fourcc;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
70 #define VID_DEPTH_NONE 0x0000
dcc632dd2097 preliminary version
nick
parents:
diff changeset
71 #define VID_DEPTH_1BPP 0x0001
dcc632dd2097 preliminary version
nick
parents:
diff changeset
72 #define VID_DEPTH_2BPP 0x0002
dcc632dd2097 preliminary version
nick
parents:
diff changeset
73 #define VID_DEPTH_4BPP 0x0004
dcc632dd2097 preliminary version
nick
parents:
diff changeset
74 #define VID_DEPTH_8BPP 0x0008
dcc632dd2097 preliminary version
nick
parents:
diff changeset
75 #define VID_DEPTH_12BPP 0x0010
dcc632dd2097 preliminary version
nick
parents:
diff changeset
76 #define VID_DEPTH_15BPP 0x0020
dcc632dd2097 preliminary version
nick
parents:
diff changeset
77 #define VID_DEPTH_16BPP 0x0040
dcc632dd2097 preliminary version
nick
parents:
diff changeset
78 #define VID_DEPTH_24BPP 0x0080
dcc632dd2097 preliminary version
nick
parents:
diff changeset
79 #define VID_DEPTH_32BPP 0x0100
dcc632dd2097 preliminary version
nick
parents:
diff changeset
80 unsigned depth;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
81 #define VID_CAP_NONE 0x0000
dcc632dd2097 preliminary version
nick
parents:
diff changeset
82 #define VID_CAP_EXPAND 0x0001 /* if overlay can be bigger than source */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
83 #define VID_CAP_SHRINK 0x0002 /* if overlay can be smaller than source */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
84 #define VID_CAP_BLEND 0x0004 /* if overlay can be blended with framebuffer */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
85 #define VID_CAP_COLORKEY 0x0008 /* if overlay can be restricted to a colorkey */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
86 #define VID_CAP_ALPHAKEY 0x0010 /* if overlay can be restricted to an alpha channel */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
87 #define VID_CAP_COLORKEY_ISRANGE 0x0020 /* if the colorkey can be a range */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
88 #define VID_CAP_ALPHAKEY_ISRANGE 0x0040 /* if the alphakey can be a range */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
89 #define VID_CAP_COLORKEY_ISMAIN 0x0080 /* colorkey is checked against framebuffer */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
90 #define VID_CAP_COLORKEY_ISOVERLAY 0x0100 /* colorkey is checked against overlay */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
91 #define VID_CAP_ALPHAKEY_ISMAIN 0x0200 /* alphakey is checked against framebuffer */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
92 #define VID_CAP_ALPHAKEY_ISOVERLAY 0x0400 /* alphakey is checked against overlay */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
93 unsigned flags;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
94 }vidix_fourcc_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
95
dcc632dd2097 preliminary version
nick
parents:
diff changeset
96 /* Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
97 extern int vixQueryFourcc(vidix_fourcc_t *);
dcc632dd2097 preliminary version
nick
parents:
diff changeset
98
dcc632dd2097 preliminary version
nick
parents:
diff changeset
99 typedef struct vidix_yuv_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
100 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
101 unsigned y,u,v;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
102 }vidix_yuv_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
103
dcc632dd2097 preliminary version
nick
parents:
diff changeset
104 typedef struct vidix_rect_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
105 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
106 unsigned x,y,w,h; /* in pixels */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
107 vidix_yuv_t pitch; /* bytes per line */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
108 }vidix_rect_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
109
dcc632dd2097 preliminary version
nick
parents:
diff changeset
110 typedef struct vidix_color_key_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
111 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
112 #define CKEY_FALSE 0
dcc632dd2097 preliminary version
nick
parents:
diff changeset
113 #define CKEY_TRUE 1
dcc632dd2097 preliminary version
nick
parents:
diff changeset
114 #define CKEY_EQ 2
dcc632dd2097 preliminary version
nick
parents:
diff changeset
115 #define CKEY_NEQ 3
dcc632dd2097 preliminary version
nick
parents:
diff changeset
116 unsigned op; /* defines logical operation */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
117 unsigned char red;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
118 unsigned char green;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
119 unsigned char blue;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
120 unsigned char reserved;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
121 }vidix_ckey_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
122
dcc632dd2097 preliminary version
nick
parents:
diff changeset
123 typedef struct vidix_video_key_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
124 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
125 #define VKEY_FALSE 0
dcc632dd2097 preliminary version
nick
parents:
diff changeset
126 #define VKEY_TRUE 1
dcc632dd2097 preliminary version
nick
parents:
diff changeset
127 #define VKEY_EQ 2
dcc632dd2097 preliminary version
nick
parents:
diff changeset
128 #define VKEY_NEQ 3
dcc632dd2097 preliminary version
nick
parents:
diff changeset
129 unsigned op; /* defines logical operation */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
130 unsigned char key[8];
dcc632dd2097 preliminary version
nick
parents:
diff changeset
131 }vidix_vkey_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
132
dcc632dd2097 preliminary version
nick
parents:
diff changeset
133 typedef struct vidix_playback_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
134 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
135 unsigned fourcc; /* app -> driver: movies's fourcc */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
136 unsigned capability; /* app -> driver: what capability to use */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
137 unsigned blend_factor; /* app -> driver: blenfing factor */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
138 vidix_rect_t src; /* app -> driver: original movie size */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
139 vidix_rect_t dest; /* app -> driver: destinition movie size. driver->app dest_pitch */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
140 vidix_ckey_t ckey; /* app -> driver: color key */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
141 vidix_vkey_t vkey; /* app -> driver: video key */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
142 #define KEYS_PUT 0
dcc632dd2097 preliminary version
nick
parents:
diff changeset
143 #define KEYS_AND 1
dcc632dd2097 preliminary version
nick
parents:
diff changeset
144 #define KEYS_OR 2
dcc632dd2097 preliminary version
nick
parents:
diff changeset
145 #define KEYS_XOR 3
dcc632dd2097 preliminary version
nick
parents:
diff changeset
146 unsigned key_op; /* app -> driver: keys operations */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
147 }vidix_playback_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
148
dcc632dd2097 preliminary version
nick
parents:
diff changeset
149 /* Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
150 extern int vixConfigPlayback(const vidix_playback_t *);
dcc632dd2097 preliminary version
nick
parents:
diff changeset
151
dcc632dd2097 preliminary version
nick
parents:
diff changeset
152 typedef struct vidix_dga_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
153 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
154 unsigned frame_size; /* app -> driver */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
155 unsigned num_frames; /* app -> driver; after call: driver -> app */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
156 #define LVO_MAXFRAMES 32
dcc632dd2097 preliminary version
nick
parents:
diff changeset
157 unsigned offsets[LVO_MAXFRAMES]; /* driver -> app */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
158 vidix_yuv_t offset; /* driver -> app: relative offsets within frame for yuv planes */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
159 void* dga_addr; /* driver -> app: linear address */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
160 }vidix_dga_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
161
dcc632dd2097 preliminary version
nick
parents:
diff changeset
162 /* Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
163 extern int vixMapPlayback(vidix_dga_t *);
dcc632dd2097 preliminary version
nick
parents:
diff changeset
164
dcc632dd2097 preliminary version
nick
parents:
diff changeset
165 /* Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
166 extern int vixPlaybackOn( void );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
167
dcc632dd2097 preliminary version
nick
parents:
diff changeset
168 /* Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
169 extern int vixPlaybackOff( void );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
170
dcc632dd2097 preliminary version
nick
parents:
diff changeset
171 /* Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
172 extern int vixPlaybackFrameSelect( unsigned frame_idx );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
173
dcc632dd2097 preliminary version
nick
parents:
diff changeset
174 typedef struct vidix_video_eq_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
175 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
176 /* end-user app can have presets like: cold-normal-hot picture and so on */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
177 int brightness; /* -1000 : +1000 */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
178 int contrast; /* -1000 : +1000 */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
179 int saturation; /* -1000 : +1000 */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
180 int hue; /* -1000 : +1000 */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
181 int red_intense; /* -1000 : +1000 */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
182 int green_intense; /* -1000 : +1000 */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
183 int blue_intense; /* -1000 : +1000 */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
184 }vidix_video_eq_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
185
dcc632dd2097 preliminary version
nick
parents:
diff changeset
186 /* Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
187 extern int vixPlaybackGetEq( vidix_video_eq_t * );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
188
dcc632dd2097 preliminary version
nick
parents:
diff changeset
189 /* Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
190 extern int vixPlaybackSetEq( const vidix_video_eq_t * );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
191
dcc632dd2097 preliminary version
nick
parents:
diff changeset
192 typedef struct vidix_slice_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
193 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
194 void* address; /* app -> driver */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
195 unsigned size; /* app -> driver */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
196 vidix_rect_t slice; /* app -> driver */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
197 }vidix_slice_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
198
dcc632dd2097 preliminary version
nick
parents:
diff changeset
199 typedef struct vidix_dma_s
dcc632dd2097 preliminary version
nick
parents:
diff changeset
200 {
dcc632dd2097 preliminary version
nick
parents:
diff changeset
201 vidix_slice_t src; /* app -> driver */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
202 vidix_slice_t dest; /* app -> driver */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
203 #define LVO_DMA_NOSYNC 0
dcc632dd2097 preliminary version
nick
parents:
diff changeset
204 #define LVO_DMA_SYNC 1 /* means: wait vsync or hsync */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
205 unsigned flags; /* app -> driver */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
206 }vidix_dma_t;
dcc632dd2097 preliminary version
nick
parents:
diff changeset
207
dcc632dd2097 preliminary version
nick
parents:
diff changeset
208 /* Returns 0 if ok else errno */
dcc632dd2097 preliminary version
nick
parents:
diff changeset
209 extern int vixPlaybackCopyFrame( const vidix_dma_t * );
dcc632dd2097 preliminary version
nick
parents:
diff changeset
210
dcc632dd2097 preliminary version
nick
parents:
diff changeset
211 #ifdef __cplusplus
dcc632dd2097 preliminary version
nick
parents:
diff changeset
212 }
dcc632dd2097 preliminary version
nick
parents:
diff changeset
213 #endif
dcc632dd2097 preliminary version
nick
parents:
diff changeset
214
dcc632dd2097 preliminary version
nick
parents:
diff changeset
215 #endif