diff options
author | wm4 <wm4@nowhere> | 2012-11-05 17:02:04 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-11-12 20:06:14 +0100 |
commit | d4bdd0473d6f43132257c9fb3848d829755167a3 (patch) | |
tree | 8021c2f7da1841393c8c832105e20cd527826d6c /video/out/geometry.c | |
parent | bd48deba77bd5582c5829d6fe73a7d2571088aba (diff) | |
download | mpv-d4bdd0473d6f43132257c9fb3848d829755167a3.tar.bz2 mpv-d4bdd0473d6f43132257c9fb3848d829755167a3.tar.xz |
Rename directories, move files (step 1 of 2) (does not compile)
Tis drops the silly lib prefixes, and attempts to organize the tree in
a more logical way. Make the top-level directory less cluttered as
well.
Renames the following directories:
libaf -> audio/filter
libao2 -> audio/out
libvo -> video/out
libmpdemux -> demux
Split libmpcodecs:
vf* -> video/filter
vd*, dec_video.* -> video/decode
mp_image*, img_format*, ... -> video/
ad*, dec_audio.* -> audio/decode
libaf/format.* is moved to audio/ - this is similar to how mp_image.*
is located in video/.
Move most top-level .c/.h files to core. (talloc.c/.h is left on top-
level, because it's external.) Park some of the more annoying files
in compat/. Some of these are relicts from the time mplayer used
ffmpeg internals.
sub/ is not split, because it's too much of a mess (subtitle code is
mixed with OSD display and rendering).
Maybe the organization of core is not ideal: it mixes playback core
(like mplayer.c) and utility helpers (like bstr.c/h). Should the need
arise, the playback core will be moved somewhere else, while core
contains all helper and common code.
Diffstat (limited to 'video/out/geometry.c')
-rw-r--r-- | video/out/geometry.c | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/video/out/geometry.c b/video/out/geometry.c new file mode 100644 index 0000000000..941528aea9 --- /dev/null +++ b/video/out/geometry.c @@ -0,0 +1,112 @@ +/* + * copyright (C) 2002 Mark Zealey <mark@zealos.org> + * + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include <stdio.h> +#include <string.h> +#include <limits.h> +#include "geometry.h" +#include "mp_msg.h" + +/* A string of the form [WxH][+X+Y] or xpos[%]:ypos[%] */ +char *vo_geometry; +// set when either width or height is changed +int geometry_wh_changed; +int geometry_xy_changed; + +// 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) +{ + if(vo_geometry != NULL) { + char xsign[2], ysign[2], dummy[2]; + int width, height, xoff, yoff, xper, yper; + int i; + int ok = 0; + for (i = 0; !ok && i < 9; i++) { + width = height = xoff = yoff = xper = yper = INT_MIN; + strcpy(xsign, "+"); + strcpy(ysign, "+"); + switch (i) { + case 0: + ok = sscanf(vo_geometry, "%ix%i%1[+-]%i%1[+-]%i%c", + &width, &height, xsign, &xoff, ysign, + &yoff, dummy) == 6; + break; + case 1: + ok = sscanf(vo_geometry, "%ix%i%c", &width, &height, dummy) == 2; + break; + case 2: + ok = sscanf(vo_geometry, "%1[+-]%i%1[+-]%i%c", + xsign, &xoff, ysign, &yoff, dummy) == 4; + break; + case 3: + ok = sscanf(vo_geometry, "%i%%:%i%1[%]%c", &xper, &yper, dummy, dummy) == 3; + break; + case 4: + ok = sscanf(vo_geometry, "%i:%i%1[%]%c", &xoff, &yper, dummy, dummy) == 3; + break; + case 5: + ok = sscanf(vo_geometry, "%i%%:%i%c", &xper, &yoff, dummy) == 2; + break; + case 6: + ok = sscanf(vo_geometry, "%i:%i%c", &xoff, &yoff, dummy) == 2; + break; + case 7: + ok = sscanf(vo_geometry, "%i%1[%]%c", &xper, dummy, dummy) == 2; + break; + case 8: + ok = sscanf(vo_geometry, "%i%c", &xoff, dummy) == 1; + break; + } + } + if (!ok) { + mp_msg(MSGT_VO, MSGL_ERR, + "-geometry must be in [WxH][[+-]X[+-]Y] | [X[%%]:[Y[%%]]] format, incorrect (%s)\n", vo_geometry); + return 0; + } + + mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i," + " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh); + + mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i," + "height: %i, xoff: %s%i, yoff: %s%i, xper: %i, yper: %i\n", + width, height, xsign, xoff, ysign, yoff, xper, yper); + + if (width > 0) *widw = width; + if (height > 0) *widh = height; + + if(xoff != INT_MIN && xsign[0] == '-') xoff = scrw - *widw - xoff; + if(yoff != INT_MIN && ysign[0] == '-') yoff = scrh - *widh - yoff; + if(xper >= 0 && xper <= 100) xoff = (scrw - *widw) * ((float)xper / 100.0); + if(yper >= 0 && yper <= 100) yoff = (scrh - *widh) * ((float)yper / 100.0); + + mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i," + "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n", + width, height, xoff, yoff, xper, yper); + + if (xoff != INT_MIN && xpos) *xpos = xoff; + if (yoff != INT_MIN && ypos) *ypos = yoff; + + geometry_wh_changed = width > 0 || height > 0; + geometry_xy_changed = xoff != INT_MIN || yoff != INT_MIN; + } + return 1; +} |