2 VIDIX accelerated overlay on (black) background
18 #include "video_out.h"
19 #include "video_out_internal.h"
25 #include "vosub_vidix.h"
26 #include "vidix/vidix.h"
29 static const vo_info_t info
= {
38 #define UNUSED(x) ((void)(x)) /* Removes warning about unused arguments */
41 static char *vidix_name
;
42 static uint32_t swidth
,sheight
,sformat
;
43 /// center video only when screenw & height are set
44 static uint32_t center
=0;
45 static vidix_grkey_t gr_key
;
48 static uint32_t setup_vidix(void){
50 aspect(&vo_dwidth
,&vo_dheight
,vo_fs
? A_ZOOM
: A_NOZOOM
);
52 if(vo_dwidth
<= vo_screenwidth
)x
= (vo_screenwidth
- vo_dwidth
)/2;
54 if(vo_dheight
<= vo_screenheight
)y
= (vo_screenheight
- vo_dheight
)/2;
57 if(vo_config_count
)vidix_stop();
58 if(vidix_init(swidth
, sheight
, x
, y
, vo_dwidth
, vo_dheight
, sformat
, 32, vo_screenwidth
,vo_screenheight
)){
59 mp_msg(MSGT_VO
, MSGL_FATAL
, "Can't setup VIDIX driver: %s\n", strerror(errno
));
63 if(vidix_grkey_support()){
64 vidix_grkey_get(&gr_key
);
65 gr_key
.key_op
= KEYS_PUT
;
66 if (!vo_fs
&& !(vo_colorkey
& 0xff000000)){
67 gr_key
.ckey
.op
= CKEY_TRUE
;
68 gr_key
.ckey
.red
= (vo_colorkey
& 0x00FF0000) >> 16;
69 gr_key
.ckey
.green
= (vo_colorkey
& 0x0000FF00) >> 8;
70 gr_key
.ckey
.blue
= vo_colorkey
& 0x000000FF;
72 else gr_key
.ckey
.op
= CKEY_FALSE
;
73 vidix_grkey_set(&gr_key
);
78 static int config(uint32_t width
, uint32_t height
, uint32_t d_width
,uint32_t d_height
, uint32_t flags
, char *title
, uint32_t format
){
79 vo_fs
= flags
& VOFLAG_FULLSCREEN
;
81 if(vo_screenwidth
&& vo_screenheight
){
82 if(!vo_geometry
)center
=1;
86 mp_msg(MSGT_VO
, MSGL_WARN
, "vo_cvidix: Screen width not set (see -screenw), assuming 640 pixels.\n");
90 mp_msg(MSGT_VO
, MSGL_WARN
, "vo_cvidix: Screen height not set (see -screenh), assuming 480 pixels.\n");
91 vo_screenheight
= 480;
98 aspect_save_orig(width
,height
);
99 aspect_save_prescale(d_width
,d_height
);
100 aspect_save_screenres(vo_screenwidth
,vo_screenheight
);
105 else geometry(&vo_dx
, &vo_dy
, &vo_dwidth
, &vo_dheight
,vo_screenwidth
,vo_screenheight
);
106 return setup_vidix();
109 static void check_events(void){
112 /* draw_osd, flip_page, draw_slice, draw_frame should be
113 overwritten with vidix functions (vosub_vidix.c) */
114 static void draw_osd(void){
115 mp_msg(MSGT_VO
, MSGL_FATAL
, "vo_cvidix: error: didn't use vidix draw_osd!\n");
119 static void flip_page(void){
120 mp_msg(MSGT_VO
, MSGL_FATAL
, "vo_cvidix: error: didn't use vidix flip_page!\n");
124 static int draw_slice(uint8_t *src
[], int stride
[],int w
, int h
, int x
, int y
){
131 mp_msg(MSGT_VO
, MSGL_FATAL
, "vo_cvidix: error: didn't use vidix draw_slice!\n");
135 static int draw_frame(uint8_t *src
[]){
137 mp_msg(MSGT_VO
, MSGL_FATAL
, "vo_cvidix: error: didn't use vidix draw_frame!\n");
141 static int query_format(uint32_t format
){
142 return vidix_query_fourcc(format
);
145 static void uninit(void){
146 if(!vo_config_count
) return;
154 static int preinit(const char *arg
){
155 if(arg
)vidix_name
= strdup(arg
);
157 mp_msg(MSGT_VO
, MSGL_INFO
, "vo_cvidix: No vidix driver name provided, probing available ones (-v option for details)!\n");
160 if(vidix_preinit(vidix_name
, &video_out_cvidix
))return 1;
164 static int control(uint32_t request
, void *data
, ...){
166 case VOCTRL_QUERY_FORMAT
:
167 return query_format(*((uint32_t*)data
));
168 case VOCTRL_FULLSCREEN
:
173 case VOCTRL_SET_EQUALIZER
:
178 value
= va_arg(ap
, int);
180 return vidix_control(request
, data
, value
);
182 case VOCTRL_GET_EQUALIZER
:
187 value
= va_arg(ap
, int *);
189 return vidix_control(request
, data
, value
);
192 return vidix_control(request
, data
);