Mercurial > mplayer.hg
annotate libvo/vosub_vidix.c @ 4362:7ef67ffa9274
preinit usage
author | nick |
---|---|
date | Sat, 26 Jan 2002 19:12:49 +0000 |
parents | 09f15844c960 |
children | 9b6430df4de5 |
rev | line source |
---|---|
4014 | 1 |
4010 | 2 /* |
3 * vosub_vidix.c | |
4 * | |
5 * Copyright (C) Nick Kurshev <nickols_k@mail.ru> - 2002 | |
4280 | 6 * Copyright (C) Alex Beregszaszi |
4010 | 7 * |
8 * You can redistribute this file under terms and conditions | |
9 * of GNU General Public licence v2. | |
10 * | |
11 * This file contains vidix interface to any mplayer's VO plugin. | |
12 * (Partly based on vesa_lvo.c from mplayer's package) | |
13 */ | |
14 | |
15 #include <inttypes.h> | |
16 #include <sys/ioctl.h> | |
17 #include <unistd.h> | |
18 #include <fcntl.h> | |
19 #include <sys/mman.h> | |
20 #include <stdio.h> | |
21 #include <stdlib.h> | |
22 #include <string.h> | |
23 | |
24 #include "config.h" | |
25 | |
26 #include "vosub_vidix.h" | |
27 #include "../vidix/vidixlib.h" | |
28 #include "fastmemcpy.h" | |
29 #include "osd.h" | |
30 #include "video_out.h" | |
31 | |
32 #define NUM_FRAMES 10 /* Temporary: driver will overwrite it */ | |
33 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */ | |
34 | |
35 static VDL_HANDLE vidix_handler = NULL; | |
36 static uint8_t *vidix_mem = NULL; | |
37 static uint8_t next_frame; | |
38 static unsigned image_bpp,image_height,image_width,src_format; | |
39 extern int verbose; | |
40 | |
41 static vidix_capability_t vidix_cap; | |
42 static vidix_playback_t vidix_play; | |
43 static vidix_fourcc_t vidix_fourcc; | |
44 | |
4082 | 45 int vidix_preinit(const char *drvname,void *server) |
4010 | 46 { |
47 int err; | |
48 if(verbose > 1) printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname); | |
49 if(vdlGetVersion() != VIDIX_VERSION) | |
50 { | |
51 printf("vosub_vidix: You have wrong version of VIDIX library\n"); | |
52 return -1; | |
53 } | |
4138 | 54 vidix_handler = vdlOpen(LIBDIR"/vidix/", |
4132
84ecfd03c86a
test for preinit errors and correct handling subdevice
nick
parents:
4082
diff
changeset
|
55 drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, |
4010 | 56 TYPE_OUTPUT, |
57 verbose); | |
58 if(vidix_handler == NULL) | |
59 { | |
60 printf("vosub_vidix: Couldn't find working VIDIX driver\n"); | |
61 return -1; | |
62 } | |
63 if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0) | |
64 { | |
65 printf("vosub_vidix: Couldn't get capability: %s\n",strerror(err)); | |
66 return -1; | |
67 } | |
4013 | 68 printf("vosub_vidix: Using: %s\n",vidix_cap.name); |
4010 | 69 /* we are able to tune up this stuff depend on fourcc format */ |
4082 | 70 ((vo_functions_t *)server)->draw_slice=vidix_draw_slice; |
71 ((vo_functions_t *)server)->draw_frame=vidix_draw_frame; | |
72 ((vo_functions_t *)server)->flip_page=vidix_flip_page; | |
73 ((vo_functions_t *)server)->draw_osd=vidix_draw_osd; | |
4362 | 74 ((vo_functions_t *)server)->query_format=vidix_query_fourcc; |
4010 | 75 return 0; |
76 } | |
77 | |
78 int vidix_init(unsigned src_width,unsigned src_height, | |
79 unsigned x_org,unsigned y_org,unsigned dst_width, | |
80 unsigned dst_height,unsigned format,unsigned dest_bpp, | |
81 unsigned vid_w,unsigned vid_h) | |
82 { | |
83 size_t i,awidth; | |
84 int err; | |
4082 | 85 if(verbose > 1) |
86 printf("vosub_vidix: vidix_init() was called\n" | |
87 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" | |
88 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" | |
89 ,src_width,src_height,x_org,y_org,dst_width,dst_height | |
90 ,vo_format_name(format),dest_bpp,vid_w,vid_h); | |
4280 | 91 |
92 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) || | |
93 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) || | |
94 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) || | |
95 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight))) | |
4010 | 96 { |
4280 | 97 printf("vosub_vidix: video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", |
98 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight, | |
99 vidix_cap.maxwidth, vidix_cap.maxheight); | |
4010 | 100 return -1; |
101 } | |
4280 | 102 |
4010 | 103 err = 0; |
104 switch(dest_bpp) | |
105 { | |
106 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; | |
107 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; | |
108 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; | |
109 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; | |
110 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; | |
111 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; | |
112 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; | |
113 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; | |
114 } | |
115 if(err) | |
116 { | |
117 printf("vosub_vidix: video server has unsupported color depth by vidix\n"); | |
118 return -1; | |
119 } | |
120 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) | |
121 { | |
122 printf("vosub_vidix: vidix driver can't upscale image\n"); | |
123 return -1; | |
124 } | |
125 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) | |
126 { | |
127 printf("vosub_vidix: vidix driver can't downscale image\n"); | |
128 return -1; | |
129 } | |
130 image_width = src_width; | |
131 image_height = src_height; | |
4014 | 132 src_format = format; |
4010 | 133 memset(&vidix_play,0,sizeof(vidix_playback_t)); |
134 vidix_play.fourcc = format; | |
135 vidix_play.capability = vidix_cap.flags; /* every ;) */ | |
136 vidix_play.blend_factor = 0; /* for now */ | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
137 /* display the full picture. |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
138 Nick: we could implement here zooming to a specified area -- alex */ |
4010 | 139 vidix_play.src.x = vidix_play.src.y = 0; |
140 vidix_play.src.w = src_width; | |
141 vidix_play.src.h = src_height; | |
142 vidix_play.dest.x = x_org; | |
143 vidix_play.dest.y = y_org; | |
144 vidix_play.dest.w = dst_width; | |
145 vidix_play.dest.h = dst_height; | |
146 vidix_play.num_frames=NUM_FRAMES; | |
147 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0) | |
148 { | |
149 printf("vosub_vidix: Can't configure playback: %s\n",strerror(err)); | |
150 return -1; | |
151 } | |
152 | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
153 vidix_mem = vidix_play.dga_addr; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
154 |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
155 /* select first frame */ |
4010 | 156 next_frame = 0; |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
157 // vdlPlaybackFrameSelect(vidix_handler,next_frame); |
4010 | 158 |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
159 /* clear every frame with correct address and frame_size */ |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
160 for (i = 0; i < vidix_play.num_frames; i++) |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
161 memset(vidix_mem + vidix_play.offsets[i], 0x80, |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
162 vidix_play.frame_size); |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
163 return 0; |
4010 | 164 } |
165 | |
4229 | 166 extern int vo_gamma_brightness; |
167 extern int vo_gamma_saturation; | |
168 extern int vo_gamma_contrast; | |
169 extern int vo_gamma_hue; | |
4317 | 170 extern int vo_gamma_red_intensity; |
171 extern int vo_gamma_green_intensity; | |
172 extern int vo_gamma_blue_intensity; | |
4229 | 173 |
4240 | 174 static vidix_video_eq_t vid_eq; |
4229 | 175 |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
176 int vidix_start(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
177 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
178 int err; |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
179 if((err=vdlPlaybackOn(vidix_handler))!=0) |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
180 { |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
181 printf("vosub_vidix: Can't start playback: %s\n",strerror(err)); |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
182 return -1; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
183 } |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
184 |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
185 if (vidix_cap.flags & FLAG_EQUALIZER) |
4229 | 186 { |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
187 if(verbose > 1) |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
188 { |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
189 printf("vosub_vidix: vo_gamma_brightness=%i\n" |
4229 | 190 "vosub_vidix: vo_gamma_saturation=%i\n" |
191 "vosub_vidix: vo_gamma_contrast=%i\n" | |
192 "vosub_vidix: vo_gamma_hue=%i\n" | |
4317 | 193 "vosub_vidix: vo_gamma_red_intensity=%i\n" |
194 "vosub_vidix: vo_gamma_green_intensity=%i\n" | |
195 "vosub_vidix: vo_gamma_blue_intensity=%i\n" | |
4229 | 196 ,vo_gamma_brightness |
197 ,vo_gamma_saturation | |
198 ,vo_gamma_contrast | |
199 ,vo_gamma_hue | |
4317 | 200 ,vo_gamma_red_intensity |
201 ,vo_gamma_green_intensity | |
202 ,vo_gamma_blue_intensity); | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
203 } |
4317 | 204 /* To use full set of vid_eq.cap */ |
205 if(vdlPlaybackGetEq(vidix_handler,&vid_eq) == 0) | |
206 { | |
207 vid_eq.brightness = vo_gamma_brightness; | |
208 vid_eq.saturation = vo_gamma_saturation; | |
209 vid_eq.contrast = vo_gamma_contrast; | |
210 vid_eq.hue = vo_gamma_hue; | |
211 vid_eq.red_intensity = vo_gamma_red_intensity; | |
212 vid_eq.green_intensity = vo_gamma_green_intensity; | |
213 vid_eq.blue_intensity = vo_gamma_blue_intensity; | |
214 vid_eq.flags = VEQ_FLG_ITU_R_BT_601; | |
215 vdlPlaybackSetEq(vidix_handler,&vid_eq); | |
216 } | |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
217 } |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
218 return 0; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
219 } |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
220 |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
221 int vidix_stop(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
222 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
223 int err; |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
224 if((err=vdlPlaybackOff(vidix_handler))!=0) |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
225 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
226 printf("vosub_vidix: Can't stop playback: %s\n",strerror(err)); |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
227 return -1; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
228 } |
4234
0ec1d81c8f94
sorry, i really wanted to add vidix_start and stop as int, to detect if something went into the wrong way (also implement check in vo_xvidix)
alex
parents:
4231
diff
changeset
|
229 return 0; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
230 } |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
231 |
4010 | 232 void vidix_term( void ) |
233 { | |
234 if(verbose > 1) printf("vosub_vidix: vidix_term() was called\n"); | |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
235 vidix_stop(); |
4010 | 236 vdlClose(vidix_handler); |
237 } | |
238 | |
239 uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
240 { | |
241 uint8_t *src; | |
242 uint8_t *dest; | |
4014 | 243 unsigned bespitch,apitch; |
4010 | 244 int i; |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
245 |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
246 /* Plane Y */ |
4014 | 247 apitch = vidix_play.dest.pitch.y-1; |
248 bespitch = (w + apitch) & ~apitch; | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
249 |
4032 | 250 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4010 | 251 dest += bespitch*y + x; |
252 src = image[0]; | |
253 for(i=0;i<h;i++){ | |
254 memcpy(dest,src,w); | |
255 src+=stride[0]; | |
256 dest += bespitch; | |
257 } | |
258 | |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
259 if (vidix_play.flags & VID_PLAY_INTERLEAVED_UV) |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
260 { |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
261 printf("vosub_vidix: interleaving UV planes not supported yet\n"); |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
262 return 0; |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
263 } |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
264 |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
265 /* Plane V */ |
4014 | 266 apitch = vidix_play.dest.pitch.v-1; |
267 bespitch = (w + apitch) & ~apitch; | |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
268 |
4032 | 269 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v; |
4031 | 270 dest += bespitch*y/4 + x; |
4014 | 271 src = image[1]; |
272 for(i=0;i<h/2;i++){ | |
273 memcpy(dest,src,w/2); | |
274 src+=stride[1]; | |
275 dest+=bespitch/2; | |
276 } | |
4324
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
277 |
09f15844c960
don't render UV planes if interleaved (also add support later)
alex
parents:
4317
diff
changeset
|
278 /* Plane U */ |
4014 | 279 apitch = vidix_play.dest.pitch.u-1; |
280 bespitch = (w + apitch) & ~apitch; | |
4010 | 281 |
4032 | 282 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u; |
4031 | 283 dest += bespitch*y/4 + x; |
4010 | 284 src = image[2]; |
4014 | 285 for(i=0;i<h/2;i++){ |
286 memcpy(dest,src,w/2); | |
4010 | 287 src+=stride[2]; |
4014 | 288 dest += bespitch/2; |
4010 | 289 } |
290 return 0; | |
291 } | |
292 | |
293 uint32_t vidix_draw_slice_422(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
294 { | |
295 uint8_t *src; | |
296 uint8_t *dest; | |
4014 | 297 unsigned bespitch,apitch; |
4010 | 298 int i; |
4014 | 299 apitch = vidix_play.dest.pitch.y-1; |
300 bespitch = (w*2 + apitch) & ~apitch; | |
4032 | 301 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4010 | 302 dest += bespitch*y + x; |
303 src = image[0]; | |
304 for(i=0;i<h;i++){ | |
305 memcpy(dest,src,w*2); | |
306 src+=stride[0]; | |
307 dest += bespitch; | |
308 } | |
4240 | 309 |
310 return 0; | |
4010 | 311 } |
312 | |
313 | |
314 uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
315 { | |
316 if(verbose > 1) printf("vosub_vidix: vidix_draw_slice() was called\n"); | |
317 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) | |
318 vidix_draw_slice_420(image,stride,w,h,x,y); | |
319 else | |
320 vidix_draw_slice_422(image,stride,w,h,x,y); | |
321 return 0; | |
322 } | |
323 | |
324 uint32_t vidix_draw_frame(uint8_t *image[]) | |
325 { | |
326 if(verbose > 1) printf("vosub_vidix: vidix_draw_frame() was called\n"); | |
327 /* Note it's very strange but sometime for YUY2 draw_frame is called */ | |
328 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) | |
329 { | |
4240 | 330 printf("vosub_vidix: draw_frame for YUV420 called\nExiting...\n"); |
4010 | 331 vidix_term(); |
332 exit( EXIT_FAILURE ); | |
333 } | |
334 else | |
335 { | |
336 int stride[1]; | |
337 stride[0] = vidix_play.src.w*2; | |
338 vidix_draw_slice_422(image,stride,vidix_play.src.w,vidix_play.src.h, | |
339 vidix_play.src.x,vidix_play.src.y); | |
340 } | |
341 return 0; | |
342 } | |
343 | |
344 void vidix_flip_page(void) | |
345 { | |
346 if(verbose > 1) printf("vosub_vidix: vidix_flip_page() was called\n"); | |
347 if(vo_doublebuffering) | |
348 { | |
4032 | 349 vdlPlaybackFrameSelect(vidix_handler,next_frame); |
4010 | 350 next_frame=(next_frame+1)%vidix_play.num_frames; |
351 } | |
352 } | |
353 | |
354 static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) | |
355 { | |
356 UNUSED(x0); | |
357 UNUSED(y0); | |
358 UNUSED(w); | |
359 UNUSED(h); | |
360 UNUSED(src); | |
361 UNUSED(srca); | |
362 UNUSED(stride); | |
363 } | |
364 | |
365 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) | |
366 { | |
4032 | 367 uint32_t apitch,bespitch; |
4010 | 368 void *lvo_mem; |
4032 | 369 lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
370 apitch = vidix_play.dest.pitch.y-1; | |
371 bespitch = (vidix_play.src.w + apitch) & (~apitch); | |
4010 | 372 switch(vidix_play.fourcc){ |
373 case IMGFMT_YV12: | |
374 case IMGFMT_IYUV: | |
375 case IMGFMT_I420: | |
376 vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); | |
377 break; | |
378 case IMGFMT_YUY2: | |
4032 | 379 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0),2*bespitch); |
4010 | 380 break; |
381 case IMGFMT_UYVY: | |
4032 | 382 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0)+1,2*bespitch); |
4010 | 383 break; |
384 default: | |
385 draw_alpha_null(x0,y0,w,h,src,srca,stride); | |
386 } | |
387 } | |
388 | |
389 void vidix_draw_osd(void) | |
390 { | |
391 if(verbose > 1) printf("vosub_vidix: vidix_draw_osd() was called\n"); | |
392 /* TODO: hw support */ | |
393 vo_draw_text(vidix_play.src.w,vidix_play.src.h,draw_alpha); | |
394 } | |
395 | |
396 uint32_t vidix_query_fourcc(uint32_t format) | |
397 { | |
398 if(verbose > 1) printf("vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format)); | |
399 vidix_fourcc.fourcc = format; | |
400 vdlQueryFourcc(vidix_handler,&vidix_fourcc); | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
401 if (vidix_fourcc.depth == VID_DEPTH_NONE) |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
402 return(0); |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
403 return(0x2); /* hw support without conversion */ |
4010 | 404 } |
4240 | 405 |
4255 | 406 int vidix_grkey_support(void) |
407 { | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
408 return(vidix_fourcc.flags & VID_CAP_COLORKEY); |
4255 | 409 } |
410 | |
4240 | 411 int vidix_grkey_get(vidix_grkey_t *gr_key) |
412 { | |
413 return(vdlGetGrKeys(vidix_handler, gr_key)); | |
414 } | |
415 | |
416 int vidix_grkey_set(const vidix_grkey_t *gr_key) | |
417 { | |
418 return(vdlSetGrKeys(vidix_handler, gr_key)); | |
419 } |