Mercurial > mplayer.hg
comparison libvo/vosub_vidix.c @ 4454:c58106c9e2af
Optimizing with use new tune info
author | nick |
---|---|
date | Fri, 01 Feb 2002 08:51:52 +0000 |
parents | 49c410f359e0 |
children | cb255a42aa5e |
comparison
equal
deleted
inserted
replaced
4453:71d05615a378 | 4454:c58106c9e2af |
---|---|
40 static int video_on=0; | 40 static int video_on=0; |
41 | 41 |
42 static vidix_capability_t vidix_cap; | 42 static vidix_capability_t vidix_cap; |
43 static vidix_playback_t vidix_play; | 43 static vidix_playback_t vidix_play; |
44 static vidix_fourcc_t vidix_fourcc; | 44 static vidix_fourcc_t vidix_fourcc; |
45 static vo_functions_t * vo_server; | |
45 | 46 |
46 static int vidix_get_bes_da(bes_da_t *); | 47 static int vidix_get_bes_da(bes_da_t *); |
47 static int vidix_get_video_eq(vidix_video_eq_t *info); | 48 static int vidix_get_video_eq(vidix_video_eq_t *info); |
48 static int vidix_set_video_eq(const vidix_video_eq_t *info); | 49 static int vidix_set_video_eq(const vidix_video_eq_t *info); |
49 static int vidix_get_num_fx(unsigned *info); | 50 static int vidix_get_num_fx(unsigned *info); |
59 vaa->set_video_eq=vidix_set_video_eq; | 60 vaa->set_video_eq=vidix_set_video_eq; |
60 vaa->get_num_fx=vidix_get_num_fx; | 61 vaa->get_num_fx=vidix_get_num_fx; |
61 vaa->get_oem_fx=vidix_get_oem_fx; | 62 vaa->get_oem_fx=vidix_get_oem_fx; |
62 vaa->set_oem_fx=vidix_set_oem_fx; | 63 vaa->set_oem_fx=vidix_set_oem_fx; |
63 vaa->set_deint=vidix_set_deint; | 64 vaa->set_deint=vidix_set_deint; |
64 } | |
65 | |
66 int vidix_preinit(const char *drvname,void *server) | |
67 { | |
68 int err; | |
69 if(verbose > 1) printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname); | |
70 if(vdlGetVersion() != VIDIX_VERSION) | |
71 { | |
72 printf("vosub_vidix: You have wrong version of VIDIX library\n"); | |
73 return -1; | |
74 } | |
75 vidix_handler = vdlOpen(LIBDIR"/vidix/", | |
76 drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, | |
77 TYPE_OUTPUT, | |
78 verbose); | |
79 if(vidix_handler == NULL) | |
80 { | |
81 printf("vosub_vidix: Couldn't find working VIDIX driver\n"); | |
82 return -1; | |
83 } | |
84 if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0) | |
85 { | |
86 printf("vosub_vidix: Couldn't get capability: %s\n",strerror(err)); | |
87 return -1; | |
88 } | |
89 printf("vosub_vidix: Using: %s by %s\n",vidix_cap.name,vidix_cap.author); | |
90 /* we are able to tune up this stuff depend on fourcc format */ | |
91 ((vo_functions_t *)server)->draw_slice=vidix_draw_slice; | |
92 ((vo_functions_t *)server)->draw_frame=vidix_draw_frame; | |
93 ((vo_functions_t *)server)->flip_page=vidix_flip_page; | |
94 ((vo_functions_t *)server)->draw_osd=vidix_draw_osd; | |
95 ((vo_functions_t *)server)->query_format=vidix_query_fourcc; | |
96 ((vo_functions_t *)server)->query_vaa=vidix_query_vaa; | |
97 return 0; | |
98 } | |
99 | |
100 int vidix_init(unsigned src_width,unsigned src_height, | |
101 unsigned x_org,unsigned y_org,unsigned dst_width, | |
102 unsigned dst_height,unsigned format,unsigned dest_bpp, | |
103 unsigned vid_w,unsigned vid_h,const void *info) | |
104 { | |
105 size_t i,awidth; | |
106 int err; | |
107 if(verbose > 1) | |
108 printf("vosub_vidix: vidix_init() was called\n" | |
109 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" | |
110 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" | |
111 ,src_width,src_height,x_org,y_org,dst_width,dst_height | |
112 ,vo_format_name(format),dest_bpp,vid_w,vid_h); | |
113 | |
114 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) || | |
115 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) || | |
116 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) || | |
117 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight))) | |
118 { | |
119 printf("vosub_vidix: video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", | |
120 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight, | |
121 vidix_cap.maxwidth, vidix_cap.maxheight); | |
122 return -1; | |
123 } | |
124 | |
125 err = 0; | |
126 switch(dest_bpp) | |
127 { | |
128 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; | |
129 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; | |
130 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; | |
131 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; | |
132 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; | |
133 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; | |
134 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; | |
135 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; | |
136 default: err = 1; break; | |
137 } | |
138 if(err) | |
139 { | |
140 printf("vosub_vidix: video server has unsupported color depth by vidix (%d)\n", | |
141 vidix_fourcc.depth); | |
142 return -1; | |
143 } | |
144 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) | |
145 { | |
146 printf("vosub_vidix: vidix driver can't upscale image (%dx%d -> %dx%d)\n", | |
147 src_width, src_height, dst_width, dst_height); | |
148 return -1; | |
149 } | |
150 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) | |
151 { | |
152 printf("vosub_vidix: vidix driver can't downscale image (%dx%d -> %dx%d)\n", | |
153 src_width, src_height, dst_width, dst_height); | |
154 return -1; | |
155 } | |
156 image_width = src_width; | |
157 image_height = src_height; | |
158 src_format = format; | |
159 memset(&vidix_play,0,sizeof(vidix_playback_t)); | |
160 vidix_play.fourcc = format; | |
161 vidix_play.capability = vidix_cap.flags; /* every ;) */ | |
162 vidix_play.blend_factor = 0; /* for now */ | |
163 /* display the full picture. | |
164 Nick: we could implement here zooming to a specified area -- alex */ | |
165 vidix_play.src.x = vidix_play.src.y = 0; | |
166 vidix_play.src.w = src_width; | |
167 vidix_play.src.h = src_height; | |
168 vidix_play.dest.x = x_org; | |
169 vidix_play.dest.y = y_org; | |
170 vidix_play.dest.w = dst_width; | |
171 vidix_play.dest.h = dst_height; | |
172 vidix_play.num_frames=NUM_FRAMES; | |
173 vidix_play.src.pitch.y = vidix_play.src.pitch.u = vidix_play.src.pitch.v = 0; | |
174 if(info) | |
175 { | |
176 switch(((const vo_tune_info_t *)info)->pitch[0]) | |
177 { | |
178 case 2: | |
179 case 4: | |
180 case 8: | |
181 case 16: | |
182 case 32: | |
183 case 64: | |
184 case 128: | |
185 case 256: vidix_play.src.pitch.y = ((const vo_tune_info_t *)info)->pitch[0]; | |
186 break; | |
187 default: break; | |
188 } | |
189 switch(((const vo_tune_info_t *)info)->pitch[1]) | |
190 { | |
191 case 2: | |
192 case 4: | |
193 case 8: | |
194 case 16: | |
195 case 32: | |
196 case 64: | |
197 case 128: | |
198 case 256: vidix_play.src.pitch.u = ((const vo_tune_info_t *)info)->pitch[1]; | |
199 break; | |
200 default: break; | |
201 } | |
202 switch(((const vo_tune_info_t *)info)->pitch[2]) | |
203 { | |
204 case 2: | |
205 case 4: | |
206 case 8: | |
207 case 16: | |
208 case 32: | |
209 case 64: | |
210 case 128: | |
211 case 256: vidix_play.src.pitch.v = ((const vo_tune_info_t *)info)->pitch[2]; | |
212 break; | |
213 default: break; | |
214 } | |
215 } | |
216 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0) | |
217 { | |
218 printf("vosub_vidix: Can't configure playback: %s\n",strerror(err)); | |
219 return -1; | |
220 } | |
221 | |
222 vidix_mem = vidix_play.dga_addr; | |
223 | |
224 /* select first frame */ | |
225 next_frame = 0; | |
226 // vdlPlaybackFrameSelect(vidix_handler,next_frame); | |
227 | |
228 /* clear every frame with correct address and frame_size */ | |
229 for (i = 0; i < vidix_play.num_frames; i++) | |
230 memset(vidix_mem + vidix_play.offsets[i], 0x80, | |
231 vidix_play.frame_size); | |
232 return 0; | |
233 } | 65 } |
234 | 66 |
235 extern int vo_gamma_brightness; | 67 extern int vo_gamma_brightness; |
236 extern int vo_gamma_saturation; | 68 extern int vo_gamma_saturation; |
237 extern int vo_gamma_contrast; | 69 extern int vo_gamma_contrast; |
378 } | 210 } |
379 | 211 |
380 return 0; | 212 return 0; |
381 } | 213 } |
382 | 214 |
215 static uint32_t vidix_draw_slice_422_fast(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
216 { | |
217 uint8_t *src; | |
218 uint8_t *dest; | |
219 unsigned bespitch,apitch; | |
220 int i; | |
221 apitch = vidix_play.dest.pitch.y-1; | |
222 bespitch = (w*2 + apitch) & ~apitch; | |
223 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; | |
224 dest += bespitch*y + x; | |
225 src = image[0]; | |
226 memcpy(dest,src,h*bespitch); | |
227 return 0; | |
228 } | |
229 | |
383 static uint32_t vidix_draw_slice_32(uint8_t *image[], int stride[], int w,int h,int x,int y) | 230 static uint32_t vidix_draw_slice_32(uint8_t *image[], int stride[], int w,int h,int x,int y) |
384 { | 231 { |
385 uint8_t *src; | 232 uint8_t *src; |
386 uint8_t *dest; | 233 uint8_t *dest; |
387 unsigned bespitch,apitch; | 234 unsigned bespitch,apitch; |
398 } | 245 } |
399 | 246 |
400 return 0; | 247 return 0; |
401 } | 248 } |
402 | 249 |
250 static uint32_t vidix_draw_slice_32_fast(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
251 { | |
252 uint8_t *src; | |
253 uint8_t *dest; | |
254 unsigned bespitch,apitch; | |
255 int i; | |
256 apitch = vidix_play.dest.pitch.y-1; | |
257 bespitch = (w*4 + apitch) & ~apitch; | |
258 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; | |
259 dest += bespitch*y + x; | |
260 src = image[0]; | |
261 memcpy(dest,src,h*bespitch); | |
262 return 0; | |
263 } | |
264 | |
403 static uint32_t vidix_draw_slice_24(uint8_t *image[], int stride[], int w,int h,int x,int y) | 265 static uint32_t vidix_draw_slice_24(uint8_t *image[], int stride[], int w,int h,int x,int y) |
404 { | 266 { |
405 uint8_t *src; | 267 uint8_t *src; |
406 uint8_t *dest; | 268 uint8_t *dest; |
407 unsigned bespitch,apitch; | 269 unsigned bespitch,apitch; |
418 } | 280 } |
419 | 281 |
420 return 0; | 282 return 0; |
421 } | 283 } |
422 | 284 |
285 static uint32_t vidix_draw_slice_24_fast(uint8_t *image[], int stride[], int w,int h,int x,int y) | |
286 { | |
287 uint8_t *src; | |
288 uint8_t *dest; | |
289 unsigned bespitch,apitch; | |
290 int i; | |
291 apitch = vidix_play.dest.pitch.y-1; | |
292 bespitch = (w*3 + apitch) & ~apitch; | |
293 dest = vidix_mem + vidix_play.offsets[next_frame] + vidix_play.offset.y; | |
294 dest += bespitch*y + x; | |
295 src = image[0]; | |
296 memcpy(dest,src,h*bespitch); | |
297 return 0; | |
298 } | |
299 | |
423 uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) | 300 uint32_t vidix_draw_slice(uint8_t *image[], int stride[], int w,int h,int x,int y) |
424 { | 301 { |
425 if(verbose > 1) printf("vosub_vidix: vidix_draw_slice() was called\n"); | 302 printf("vosub_vidix: Error unoptimized draw_slice was called\nExiting..."); |
426 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) | 303 vidix_term(); |
427 vidix_draw_slice_420(image,stride,w,h,x,y); | 304 exit( EXIT_FAILURE ); |
428 else | 305 return 0; |
429 if(src_format == IMGFMT_RGB32 || src_format == IMGFMT_BGR32) | |
430 vidix_draw_slice_32(image,stride,w,h,x,y); | |
431 else | |
432 if(src_format == IMGFMT_RGB24 || src_format == IMGFMT_BGR24) | |
433 vidix_draw_slice_24(image,stride,w,h,x,y); | |
434 else | |
435 vidix_draw_slice_422(image,stride,w,h,x,y); | |
436 return 0; | |
437 } | 306 } |
438 | 307 |
439 uint32_t vidix_draw_frame(uint8_t *image[]) | 308 uint32_t vidix_draw_frame(uint8_t *image[]) |
440 { | 309 { |
310 int stride[1]; | |
441 if(verbose > 1) printf("vosub_vidix: vidix_draw_frame() was called\n"); | 311 if(verbose > 1) printf("vosub_vidix: vidix_draw_frame() was called\n"); |
442 /* Note it's very strange but sometime for YUY2 draw_frame is called */ | 312 /* Note it's very strange but sometime for YUY2 draw_frame is called */ |
443 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) | 313 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) |
444 { | |
445 printf("vosub_vidix: draw_frame for YUV420 called, frame cannot be written\n"); | 314 printf("vosub_vidix: draw_frame for YUV420 called, frame cannot be written\n"); |
446 } | |
447 else | 315 else |
448 if(src_format == IMGFMT_RGB32 || src_format == IMGFMT_BGR32) | 316 if(src_format == IMGFMT_RGB32 || src_format == IMGFMT_BGR32) |
449 { | |
450 int stride[1]; | |
451 stride[0] = vidix_play.src.w*4; | 317 stride[0] = vidix_play.src.w*4; |
452 vidix_draw_slice_32(image,stride,vidix_play.src.w,vidix_play.src.h, | |
453 vidix_play.src.x,vidix_play.src.y); | |
454 } | |
455 else | 318 else |
456 if(src_format == IMGFMT_RGB24 || src_format == IMGFMT_BGR24) | 319 if(src_format == IMGFMT_RGB24 || src_format == IMGFMT_BGR24) |
457 { | |
458 int stride[1]; | |
459 stride[0] = vidix_play.src.w*3; | 320 stride[0] = vidix_play.src.w*3; |
460 vidix_draw_slice_24(image,stride,vidix_play.src.w,vidix_play.src.h, | |
461 vidix_play.src.x,vidix_play.src.y); | |
462 } | |
463 else | 321 else |
464 { | |
465 int stride[1]; | |
466 stride[0] = vidix_play.src.w*2; | 322 stride[0] = vidix_play.src.w*2; |
467 vidix_draw_slice_422(image,stride,vidix_play.src.w,vidix_play.src.h, | 323 return vo_server->draw_slice(image,stride,vidix_play.src.w,vidix_play.src.h, |
468 vidix_play.src.x,vidix_play.src.y); | 324 vidix_play.src.x,vidix_play.src.y); |
469 } | |
470 return 0; | |
471 } | 325 } |
472 | 326 |
473 void vidix_flip_page(void) | 327 void vidix_flip_page(void) |
474 { | 328 { |
475 if(verbose > 1) printf("vosub_vidix: vidix_flip_page() was called\n"); | 329 if(verbose > 1) printf("vosub_vidix: vidix_flip_page() was called\n"); |
614 static int vidix_set_deint(const vidix_deinterlace_t *info) | 468 static int vidix_set_deint(const vidix_deinterlace_t *info) |
615 { | 469 { |
616 if(!video_on) return EPERM; | 470 if(!video_on) return EPERM; |
617 return vdlPlaybackSetDeint(vidix_handler, info); | 471 return vdlPlaybackSetDeint(vidix_handler, info); |
618 } | 472 } |
473 | |
474 int vidix_init(unsigned src_width,unsigned src_height, | |
475 unsigned x_org,unsigned y_org,unsigned dst_width, | |
476 unsigned dst_height,unsigned format,unsigned dest_bpp, | |
477 unsigned vid_w,unsigned vid_h,const void *info) | |
478 { | |
479 size_t i,awidth; | |
480 int err; | |
481 if(verbose > 1) | |
482 printf("vosub_vidix: vidix_init() was called\n" | |
483 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n" | |
484 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n" | |
485 ,src_width,src_height,x_org,y_org,dst_width,dst_height | |
486 ,vo_format_name(format),dest_bpp,vid_w,vid_h); | |
487 | |
488 if(((vidix_cap.maxwidth != -1) && (vid_w > vidix_cap.maxwidth)) || | |
489 ((vidix_cap.minwidth != -1) && (vid_w < vidix_cap.minwidth)) || | |
490 ((vidix_cap.maxheight != -1) && (vid_h > vidix_cap.maxheight)) || | |
491 ((vidix_cap.minwidth != -1 ) && (vid_h < vidix_cap.minheight))) | |
492 { | |
493 printf("vosub_vidix: video server has unsupported resolution (%dx%d), supported: %dx%d-%dx%d\n", | |
494 vid_w, vid_h, vidix_cap.minwidth, vidix_cap.minheight, | |
495 vidix_cap.maxwidth, vidix_cap.maxheight); | |
496 return -1; | |
497 } | |
498 | |
499 err = 0; | |
500 switch(dest_bpp) | |
501 { | |
502 case 1: err = ((vidix_fourcc.depth & VID_DEPTH_1BPP) != VID_DEPTH_1BPP); break; | |
503 case 2: err = ((vidix_fourcc.depth & VID_DEPTH_2BPP) != VID_DEPTH_2BPP); break; | |
504 case 4: err = ((vidix_fourcc.depth & VID_DEPTH_4BPP) != VID_DEPTH_4BPP); break; | |
505 case 8: err = ((vidix_fourcc.depth & VID_DEPTH_8BPP) != VID_DEPTH_8BPP); break; | |
506 case 12:err = ((vidix_fourcc.depth & VID_DEPTH_12BPP) != VID_DEPTH_12BPP); break; | |
507 case 16:err = ((vidix_fourcc.depth & VID_DEPTH_16BPP) != VID_DEPTH_16BPP); break; | |
508 case 24:err = ((vidix_fourcc.depth & VID_DEPTH_24BPP) != VID_DEPTH_24BPP); break; | |
509 case 32:err = ((vidix_fourcc.depth & VID_DEPTH_32BPP) != VID_DEPTH_32BPP); break; | |
510 default: err=1; break; | |
511 } | |
512 if(err) | |
513 { | |
514 printf("vosub_vidix: video server has unsupported color depth by vidix (%d)\n" | |
515 ,vidix_fourcc.depth); | |
516 return -1; | |
517 } | |
518 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_UPSCALER) != FLAG_UPSCALER) | |
519 { | |
520 printf("vosub_vidix: vidix driver can't upscale image (%d%d -> %d%d)\n", | |
521 src_width, src_height, dst_width, dst_height); | |
522 return -1; | |
523 } | |
524 if((dst_width > src_width || dst_height > src_height) && (vidix_cap.flags & FLAG_DOWNSCALER) != FLAG_DOWNSCALER) | |
525 { | |
526 printf("vosub_vidix: vidix driver can't downscale image (%d%d -> %d%d)\n", | |
527 src_width, src_height, dst_width, dst_height); | |
528 return -1; | |
529 } | |
530 image_width = src_width; | |
531 image_height = src_height; | |
532 src_format = format; | |
533 memset(&vidix_play,0,sizeof(vidix_playback_t)); | |
534 vidix_play.fourcc = format; | |
535 vidix_play.capability = vidix_cap.flags; /* every ;) */ | |
536 vidix_play.blend_factor = 0; /* for now */ | |
537 /* display the full picture. | |
538 Nick: we could implement here zooming to a specified area -- alex */ | |
539 vidix_play.src.x = vidix_play.src.y = 0; | |
540 vidix_play.src.w = src_width; | |
541 vidix_play.src.h = src_height; | |
542 vidix_play.dest.x = x_org; | |
543 vidix_play.dest.y = y_org; | |
544 vidix_play.dest.w = dst_width; | |
545 vidix_play.dest.h = dst_height; | |
546 vidix_play.num_frames=NUM_FRAMES; | |
547 vidix_play.src.pitch.y = vidix_play.src.pitch.u = vidix_play.src.pitch.v = 0; | |
548 if(info) | |
549 { | |
550 switch(((const vo_tune_info_t *)info)->pitch[0]) | |
551 { | |
552 case 2: | |
553 case 4: | |
554 case 8: | |
555 case 16: | |
556 case 32: | |
557 case 64: | |
558 case 128: | |
559 case 256: vidix_play.src.pitch.y = ((const vo_tune_info_t *)info)->pitch[0]; | |
560 break; | |
561 default: break; | |
562 } | |
563 switch(((const vo_tune_info_t *)info)->pitch[1]) | |
564 { | |
565 case 2: | |
566 case 4: | |
567 case 8: | |
568 case 16: | |
569 case 32: | |
570 case 64: | |
571 case 128: | |
572 case 256: vidix_play.src.pitch.u = ((const vo_tune_info_t *)info)->pitch[1]; | |
573 break; | |
574 default: break; | |
575 } | |
576 switch(((const vo_tune_info_t *)info)->pitch[2]) | |
577 { | |
578 case 2: | |
579 case 4: | |
580 case 8: | |
581 case 16: | |
582 case 32: | |
583 case 64: | |
584 case 128: | |
585 case 256: vidix_play.src.pitch.v = ((const vo_tune_info_t *)info)->pitch[2]; | |
586 break; | |
587 default: break; | |
588 } | |
589 } | |
590 if((err=vdlConfigPlayback(vidix_handler,&vidix_play))!=0) | |
591 { | |
592 printf("vosub_vidix: Can't configure playback: %s\n",strerror(err)); | |
593 return -1; | |
594 } | |
595 | |
596 vidix_mem = vidix_play.dga_addr; | |
597 | |
598 /* select first frame */ | |
599 next_frame = 0; | |
600 // vdlPlaybackFrameSelect(vidix_handler,next_frame); | |
601 | |
602 /* clear every frame with correct address and frame_size */ | |
603 for (i = 0; i < vidix_play.num_frames; i++) | |
604 memset(vidix_mem + vidix_play.offsets[i], 0x80, | |
605 vidix_play.frame_size); | |
606 /* tune some info here */ | |
607 if(src_format == IMGFMT_YV12 || src_format == IMGFMT_I420 || src_format == IMGFMT_IYUV) | |
608 vo_server->draw_slice = vidix_draw_slice_420; | |
609 else | |
610 if(src_format == IMGFMT_RGB32 || src_format == IMGFMT_BGR32) | |
611 vo_server->draw_slice = | |
612 vidix_play.src.pitch.y == vidix_play.dest.pitch.y ? | |
613 vidix_draw_slice_32_fast: | |
614 vidix_draw_slice_32; | |
615 else | |
616 if(src_format == IMGFMT_RGB24 || src_format == IMGFMT_BGR24) | |
617 vo_server->draw_slice = | |
618 vidix_play.src.pitch.y == vidix_play.dest.pitch.y ? | |
619 vidix_draw_slice_24_fast: | |
620 vidix_draw_slice_24; | |
621 else | |
622 vo_server->draw_slice = | |
623 vidix_play.src.pitch.y == vidix_play.dest.pitch.y ? | |
624 vidix_draw_slice_422_fast: | |
625 vidix_draw_slice_422; | |
626 return 0; | |
627 } | |
628 | |
629 int vidix_preinit(const char *drvname,void *server) | |
630 { | |
631 int err; | |
632 if(verbose > 1) printf("vosub_vidix: vidix_preinit(%s) was called\n",drvname); | |
633 if(vdlGetVersion() != VIDIX_VERSION) | |
634 { | |
635 printf("vosub_vidix: You have wrong version of VIDIX library\n"); | |
636 return -1; | |
637 } | |
638 vidix_handler = vdlOpen(LIBDIR"/vidix/", | |
639 drvname ? drvname[0] == ':' ? &drvname[1] : drvname[0] ? drvname : NULL : NULL, | |
640 TYPE_OUTPUT, | |
641 verbose); | |
642 if(vidix_handler == NULL) | |
643 { | |
644 printf("vosub_vidix: Couldn't find working VIDIX driver\n"); | |
645 return -1; | |
646 } | |
647 if((err=vdlGetCapability(vidix_handler,&vidix_cap)) != 0) | |
648 { | |
649 printf("vosub_vidix: Couldn't get capability: %s\n",strerror(err)); | |
650 return -1; | |
651 } | |
652 printf("vosub_vidix: Using: %s by %s\n",vidix_cap.name,vidix_cap.author); | |
653 /* we are able to tune up this stuff depend on fourcc format */ | |
654 ((vo_functions_t *)server)->draw_slice=vidix_draw_slice; | |
655 ((vo_functions_t *)server)->draw_frame=vidix_draw_frame; | |
656 ((vo_functions_t *)server)->flip_page=vidix_flip_page; | |
657 ((vo_functions_t *)server)->draw_osd=vidix_draw_osd; | |
658 ((vo_functions_t *)server)->query_format=vidix_query_fourcc; | |
659 ((vo_functions_t *)server)->query_vaa=vidix_query_vaa; | |
660 vo_server = server; | |
661 return 0; | |
662 } |