Mercurial > mplayer.hg
annotate libvo/geometry.c @ 28585:7d42a45c225d
Fix compilation without VDPAU
The commit adding vo_vdpau had two bugs that broke compilation when
VDPAU was not enabled.
- video_out.c used "#ifdef CONFIG_VDPAU", but it's always set to 0 or 1
- In configure, MPEG1_VDPAU_DECODER was dropped from the list of
libavcodec codecs to disable when moving VDPAU-related ones from the
always-disabled list to a conditinal one.
author | uau |
---|---|
date | Tue, 17 Feb 2009 00:09:15 +0000 |
parents | d97a607821f1 |
children | a5f19a8ecc86 |
rev | line source |
---|---|
27509
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
1 /* |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
2 * copyright (C) 2002 Mark Zealey <mark@zealos.org> |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
3 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
4 * This file is part of MPlayer. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
5 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
6 * MPlayer is free software; you can redistribute it and/or modify |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
9 * (at your option) any later version. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
10 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
11 * MPlayer is distributed in the hope that it will be useful, |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
14 * GNU General Public License for more details. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
15 * |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
16 * You should have received a copy of the GNU General Public License along |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
17 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
d97a607821f1
Replace casual GPL notices by proper license headers.
diego
parents:
15058
diff
changeset
|
19 */ |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
20 |
9217
420e2b2f8e5a
compiler warning fixes patch by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents:
8768
diff
changeset
|
21 #include <stdio.h> |
420e2b2f8e5a
compiler warning fixes patch by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents:
8768
diff
changeset
|
22 #include <string.h> |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
23 #include "geometry.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
11996
diff
changeset
|
24 #include "mp_msg.h" |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
25 |
8745
93f78fb709e6
Added support for X style -geometry options (adapted from Henk's patch)
mark
parents:
8254
diff
changeset
|
26 /* A string of the form [WxH][+X+Y] or xpos[%]:ypos[%] */ |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
27 char *vo_geometry = NULL; |
11125 | 28 // set when either width or height is changed |
29 int geometry_wh_changed = 0; | |
11996
398c24cecdc7
dont mess with the window position in xinerama when -geometry changes it.
attila
parents:
11125
diff
changeset
|
30 int geometry_xy_changed = 0; |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
31 |
9517 | 32 #define RESET_GEOMETRY width = height = xoff = yoff = xper = yper = -1; |
33 | |
34 // xpos,ypos: position of the left upper corner | |
35 // widw,widh: width and height of the window | |
36 // scrw,scrh: width and height of the current screen | |
37 int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh) | |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
38 { |
8745
93f78fb709e6
Added support for X style -geometry options (adapted from Henk's patch)
mark
parents:
8254
diff
changeset
|
39 int width, height, xoff, yoff, xper, yper; |
93f78fb709e6
Added support for X style -geometry options (adapted from Henk's patch)
mark
parents:
8254
diff
changeset
|
40 |
93f78fb709e6
Added support for X style -geometry options (adapted from Henk's patch)
mark
parents:
8254
diff
changeset
|
41 width = height = xoff = yoff = xper = yper = -1; |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
42 |
8745
93f78fb709e6
Added support for X style -geometry options (adapted from Henk's patch)
mark
parents:
8254
diff
changeset
|
43 if(vo_geometry != NULL) { |
9517 | 44 if(sscanf(vo_geometry, "%ix%i+%i+%i", &width, &height, &xoff, &yoff) != 4 ) |
45 { | |
46 RESET_GEOMETRY | |
47 if(sscanf(vo_geometry, "%ix%i", &width, &height) != 2) | |
48 { | |
49 RESET_GEOMETRY | |
50 if(sscanf(vo_geometry, "+%i+%i", &xoff, &yoff) != 2) | |
51 { | |
14678
58f061d12c83
Fix the behaviour of -geometry according to the documentation.
al
parents:
13787
diff
changeset
|
52 char percent[2]; |
9517 | 53 RESET_GEOMETRY |
15058 | 54 if(sscanf(vo_geometry, "%i%%:%i%1[%]", &xper, &yper, percent) != 3) |
9517 | 55 { |
56 RESET_GEOMETRY | |
15058 | 57 if(sscanf(vo_geometry, "%i:%i%1[%]", &xoff, &yper, percent) != 3) |
9517 | 58 { |
59 RESET_GEOMETRY | |
14678
58f061d12c83
Fix the behaviour of -geometry according to the documentation.
al
parents:
13787
diff
changeset
|
60 if(sscanf(vo_geometry, "%i%%:%i", &xper, &yoff) != 2) |
9517 | 61 { |
62 RESET_GEOMETRY | |
14678
58f061d12c83
Fix the behaviour of -geometry according to the documentation.
al
parents:
13787
diff
changeset
|
63 if(sscanf(vo_geometry, "%i:%i", &xoff, &yoff) != 2) |
9517 | 64 { |
65 RESET_GEOMETRY | |
15058 | 66 if(sscanf(vo_geometry, "%i%1[%]", &xper, percent) != 2) |
10734 | 67 { |
68 mp_msg(MSGT_VO, MSGL_ERR, | |
69 "-geometry must be in [WxH][+X+Y] | [X[%%]:[Y[%%]]] format, incorrect (%s)\n", vo_geometry); | |
70 return 0; | |
71 } | |
9517 | 72 } |
73 } | |
74 } | |
75 } | |
76 } | |
77 } | |
78 } | |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
79 |
9517 | 80 mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i," |
9947 | 81 "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n", |
9517 | 82 width, height, xoff, yoff, xper, yper); |
83 | |
84 if(xper >= 0 && xper <= 100) xoff = (scrw - *widw) * ((float)xper / 100.0); | |
85 if(yper >= 0 && yper <= 100) yoff = (scrh - *widh) * ((float)yper / 100.0); | |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
86 |
9947 | 87 mp_msg(MSGT_VO, MSGL_V,"geometry set to width: %i," |
88 "height: %i, xoff: %i, yoff: %i, xper: %i, yper: %i\n", | |
89 width, height, xoff, yoff, xper, yper); | |
90 mp_msg(MSGT_VO, MSGL_V,"geometry window parameter: widw: %i," | |
91 " widh: %i, scrw: %i, scrh: %i\n",*widw, *widh, scrw, scrh); | |
92 | |
8768 | 93 /* FIXME: better checking of bounds... */ |
11125 | 94 if( width != -1 && (width < 0 || width > scrw)) |
95 width = (scrw < *widw) ? scrw : *widw; | |
96 if( height != -1 && (height < 0 || height > scrh)) | |
97 height = (scrh < *widh) ? scrh : *widh; | |
98 if(xoff != -1 && (xoff < 0 || xoff + width > scrw)) xoff = 0; | |
99 if(yoff != -1 && (yoff < 0 || yoff + height > scrh)) yoff = 0; | |
8745
93f78fb709e6
Added support for X style -geometry options (adapted from Henk's patch)
mark
parents:
8254
diff
changeset
|
100 |
11125 | 101 if(xoff != -1 && xpos) *xpos = xoff; |
102 if(yoff != -1 && ypos) *ypos = yoff; | |
103 if(width != -1 && widw) *widw = width; | |
104 if(height != -1 && widh) *widh = height; | |
105 | |
106 if( width != -1 || height != -1) | |
107 geometry_wh_changed = 1; | |
11996
398c24cecdc7
dont mess with the window position in xinerama when -geometry changes it.
attila
parents:
11125
diff
changeset
|
108 if( xoff != -1 || yoff != -1) |
398c24cecdc7
dont mess with the window position in xinerama when -geometry changes it.
attila
parents:
11125
diff
changeset
|
109 geometry_xy_changed = 1; |
8767 | 110 } |
7866
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
111 return 1; |
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
112 } |
732a8bfc7681
Added the -geometry option (supports fbdev and tdfxfb drivers)
mark
parents:
diff
changeset
|
113 |
9517 | 114 #undef RESET_GEOMETRY |