2002-09-09 22:03:21 +02:00
|
|
|
|
2008-04-03 03:58:32 +02:00
|
|
|
/* this file contains libvo's common functions, variables used by
|
2002-09-09 22:03:21 +02:00
|
|
|
many/all drivers. */
|
2001-02-24 21:28:24 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <unistd.h>
|
2002-03-24 01:44:54 +01:00
|
|
|
//#include <sys/mman.h>
|
2001-02-24 21:28:24 +01:00
|
|
|
|
|
|
|
#include "config.h"
|
2008-04-19 06:04:55 +02:00
|
|
|
#include "options.h"
|
2008-04-20 05:04:10 +02:00
|
|
|
#include "talloc.h"
|
2001-02-24 21:28:24 +01:00
|
|
|
#include "video_out.h"
|
2007-02-17 21:58:55 +01:00
|
|
|
#include "aspect.h"
|
|
|
|
#include "geometry.h"
|
2001-02-24 21:28:24 +01:00
|
|
|
|
2002-09-29 23:53:05 +02:00
|
|
|
#include "mp_msg.h"
|
|
|
|
#include "help_mp.h"
|
|
|
|
|
2004-10-28 03:15:53 +02:00
|
|
|
#include "osdep/shmem.h"
|
2008-04-20 06:36:34 +02:00
|
|
|
#ifdef HAVE_X11
|
|
|
|
#include "x11_common.h"
|
|
|
|
#endif
|
2001-02-24 21:28:24 +01:00
|
|
|
|
2002-03-15 00:09:27 +01:00
|
|
|
//int vo_flags=0;
|
2002-02-17 04:06:38 +01:00
|
|
|
|
2006-04-16 15:38:28 +02:00
|
|
|
int xinerama_screen = -1;
|
|
|
|
int xinerama_x;
|
|
|
|
int xinerama_y;
|
|
|
|
|
2001-04-13 15:47:36 +02:00
|
|
|
// currect resolution/bpp on screen: (should be autodetected by vo_init())
|
|
|
|
int vo_depthonscreen=0;
|
|
|
|
int vo_screenwidth=0;
|
|
|
|
int vo_screenheight=0;
|
|
|
|
|
|
|
|
// requested resolution/bpp: (-x -y -bpp options)
|
2002-02-22 19:00:38 +01:00
|
|
|
int vo_dx=0;
|
|
|
|
int vo_dy=0;
|
2001-04-13 15:47:36 +02:00
|
|
|
int vo_dwidth=0;
|
|
|
|
int vo_dheight=0;
|
|
|
|
int vo_dbpp=0;
|
2002-03-07 18:50:25 +01:00
|
|
|
|
2003-09-01 20:24:27 +02:00
|
|
|
int vo_nomouse_input = 0;
|
2002-09-28 22:09:14 +02:00
|
|
|
int vo_grabpointer = 1;
|
2004-11-30 08:42:08 +01:00
|
|
|
int vo_doublebuffering = 1;
|
2002-02-12 16:06:04 +01:00
|
|
|
int vo_vsync = 0;
|
2002-03-07 18:50:25 +01:00
|
|
|
int vo_fs = 0;
|
2001-07-04 01:46:24 +02:00
|
|
|
int vo_fsmode = 0;
|
2002-06-04 22:17:07 +02:00
|
|
|
float vo_panscan = 0.0f;
|
2004-03-13 17:48:52 +01:00
|
|
|
int vo_adapter_num=0;
|
|
|
|
int vo_refresh_rate=0;
|
2004-05-01 16:52:15 +02:00
|
|
|
int vo_keepaspect=1;
|
2004-07-29 16:59:48 +02:00
|
|
|
int vo_rootwin=0;
|
2005-11-10 23:25:54 +01:00
|
|
|
int vo_border=1;
|
2004-12-21 21:33:51 +01:00
|
|
|
int WinID = -1;
|
2001-04-13 15:47:36 +02:00
|
|
|
|
2001-11-05 03:58:47 +01:00
|
|
|
int vo_pts=0; // for hw decoding
|
2006-07-12 15:03:40 +02:00
|
|
|
float vo_fps=0;
|
2001-11-05 03:58:47 +01:00
|
|
|
|
2001-06-22 00:34:25 +02:00
|
|
|
char *vo_subdevice = NULL;
|
2002-03-31 22:38:56 +02:00
|
|
|
int vo_directrendering=0;
|
2002-07-24 20:19:39 +02:00
|
|
|
|
2003-10-03 20:13:45 +02:00
|
|
|
int vo_colorkey = 0x0000ff00; // default colorkey is green
|
2003-10-17 11:08:37 +02:00
|
|
|
// (0xff000000 means that colorkey has been disabled)
|
2003-10-03 20:13:45 +02:00
|
|
|
|
2001-02-24 21:28:24 +01:00
|
|
|
//
|
|
|
|
// Externally visible list of all vo drivers
|
|
|
|
//
|
2008-04-03 05:25:41 +02:00
|
|
|
extern struct vo_driver video_out_mga;
|
|
|
|
extern struct vo_driver video_out_xmga;
|
|
|
|
extern struct vo_driver video_out_x11;
|
|
|
|
extern struct vo_driver video_out_xover;
|
|
|
|
extern struct vo_driver video_out_xvmc;
|
|
|
|
extern struct vo_driver video_out_xv;
|
|
|
|
extern struct vo_driver video_out_gl;
|
|
|
|
extern struct vo_driver video_out_gl2;
|
|
|
|
extern struct vo_driver video_out_dga;
|
|
|
|
extern struct vo_driver video_out_sdl;
|
|
|
|
extern struct vo_driver video_out_3dfx;
|
|
|
|
extern struct vo_driver video_out_tdfxfb;
|
|
|
|
extern struct vo_driver video_out_s3fb;
|
|
|
|
extern struct vo_driver video_out_null;
|
|
|
|
extern struct vo_driver video_out_zr;
|
|
|
|
extern struct vo_driver video_out_zr2;
|
|
|
|
extern struct vo_driver video_out_bl;
|
|
|
|
extern struct vo_driver video_out_fbdev;
|
|
|
|
extern struct vo_driver video_out_fbdev2;
|
|
|
|
extern struct vo_driver video_out_svga;
|
|
|
|
extern struct vo_driver video_out_png;
|
|
|
|
extern struct vo_driver video_out_ggi;
|
|
|
|
extern struct vo_driver video_out_aa;
|
|
|
|
extern struct vo_driver video_out_caca;
|
|
|
|
extern struct vo_driver video_out_mpegpes;
|
|
|
|
extern struct vo_driver video_out_yuv4mpeg;
|
|
|
|
extern struct vo_driver video_out_directx;
|
|
|
|
extern struct vo_driver video_out_dxr2;
|
|
|
|
extern struct vo_driver video_out_dxr3;
|
|
|
|
extern struct vo_driver video_out_ivtv;
|
|
|
|
extern struct vo_driver video_out_v4l2;
|
|
|
|
extern struct vo_driver video_out_jpeg;
|
|
|
|
extern struct vo_driver video_out_gif89a;
|
|
|
|
extern struct vo_driver video_out_vesa;
|
|
|
|
extern struct vo_driver video_out_directfb;
|
|
|
|
extern struct vo_driver video_out_dfbmga;
|
|
|
|
extern struct vo_driver video_out_xvidix;
|
|
|
|
extern struct vo_driver video_out_winvidix;
|
|
|
|
extern struct vo_driver video_out_cvidix;
|
|
|
|
extern struct vo_driver video_out_tdfx_vid;
|
|
|
|
extern struct vo_driver video_out_xvr100;
|
|
|
|
extern struct vo_driver video_out_tga;
|
|
|
|
extern struct vo_driver video_out_macosx;
|
|
|
|
extern struct vo_driver video_out_quartz;
|
|
|
|
extern struct vo_driver video_out_pnm;
|
|
|
|
extern struct vo_driver video_out_md5sum;
|
|
|
|
|
|
|
|
const struct vo_driver *video_out_drivers[] =
|
2001-02-24 21:28:24 +01:00
|
|
|
{
|
2007-08-03 19:14:35 +02:00
|
|
|
#ifdef HAVE_XVR100
|
|
|
|
&video_out_xvr100,
|
|
|
|
#endif
|
2003-03-07 19:45:02 +01:00
|
|
|
#ifdef HAVE_TDFX_VID
|
|
|
|
&video_out_tdfx_vid,
|
|
|
|
#endif
|
2003-01-03 06:10:44 +01:00
|
|
|
#ifdef HAVE_DIRECTX
|
|
|
|
&video_out_directx,
|
|
|
|
#endif
|
2008-03-15 10:19:38 +01:00
|
|
|
#ifdef HAVE_COREVIDEO
|
2005-04-29 13:41:07 +02:00
|
|
|
&video_out_macosx,
|
2005-05-05 02:17:27 +02:00
|
|
|
#endif
|
2008-03-15 10:49:14 +01:00
|
|
|
#ifdef HAVE_QUARTZ
|
2004-06-17 03:07:53 +02:00
|
|
|
&video_out_quartz,
|
|
|
|
#endif
|
2001-06-21 17:19:38 +02:00
|
|
|
#ifdef HAVE_XMGA
|
2001-02-24 21:28:24 +01:00
|
|
|
&video_out_xmga,
|
|
|
|
#endif
|
2001-06-21 17:19:38 +02:00
|
|
|
#ifdef HAVE_MGA
|
2001-02-24 21:28:24 +01:00
|
|
|
&video_out_mga,
|
|
|
|
#endif
|
2001-09-27 14:23:54 +02:00
|
|
|
#ifdef HAVE_TDFXFB
|
|
|
|
&video_out_tdfxfb,
|
|
|
|
#endif
|
2006-05-17 22:56:49 +02:00
|
|
|
#ifdef HAVE_S3FB
|
|
|
|
&video_out_s3fb,
|
|
|
|
#endif
|
2005-12-01 12:58:44 +01:00
|
|
|
#ifdef HAVE_3DFX
|
|
|
|
&video_out_3dfx,
|
|
|
|
#endif
|
2001-02-24 21:28:24 +01:00
|
|
|
#ifdef HAVE_XV
|
|
|
|
&video_out_xv,
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_X11
|
|
|
|
&video_out_x11,
|
2003-03-12 16:04:05 +01:00
|
|
|
&video_out_xover,
|
2001-02-24 21:28:24 +01:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_GL
|
2008-04-03 03:58:32 +02:00
|
|
|
&video_out_gl,
|
2001-10-07 23:35:59 +02:00
|
|
|
&video_out_gl2,
|
2001-02-24 21:28:24 +01:00
|
|
|
#endif
|
2001-02-27 02:08:09 +01:00
|
|
|
#ifdef HAVE_DGA
|
|
|
|
&video_out_dga,
|
|
|
|
#endif
|
2001-02-24 21:28:24 +01:00
|
|
|
#ifdef HAVE_SDL
|
|
|
|
&video_out_sdl,
|
2001-03-28 22:14:16 +02:00
|
|
|
#endif
|
2001-06-27 01:34:03 +02:00
|
|
|
#ifdef HAVE_GGI
|
|
|
|
&video_out_ggi,
|
|
|
|
#endif
|
2001-03-28 22:14:16 +02:00
|
|
|
#ifdef HAVE_FBDEV
|
|
|
|
&video_out_fbdev,
|
2003-09-01 01:00:39 +02:00
|
|
|
&video_out_fbdev2,
|
2001-04-05 21:01:27 +02:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SVGALIB
|
|
|
|
&video_out_svga,
|
2001-02-24 21:28:24 +01:00
|
|
|
#endif
|
2001-08-14 14:30:56 +02:00
|
|
|
#ifdef HAVE_AA
|
|
|
|
&video_out_aa,
|
|
|
|
#endif
|
2004-04-06 02:04:48 +02:00
|
|
|
#ifdef HAVE_CACA
|
|
|
|
&video_out_caca,
|
|
|
|
#endif
|
2002-05-13 15:15:40 +02:00
|
|
|
#ifdef HAVE_DXR2
|
|
|
|
&video_out_dxr2,
|
|
|
|
#endif
|
2001-11-03 03:38:10 +01:00
|
|
|
#ifdef HAVE_DXR3
|
|
|
|
&video_out_dxr3,
|
|
|
|
#endif
|
2006-07-20 00:02:09 +02:00
|
|
|
#ifdef HAVE_IVTV
|
|
|
|
&video_out_ivtv,
|
|
|
|
#endif
|
2007-07-29 21:20:55 +02:00
|
|
|
#ifdef HAVE_V4L2_DECODER
|
|
|
|
&video_out_v4l2,
|
|
|
|
#endif
|
2002-01-17 02:32:29 +01:00
|
|
|
#ifdef HAVE_ZR
|
|
|
|
&video_out_zr,
|
2003-11-04 21:05:47 +01:00
|
|
|
&video_out_zr2,
|
2002-01-17 02:32:29 +01:00
|
|
|
#endif
|
2002-09-09 00:41:53 +02:00
|
|
|
#ifdef HAVE_BL
|
|
|
|
&video_out_bl,
|
|
|
|
#endif
|
2002-02-07 03:29:55 +01:00
|
|
|
#ifdef HAVE_VESA
|
2001-10-17 20:24:50 +02:00
|
|
|
&video_out_vesa,
|
|
|
|
#endif
|
2001-12-03 02:09:36 +01:00
|
|
|
#ifdef HAVE_DIRECTFB
|
|
|
|
&video_out_directfb,
|
2008-03-07 18:20:04 +01:00
|
|
|
#endif
|
2006-10-14 20:00:26 +02:00
|
|
|
#ifdef HAVE_DFBMGA
|
2002-11-01 00:54:26 +01:00
|
|
|
&video_out_dfbmga,
|
|
|
|
#endif
|
2003-10-02 16:25:52 +02:00
|
|
|
#ifdef CONFIG_VIDIX
|
|
|
|
#ifdef HAVE_X11
|
2002-01-13 00:30:20 +01:00
|
|
|
&video_out_xvidix,
|
2003-10-02 16:25:52 +02:00
|
|
|
#endif
|
|
|
|
#ifdef WIN32
|
|
|
|
&video_out_winvidix,
|
|
|
|
#endif
|
2003-10-05 17:34:40 +02:00
|
|
|
&video_out_cvidix,
|
2004-10-04 21:36:12 +02:00
|
|
|
#endif
|
|
|
|
&video_out_null,
|
|
|
|
// should not be auto-selected
|
2006-01-18 19:11:02 +01:00
|
|
|
#ifdef HAVE_XVMC
|
|
|
|
&video_out_xvmc,
|
|
|
|
#endif
|
2004-10-04 21:36:12 +02:00
|
|
|
&video_out_mpegpes,
|
|
|
|
&video_out_yuv4mpeg,
|
|
|
|
#ifdef HAVE_PNG
|
|
|
|
&video_out_png,
|
2008-04-03 03:58:32 +02:00
|
|
|
#endif
|
2004-10-04 21:36:12 +02:00
|
|
|
#ifdef HAVE_JPEG
|
|
|
|
&video_out_jpeg,
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_GIF
|
|
|
|
&video_out_gif89a,
|
2003-08-24 20:26:37 +02:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_TGA
|
|
|
|
&video_out_tga,
|
2002-01-13 00:30:20 +01:00
|
|
|
#endif
|
2004-10-24 00:43:19 +02:00
|
|
|
#ifdef HAVE_PNM
|
2004-09-20 03:31:26 +02:00
|
|
|
&video_out_pnm,
|
2004-10-24 00:43:19 +02:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_MD5SUM
|
2004-09-20 03:35:43 +02:00
|
|
|
&video_out_md5sum,
|
2004-10-24 00:43:19 +02:00
|
|
|
#endif
|
2001-02-24 21:28:24 +01:00
|
|
|
NULL
|
|
|
|
};
|
2002-05-13 15:15:40 +02:00
|
|
|
|
2008-04-03 05:25:41 +02:00
|
|
|
|
|
|
|
static int vo_preinit(struct vo *vo, const char *arg)
|
|
|
|
{
|
|
|
|
return vo->driver->preinit(vo, arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
int vo_control(struct vo *vo, uint32_t request, void *data)
|
|
|
|
{
|
|
|
|
return vo->driver->control(vo, request, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
int vo_draw_frame(struct vo *vo, uint8_t *src[])
|
|
|
|
{
|
2008-04-18 05:28:47 +02:00
|
|
|
if (!vo->config_ok)
|
|
|
|
return 0;
|
2008-04-03 05:25:41 +02:00
|
|
|
return vo->driver->draw_frame(vo, src);
|
|
|
|
}
|
|
|
|
|
|
|
|
int vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], int w, int h, int x, int y)
|
|
|
|
{
|
|
|
|
return vo->driver->draw_slice(vo, src, stride, w, h, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
void vo_draw_osd(struct vo *vo)
|
|
|
|
{
|
2008-04-18 05:28:47 +02:00
|
|
|
if (!vo->config_ok)
|
|
|
|
return;
|
2008-04-03 05:25:41 +02:00
|
|
|
vo->driver->draw_osd(vo);
|
|
|
|
}
|
|
|
|
|
|
|
|
void vo_flip_page(struct vo *vo)
|
|
|
|
{
|
2008-04-18 05:28:47 +02:00
|
|
|
if (!vo->config_ok)
|
|
|
|
return;
|
2008-04-03 05:25:41 +02:00
|
|
|
vo->driver->flip_page(vo);
|
|
|
|
}
|
|
|
|
|
|
|
|
void vo_check_events(struct vo *vo)
|
|
|
|
{
|
2008-04-18 05:28:47 +02:00
|
|
|
if (!vo->config_ok)
|
|
|
|
return;
|
2008-04-03 05:25:41 +02:00
|
|
|
vo->driver->check_events(vo);
|
|
|
|
}
|
|
|
|
|
|
|
|
void vo_destroy(struct vo *vo)
|
|
|
|
{
|
|
|
|
vo->driver->uninit(vo);
|
2008-04-20 05:04:10 +02:00
|
|
|
talloc_free(vo);
|
2008-04-03 05:25:41 +02:00
|
|
|
}
|
|
|
|
|
2008-04-03 03:58:32 +02:00
|
|
|
void list_video_out(void)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AvailableVideoOutputDrivers);
|
|
|
|
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_OUTPUTS\n");
|
|
|
|
while (video_out_drivers[i]) {
|
2002-11-11 16:22:10 +01:00
|
|
|
const vo_info_t *info = video_out_drivers[i++]->info;
|
2008-04-03 03:58:32 +02:00
|
|
|
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\t%s\t%s\n", info->short_name, info->name);
|
|
|
|
}
|
|
|
|
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
|
2002-09-29 23:53:05 +02:00
|
|
|
}
|
|
|
|
|
2008-04-20 06:36:34 +02:00
|
|
|
struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11)
|
2008-04-03 03:58:32 +02:00
|
|
|
{
|
2008-04-19 06:04:55 +02:00
|
|
|
char **vo_list = opts->video_driver_list;
|
2002-09-29 23:53:05 +02:00
|
|
|
int i;
|
2008-04-20 05:04:10 +02:00
|
|
|
struct vo *vo = talloc_ptrtype(NULL, vo);
|
2002-09-29 23:53:05 +02:00
|
|
|
// first try the preferred drivers, with their optional subdevice param:
|
2008-04-03 03:58:32 +02:00
|
|
|
if (vo_list && vo_list[0])
|
|
|
|
while (vo_list[0][0]) {
|
|
|
|
char *name = strdup(vo_list[0]);
|
|
|
|
vo_subdevice = strchr(name,':');
|
|
|
|
if (!strcmp(name, "pgm"))
|
|
|
|
mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_VO_PGM_HasBeenReplaced);
|
|
|
|
if (!strcmp(name, "md5"))
|
|
|
|
mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_VO_MD5_HasBeenReplaced);
|
|
|
|
if (vo_subdevice) {
|
|
|
|
vo_subdevice[0] = 0;
|
|
|
|
++vo_subdevice;
|
|
|
|
}
|
|
|
|
for (i = 0; video_out_drivers[i]; i++) {
|
2008-04-03 05:25:41 +02:00
|
|
|
const struct vo_driver *video_driver = video_out_drivers[i];
|
2008-04-03 03:58:32 +02:00
|
|
|
const vo_info_t *info = video_driver->info;
|
|
|
|
if (!strcmp(info->short_name, name)) {
|
|
|
|
// name matches, try it
|
2008-04-20 06:36:34 +02:00
|
|
|
*vo = (struct vo){.opts = opts, .x11 = x11};
|
2008-04-03 05:25:41 +02:00
|
|
|
vo->driver = video_driver;
|
|
|
|
if (!vo_preinit(vo, vo_subdevice)) {
|
2008-04-03 03:58:32 +02:00
|
|
|
free(name);
|
2008-04-03 05:25:41 +02:00
|
|
|
return vo; // success!
|
2008-04-03 03:58:32 +02:00
|
|
|
}
|
2003-05-31 19:33:33 +02:00
|
|
|
}
|
2002-09-29 23:53:05 +02:00
|
|
|
}
|
2008-04-03 03:58:32 +02:00
|
|
|
// continue...
|
|
|
|
free(name);
|
|
|
|
++vo_list;
|
|
|
|
if (!(vo_list[0]))
|
|
|
|
return NULL; // do NOT fallback to others
|
2002-09-29 23:53:05 +02:00
|
|
|
}
|
|
|
|
// now try the rest...
|
2008-04-03 03:58:32 +02:00
|
|
|
vo_subdevice = NULL;
|
|
|
|
for (i = 0; video_out_drivers[i]; i++) {
|
2008-04-03 05:25:41 +02:00
|
|
|
const struct vo_driver *video_driver = video_out_drivers[i];
|
2008-04-20 06:36:34 +02:00
|
|
|
*vo = (struct vo){.opts = opts, .x11 = x11};
|
2008-04-03 05:25:41 +02:00
|
|
|
vo->driver = video_driver;
|
|
|
|
if (!vo_preinit(vo, vo_subdevice))
|
|
|
|
return vo; // success!
|
2002-09-29 23:53:05 +02:00
|
|
|
}
|
2008-04-03 05:25:41 +02:00
|
|
|
free(vo);
|
2002-09-29 23:53:05 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-04-03 05:25:41 +02:00
|
|
|
int vo_config(struct vo *vo, uint32_t width, uint32_t height,
|
2007-02-17 21:58:55 +01:00
|
|
|
uint32_t d_width, uint32_t d_height, uint32_t flags,
|
2008-04-03 03:58:32 +02:00
|
|
|
char *title, uint32_t format)
|
|
|
|
{
|
|
|
|
panscan_init();
|
|
|
|
aspect_save_orig(width, height);
|
|
|
|
aspect_save_prescale(d_width, d_height);
|
2007-02-17 21:58:55 +01:00
|
|
|
|
2008-04-03 05:25:41 +02:00
|
|
|
if (vo_control(vo, VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
|
2008-04-03 03:58:32 +02:00
|
|
|
aspect(&d_width, &d_height, A_NOZOOM);
|
|
|
|
vo_dx = (int)(vo_screenwidth - d_width) / 2;
|
|
|
|
vo_dy = (int)(vo_screenheight - d_height) / 2;
|
|
|
|
geometry(&vo_dx, &vo_dy, &d_width, &d_height,
|
|
|
|
vo_screenwidth, vo_screenheight);
|
|
|
|
vo_dx += xinerama_x;
|
|
|
|
vo_dy += xinerama_y;
|
|
|
|
vo_dwidth = d_width;
|
|
|
|
vo_dheight = d_height;
|
|
|
|
}
|
2007-02-17 21:58:55 +01:00
|
|
|
|
2008-04-18 05:28:47 +02:00
|
|
|
int ret = vo->driver->config(vo, width, height, d_width, d_height, flags,
|
|
|
|
title, format);
|
|
|
|
vo->config_ok = (ret == 0);
|
|
|
|
vo->config_count += vo->config_ok;
|
|
|
|
return ret;
|
2007-02-17 21:58:55 +01:00
|
|
|
}
|
2002-09-29 23:53:05 +02:00
|
|
|
|
2008-04-03 03:58:32 +02:00
|
|
|
#if defined(HAVE_FBDEV)||defined(HAVE_VESA)
|
|
|
|
/* Borrowed from vo_fbdev.c
|
2002-08-23 01:03:51 +02:00
|
|
|
Monitor ranges related functions*/
|
|
|
|
|
|
|
|
char *monitor_hfreq_str = NULL;
|
|
|
|
char *monitor_vfreq_str = NULL;
|
|
|
|
char *monitor_dotclock_str = NULL;
|
|
|
|
|
|
|
|
float range_max(range_t *r)
|
|
|
|
{
|
|
|
|
float max = 0;
|
|
|
|
|
|
|
|
for (/* NOTHING */; (r->min != -1 && r->max != -1); r++)
|
|
|
|
if (max < r->max) max = r->max;
|
|
|
|
return max;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int in_range(range_t *r, float f)
|
|
|
|
{
|
|
|
|
for (/* NOTHING */; (r->min != -1 && r->max != -1); r++)
|
|
|
|
if (f >= r->min && f <= r->max)
|
|
|
|
return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
range_t *str2range(char *s)
|
|
|
|
{
|
|
|
|
float tmp_min, tmp_max;
|
|
|
|
char *endptr = s; // to start the loop
|
|
|
|
range_t *r = NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (!s)
|
|
|
|
return NULL;
|
|
|
|
for (i = 0; *endptr; i++) {
|
|
|
|
if (*s == ',')
|
|
|
|
goto out_err;
|
|
|
|
if (!(r = (range_t *) realloc(r, sizeof(*r) * (i + 2)))) {
|
2006-04-24 06:23:53 +02:00
|
|
|
mp_msg(MSGT_GLOBAL, MSGL_WARN,"can't realloc 'r'\n");
|
2002-08-23 01:03:51 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
tmp_min = strtod(s, &endptr);
|
|
|
|
if (*endptr == 'k' || *endptr == 'K') {
|
|
|
|
tmp_min *= 1000.0;
|
|
|
|
endptr++;
|
|
|
|
} else if (*endptr == 'm' || *endptr == 'M') {
|
|
|
|
tmp_min *= 1000000.0;
|
|
|
|
endptr++;
|
|
|
|
}
|
|
|
|
if (*endptr == '-') {
|
|
|
|
tmp_max = strtod(endptr + 1, &endptr);
|
|
|
|
if (*endptr == 'k' || *endptr == 'K') {
|
|
|
|
tmp_max *= 1000.0;
|
|
|
|
endptr++;
|
|
|
|
} else if (*endptr == 'm' || *endptr == 'M') {
|
|
|
|
tmp_max *= 1000000.0;
|
|
|
|
endptr++;
|
|
|
|
}
|
|
|
|
if (*endptr != ',' && *endptr)
|
|
|
|
goto out_err;
|
|
|
|
} else if (*endptr == ',' || !*endptr) {
|
|
|
|
tmp_max = tmp_min;
|
|
|
|
} else
|
|
|
|
goto out_err;
|
|
|
|
r[i].min = tmp_min;
|
|
|
|
r[i].max = tmp_max;
|
|
|
|
if (r[i].min < 0 || r[i].max < 0)
|
|
|
|
goto out_err;
|
|
|
|
s = endptr + 1;
|
|
|
|
}
|
|
|
|
r[i].min = r[i].max = -1;
|
|
|
|
return r;
|
|
|
|
out_err:
|
|
|
|
if (r)
|
|
|
|
free(r);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Borrowed from vo_fbdev.c END */
|
|
|
|
#endif
|
|
|
|
|