synced with r22428
[mplayer/greg.git] / vidix / vidix.h
blob67462b33c7fa5db788399a7fbf6009145929bd80
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.
16 #ifndef VIDIX_H
17 #define VIDIX_H
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
23 #define VIDIX_VERSION 100
25 /* returns driver version */
26 extern unsigned vixGetVersion( void );
28 #define PROBE_NORMAL 0 /* normal probing */
29 #define PROBE_FORCE 1 /* ignore device_id but recognize device if it's known */
30 /* Probes video hw.
31 verbose - specifies verbose level.
32 force - specifies force mode - driver should ignore
33 device_id (danger but useful for new devices)
34 Returns 0 if ok else errno */
35 extern int vixProbe( int verbose, int force );
36 /* Initializes driver. Returns 0 if ok else errno */
37 extern int vixInit( void );
38 /* Destroys driver */
39 extern void vixDestroy( void );
41 typedef struct vidix_capability_s
43 char name[64]; /* Driver name */
44 char author[64]; /* Author name */
45 #define TYPE_OUTPUT 0x00000000 /* Is a video playback device */
46 #define TYPE_CAPTURE 0x00000001 /* Is a capture device */
47 #define TYPE_CODEC 0x00000002 /* Device supports hw (de)coding */
48 #define TYPE_FX 0x00000004 /* Is a video effects device */
49 int type; /* Device type, see below */
50 unsigned reserved0[4];
51 int maxwidth;
52 int maxheight;
53 int minwidth;
54 int minheight;
55 int maxframerate; /* -1 if unlimited */
56 #define FLAG_NONE 0x00000000 /* No flags defined */
57 #define FLAG_DMA 0x00000001 /* Card can use DMA */
58 #define FLAG_EQ_DMA 0x00000002 /* Card can use DMA only if src pitch == dest pitch */
59 #define FLAG_UPSCALER 0x00000010 /* Card supports hw upscaling */
60 #define FLAG_DOWNSCALER 0x00000020 /* Card supports hw downscaling */
61 #define FLAG_SUBPIC 0x00001000 /* Card supports DVD subpictures */
62 #define FLAG_EQUALIZER 0x00002000 /* Card supports equalizer */
63 unsigned flags; /* Feature flags, see above */
64 unsigned short vendor_id;
65 unsigned short device_id;
66 unsigned reserved1[4];
67 }vidix_capability_t;
69 /* Should fill at least type before init.
70 Returns 0 if ok else errno */
71 extern int vixGetCapability(vidix_capability_t *);
73 typedef struct vidix_fourcc_s
75 unsigned fourcc;
76 #define VID_DEPTH_NONE 0x0000
77 #define VID_DEPTH_1BPP 0x0001
78 #define VID_DEPTH_2BPP 0x0002
79 #define VID_DEPTH_4BPP 0x0004
80 #define VID_DEPTH_8BPP 0x0008
81 #define VID_DEPTH_12BPP 0x0010
82 #define VID_DEPTH_15BPP 0x0020
83 #define VID_DEPTH_16BPP 0x0040
84 #define VID_DEPTH_24BPP 0x0080
85 #define VID_DEPTH_32BPP 0x0100
86 unsigned depth;
87 #define VID_CAP_NONE 0x0000
88 #define VID_CAP_EXPAND 0x0001 /* if overlay can be bigger than source */
89 #define VID_CAP_SHRINK 0x0002 /* if overlay can be smaller than source */
90 #define VID_CAP_BLEND 0x0004 /* if overlay can be blended with framebuffer */
91 #define VID_CAP_COLORKEY 0x0008 /* if overlay can be restricted to a colorkey */
92 #define VID_CAP_ALPHAKEY 0x0010 /* if overlay can be restricted to an alpha channel */
93 #define VID_CAP_COLORKEY_ISRANGE 0x0020 /* if the colorkey can be a range */
94 #define VID_CAP_ALPHAKEY_ISRANGE 0x0040 /* if the alphakey can be a range */
95 #define VID_CAP_COLORKEY_ISMAIN 0x0080 /* colorkey is checked against framebuffer */
96 #define VID_CAP_COLORKEY_ISOVERLAY 0x0100 /* colorkey is checked against overlay */
97 #define VID_CAP_ALPHAKEY_ISMAIN 0x0200 /* alphakey is checked against framebuffer */
98 #define VID_CAP_ALPHAKEY_ISOVERLAY 0x0400 /* alphakey is checked against overlay */
99 unsigned flags;
100 }vidix_fourcc_t;
102 /* Returns 0 if ok else errno */
103 extern int vixQueryFourcc(vidix_fourcc_t *);
105 typedef struct vidix_yuv_s
107 unsigned y,u,v;
108 }vidix_yuv_t;
110 typedef struct vidix_rect_s
112 unsigned x,y,w,h; /* in pixels */
113 vidix_yuv_t pitch; /* line-align in bytes */
114 }vidix_rect_t;
116 typedef struct vidix_color_key_s
118 #define CKEY_FALSE 0
119 #define CKEY_TRUE 1
120 #define CKEY_EQ 2
121 #define CKEY_NEQ 3
122 unsigned op; /* defines logical operation */
123 unsigned char red;
124 unsigned char green;
125 unsigned char blue;
126 unsigned char reserved;
127 }vidix_ckey_t;
129 typedef struct vidix_video_key_s
131 #define VKEY_FALSE 0
132 #define VKEY_TRUE 1
133 #define VKEY_EQ 2
134 #define VKEY_NEQ 3
135 unsigned op; /* defines logical operation */
136 unsigned char key[8];
137 }vidix_vkey_t;
139 typedef struct vidix_playback_s
141 unsigned fourcc; /* app -> driver: movies's fourcc */
142 unsigned capability; /* app -> driver: what capability to use */
143 unsigned blend_factor; /* app -> driver: blending factor */
144 vidix_rect_t src; /* app -> driver: original movie size */
145 vidix_rect_t dest; /* app -> driver: destinition movie size. driver->app dest_pitch */
146 #define VID_PLAY_INTERLEAVED_UV 0x00000001 /* driver -> app: interleaved UV planes */
147 #define INTERLEAVING_UV 0x00001000 /* UVUVUVUVUV used by Matrox G200 */
148 #define INTERLEAVING_VU 0x00001001 /* VUVUVUVUVU */
149 int flags;
150 /* memory model */
151 unsigned frame_size; /* driver -> app: destinition frame size */
152 unsigned num_frames; /* app -> driver: after call: driver -> app */
153 #define VID_PLAY_MAXFRAMES 64 /* reasonable limitation for decoding ahead */
154 unsigned offsets[VID_PLAY_MAXFRAMES]; /* driver -> app */
155 vidix_yuv_t offset; /* driver -> app: relative offsets within frame for yuv planes */
156 void* dga_addr; /* driver -> app: linear address */
157 }vidix_playback_t;
159 /* Returns 0 if ok else errno */
160 extern int vixConfigPlayback(vidix_playback_t *);
162 /* Returns 0 if ok else errno */
163 extern int vixPlaybackOn( void );
165 /* Returns 0 if ok else errno */
166 extern int vixPlaybackOff( void );
168 /* Returns 0 if ok else errno */
169 extern int vixPlaybackFrameSelect( unsigned frame_idx );
171 typedef struct vidix_grkey_s
173 vidix_ckey_t ckey; /* app -> driver: color key */
174 vidix_vkey_t vkey; /* app -> driver: video key */
175 #define KEYS_PUT 0
176 #define KEYS_AND 1
177 #define KEYS_OR 2
178 #define KEYS_XOR 3
179 unsigned key_op; /* app -> driver: keys operations */
180 }vidix_grkey_t;
182 /* Returns 0 if ok else errno */
183 extern int vixGetGrKeys( vidix_grkey_t * );
185 /* Returns 0 if ok else errno */
186 extern int vixSetGrKeys( const vidix_grkey_t * );
189 typedef struct vidix_video_eq_s
191 #define VEQ_CAP_NONE 0x00000000UL
192 #define VEQ_CAP_BRIGHTNESS 0x00000001UL
193 #define VEQ_CAP_CONTRAST 0x00000002UL
194 #define VEQ_CAP_SATURATION 0x00000004UL
195 #define VEQ_CAP_HUE 0x00000008UL
196 #define VEQ_CAP_RGB_INTENSITY 0x00000010UL
197 int cap; /* on get_eq should contain capability of equalizer
198 on set_eq should contain using fields */
199 /* end-user app can have presets like: cold-normal-hot picture and so on */
200 int brightness; /* -1000 : +1000 */
201 int contrast; /* -1000 : +1000 */
202 int saturation; /* -1000 : +1000 */
203 int hue; /* -1000 : +1000 */
204 int red_intensity; /* -1000 : +1000 */
205 int green_intensity;/* -1000 : +1000 */
206 int blue_intensity; /* -1000 : +1000 */
207 #define VEQ_FLG_ITU_R_BT_601 0x00000000 /* ITU-R BT.601 colour space (default) */
208 #define VEQ_FLG_ITU_R_BT_709 0x00000001 /* ITU-R BT.709 colour space */
209 #define VEQ_FLG_ITU_MASK 0x0000000f
210 int flags; /* currently specifies ITU YCrCb color space to use */
211 }vidix_video_eq_t;
213 /* Returns 0 if ok else errno */
214 extern int vixPlaybackGetEq( vidix_video_eq_t * );
216 /* Returns 0 if ok else errno */
217 extern int vixPlaybackSetEq( const vidix_video_eq_t * );
219 typedef struct vidix_deinterlace_s
221 #define CFG_NON_INTERLACED 0x00000000 /* stream is not interlaced */
222 #define CFG_INTERLACED 0x00000001 /* stream is interlaced */
223 #define CFG_EVEN_ODD_INTERLACING 0x00000002 /* first frame contains even fields but second - odd */
224 #define CFG_ODD_EVEN_INTERLACING 0x00000004 /* first frame contains odd fields but second - even */
225 #define CFG_UNIQUE_INTERLACING 0x00000008 /* field deinterlace_pattern is valid */
226 #define CFG_UNKNOWN_INTERLACING 0x0000000f /* unknown deinterlacing - use adaptive if it's possible */
227 unsigned flags;
228 unsigned deinterlace_pattern; /* app -> driver: deinterlace pattern if flag CFG_UNIQUE_INTERLACING is set */
229 }vidix_deinterlace_t;
231 /* Returns 0 if ok else errno */
232 extern int vixPlaybackGetDeint( vidix_deinterlace_t * );
234 /* Returns 0 if ok else errno */
235 extern int vixPlaybackSetDeint( const vidix_deinterlace_t * );
237 typedef struct vidix_slice_s
239 void* address; /* app -> driver */
240 unsigned size; /* app -> driver */
241 vidix_rect_t slice; /* app -> driver */
242 }vidix_slice_t;
244 typedef struct vidix_dma_s
246 vidix_slice_t src; /* app -> driver */
247 vidix_slice_t dest; /* app -> driver */
248 #define LVO_DMA_NOSYNC 0
249 #define LVO_DMA_SYNC 1 /* means: wait vsync or hsync */
250 unsigned flags; /* app -> driver */
251 }vidix_dma_t;
253 /* Returns 0 if ok else errno */
254 extern int vixPlaybackCopyFrame( const vidix_dma_t * );
257 This structure is introdused to support OEM effects like:
258 - sharpness
259 - exposure
260 - (auto)gain
261 - H(V)flip
262 - black level
263 - white balance
264 and many other
266 typedef struct vidix_oem_fx_s
268 #define FX_TYPE_BOOLEAN 0x00000000
269 #define FX_TYPE_INTEGER 0x00000001
270 int type; /* type of effects */
271 int num; /* app -> driver: effect number. From 0 to max number of effects */
272 int minvalue; /* min value of effect. 0 - for boolean */
273 int maxvalue; /* max value of effect. 1 - for boolean */
274 int value; /* current value of effect on 'get'; required on set */
275 char * name[80]; /* effect name to display */
276 }vidix_oem_fx_t;
278 /* Returns 0 if ok else errno */
279 extern int vixQueryNumOemEffects( unsigned * number );
281 /* Returns 0 if ok else errno */
282 extern int vixGetOemEffect( vidix_oem_fx_t * );
284 /* Returns 0 if ok else errno */
285 extern int vixSetOemEffect( const vidix_oem_fx_t * );
287 #ifdef __cplusplus
289 #endif
291 #endif