summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-21 02:18:28 +0300
committerUoti Urpala <uau@symbol.nonexistent.invalid>2008-04-23 13:46:40 +0300
commit78172918ff4c7df7c9d1305dbfc48a8df409e470 (patch)
tree664cd8c4d580ed5e487ce03f0d5a89ad40965699 /libvo
parent432e8ff4a568b1040cae43df4aa6a602c86c6162 (diff)
downloadmpv-78172918ff4c7df7c9d1305dbfc48a8df409e470.tar.bz2
mpv-78172918ff4c7df7c9d1305dbfc48a8df409e470.tar.xz
Move vo_screenwidth,vo_screenheight to options struct
Diffstat (limited to 'libvo')
-rw-r--r--libvo/old_vo_defines.h2
-rw-r--r--libvo/video_out.c11
-rw-r--r--libvo/video_out.h4
-rw-r--r--libvo/vo_xv.c15
-rw-r--r--libvo/x11_common.c77
-rw-r--r--libvo/x11_common.h6
6 files changed, 61 insertions, 54 deletions
diff --git a/libvo/old_vo_defines.h b/libvo/old_vo_defines.h
index a8231b970a..a092589377 100644
--- a/libvo/old_vo_defines.h
+++ b/libvo/old_vo_defines.h
@@ -15,4 +15,6 @@
#define vo_dwidth global_vo->dwidth
#define vo_dheight global_vo->dheight
#define vo_dbpp global_vo->opts->vo_dbpp
+#define vo_screenwidth global_vo->opts->vo_screenwidth
+#define vo_screenheight global_vo->opts->vo_screenheight
#endif
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 7e3781020b..9b0ca48504 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -30,10 +30,6 @@ int xinerama_screen = -1;
int xinerama_x;
int xinerama_y;
-// currect resolution/bpp on screen: (should be autodetected by vo_init())
-int vo_screenwidth=0;
-int vo_screenheight=0;
-
int vo_nomouse_input = 0;
int vo_grabpointer = 1;
int vo_doublebuffering = 1;
@@ -353,16 +349,17 @@ int vo_config(struct vo *vo, uint32_t width, uint32_t height,
uint32_t d_width, uint32_t d_height, uint32_t flags,
char *title, uint32_t format)
{
+ struct MPOpts *opts = vo->opts;
panscan_init();
aspect_save_orig(width, height);
aspect_save_prescale(d_width, d_height);
if (vo_control(vo, VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
aspect(&d_width, &d_height, A_NOZOOM);
- vo->dx = (int)(vo_screenwidth - d_width) / 2;
- vo->dy = (int)(vo_screenheight - d_height) / 2;
+ vo->dx = (int)(opts->vo_screenwidth - d_width) / 2;
+ vo->dy = (int)(opts->vo_screenheight - d_height) / 2;
geometry(&vo->dx, &vo->dy, &d_width, &d_height,
- vo_screenwidth, vo_screenheight);
+ opts->vo_screenwidth, opts->vo_screenheight);
vo->dx += xinerama_x;
vo->dy += xinerama_y;
vo->dwidth = d_width;
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 1604bd233b..9b7d93de17 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -245,10 +245,6 @@ extern int xinerama_screen;
extern int xinerama_x;
extern int xinerama_y;
-// correct resolution/bpp on screen: (should be autodetected by vo_init())
-extern int vo_screenwidth;
-extern int vo_screenheight;
-
extern int vo_grabpointer;
extern int vo_doublebuffering;
extern int vo_directrendering;
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index ec2099866a..301fed5a7b 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -152,13 +152,14 @@ static void draw_alpha_null(void *p, int x0, int y0, int w, int h,
static void deallocate_xvimage(struct vo *vo, int foo);
static void calc_drwXY(struct vo *vo, uint32_t *drwX, uint32_t *drwY) {
+ struct MPOpts *opts = vo->opts;
*drwX = *drwY = 0;
if (vo_fs) {
aspect(&vo->dwidth, &vo->dheight, A_ZOOM);
- vo->dwidth = FFMIN(vo->dwidth, vo_screenwidth);
- vo->dheight = FFMIN(vo->dheight, vo_screenheight);
- *drwX = (vo_screenwidth - vo->dwidth) / 2;
- *drwY = (vo_screenheight - vo->dheight) / 2;
+ vo->dwidth = FFMIN(vo->dwidth, opts->vo_screenwidth);
+ vo->dheight = FFMIN(vo->dheight, opts->vo_screenheight);
+ *drwX = (opts->vo_screenwidth - vo->dwidth) / 2;
+ *drwY = (opts->vo_screenheight - vo->dheight) / 2;
mp_msg(MSGT_VO, MSGL_V, "[xv-fs] dx: %d dy: %d dw: %d dh: %d\n",
*drwX, *drwY, vo->dwidth, vo->dheight);
} else if (WinID == 0) {
@@ -246,8 +247,8 @@ static int config(struct vo *vo, uint32_t width, uint32_t height,
vo_vm_switch(vo, vm_width, vm_height, &modeline_width,
&modeline_height);
ctx->mode_switched = 1;
- hint.x = (vo_screenwidth - modeline_width) / 2;
- hint.y = (vo_screenheight - modeline_height) / 2;
+ hint.x = (opts->vo_screenwidth - modeline_width) / 2;
+ hint.y = (opts->vo_screenheight - modeline_height) / 2;
hint.width = modeline_width;
hint.height = modeline_height;
aspect_save_screenres(modeline_width, modeline_height);
@@ -706,7 +707,7 @@ static void uninit(struct vo *vo)
deallocate_xvimage(vo, i);
#ifdef HAVE_XF86VM
if (ctx->mode_switched)
- vo_vm_close(vo->x11->display);
+ vo_vm_close(vo);
#endif
if (ctx->event_fd_registered)
mp_input_rm_event_fd(ConnectionNumber(vo->x11->display));
diff --git a/libvo/x11_common.c b/libvo/x11_common.c
index 8d144ea960..409b820c95 100644
--- a/libvo/x11_common.c
+++ b/libvo/x11_common.c
@@ -373,6 +373,7 @@ static void init_atoms(Display *d)
}
void update_xinerama_info(struct vo *vo) {
+ struct MPOpts *opts = vo->opts;
int screen = xinerama_screen;
xinerama_x = xinerama_y = 0;
#ifdef HAVE_XINERAMA
@@ -398,19 +399,20 @@ void update_xinerama_info(struct vo *vo) {
}
if (screen < 0)
screen = 0;
- vo_screenwidth = screens[screen].width;
- vo_screenheight = screens[screen].height;
+ opts->vo_screenwidth = screens[screen].width;
+ opts->vo_screenheight = screens[screen].height;
xinerama_x = screens[screen].x_org;
xinerama_y = screens[screen].y_org;
XFree(screens);
}
#endif
- aspect_save_screenres(vo_screenwidth, vo_screenheight);
+ aspect_save_screenres(opts->vo_screenwidth, opts->vo_screenheight);
}
int vo_init(struct vo *vo)
{
+ struct MPOpts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
// int mScreen;
int depth, bpp;
@@ -462,17 +464,17 @@ int vo_init(struct vo *vo)
int clock;
XF86VidModeGetModeLine(x11->display, mScreen, &clock, &modeline);
- if (!vo_screenwidth)
- vo_screenwidth = modeline.hdisplay;
- if (!vo_screenheight)
- vo_screenheight = modeline.vdisplay;
+ if (!opts->vo_screenwidth)
+ opts->vo_screenwidth = modeline.hdisplay;
+ if (!opts->vo_screenheight)
+ opts->vo_screenheight = modeline.vdisplay;
}
#endif
{
- if (!vo_screenwidth)
- vo_screenwidth = DisplayWidth(x11->display, mScreen);
- if (!vo_screenheight)
- vo_screenheight = DisplayHeight(x11->display, mScreen);
+ if (!opts->vo_screenwidth)
+ opts->vo_screenwidth = DisplayWidth(x11->display, mScreen);
+ if (!opts->vo_screenheight)
+ opts->vo_screenheight = DisplayHeight(x11->display, mScreen);
}
// get color depth (from root window, or the best visual):
XGetWindowAttributes(x11->display, mRootWin, &attribs);
@@ -535,7 +537,7 @@ int vo_init(struct vo *vo)
mLocalDisplay = 0;
mp_msg(MSGT_VO, MSGL_V,
"vo: X11 running at %dx%d with depth %d and %d bpp (\"%s\" => %s display)\n",
- vo_screenwidth, vo_screenheight, depth, x11->depthonscreen,
+ opts->vo_screenwidth, opts->vo_screenheight, depth, x11->depthonscreen,
dispName, mLocalDisplay ? "local" : "remote");
vo_wm_type = vo_wm_detect(vo);
@@ -1021,6 +1023,7 @@ static int mouse_waiting_hide;
int vo_x11_check_events(struct vo *vo)
{
+ struct MPOpts *opts = vo->opts;
Display *display = vo->x11->display;
int ret = 0;
XEvent Event;
@@ -1054,8 +1057,8 @@ int vo_x11_check_events(struct vo *vo)
ret |= VO_EVENT_EXPOSE;
break;
case ConfigureNotify:
-// if (!vo_fs && (Event.xconfigure.width == vo_screenwidth || Event.xconfigure.height == vo_screenheight)) break;
-// if (vo_fs && Event.xconfigure.width != vo_screenwidth && Event.xconfigure.height != vo_screenheight) break;
+// if (!vo_fs && (Event.xconfigure.width == opts->vo_screenwidth || Event.xconfigure.height == opts->vo_screenheight)) break;
+// if (vo_fs && Event.xconfigure.width != opts->vo_screenwidth && Event.xconfigure.height != opts->vo_screenheight) break;
if (vo_window == None)
break;
vo->dwidth = Event.xconfigure.width;
@@ -1346,14 +1349,15 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y,
void vo_x11_clearwindow_part(struct vo *vo, Window vo_window,
int img_width, int img_height, int use_fs)
{
+ struct MPOpts *opts = vo->opts;
Display *mDisplay = vo->x11->display;
int u_dheight, u_dwidth, left_ov, left_ov2;
if (!f_gc)
return;
- u_dheight = use_fs ? vo_screenheight : vo->dheight;
- u_dwidth = use_fs ? vo_screenwidth : vo->dwidth;
+ u_dheight = use_fs ? opts->vo_screenheight : vo->dheight;
+ u_dwidth = use_fs ? opts->vo_screenwidth : vo->dwidth;
if ((u_dheight <= img_height) && (u_dwidth <= img_width))
return;
@@ -1375,14 +1379,15 @@ void vo_x11_clearwindow_part(struct vo *vo, Window vo_window,
XFlush(mDisplay);
}
-void vo_x11_clearwindow(Display * mDisplay, Window vo_window)
+void vo_x11_clearwindow(struct vo *vo, Window vo_window)
{
+ struct MPOpts *opts = vo->opts;
if (!f_gc)
return;
- XFillRectangle(mDisplay, vo_window, f_gc, 0, 0, vo_screenwidth,
- vo_screenheight);
+ XFillRectangle(vo->x11->display, vo_window, f_gc, 0, 0,
+ opts->vo_screenwidth, opts->vo_screenheight);
//
- XFlush(mDisplay);
+ XFlush(vo->x11->display);
}
@@ -1555,8 +1560,8 @@ void vo_x11_fullscreen(struct vo *vo)
update_xinerama_info(vo);
x = xinerama_x;
y = xinerama_y;
- w = vo_screenwidth;
- h = vo_screenheight;
+ w = opts->vo_screenwidth;
+ h = opts->vo_screenheight;
}
{
long dummy;
@@ -1766,6 +1771,7 @@ void vo_x11_selectinput_witherr(Display * display, Window w,
void vo_vm_switch(struct vo *vo, uint32_t X, uint32_t Y, int *modeline_width,
int *modeline_height)
{
+ struct MPOpts *opts = vo->opts;
Display *mDisplay = vo->x11->display;
int vm_event, vm_error;
int vm_ver, vm_rev;
@@ -1808,14 +1814,16 @@ void vo_vm_switch(struct vo *vo, uint32_t X, uint32_t Y, int *modeline_width,
XF86VidModeLockModeSwitch(mDisplay, mScreen, 0);
XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[j]);
XF86VidModeSwitchToMode(mDisplay, mScreen, vidmodes[j]);
- X = (vo_screenwidth - *modeline_width) / 2;
- Y = (vo_screenheight - *modeline_height) / 2;
+ X = (opts->vo_screenwidth - *modeline_width) / 2;
+ Y = (opts->vo_screenheight - *modeline_height) / 2;
XF86VidModeSetViewPort(mDisplay, mScreen, X, Y);
}
}
-void vo_vm_close(Display * dpy)
+void vo_vm_close(struct vo *vo)
{
+ Display *dpy = vo->x11->display;
+ struct MPOpts *opts = vo->opts;
#ifdef HAVE_NEW_GUI
if (vidmodes != NULL && vo_window != None)
#else
@@ -1832,12 +1840,12 @@ void vo_vm_close(Display * dpy)
XF86VidModeGetAllModeLines(dpy, mScreen, &modecount,
&vidmodes);
for (i = 0; i < modecount; i++)
- if ((vidmodes[i]->hdisplay == vo_screenwidth)
- && (vidmodes[i]->vdisplay == vo_screenheight))
+ if ((vidmodes[i]->hdisplay == opts->vo_screenwidth)
+ && (vidmodes[i]->vdisplay == opts->vo_screenheight))
{
mp_msg(MSGT_VO, MSGL_INFO,
"Returning to original mode %dx%d\n",
- vo_screenwidth, vo_screenheight);
+ opts->vo_screenwidth, opts->vo_screenheight);
break;
}
@@ -2456,6 +2464,7 @@ int vo_xv_init_colorkey(struct vo *vo)
void vo_xv_draw_colorkey(struct vo *vo, int32_t x, int32_t y,
int32_t w, int32_t h)
{
+ struct MPOpts *opts = vo->opts;
struct vo_x11_state *x11 = vo->x11;
if( xv_ck_info.method == CK_METHOD_MANUALFILL ||
xv_ck_info.method == CK_METHOD_BACKGROUND )//less tearing than XClearWindow()
@@ -2475,19 +2484,19 @@ void vo_xv_draw_colorkey(struct vo *vo, int32_t x, int32_t y,
if ( y > 0 )
XFillRectangle(x11->display, vo_window, vo_gc,
0, 0,
- vo_screenwidth, y);
+ opts->vo_screenwidth, y);
if (x > 0)
XFillRectangle(x11->display, vo_window, vo_gc,
0, 0,
- x, vo_screenheight);
- if (x + w < vo_screenwidth)
+ x, opts->vo_screenheight);
+ if (x + w < opts->vo_screenwidth)
XFillRectangle(x11->display, vo_window, vo_gc,
x + w, 0,
- vo_screenwidth, vo_screenheight);
- if (y + h < vo_screenheight)
+ opts->vo_screenwidth, opts->vo_screenheight);
+ if (y + h < opts->vo_screenheight)
XFillRectangle(x11->display, vo_window, vo_gc,
0, y + h,
- vo_screenwidth, vo_screenheight);
+ opts->vo_screenwidth, opts->vo_screenheight);
}
}
diff --git a/libvo/x11_common.h b/libvo/x11_common.h
index 3cae10714f..58eef5caa2 100644
--- a/libvo/x11_common.h
+++ b/libvo/x11_common.h
@@ -60,7 +60,7 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis,
Colormap col_map, const char *classname, const char *title);
void vo_x11_clearwindow_part(struct vo *vo, Window vo_window,
int img_width, int img_height, int use_fs);
-extern void vo_x11_clearwindow( Display *mDisplay, Window vo_window );
+void vo_x11_clearwindow(struct vo *vo, Window vo_window);
void vo_x11_ontop(struct vo *vo);
void vo_x11_ewmh_fullscreen(Display *mDisplay, int action);
@@ -113,7 +113,7 @@ int xv_test_ckm( void * arg );
#ifdef HAVE_XF86VM
void vo_vm_switch(struct vo *vo, uint32_t, uint32_t, int*, int*);
-void vo_vm_close(Display*);
+void vo_vm_close(struct vo *vo);
#endif
void update_xinerama_info(struct vo *vo);
@@ -142,6 +142,8 @@ int vo_find_depth_from_visuals(Display *dpy, int screen, Visual **visual_return)
#define vo_xv_init_colorkey() vo_xv_init_colorkey(global_vo)
#define vo_xv_draw_colorkey(...) vo_xv_draw_colorkey(global_vo, __VA_ARGS__)
#define vo_x11_clearwindow_part(display, ...) vo_x11_clearwindow_part(global_vo, __VA_ARGS__)
+#define vo_vm_close(display) vo_vm_close(global_vo)
+#define vo_x11_clearwindow(display, window) vo_x11_clearwindow(global_vo, window)
#define mDisplay global_vo->x11->display
#define vo_depthonscreen global_vo->x11->depthonscreen