4 * Copyright (C) Nick Kurshev <nickols_k@mail.ru> - 2002
5 * Copyright (C) Alex Beregszaszi
7 * You can redistribute this file under terms and conditions
8 * of GNU General Public licence v2.
10 * This file contains vidix interface to any mplayer's VO plugin.
11 * (Partly based on vesa_lvo.c from mplayer's package)
18 #include <sys/ioctl.h>
30 #include "vosub_vidix.h"
31 #include "vidix/vidixlib.h"
32 #include "fastmemcpy.h"
34 #include "video_out.h"
37 #include "libmpcodecs/vfcap.h"
38 #include "libmpcodecs/mp_image.h"
40 #define NUM_FRAMES VID_PLAY_MAXFRAMES /* Temporary: driver will overwrite it */
42 static VDL_HANDLE vidix_handler
= NULL
;
43 static uint8_t *vidix_mem
= NULL
;
44 static uint8_t next_frame
;
45 static unsigned image_Bpp
,image_height
,image_width
,src_format
,forced_fourcc
=0;
46 static int video_on
=0;
48 static vidix_capability_t vidix_cap
;
49 static vidix_playback_t vidix_play
;
50 static vidix_fourcc_t vidix_fourcc
;
51 static vo_functions_t
* vo_server
;
52 static vidix_yuv_t dstrides
;
53 /*static uint32_t (*server_control)(uint32_t request, void *data, ...);*/
55 static int vidix_get_video_eq(vidix_video_eq_t
*info
);
56 static int vidix_set_video_eq(const vidix_video_eq_t
*info
);
57 static int vidix_get_num_fx(unsigned *info
);
58 static int vidix_get_oem_fx(vidix_oem_fx_t
*info
);
59 static int vidix_set_oem_fx(const vidix_oem_fx_t
*info
);
60 static int vidix_set_deint(const vidix_deinterlace_t
*info
);
65 if((err
=vdlPlaybackOn(vidix_handler
))!=0)
67 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_CantStartPlayback
,strerror(err
));
77 if((err
=vdlPlaybackOff(vidix_handler
))!=0)
79 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_CantStopPlayback
,strerror(err
));
86 void vidix_term( void )
88 if( mp_msg_test(MSGT_VO
,MSGL_DBG2
) ) {
89 mp_msg(MSGT_VO
,MSGL_DBG2
, "vosub_vidix: vidix_term() was called\n"); }
91 vdlClose(vidix_handler
);
92 // ((vo_functions_t *)vo_server)->control=server_control;
95 static uint32_t vidix_draw_slice_420(uint8_t *image
[], int stride
[], int w
,int h
,int x
,int y
)
102 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.y
;
103 dest
+= dstrides
.y
*y
+ x
;
111 if (vidix_play
.flags
& VID_PLAY_INTERLEAVED_UV
)
115 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.v
;
116 dest
+= dstrides
.y
*y
/2 + x
; // <- is this correct ?
121 for(hi
= 0; hi
< h
; hi
++)
123 for(wi
= 0; wi
< w
; wi
++)
125 dest
[2*wi
+0] = src
[wi
];
126 dest
[2*wi
+1] = src2
[wi
];
136 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.v
;
137 dest
+= dstrides
.v
*y
/4 + x
;
140 memcpy(dest
,src
,w
/2);
146 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.u
;
147 dest
+= dstrides
.u
*y
/4 + x
;
150 memcpy(dest
,src
,w
/2);
152 dest
+= dstrides
.u
/2;
159 static uint32_t vidix_draw_slice_410(uint8_t *image
[], int stride
[], int w
,int h
,int x
,int y
)
166 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.y
;
167 dest
+= dstrides
.y
*y
+ x
;
175 if (vidix_play
.flags
& VID_PLAY_INTERLEAVED_UV
)
177 mp_msg(MSGT_VO
,MSGL_WARN
, MSGTR_LIBVO_SUB_VIDIX_InterleavedUvForYuv410pNotSupported
);
182 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.v
;
183 dest
+= dstrides
.v
*y
/8 + x
;
186 memcpy(dest
,src
,w
/4);
192 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.u
;
193 dest
+= dstrides
.u
*y
/8 + x
;
196 memcpy(dest
,src
,w
/4);
198 dest
+= dstrides
.u
/4;
205 static uint32_t vidix_draw_slice_410_fast(uint8_t *image
[], int stride
[], int w
, int h
, int x
, int y
)
210 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.y
;
211 dest
+= dstrides
.y
*y
+ x
;
213 memcpy(dest
, src
, dstrides
.y
*h
*9/8);
217 static uint32_t vidix_draw_slice_400(uint8_t *image
[], int stride
[], int w
,int h
,int x
,int y
)
223 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.y
;
224 dest
+= dstrides
.y
*y
+ x
;
234 static uint32_t vidix_draw_slice_packed(uint8_t *image
[], int stride
[], int w
,int h
,int x
,int y
)
240 dest
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.y
;
241 dest
+= dstrides
.y
*y
+ x
;
244 memcpy(dest
,src
,w
*image_Bpp
);
251 uint32_t vidix_draw_slice(uint8_t *image
[], int stride
[], int w
,int h
,int x
,int y
)
253 mp_msg(MSGT_VO
,MSGL_WARN
, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawsliceWasCalled
);
257 static uint32_t vidix_draw_image(mp_image_t
*mpi
){
258 if( mp_msg_test(MSGT_VO
,MSGL_DBG2
) ) {
259 mp_msg(MSGT_VO
,MSGL_DBG2
, "vosub_vidix: vidix_draw_image() was called\n"); }
261 // if -dr or -slices then do nothing:
262 if(mpi
->flags
&(MP_IMGFLAG_DIRECT
|MP_IMGFLAG_DRAW_CALLBACK
)) return VO_TRUE
;
264 vo_server
->draw_slice(mpi
->planes
,mpi
->stride
,
265 vidix_play
.src
.w
,vidix_play
.src
.h
,vidix_play
.src
.x
,vidix_play
.src
.y
);
269 uint32_t vidix_draw_frame(uint8_t *image
[])
271 mp_msg(MSGT_VO
,MSGL_WARN
, MSGTR_LIBVO_SUB_VIDIX_DummyVidixdrawframeWasCalled
);
275 void vidix_flip_page(void)
277 if( mp_msg_test(MSGT_VO
,MSGL_DBG2
) ) {
278 mp_msg(MSGT_VO
,MSGL_DBG2
, "vosub_vidix: vidix_flip_page() was called\n"); }
279 if(vo_doublebuffering
)
281 vdlPlaybackFrameSelect(vidix_handler
,next_frame
);
282 next_frame
=(next_frame
+1)%vidix_play
.num_frames
;
286 static void draw_alpha(int x0
,int y0
, int w
,int h
, unsigned char* src
, unsigned char *srca
, int stride
)
288 uint32_t apitch
,bespitch
;
290 lvo_mem
= vidix_mem
+ vidix_play
.offsets
[next_frame
] + vidix_play
.offset
.y
;
291 apitch
= vidix_play
.dest
.pitch
.y
-1;
292 switch(vidix_play
.fourcc
){
300 bespitch
= (vidix_play
.src
.w
+ apitch
) & (~apitch
);
301 vo_draw_alpha_yv12(w
,h
,src
,srca
,stride
,lvo_mem
+bespitch
*y0
+x0
,bespitch
);
304 bespitch
= (vidix_play
.src
.w
*2 + apitch
) & (~apitch
);
305 vo_draw_alpha_yuy2(w
,h
,src
,srca
,stride
,lvo_mem
+bespitch
*y0
+2*x0
,bespitch
);
308 bespitch
= (vidix_play
.src
.w
*2 + apitch
) & (~apitch
);
309 vo_draw_alpha_yuy2(w
,h
,src
,srca
,stride
,lvo_mem
+bespitch
*y0
+2*x0
+1,bespitch
);
313 bespitch
= (vidix_play
.src
.w
*4 + apitch
) & (~apitch
);
314 vo_draw_alpha_rgb32(w
,h
,src
,srca
,stride
,lvo_mem
+y0
*bespitch
+4*x0
,bespitch
);
318 bespitch
= (vidix_play
.src
.w
*3 + apitch
) & (~apitch
);
319 vo_draw_alpha_rgb24(w
,h
,src
,srca
,stride
,lvo_mem
+y0
*bespitch
+3*x0
,bespitch
);
323 bespitch
= (vidix_play
.src
.w
*2 + apitch
) & (~apitch
);
324 vo_draw_alpha_rgb16(w
,h
,src
,srca
,stride
,lvo_mem
+y0
*bespitch
+2*x0
,bespitch
);
328 bespitch
= (vidix_play
.src
.w
*2 + apitch
) & (~apitch
);
329 vo_draw_alpha_rgb15(w
,h
,src
,srca
,stride
,lvo_mem
+y0
*bespitch
+2*x0
,bespitch
);
336 void vidix_draw_osd(void)
338 if( mp_msg_test(MSGT_VO
,MSGL_DBG2
) ) {
339 mp_msg(MSGT_VO
,MSGL_DBG2
, "vosub_vidix: vidix_draw_osd() was called\n"); }
340 /* TODO: hw support */
341 vo_draw_text(vidix_play
.src
.w
,vidix_play
.src
.h
,draw_alpha
);
344 uint32_t vidix_query_fourcc(uint32_t format
)
346 if( mp_msg_test(MSGT_VO
,MSGL_DBG2
) ) {
347 mp_msg(MSGT_VO
,MSGL_DBG2
, "vosub_vidix: query_format was called: %x (%s)\n",format
,vo_format_name(format
)); }
348 vidix_fourcc
.fourcc
= format
;
349 vdlQueryFourcc(vidix_handler
,&vidix_fourcc
);
350 if (vidix_fourcc
.depth
== VID_DEPTH_NONE
)
352 return VFCAP_CSP_SUPPORTED
|VFCAP_CSP_SUPPORTED_BY_HW
|VFCAP_HWSCALE_UP
|VFCAP_HWSCALE_DOWN
|VFCAP_OSD
|VFCAP_ACCEPT_STRIDE
;
355 int vidix_grkey_support(void)
357 return(vidix_fourcc
.flags
& VID_CAP_COLORKEY
);
360 int vidix_grkey_get(vidix_grkey_t
*gr_key
)
362 return(vdlGetGrKeys(vidix_handler
, gr_key
));
365 int vidix_grkey_set(const vidix_grkey_t
*gr_key
)
367 return(vdlSetGrKeys(vidix_handler
, gr_key
));
371 static int vidix_get_video_eq(vidix_video_eq_t
*info
)
373 if(!video_on
) return EPERM
;
374 return vdlPlaybackGetEq(vidix_handler
, info
);
377 static int vidix_set_video_eq(const vidix_video_eq_t
*info
)
379 if(!video_on
) return EPERM
;
380 return vdlPlaybackSetEq(vidix_handler
, info
);
383 static int vidix_get_num_fx(unsigned *info
)
385 if(!video_on
) return EPERM
;
386 return vdlQueryNumOemEffects(vidix_handler
, info
);
389 static int vidix_get_oem_fx(vidix_oem_fx_t
*info
)
391 if(!video_on
) return EPERM
;
392 return vdlGetOemEffect(vidix_handler
, info
);
395 static int vidix_set_oem_fx(const vidix_oem_fx_t
*info
)
397 if(!video_on
) return EPERM
;
398 return vdlSetOemEffect(vidix_handler
, info
);
401 static int vidix_set_deint(const vidix_deinterlace_t
*info
)
403 if(!video_on
) return EPERM
;
404 return vdlPlaybackSetDeint(vidix_handler
, info
);
407 static int is_422_planes_eq
=0;
408 int vidix_init(unsigned src_width
,unsigned src_height
,
409 unsigned x_org
,unsigned y_org
,unsigned dst_width
,
410 unsigned dst_height
,unsigned format
,unsigned dest_bpp
,
411 unsigned vid_w
,unsigned vid_h
)
416 uint32_t sstride
,apitch
;
417 if( mp_msg_test(MSGT_VO
,MSGL_DBG2
) )
418 mp_msg(MSGT_VO
,MSGL_DBG2
, "vosub_vidix: vidix_init() was called\n"
419 "src_w=%u src_h=%u dest_x_y_w_h = %u %u %u %u\n"
420 "format=%s dest_bpp=%u vid_w=%u vid_h=%u\n"
421 ,src_width
,src_height
,x_org
,y_org
,dst_width
,dst_height
422 ,vo_format_name(format
),dest_bpp
,vid_w
,vid_h
);
424 if(vidix_query_fourcc(format
) == 0)
426 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_UnsupportedFourccForThisVidixDriver
,
427 format
,vo_format_name(format
));
431 if(((vidix_cap
.maxwidth
!= -1) && (vid_w
> vidix_cap
.maxwidth
)) ||
432 ((vidix_cap
.minwidth
!= -1) && (vid_w
< vidix_cap
.minwidth
)) ||
433 ((vidix_cap
.maxheight
!= -1) && (vid_h
> vidix_cap
.maxheight
)) ||
434 ((vidix_cap
.minwidth
!= -1 ) && (vid_h
< vidix_cap
.minheight
)))
436 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_VideoServerHasUnsupportedResolution
,
437 vid_w
, vid_h
, vidix_cap
.minwidth
, vidix_cap
.minheight
,
438 vidix_cap
.maxwidth
, vidix_cap
.maxheight
);
445 case 1: err
= ((vidix_fourcc
.depth
& VID_DEPTH_1BPP
) != VID_DEPTH_1BPP
); break;
446 case 2: err
= ((vidix_fourcc
.depth
& VID_DEPTH_2BPP
) != VID_DEPTH_2BPP
); break;
447 case 4: err
= ((vidix_fourcc
.depth
& VID_DEPTH_4BPP
) != VID_DEPTH_4BPP
); break;
448 case 8: err
= ((vidix_fourcc
.depth
& VID_DEPTH_8BPP
) != VID_DEPTH_8BPP
); break;
449 case 12:err
= ((vidix_fourcc
.depth
& VID_DEPTH_12BPP
) != VID_DEPTH_12BPP
); break;
450 case 15:err
= ((vidix_fourcc
.depth
& VID_DEPTH_15BPP
) != VID_DEPTH_15BPP
); break;
451 case 16:err
= ((vidix_fourcc
.depth
& VID_DEPTH_16BPP
) != VID_DEPTH_16BPP
); break;
452 case 24:err
= ((vidix_fourcc
.depth
& VID_DEPTH_24BPP
) != VID_DEPTH_24BPP
); break;
453 case 32:err
= ((vidix_fourcc
.depth
& VID_DEPTH_32BPP
) != VID_DEPTH_32BPP
); break;
454 default: err
=1; break;
458 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_VideoServerHasUnsupportedColorDepth
459 ,vidix_fourcc
.depth
);
462 if((dst_width
> src_width
|| dst_height
> src_height
) && (vidix_cap
.flags
& FLAG_UPSCALER
) != FLAG_UPSCALER
)
464 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_DriverCantUpscaleImage
,
465 src_width
, src_height
, dst_width
, dst_height
);
468 if((dst_width
> src_width
|| dst_height
> src_height
) && (vidix_cap
.flags
& FLAG_DOWNSCALER
) != FLAG_DOWNSCALER
)
470 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_DriverCantDownscaleImage
,
471 src_width
, src_height
, dst_width
, dst_height
);
474 image_width
= src_width
;
475 image_height
= src_height
;
477 if(forced_fourcc
) format
= forced_fourcc
;
478 memset(&vidix_play
,0,sizeof(vidix_playback_t
));
479 vidix_play
.fourcc
= format
;
480 vidix_play
.capability
= vidix_cap
.flags
; /* every ;) */
481 vidix_play
.blend_factor
= 0; /* for now */
482 /* display the full picture.
483 Nick: we could implement here zooming to a specified area -- alex */
484 vidix_play
.src
.x
= vidix_play
.src
.y
= 0;
485 vidix_play
.src
.w
= src_width
;
486 vidix_play
.src
.h
= src_height
;
487 vidix_play
.dest
.x
= x_org
;
488 vidix_play
.dest
.y
= y_org
;
489 vidix_play
.dest
.w
= dst_width
;
490 vidix_play
.dest
.h
= dst_height
;
491 // vidix_play.num_frames=vo_doublebuffering?NUM_FRAMES-1:1;
492 /* we aren't mad...3 buffers are more than enough */
493 vidix_play
.num_frames
=vo_doublebuffering
?3:1;
494 vidix_play
.src
.pitch
.y
= vidix_play
.src
.pitch
.u
= vidix_play
.src
.pitch
.v
= 0;
496 if((err
=vdlConfigPlayback(vidix_handler
,&vidix_play
))!=0)
498 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_CantConfigurePlayback
,strerror(err
));
501 if ( mp_msg_test(MSGT_VO
,MSGL_V
) ) {
502 mp_msg(MSGT_VO
,MSGL_V
, "vosub_vidix: using %d buffer(s)\n", vidix_play
.num_frames
); }
504 vidix_mem
= vidix_play
.dga_addr
;
506 tmp
= calloc(image_width
, image_height
);
507 tmpa
= malloc(image_width
* image_height
);
508 memset(tmpa
, 1, image_width
* image_height
);
509 /* clear every frame with correct address and frame_size */
510 /* HACK: use draw_alpha to clear Y component */
511 for (i
= 0; i
< vidix_play
.num_frames
; i
++) {
513 memset(vidix_mem
+ vidix_play
.offsets
[i
], 0x80,
514 vidix_play
.frame_size
);
515 draw_alpha(0, 0, image_width
, image_height
, tmp
, tmpa
, image_width
);
519 /* show one of the "clear" frames */
531 apitch
= vidix_play
.dest
.pitch
.y
-1;
532 dstrides
.y
= (image_width
+ apitch
) & ~apitch
;
533 apitch
= vidix_play
.dest
.pitch
.v
-1;
534 dstrides
.v
= (image_width
+ apitch
) & ~apitch
;
535 apitch
= vidix_play
.dest
.pitch
.u
-1;
536 dstrides
.u
= (image_width
+ apitch
) & ~apitch
;
541 apitch
= vidix_play
.dest
.pitch
.y
-1;
542 dstrides
.y
= (image_width
*4 + apitch
) & ~apitch
;
543 dstrides
.u
= dstrides
.v
= 0;
548 apitch
= vidix_play
.dest
.pitch
.y
-1;
549 dstrides
.y
= (image_width
*3 + apitch
) & ~apitch
;
550 dstrides
.u
= dstrides
.v
= 0;
554 apitch
= vidix_play
.dest
.pitch
.y
-1;
555 dstrides
.y
= (image_width
*2 + apitch
) & ~apitch
;
556 dstrides
.u
= dstrides
.v
= 0;
560 /* tune some info here */
561 sstride
= src_width
*image_Bpp
;
564 is_422_planes_eq
= sstride
== dstrides
.y
;
566 if(src_format
== IMGFMT_YV12
|| src_format
== IMGFMT_I420
|| src_format
== IMGFMT_IYUV
)
567 vo_server
->draw_slice
= vidix_draw_slice_420
;
568 else if (src_format
== IMGFMT_YVU9
|| src_format
== IMGFMT_IF09
)
569 vo_server
->draw_slice
= vidix_draw_slice_410
;
570 else vo_server
->draw_slice
= vidix_draw_slice_packed
;
575 static uint32_t vidix_get_image(mp_image_t
*mpi
)
577 if(mpi
->type
==MP_IMGTYPE_STATIC
&& vidix_play
.num_frames
>1) return VO_FALSE
;
578 if(mpi
->flags
&MP_IMGFLAG_READABLE
) return VO_FALSE
; /* slow video ram */
579 if(( (mpi
->stride
[0]==dstrides
.y
&& (!(mpi
->flags
&MP_IMGFLAG_PLANAR
) ||
580 (mpi
->stride
[1]==dstrides
.u
&& mpi
->stride
[2]==dstrides
.v
)) )
581 || (mpi
->flags
&(MP_IMGFLAG_ACCEPT_STRIDE
|MP_IMGFLAG_ACCEPT_WIDTH
))) &&
582 (!forced_fourcc
&& !(vidix_play
.flags
& VID_PLAY_INTERLEAVED_UV
)))
584 if(mpi
->flags
&MP_IMGFLAG_ACCEPT_WIDTH
){
585 // check if only width is enough to represent strides:
586 if(mpi
->flags
&MP_IMGFLAG_PLANAR
){
587 if((dstrides
.y
>>1)!=dstrides
.v
|| dstrides
.v
!=dstrides
.u
) return VO_FALSE
;
589 if(dstrides
.y
% (mpi
->bpp
/8)) return VO_FALSE
;
592 mpi
->planes
[0]=vidix_mem
+vidix_play
.offsets
[next_frame
]+vidix_play
.offset
.y
;
593 mpi
->width
=mpi
->stride
[0]=dstrides
.y
;
594 if(mpi
->flags
&MP_IMGFLAG_PLANAR
)
596 mpi
->planes
[1]=vidix_mem
+vidix_play
.offsets
[next_frame
]+vidix_play
.offset
.v
;
597 mpi
->stride
[1]=dstrides
.v
>> mpi
->chroma_x_shift
;
598 mpi
->planes
[2]=vidix_mem
+vidix_play
.offsets
[next_frame
]+vidix_play
.offset
.u
;
599 mpi
->stride
[2]=dstrides
.u
>> mpi
->chroma_x_shift
;
601 mpi
->width
/=mpi
->bpp
/8;
602 mpi
->flags
|=MP_IMGFLAG_DIRECT
;
608 uint32_t vidix_control(uint32_t request
, void *data
, ...)
611 case VOCTRL_QUERY_FORMAT
:
612 return vidix_query_fourcc(*((uint32_t*)data
));
613 case VOCTRL_GET_IMAGE
:
614 return vidix_get_image(data
);
615 case VOCTRL_DRAW_IMAGE
:
616 return vidix_draw_image(data
);
617 case VOCTRL_GET_FRAME_NUM
:
618 *(uint32_t *)data
= next_frame
;
620 case VOCTRL_SET_FRAME_NUM
:
621 next_frame
= *(uint32_t *)data
;
623 case VOCTRL_GET_NUM_FRAMES
:
624 *(uint32_t *)data
= vidix_play
.num_frames
;
626 case VOCTRL_SET_EQUALIZER
:
630 vidix_video_eq_t info
;
632 if(!video_on
) return VO_FALSE
;
634 value
= va_arg(ap
, int);
637 // printf("vidix seteq %s -> %d \n",data,value);
639 /* vidix eq ranges are -1000..1000 */
640 if (!strcasecmp(data
, "brightness"))
642 info
.brightness
= value
*10;
643 info
.cap
= VEQ_CAP_BRIGHTNESS
;
645 else if (!strcasecmp(data
, "contrast"))
647 info
.contrast
= value
*10;
648 info
.cap
= VEQ_CAP_CONTRAST
;
650 else if (!strcasecmp(data
, "saturation"))
652 info
.saturation
= value
*10;
653 info
.cap
= VEQ_CAP_SATURATION
;
655 else if (!strcasecmp(data
, "hue"))
658 info
.cap
= VEQ_CAP_HUE
;
661 if (vdlPlaybackSetEq(vidix_handler
, &info
) == 0)
665 case VOCTRL_GET_EQUALIZER
:
669 vidix_video_eq_t info
;
671 if(!video_on
) return VO_FALSE
;
672 if (vdlPlaybackGetEq(vidix_handler
, &info
) != 0)
676 value
= va_arg(ap
, int*);
679 /* vidix eq ranges are -1000..1000 */
680 if (!strcasecmp(data
, "brightness"))
682 if (info
.cap
& VEQ_CAP_BRIGHTNESS
)
683 *value
= info
.brightness
/10;
685 else if (!strcasecmp(data
, "contrast"))
687 if (info
.cap
& VEQ_CAP_CONTRAST
)
688 *value
= info
.contrast
/10;
690 else if (!strcasecmp(data
, "saturation"))
692 if (info
.cap
& VEQ_CAP_SATURATION
)
693 *value
= info
.saturation
/10;
695 else if (!strcasecmp(data
, "hue"))
697 if (info
.cap
& VEQ_CAP_HUE
)
698 *value
= info
.hue
/10;
705 // WARNING: we drop extra parameters (...) here!
706 // return server_control(request,data); //VO_NOTIMPL;
709 int vidix_preinit(const char *drvname
,void *server
)
712 if( mp_msg_test(MSGT_VO
,MSGL_DBG2
) ) {
713 mp_msg(MSGT_VO
,MSGL_DBG2
, "vosub_vidix: vidix_preinit(%s) was called\n",drvname
); }
714 if(vdlGetVersion() != VIDIX_VERSION
)
716 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_YouHaveWrongVersionOfVidixLibrary
);
720 vidix_handler
= vdlOpen(MP_VIDIX_PFX
,
721 drvname
? drvname
[0] == ':' ? &drvname
[1] : drvname
[0] ? drvname
: NULL
: NULL
,
725 vidix_handler
= vdlOpen(get_path("vidix/"),
726 drvname
? drvname
[0] == ':' ? &drvname
[1] : drvname
[0] ? drvname
: NULL
: NULL
,
731 if(vidix_handler
== NULL
)
733 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_CouldntFindWorkingVidixDriver
);
736 if((err
=vdlGetCapability(vidix_handler
,&vidix_cap
)) != 0)
738 mp_msg(MSGT_VO
,MSGL_ERR
, MSGTR_LIBVO_SUB_VIDIX_CouldntGetCapability
,strerror(err
));
741 mp_msg(MSGT_VO
,MSGL_INFO
, MSGTR_LIBVO_SUB_VIDIX_Description
, vidix_cap
.name
);
742 mp_msg(MSGT_VO
,MSGL_INFO
, MSGTR_LIBVO_SUB_VIDIX_Author
, vidix_cap
.author
);
743 /* we are able to tune up this stuff depend on fourcc format */
744 ((vo_functions_t
*)server
)->draw_slice
=vidix_draw_slice
;
745 ((vo_functions_t
*)server
)->draw_frame
=vidix_draw_frame
;
746 ((vo_functions_t
*)server
)->flip_page
=vidix_flip_page
;
747 ((vo_functions_t
*)server
)->draw_osd
=vidix_draw_osd
;
748 // server_control = ((vo_functions_t *)server)->control;
749 // ((vo_functions_t *)server)->control=vidix_control;