2 /* this file contains libvo's common functions, variables used by
10 //#include <sys/mman.h>
13 #include "video_out.h"
18 #include "osdep/shmem.h"
22 int xinerama_screen
= -1;
26 // currect resolution/bpp on screen: (should be autodetected by vo_init())
27 int vo_depthonscreen
=0;
29 int vo_screenheight
=0;
31 int vo_config_count
=0;
33 // requested resolution/bpp: (-x -y -bpp options)
40 int vo_nomouse_input
= 0;
41 int vo_grabpointer
= 1;
42 int vo_doublebuffering
= 1;
46 float vo_panscan
= 0.0f
;
49 int vo_refresh_rate
=0;
55 int vo_pts
=0; // for hw decoding
56 float vo_fps
=0; // for mp1e rte
58 char *vo_subdevice
= NULL
;
59 int vo_directrendering
=0;
61 int vo_colorkey
= 0x0000ff00; // default colorkey is green
62 // (0xff000000 means that colorkey has been disabled)
65 // Externally visible list of all vo drivers
67 extern vo_functions_t video_out_mga
;
68 extern vo_functions_t video_out_xmga
;
69 extern vo_functions_t video_out_x11
;
70 extern vo_functions_t video_out_xover
;
71 extern vo_functions_t video_out_xvmc
;
72 extern vo_functions_t video_out_xv
;
73 extern vo_functions_t video_out_gl
;
74 extern vo_functions_t video_out_gl2
;
75 extern vo_functions_t video_out_dga
;
76 extern vo_functions_t video_out_fsdga
;
77 extern vo_functions_t video_out_sdl
;
78 extern vo_functions_t video_out_3dfx
;
79 extern vo_functions_t video_out_tdfxfb
;
80 extern vo_functions_t video_out_s3fb
;
81 extern vo_functions_t video_out_null
;
82 //extern vo_functions_t video_out_odivx;
83 extern vo_functions_t video_out_zr
;
84 extern vo_functions_t video_out_zr2
;
85 extern vo_functions_t video_out_bl
;
86 extern vo_functions_t video_out_syncfb
;
87 extern vo_functions_t video_out_fbdev
;
88 extern vo_functions_t video_out_fbdev2
;
89 extern vo_functions_t video_out_svga
;
90 extern vo_functions_t video_out_png
;
91 extern vo_functions_t video_out_ggi
;
92 extern vo_functions_t video_out_aa
;
93 extern vo_functions_t video_out_caca
;
94 extern vo_functions_t video_out_mpegpes
;
95 extern vo_functions_t video_out_yuv4mpeg
;
97 extern vo_functions_t video_out_directx
;
100 extern vo_functions_t video_out_dxr2
;
102 extern vo_functions_t video_out_dxr3
;
104 extern vo_functions_t video_out_jpeg
;
107 extern vo_functions_t video_out_gif89a
;
110 extern vo_functions_t video_out_vesa
;
113 extern vo_functions_t video_out_directfb
;
114 #if DIRECTFBVERSION >= 915
115 extern vo_functions_t video_out_dfbmga
;
119 extern vo_functions_t video_out_xvidix
;
120 extern vo_functions_t video_out_winvidix
;
121 extern vo_functions_t video_out_cvidix
;
124 extern vo_functions_t video_out_tdfx_vid
;
127 extern vo_functions_t video_out_tga
;
130 #ifdef MACOSX_COREVIDEO
131 extern vo_functions_t video_out_macosx
;
133 extern vo_functions_t video_out_quartz
;
136 extern vo_functions_t video_out_pnm
;
139 extern vo_functions_t video_out_md5sum
;
142 vo_functions_t
* video_out_drivers
[] =
151 #ifdef MACOSX_COREVIDEO
226 #if DIRECTFBVERSION >= 915
240 // should not be auto-selected
267 void list_video_out(void){
269 mp_msg(MSGT_CPLAYER
, MSGL_INFO
, MSGTR_AvailableVideoOutputDrivers
);
270 mp_msg(MSGT_IDENTIFY
, MSGL_INFO
, "ID_VIDEO_OUTPUTS\n");
271 while (video_out_drivers
[i
]) {
272 const vo_info_t
*info
= video_out_drivers
[i
++]->info
;
273 mp_msg(MSGT_GLOBAL
, MSGL_INFO
,"\t%s\t%s\n", info
->short_name
, info
->name
);
275 mp_msg(MSGT_GLOBAL
, MSGL_INFO
,"\n");
278 vo_functions_t
* init_best_video_out(char** vo_list
){
280 // first try the preferred drivers, with their optional subdevice param:
281 if(vo_list
&& vo_list
[0])
282 while(vo_list
[0][0]){
283 char* vo
=strdup(vo_list
[0]);
284 vo_subdevice
=strchr(vo
,':');
285 if (!strcmp(vo
, "pgm"))
286 mp_msg(MSGT_CPLAYER
, MSGL_ERR
, MSGTR_VO_PGM_HasBeenReplaced
);
287 if (!strcmp(vo
, "md5"))
288 mp_msg(MSGT_CPLAYER
, MSGL_ERR
, MSGTR_VO_MD5_HasBeenReplaced
);
293 for(i
=0;video_out_drivers
[i
];i
++){
294 vo_functions_t
* video_driver
=video_out_drivers
[i
];
295 const vo_info_t
*info
= video_driver
->info
;
296 if(!strcmp(info
->short_name
,vo
)){
297 // name matches, try it
298 if(!video_driver
->preinit(vo_subdevice
))
301 return video_driver
; // success!
308 if(!(vo_list
[0])) return NULL
; // do NOT fallback to others
310 // now try the rest...
312 for(i
=0;video_out_drivers
[i
];i
++){
313 vo_functions_t
* video_driver
=video_out_drivers
[i
];
314 if(!video_driver
->preinit(vo_subdevice
))
315 return video_driver
; // success!
321 #if defined(HAVE_FBDEV)||defined(HAVE_VESA)
322 /* Borrowed from vo_fbdev.c
323 Monitor ranges related functions*/
325 char *monitor_hfreq_str
= NULL
;
326 char *monitor_vfreq_str
= NULL
;
327 char *monitor_dotclock_str
= NULL
;
329 float range_max(range_t
*r
)
333 for (/* NOTHING */; (r
->min
!= -1 && r
->max
!= -1); r
++)
334 if (max
< r
->max
) max
= r
->max
;
339 int in_range(range_t
*r
, float f
)
341 for (/* NOTHING */; (r
->min
!= -1 && r
->max
!= -1); r
++)
342 if (f
>= r
->min
&& f
<= r
->max
)
347 range_t
*str2range(char *s
)
349 float tmp_min
, tmp_max
;
350 char *endptr
= s
; // to start the loop
356 for (i
= 0; *endptr
; i
++) {
359 if (!(r
= (range_t
*) realloc(r
, sizeof(*r
) * (i
+ 2)))) {
360 mp_msg(MSGT_GLOBAL
, MSGL_WARN
,"can't realloc 'r'\n");
363 tmp_min
= strtod(s
, &endptr
);
364 if (*endptr
== 'k' || *endptr
== 'K') {
367 } else if (*endptr
== 'm' || *endptr
== 'M') {
368 tmp_min
*= 1000000.0;
371 if (*endptr
== '-') {
372 tmp_max
= strtod(endptr
+ 1, &endptr
);
373 if (*endptr
== 'k' || *endptr
== 'K') {
376 } else if (*endptr
== 'm' || *endptr
== 'M') {
377 tmp_max
*= 1000000.0;
380 if (*endptr
!= ',' && *endptr
)
382 } else if (*endptr
== ',' || !*endptr
) {
388 if (r
[i
].min
< 0 || r
[i
].max
< 0)
392 r
[i
].min
= r
[i
].max
= -1;
400 /* Borrowed from vo_fbdev.c END */