Mercurial > mplayer.hg
annotate libvo/vosub_vidix.c @ 4302:9f12fd5f47d0
Modified the cache option value setting/reading, so we can report
in any case the cache size value used.
author | bertrand |
---|---|
date | Tue, 22 Jan 2002 06:12:18 +0000 |
parents | a5f11106ef5e |
children | 0cf9e05f6de2 |
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; | |
4010 | 74 return 0; |
75 } | |
76 | |
77 int vidix_init(unsigned src_width,unsigned src_height, | |
78 unsigned x_org,unsigned y_org,unsigned dst_width, | |
79 unsigned dst_height,unsigned format,unsigned dest_bpp, | |
80 unsigned vid_w,unsigned vid_h) | |
81 { | |
82 size_t i,awidth; | |
83 int err; | |
4082 | 84 if(verbose > 1) |
85 printf("vosub_vidix: vidix_init() was called\n" | |
86 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" | |
87 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" | |
88 ,src_width,src_height,x_org,y_org,dst_width,dst_height | |
89 ,vo_format_name(format),dest_bpp,vid_w,vid_h); | |
4280 | 90 |
91 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) || | |
92 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) || | |
93 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) || | |
94 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight))) | |
4010 | 95 { |
4280 | 96 printf("vosub_vidix: video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", |
97 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight, | |
98 vidix_cap.maxwidth, vidix_cap.maxheight); | |
4010 | 99 return -1; |
100 } | |
4280 | 101 |
4010 | 102 err = 0; |
103 switch(dest_bpp) | |
104 { | |
105 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; | |
106 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; | |
107 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; | |
108 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; | |
109 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; | |
110 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; | |
111 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; | |
112 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; | |
113 } | |
114 if(err) | |
115 { | |
116 printf("vosub_vidix: video server has unsupported color depth by vidix\n"); | |
117 return -1; | |
118 } | |
119 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) | |
120 { | |
121 printf("vosub_vidix: vidix driver can't upscale image\n"); | |
122 return -1; | |
123 } | |
124 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) | |
125 { | |
126 printf("vosub_vidix: vidix driver can't downscale image\n"); | |
127 return -1; | |
128 } | |
129 image_width = src_width; | |
130 image_height = src_height; | |
4014 | 131 src_format = format; |
4010 | 132 memset(&vidix_play,0,sizeof(vidix_playback_t)); |
133 vidix_play.fourcc = format; | |
134 vidix_play.capability = vidix_cap.flags; /* every ;) */ | |
135 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
|
136 /* 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
|
137 Nick: we could implement here zooming to a specified area -- alex */ |
4010 | 138 vidix_play.src.x = vidix_play.src.y = 0; |
139 vidix_play.src.w = src_width; | |
140 vidix_play.src.h = src_height; | |
141 vidix_play.dest.x = x_org; | |
142 vidix_play.dest.y = y_org; | |
143 vidix_play.dest.w = dst_width; | |
144 vidix_play.dest.h = dst_height; | |
145 vidix_play.num_frames=NUM_FRAMES; | |
146 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0) | |
147 { | |
148 printf("vosub_vidix: Can't configure playback: %s\n",strerror(err)); | |
149 return -1; | |
150 } | |
151 | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
152 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
|
153 |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
154 /* select first frame */ |
4010 | 155 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
|
156 // vdlPlaybackFrameSelect(vidix_handler,next_frame); |
4010 | 157 |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
158 /* 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
|
159 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
|
160 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
|
161 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
|
162 return 0; |
4010 | 163 } |
164 | |
4229 | 165 extern int vo_gamma_brightness; |
166 extern int vo_gamma_saturation; | |
167 extern int vo_gamma_contrast; | |
168 extern int vo_gamma_hue; | |
169 extern int vo_gamma_red_intense; | |
170 extern int vo_gamma_green_intense; | |
171 extern int vo_gamma_blue_intense; | |
172 | |
4240 | 173 static vidix_video_eq_t vid_eq; |
4229 | 174 |
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
|
175 int vidix_start(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
176 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
177 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
|
178 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
|
179 { |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
180 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
|
181 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
|
182 } |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
183 |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
184 if (vidix_cap.flags & FLAG_EQUALIZER) |
4229 | 185 { |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
186 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
|
187 { |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
188 printf("vosub_vidix: vo_gamma_brightness=%i\n" |
4229 | 189 "vosub_vidix: vo_gamma_saturation=%i\n" |
190 "vosub_vidix: vo_gamma_contrast=%i\n" | |
191 "vosub_vidix: vo_gamma_hue=%i\n" | |
192 "vosub_vidix: vo_gamma_red_intense=%i\n" | |
193 "vosub_vidix: vo_gamma_green_intense=%i\n" | |
194 "vosub_vidix: vo_gamma_blue_intense=%i\n" | |
195 ,vo_gamma_brightness | |
196 ,vo_gamma_saturation | |
197 ,vo_gamma_contrast | |
198 ,vo_gamma_hue | |
199 ,vo_gamma_red_intense | |
200 ,vo_gamma_green_intense | |
201 ,vo_gamma_blue_intense); | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
202 } |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
203 vid_eq.brightness = vo_gamma_brightness; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
204 vid_eq.saturation = vo_gamma_saturation; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
205 vid_eq.contrast = vo_gamma_contrast; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
206 vid_eq.hue = vo_gamma_hue; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
207 vid_eq.red_intense = vo_gamma_red_intense; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
208 vid_eq.green_intense = vo_gamma_green_intense; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
209 vid_eq.blue_intense = vo_gamma_blue_intense; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
210 vid_eq.flags = VEQ_FLG_ITU_R_BT_601; |
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
211 vdlPlaybackSetEq(vidix_handler,&vid_eq); |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
212 } |
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
|
213 return 0; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
214 } |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
215 |
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
|
216 int vidix_stop(void) |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
217 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
218 int err; |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
219 if((err=vdlPlaybackOff(vidix_handler))!=0) |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
220 { |
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
221 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
|
222 return -1; |
4198
7e2bf04c9a7c
added vidix_start() and vidix_stop() for better runtime-resize support ;)
alex
parents:
4138
diff
changeset
|
223 } |
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
|
224 return 0; |
4198
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 |
4010 | 227 void vidix_term( void ) |
228 { | |
229 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
|
230 vidix_stop(); |
4010 | 231 vdlClose(vidix_handler); |
232 } | |
233 | |
234 uint32_t vidix_draw_slice_420(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
235 { | |
236 uint8_t *src; | |
237 uint8_t *dest; | |
4014 | 238 unsigned bespitch,apitch; |
4010 | 239 int i; |
4014 | 240 apitch = vidix_play.dest.pitch.y-1; |
241 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
|
242 |
4032 | 243 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4010 | 244 dest += bespitch*y + x; |
245 src = image[0]; | |
246 for(i=0;i<h;i++){ | |
247 memcpy(dest,src,w); | |
248 src+=stride[0]; | |
249 dest += bespitch; | |
250 } | |
251 | |
4014 | 252 apitch = vidix_play.dest.pitch.v-1; |
253 bespitch = (w + apitch) & ~apitch; | |
4032 | 254 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.v; |
4031 | 255 dest += bespitch*y/4 + x; |
4014 | 256 src = image[1]; |
257 for(i=0;i<h/2;i++){ | |
258 memcpy(dest,src,w/2); | |
259 src+=stride[1]; | |
260 dest+=bespitch/2; | |
261 } | |
262 apitch = vidix_play.dest.pitch.u-1; | |
263 bespitch = (w + apitch) & ~apitch; | |
4010 | 264 |
4032 | 265 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.u; |
4031 | 266 dest += bespitch*y/4 + x; |
4010 | 267 src = image[2]; |
4014 | 268 for(i=0;i<h/2;i++){ |
269 memcpy(dest,src,w/2); | |
4010 | 270 src+=stride[2]; |
4014 | 271 dest += bespitch/2; |
4010 | 272 } |
273 return 0; | |
274 } | |
275 | |
276 uint32_t vidix_draw_slice_422(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
277 { | |
278 uint8_t *src; | |
279 uint8_t *dest; | |
4014 | 280 unsigned bespitch,apitch; |
4010 | 281 int i; |
4014 | 282 apitch = vidix_play.dest.pitch.y-1; |
283 bespitch = (w*2 + apitch) & ~apitch; | |
4032 | 284 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
4010 | 285 dest += bespitch*y + x; |
286 src = image[0]; | |
287 for(i=0;i<h;i++){ | |
288 memcpy(dest,src,w*2); | |
289 src+=stride[0]; | |
290 dest += bespitch; | |
291 } | |
4240 | 292 |
293 return 0; | |
4010 | 294 } |
295 | |
296 | |
297 uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
298 { | |
299 if(verbose > 1) printf("vosub_vidix: vidix_draw_slice() was called\n"); | |
300 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) | |
301 vidix_draw_slice_420(image,stride,w,h,x,y); | |
302 else | |
303 vidix_draw_slice_422(image,stride,w,h,x,y); | |
304 return 0; | |
305 } | |
306 | |
307 uint32_t vidix_draw_frame(uint8_t *image[]) | |
308 { | |
309 if(verbose > 1) printf("vosub_vidix: vidix_draw_frame() was called\n"); | |
310 /* Note it's very strange but sometime for YUY2 draw_frame is called */ | |
311 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) | |
312 { | |
4240 | 313 printf("vosub_vidix: draw_frame for YUV420 called\nExiting...\n"); |
4010 | 314 vidix_term(); |
315 exit( EXIT_FAILURE ); | |
316 } | |
317 else | |
318 { | |
319 int stride[1]; | |
320 stride[0] = vidix_play.src.w*2; | |
321 vidix_draw_slice_422(image,stride,vidix_play.src.w,vidix_play.src.h, | |
322 vidix_play.src.x,vidix_play.src.y); | |
323 } | |
324 return 0; | |
325 } | |
326 | |
327 void vidix_flip_page(void) | |
328 { | |
329 if(verbose > 1) printf("vosub_vidix: vidix_flip_page() was called\n"); | |
330 if(vo_doublebuffering) | |
331 { | |
4032 | 332 vdlPlaybackFrameSelect(vidix_handler,next_frame); |
4010 | 333 next_frame=(next_frame+1)%vidix_play.num_frames; |
334 } | |
335 } | |
336 | |
337 static void draw_alpha_null(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) | |
338 { | |
339 UNUSED(x0); | |
340 UNUSED(y0); | |
341 UNUSED(w); | |
342 UNUSED(h); | |
343 UNUSED(src); | |
344 UNUSED(srca); | |
345 UNUSED(stride); | |
346 } | |
347 | |
348 static void draw_alpha(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) | |
349 { | |
4032 | 350 uint32_t apitch,bespitch; |
4010 | 351 void *lvo_mem; |
4032 | 352 lvo_mem = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; |
353 apitch = vidix_play.dest.pitch.y-1; | |
354 bespitch = (vidix_play.src.w + apitch) & (~apitch); | |
4010 | 355 switch(vidix_play.fourcc){ |
356 case IMGFMT_YV12: | |
357 case IMGFMT_IYUV: | |
358 case IMGFMT_I420: | |
359 vo_draw_alpha_yv12(w,h,src,srca,stride,lvo_mem+bespitch*y0+x0,bespitch); | |
360 break; | |
361 case IMGFMT_YUY2: | |
4032 | 362 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0),2*bespitch); |
4010 | 363 break; |
364 case IMGFMT_UYVY: | |
4032 | 365 vo_draw_alpha_yuy2(w,h,src,srca,stride,lvo_mem+2*(bespitch*y0+x0)+1,2*bespitch); |
4010 | 366 break; |
367 default: | |
368 draw_alpha_null(x0,y0,w,h,src,srca,stride); | |
369 } | |
370 } | |
371 | |
372 void vidix_draw_osd(void) | |
373 { | |
374 if(verbose > 1) printf("vosub_vidix: vidix_draw_osd() was called\n"); | |
375 /* TODO: hw support */ | |
376 vo_draw_text(vidix_play.src.w,vidix_play.src.h,draw_alpha); | |
377 } | |
378 | |
379 uint32_t vidix_query_fourcc(uint32_t format) | |
380 { | |
381 if(verbose > 1) printf("vosub_vidix: query_format was called: %x (%s)\n",format,vo_format_name(format)); | |
382 vidix_fourcc.fourcc = format; | |
383 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
|
384 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
|
385 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
|
386 return(0x2); /* hw support without conversion */ |
4010 | 387 } |
4240 | 388 |
4255 | 389 int vidix_grkey_support(void) |
390 { | |
4270
178c84b1090e
clearing safely the buffer, queryfourcc returns 0x2 (hw accel, noconv.), setting eq only if drivers i able
alex
parents:
4255
diff
changeset
|
391 return(vidix_fourcc.flags & VID_CAP_COLORKEY); |
4255 | 392 } |
393 | |
4240 | 394 int vidix_grkey_get(vidix_grkey_t *gr_key) |
395 { | |
396 return(vdlGetGrKeys(vidix_handler, gr_key)); | |
397 } | |
398 | |
399 int vidix_grkey_set(const vidix_grkey_t *gr_key) | |
400 { | |
401 return(vdlSetGrKeys(vidix_handler, gr_key)); | |
402 } |