Mercurial > mplayer.hg
annotate vidix/vidix.h @ 22859:c5a45e3d6d16
updated vidix.h from upstream vidix project
author | ben |
---|---|
date | Sun, 01 Apr 2007 12:16:49 +0000 |
parents | 939eacee89ab |
children | efe51e2b81c3 |
rev | line source |
---|---|
3991 | 1 /* |
2 * vidix.h | |
3 * VIDIX - VIDeo Interface for *niX | |
4 * This interface is introduced as universal one to MPEG decoder, | |
5 * BES == Back End Scaler and YUV2RGB hw accelerators. | |
6 * In the future it may be expanded up to capturing and audio things. | |
7 * Main goal of this this interface imlpementation is providing DGA | |
8 * everywhere where it's possible (unlike X11 and other). | |
9 * Copyright 2002 Nick Kurshev | |
10 * Licence: GPL | |
11 * This interface is based on v4l2, fbvid.h, mga_vid.h projects | |
12 * and personally my ideas. | |
13 * NOTE: This interface is introduces as driver interface. | |
14 * Don't use it for APP. | |
15 */ | |
16 #ifndef VIDIX_H | |
17 #define VIDIX_H | |
18 | |
19 #ifdef __cplusplus | |
20 extern "C" { | |
21 #endif | |
22 | |
23 #define VIDIX_VERSION 100 | |
24 | |
22859 | 25 /* returns driver version */ |
26 extern unsigned vixGetVersion (void); | |
3991 | 27 |
4191 | 28 #define PROBE_NORMAL 0 /* normal probing */ |
29 #define PROBE_FORCE 1 /* ignore device_id but recognize device if it's known */ | |
22859 | 30 |
31 /* Probes video hw. | |
32 verbose - specifies verbose level. | |
33 force - specifies force mode - driver should ignore | |
34 device_id (danger but useful for new devices) | |
35 Returns 0 if ok else errno */ | |
36 extern int vixProbe (int verbose, int force); | |
37 | |
38 /* Initializes driver. | |
39 args - specifies driver specific parameters | |
40 Returns 0 if ok else errno */ | |
41 extern int vixInit (const char *args); | |
42 | |
43 /* Destroys driver */ | |
44 extern void vixDestroy (void); | |
3991 | 45 |
22859 | 46 typedef enum vidix_dev_type { |
47 TYPE_OUTPUT = 0x00000000, /* Is a video playback device */ | |
48 TYPE_CAPTURE = 0x00000001, /* Is a capture device */ | |
49 TYPE_CODEC = 0x00000002, /* Device supports hw (de)coding */ | |
50 TYPE_FX = 0x00000004, /* Is a video effects device */ | |
51 } vidix_dev_type_t; | |
52 | |
53 typedef enum vidix_dev_flag { | |
54 FLAG_NONE = 0x00000000, /* No flags defined */ | |
55 FLAG_DMA = 0x00000001, /* Card can use DMA */ | |
56 /* Card can use DMA only if src pitch == dest pitch */ | |
57 FLAG_EQ_DMA = 0x00000002, | |
58 /* Possible to wait for DMA to finish. See BM_DMA_SYNC and BM_DMA_BLOCK */ | |
59 FLAG_SYNC_DMA = 0x00000004, | |
60 FLAG_UPSCALER = 0x00000010, /* Card supports hw upscaling */ | |
61 FLAG_DOWNSCALER = 0x00000020, /* Card supports hw downscaling */ | |
62 FLAG_SUBPIC = 0x00001000, /* Card supports DVD subpictures */ | |
63 FLAG_EQUALIZER = 0x00002000, /* Card supports equalizer */ | |
64 } vidix_dev_flag_t; | |
65 | |
3991 | 66 typedef struct vidix_capability_s |
67 { | |
22859 | 68 char name[64]; /* Driver name */ |
69 char author[64]; /* Author name */ | |
70 vidix_dev_type_t type; | |
71 unsigned reserved0[4]; | |
72 int maxwidth; | |
73 int maxheight; | |
74 int minwidth; | |
75 int minheight; | |
76 int maxframerate; /* -1 if unlimited */ | |
77 vidix_dev_flag_t flags; | |
78 unsigned short vendor_id; | |
79 unsigned short device_id; | |
80 unsigned reserved1[4]; | |
81 } vidix_capability_t; | |
82 | |
83 /* Should fill at least type before init. | |
84 Returns 0 if ok else errno */ | |
85 extern int vixGetCapability (vidix_capability_t *); | |
3991 | 86 |
22859 | 87 typedef enum vidix_depth { |
88 VID_DEPTH_NONE = 0x0000, | |
89 VID_DEPTH_1BPP = 0x0001, | |
90 VID_DEPTH_2BPP = 0x0002, | |
91 VID_DEPTH_4BPP = 0x0004, | |
92 VID_DEPTH_8BPP = 0x0008, | |
93 VID_DEPTH_12BPP = 0x0010, | |
94 VID_DEPTH_15BPP = 0x0020, | |
95 VID_DEPTH_16BPP = 0x0040, | |
96 VID_DEPTH_24BPP = 0x0080, | |
97 VID_DEPTH_32BPP = 0x0100, | |
98 VID_DEPTH_ALL = VID_DEPTH_1BPP | VID_DEPTH_2BPP | \ | |
99 VID_DEPTH_4BPP | VID_DEPTH_8BPP | \ | |
100 VID_DEPTH_12BPP | VID_DEPTH_15BPP | \ | |
101 VID_DEPTH_16BPP | VID_DEPTH_24BPP | \ | |
102 VID_DEPTH_32BPP, | |
103 } vidix_depth_t; | |
104 | |
105 typedef enum vidix_cap { | |
106 VID_CAP_NONE = 0x0000, | |
107 /* if overlay can be bigger than source */ | |
108 VID_CAP_EXPAND = 0x0001, | |
109 /* if overlay can be smaller than source */ | |
110 VID_CAP_SHRINK = 0x0002, | |
111 /* if overlay can be blended with framebuffer */ | |
112 VID_CAP_BLEND = 0x0004, | |
113 /* if overlay can be restricted to a colorkey */ | |
114 VID_CAP_COLORKEY = 0x0008, | |
115 /* if overlay can be restricted to an alpha channel */ | |
116 VID_CAP_ALPHAKEY = 0x0010, | |
117 /* if the colorkey can be a range */ | |
118 VID_CAP_COLORKEY_ISRANGE = 0x0020, | |
119 /* if the alphakey can be a range */ | |
120 VID_CAP_ALPHAKEY_ISRANGE = 0x0040, | |
121 /* colorkey is checked against framebuffer */ | |
122 VID_CAP_COLORKEY_ISMAIN = 0x0080, | |
123 /* colorkey is checked against overlay */ | |
124 VID_CAP_COLORKEY_ISOVERLAY = 0x0100, | |
125 /* alphakey is checked against framebuffer */ | |
126 VID_CAP_ALPHAKEY_ISMAIN = 0x0200, | |
127 /* alphakey is checked against overlay */ | |
128 VID_CAP_ALPHAKEY_ISOVERLAY = 0x0400, | |
129 } vidix_cap_t; | |
3991 | 130 |
131 typedef struct vidix_fourcc_s | |
132 { | |
22859 | 133 unsigned fourcc; /* input: requested fourcc */ |
134 vidix_depth_t depth; /* output: screen depth for given fourcc */ | |
135 vidix_cap_t flags; /* output: capability */ | |
136 } vidix_fourcc_t; | |
3991 | 137 |
22859 | 138 /* Returns 0 if ok else errno */ |
139 extern int vixQueryFourcc (vidix_fourcc_t *); | |
3991 | 140 |
141 typedef struct vidix_yuv_s | |
142 { | |
22859 | 143 unsigned y,u,v; |
144 } vidix_yuv_t; | |
3991 | 145 |
146 typedef struct vidix_rect_s | |
147 { | |
22859 | 148 unsigned x,y,w,h; /* in pixels */ |
149 vidix_yuv_t pitch; /* line-align in bytes */ | |
150 } vidix_rect_t; | |
151 | |
152 typedef enum vidix_color_key_op { | |
153 CKEY_FALSE = 0, | |
154 CKEY_TRUE = 1, | |
155 CKEY_EQ = 2, | |
156 CKEY_NEQ = 3, | |
157 } vidix_color_key_op_t; | |
3991 | 158 |
159 typedef struct vidix_color_key_s | |
160 { | |
22859 | 161 vidix_color_key_op_t op; /* defines logical operation */ |
162 unsigned char red; | |
163 unsigned char green; | |
164 unsigned char blue; | |
165 unsigned char reserved; | |
3991 | 166 }vidix_ckey_t; |
167 | |
22859 | 168 typedef enum vidix_video_key_op { |
169 VKEY_FALSE = 0, | |
170 VKEY_TRUE = 1, | |
171 VKEY_EQ = 2, | |
172 VKEY_NEQ = 3, | |
173 } vidix_video_key_op_t; | |
174 | |
175 typedef struct vidix_video_key_s { | |
176 vidix_video_key_op_t op; /* defines logical operation */ | |
177 unsigned char key[8]; | |
178 } vidix_vkey_t; | |
179 | |
180 typedef enum vidix_interleave { | |
181 VID_PLAY_INTERLEAVED_UV = 0x00000001, | |
182 /* UVUVUVUVUV used by Matrox G200 */ | |
183 INTERLEAVING_UV = 0x00001000, | |
184 /* VUVUVUVUVU */ | |
185 INTERLEAVING_VU = 0x00001001, | |
186 } vidix_interleave_t; | |
187 | |
188 #define VID_PLAY_MAXFRAMES 64 /* unreal limitation */ | |
3991 | 189 |
190 typedef struct vidix_playback_s | |
191 { | |
22859 | 192 unsigned fourcc; /* app -> driver: movies's fourcc */ |
193 unsigned capability; /* app -> driver: what capability to use */ | |
194 unsigned blend_factor; /* app -> driver: blending factor */ | |
195 vidix_rect_t src; /* app -> driver: original movie size */ | |
196 vidix_rect_t dest; /* app -> driver: destinition movie size. | |
197 driver->app dest_pitch */ | |
198 vidix_interleave_t flags; /* driver -> app: interleaved UV planes */ | |
199 /* memory model */ | |
200 unsigned frame_size; /* driver -> app: destinition frame size */ | |
201 unsigned num_frames; /* app -> driver: after call: driver -> app */ | |
202 unsigned offsets[VID_PLAY_MAXFRAMES]; /* driver -> app */ | |
203 vidix_yuv_t offset; /* driver -> app: relative offsets | |
204 within frame for yuv planes */ | |
205 void *dga_addr; /* driver -> app: linear address */ | |
206 } vidix_playback_t; | |
3991 | 207 |
22859 | 208 /* Returns 0 if ok else errno */ |
209 extern int vixConfigPlayback (vidix_playback_t *); | |
3991 | 210 |
22859 | 211 /* Returns 0 if ok else errno */ |
212 extern int vixPlaybackOn (void); | |
213 | |
214 /* Returns 0 if ok else errno */ | |
215 extern int vixPlaybackOff (void); | |
3991 | 216 |
22859 | 217 /* Returns 0 if ok else errno */ |
218 extern int vixPlaybackFrameSelect (unsigned frame_idx); | |
3991 | 219 |
22859 | 220 typedef enum vidix_key_op { |
221 KEYS_PUT = 0, | |
222 KEYS_AND = 1, | |
223 KEYS_OR = 2, | |
224 KEYS_XOR = 3, | |
225 } vidix_key_op_t; | |
3991 | 226 |
4070
b61ba6c256dd
Minor interface changes: color and video keys are moved out from playback configuring
nick
parents:
4008
diff
changeset
|
227 typedef struct vidix_grkey_s |
b61ba6c256dd
Minor interface changes: color and video keys are moved out from playback configuring
nick
parents:
4008
diff
changeset
|
228 { |
22859 | 229 vidix_ckey_t ckey; /* app -> driver: color key */ |
230 vidix_vkey_t vkey; /* app -> driver: video key */ | |
231 vidix_key_op_t key_op; /* app -> driver: keys operations */ | |
232 } vidix_grkey_t; | |
233 | |
234 /* Returns 0 if ok else errno */ | |
235 extern int vixGetGrKeys (vidix_grkey_t *); | |
236 | |
237 /* Returns 0 if ok else errno */ | |
238 extern int vixSetGrKeys (const vidix_grkey_t *); | |
239 | |
240 typedef enum vidix_veq_cap { | |
241 VEQ_CAP_NONE = 0x00000000UL, | |
242 VEQ_CAP_BRIGHTNESS = 0x00000001UL, | |
243 VEQ_CAP_CONTRAST = 0x00000002UL, | |
244 VEQ_CAP_SATURATION = 0x00000004UL, | |
245 VEQ_CAP_HUE = 0x00000008UL, | |
246 VEQ_CAP_RGB_INTENSITY = 0x00000010UL, | |
247 } vidix_veq_cap_t; | |
4070
b61ba6c256dd
Minor interface changes: color and video keys are moved out from playback configuring
nick
parents:
4008
diff
changeset
|
248 |
22859 | 249 typedef enum vidix_veq_flag { |
250 VEQ_FLG_ITU_R_BT_601 = 0x00000000, /* ITU-R BT.601 colour space (default) */ | |
251 VEQ_FLG_ITU_R_BT_709 = 0x00000001, /* ITU-R BT.709 colour space */ | |
252 VEQ_FLG_ITU_MASK = 0x0000000f, | |
253 } vidix_veq_flag_t; | |
4070
b61ba6c256dd
Minor interface changes: color and video keys are moved out from playback configuring
nick
parents:
4008
diff
changeset
|
254 |
22859 | 255 typedef struct vidix_video_eq_s { |
256 vidix_veq_cap_t cap; /* on get_eq should contain capability of | |
257 equalizer on set_eq should contain using fields */ | |
258 /* end-user app can have presets like: cold-normal-hot picture and so on */ | |
259 int brightness; /* -1000 : +1000 */ | |
260 int contrast; /* -1000 : +1000 */ | |
261 int saturation; /* -1000 : +1000 */ | |
262 int hue; /* -1000 : +1000 */ | |
263 int red_intensity; /* -1000 : +1000 */ | |
264 int green_intensity; /* -1000 : +1000 */ | |
265 int blue_intensity; /* -1000 : +1000 */ | |
266 vidix_veq_flag_t flags; /* currently specifies ITU YCrCb color | |
267 space to use */ | |
268 } vidix_video_eq_t; | |
4070
b61ba6c256dd
Minor interface changes: color and video keys are moved out from playback configuring
nick
parents:
4008
diff
changeset
|
269 |
22859 | 270 /* Returns 0 if ok else errno */ |
271 extern int vixPlaybackGetEq (vidix_video_eq_t *); | |
272 | |
273 /* Returns 0 if ok else errno */ | |
274 extern int vixPlaybackSetEq (const vidix_video_eq_t *); | |
3991 | 275 |
22859 | 276 typedef enum vidix_interlace_flag { |
277 /* stream is not interlaced */ | |
278 CFG_NON_INTERLACED = 0x00000000, | |
279 /* stream is interlaced */ | |
280 CFG_INTERLACED = 0x00000001, | |
281 /* first frame contains even fields but second - odd */ | |
282 CFG_EVEN_ODD_INTERLACING = 0x00000002, | |
283 /* first frame contains odd fields but second - even */ | |
284 CFG_ODD_EVEN_INTERLACING = 0x00000004, | |
285 /* field deinterlace_pattern is valid */ | |
286 CFG_UNIQUE_INTERLACING = 0x00000008, | |
287 /* unknown deinterlacing - use adaptive if it's possible */ | |
288 CFG_UNKNOWN_INTERLACING = 0x0000000f, | |
289 } vidix_interlace_flag_t; | |
3991 | 290 |
22859 | 291 typedef struct vidix_deinterlace_s { |
292 vidix_interlace_flag_t flags; | |
293 unsigned deinterlace_pattern; /* app -> driver: deinterlace pattern if | |
294 flag CFG_UNIQUE_INTERLACING is set */ | |
295 } vidix_deinterlace_t; | |
296 | |
297 /* Returns 0 if ok else errno */ | |
298 extern int vixPlaybackGetDeint (vidix_deinterlace_t *); | |
299 | |
300 /* Returns 0 if ok else errno */ | |
301 extern int vixPlaybackSetDeint (const vidix_deinterlace_t *); | |
3991 | 302 |
22859 | 303 typedef struct vidix_slice_s { |
304 void *address; /* app -> driver */ | |
305 unsigned size; /* app -> driver */ | |
306 vidix_rect_t slice; /* app -> driver */ | |
307 } vidix_slice_t; | |
4191 | 308 |
22859 | 309 typedef enum vidix_bm_flag { |
310 LVO_DMA_NOSYNC = 0, | |
311 /* waits for vsync or hsync */ | |
312 LVO_DMA_SYNC = 1, | |
313 } vidix_dma_flag_t; | |
3991 | 314 |
315 typedef struct vidix_dma_s | |
316 { | |
22859 | 317 vidix_slice_t src; /* app -> driver */ |
318 vidix_slice_t dest; /* app -> driver */ | |
319 vidix_dma_flag_t flags; /* app -> driver */ | |
320 } vidix_dma_t; | |
321 | |
322 /* Returns 0 if ok else errno */ | |
323 extern int vixPlaybackCopyFrame (vidix_dma_t *); | |
3991 | 324 |
22859 | 325 /* Returns 0 if DMA is available else errno (EBUSY) */ |
326 extern int vixQueryDMAStatus (void); | |
327 | |
328 typedef enum vidix_fx_type { | |
329 FX_TYPE_BOOLEAN = 0x00000000, | |
330 FX_TYPE_INTEGER = 0x00000001, | |
331 } vidix_fx_type_t; | |
3991 | 332 |
4191 | 333 /* |
334 This structure is introdused to support OEM effects like: | |
335 - sharpness | |
336 - exposure | |
337 - (auto)gain | |
338 - H(V)flip | |
339 - black level | |
340 - white balance | |
341 and many other | |
342 */ | |
343 typedef struct vidix_oem_fx_s | |
344 { | |
22859 | 345 vidix_fx_type_t type; /* type of effects */ |
346 int num; /* app -> driver: effect number. | |
347 From 0 to max number of effects */ | |
348 int minvalue; /* min value of effect. 0 - for boolean */ | |
349 int maxvalue; /* max value of effect. 1 - for boolean */ | |
350 int value; /* current value of effect on get; required on set */ | |
351 char *name[80]; /* effect name to display */ | |
352 } vidix_oem_fx_t; | |
4191 | 353 |
22859 | 354 /* Returns 0 if ok else errno */ |
355 extern int vixQueryNumOemEffects (unsigned * number); | |
4191 | 356 |
22859 | 357 /* Returns 0 if ok else errno */ |
358 extern int vixGetOemEffect (vidix_oem_fx_t *); | |
4191 | 359 |
22859 | 360 /* Returns 0 if ok else errno */ |
361 extern int vixSetOemEffect (const vidix_oem_fx_t *); | |
4191 | 362 |
3991 | 363 #ifdef __cplusplus |
364 } | |
365 #endif | |
366 | |
367 #endif |