comparison vidix/vidix.h @ 3991:dcc632dd2097

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