summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-03-02 21:09:15 +0000
committerattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-03-02 21:09:15 +0000
commit6514fbb0767930249dfb7accdddf5989691f7953 (patch)
tree6aac625cfc385fb73b5b6a4dfaed4aa7ac0f29b6 /libvo
parent84e15e6fe4822175cba6181d90f16bfa9620b5b7 (diff)
downloadmpv-6514fbb0767930249dfb7accdddf5989691f7953.tar.bz2
mpv-6514fbb0767930249dfb7accdddf5989691f7953.tar.xz
clean up of -geometry code.
disabled -geometry for all but -vo xv (will be fixed later) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9518 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/geometry.c75
-rw-r--r--libvo/geometry.h4
-rw-r--r--libvo/vo_fbdev.c7
-rw-r--r--libvo/vo_tdfxfb.c4
-rw-r--r--libvo/vo_xv.c2
5 files changed, 58 insertions, 34 deletions
diff --git a/libvo/geometry.c b/libvo/geometry.c
index 4f7c45a1a2..c7277cde2c 100644
--- a/libvo/geometry.c
+++ b/libvo/geometry.c
@@ -16,47 +16,68 @@ int geometry_error()
return 0;
}
-// A little kludge as to not to have to update all drivers
-// Only the vo_xv driver supports now the full [WxH][+X+Y] option
-int geometryFull(int *pwidth, int *pheight, int *xpos, int *ypos, int scrw, int scrh, int vidw, int vidh)
+#define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = -1;
+
+// xpos,ypos: position of the left upper corner
+// widw,widh: width and height of the window
+// scrw,scrh: width and height of the current screen
+int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh)
{
int width, height, xoff, yoff, xper, yper;
width = height = xoff = yoff = xper = yper = -1;
- /* no need to save a few extra cpu cycles here ;) */
- /* PUKE i will rewrite this code sometime maybe - euck but it works */
if(vo_geometry != NULL) {
- if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 &&
- sscanf(vo_geometry, "%ix%i", &width, &height) != 2 &&
- sscanf(vo_geometry, "+%i+%i", &xoff, &yoff) != 2 &&
- sscanf(vo_geometry, "%i:%i", &xoff, &yoff) != 2 &&
- sscanf(vo_geometry, "%i:%i%%", &xper, &yper) != 2 &&
- sscanf(vo_geometry, "%i%%:%i", &xper, &yper) != 2 &&
- sscanf(vo_geometry, "%i%%:%i%%", &xper, &yper) != 2 &&
- sscanf(vo_geometry, "%i%%", &xper) != 1)
+ if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 )
+ {
+ RESET_GEOMETRY
+ if(sscanf(vo_geometry, "%ix%i", &width, &height) != 2)
+ {
+ RESET_GEOMETRY
+ if(sscanf(vo_geometry, "+%i+%i", &xoff, &yoff) != 2)
+ {
+ RESET_GEOMETRY
+ if(sscanf(vo_geometry, "%i:%i", &xoff, &yoff) != 2)
+ {
+ RESET_GEOMETRY
+ if(sscanf(vo_geometry, "%i:%i%%", &xper, &yper) != 2)
+ {
+ RESET_GEOMETRY
+ if(sscanf(vo_geometry, "%i%%:%i", &xper, &yper) != 2)
+ {
+ RESET_GEOMETRY
+ if(sscanf(vo_geometry, "%i%%:%i%%", &xper, &yper) != 2)
+ {
+ RESET_GEOMETRY
+ if(sscanf(vo_geometry, "%i%%", &xper) != 1)
return geometry_error();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
- if(xper >= 0 && xper <= 100) xoff = (scrw - vidw) * ((float)xper / 100.0);
- if(yper >= 0 && yper <= 100) yoff = (scrh - vidh) * ((float)yper / 100.0);
+ mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i,"
+ "height: %i, xoff: %i, yoff: %i, xper: %1, yper: %i\n",
+ width, height, xoff, yoff, xper, yper);
+
+ if(xper >= 0 && xper <= 100) xoff = (scrw - *widw) * ((float)xper / 100.0);
+ if(yper >= 0 && yper <= 100) yoff = (scrh - *widh) * ((float)yper / 100.0);
/* FIXME: better checking of bounds... */
- if(width < 0 || width > scrw) width = vidw;
- if(height < 0 || height > scrh) height = vidh;
- if(xoff < 0 || xoff + vidw > scrw) xoff = 0;
- if(yoff < 0 || yoff + vidh > scrh) yoff = 0;
+ if(width < 0 || width > scrw) width = *widw;
+ if(height < 0 || height > scrh) height = *widh;
+ if(xoff < 0 || xoff + *widw > scrw) xoff = 0;
+ if(yoff < 0 || yoff + *widh > scrh) yoff = 0;
if(xpos) *xpos = xoff;
if(ypos) *ypos = yoff;
- if(pwidth) *pwidth = width;
- if(pheight) *pheight = height;
+ if(widw) *widw = width;
+ if(widh) *widh = height;
}
return 1;
}
-// compatibility function
-// only libvo working with full geometry options.
-int geometry(int *xpos, int *ypos, int scrw, int scrh, int vidw, int vidh)
-{
- return geometryFull(NULL, NULL, xpos, ypos, scrw, scrh, vidw, vidh);
-}
+#undef RESET_GEOMETRY
diff --git a/libvo/geometry.h b/libvo/geometry.h
index b3a1d2bffd..78a6626668 100644
--- a/libvo/geometry.h
+++ b/libvo/geometry.h
@@ -3,7 +3,5 @@
#define __GEOMETRY_H
extern char *vo_geometry;
-int geometryFull(int *pwidth, int *pheight, int *xpos, int *ypos, int scrw, int scrh, int vidw, int vidh);
-int geometry(int *xpos, int *ypos, int scrw, int scrh, int vidw, int vidh);
-
+int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh);
#endif /* !__GEOMETRY_H */
diff --git a/libvo/vo_fbdev.c b/libvo/vo_fbdev.c
index 28d18510a3..4120661138 100644
--- a/libvo/vo_fbdev.c
+++ b/libvo/vo_fbdev.c
@@ -1046,7 +1046,9 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
if(fb_yres > image_height)
y_offset = (fb_yres - image_height) / 2;
else y_offset = 0;
- geometry(&x_offset,&y_offset,fb_xres,fb_yres,image_width,image_height);
+
+ //FIXME: update geometry code
+ //geometry(&x_offset,&y_offset,fb_xres,fb_yres,image_width,image_height);
if(vidix_init(width,height,x_offset,y_offset,image_width,
image_height,format,fb_bpp,
@@ -1070,7 +1072,8 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width,
return 1;
}
- geometry(&x_offset,&y_offset,fb_xres,fb_yres,out_width,out_height);
+ //FIXME: update geometry code
+ //geometry(&x_offset,&y_offset,fb_xres,fb_yres,out_width,out_height);
L123123875 = frame_buffer + (out_width - in_width) * fb_pixel_size /
2 + ( (out_height - in_height) / 2 ) * fb_line_len +
diff --git a/libvo/vo_tdfxfb.c b/libvo/vo_tdfxfb.c
index b7e4b03895..f840893c26 100644
--- a/libvo/vo_tdfxfb.c
+++ b/libvo/vo_tdfxfb.c
@@ -204,7 +204,9 @@ static void clear_screen()
static void setup_screen(uint32_t full)
{
aspect(&vidwidth, &vidheight, full ? A_ZOOM : A_NOZOOM);
- geometry(&vidx, &vidy, screenwidth, screenheight, vidwidth, vidheight);
+
+ //FIXME: update geometry code
+ //geometry(&vidx, &vidy, screenwidth, screenheight, vidwidth, vidheight);
vo_fs = full;
clear_screen();
}
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 6c46cfd8c4..e8e9054833 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -282,7 +282,7 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32
vo_mouse_autohide=1;
vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2;
- geometry(&vo_dx, &vo_dy, vo_screenwidth, vo_screenheight, d_width, d_height);
+ geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight);
vo_dwidth=d_width; vo_dheight=d_height;
#ifdef HAVE_XF86VM