summaryrefslogtreecommitdiffstats
path: root/libvo
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-06-02 19:12:01 +0300
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-06-02 19:12:01 +0300
commit80be936a56199f7affddef546514604dcefcb763 (patch)
treeead37c819dad115446817aea7b78c53cee584735 /libvo
parented1a1e28d89e9ab63e886adda18f0b8ccfec9356 (diff)
parent1cbf1ec46835300d1226068487b90476aff73ce8 (diff)
downloadmpv-80be936a56199f7affddef546514604dcefcb763.tar.bz2
mpv-80be936a56199f7affddef546514604dcefcb763.tar.xz
Merge svn changes up to r31303
Diffstat (limited to 'libvo')
-rw-r--r--libvo/geometry.c21
-rw-r--r--libvo/vo_xv.c20
2 files changed, 26 insertions, 15 deletions
diff --git a/libvo/geometry.c b/libvo/geometry.c
index 39ff209b7b..9d60ada29f 100644
--- a/libvo/geometry.c
+++ b/libvo/geometry.c
@@ -36,7 +36,7 @@ int geometry_xy_changed;
int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh)
{
if(vo_geometry != NULL) {
- char xsign[2], ysign[2];
+ char xsign[2], ysign[2], dummy[2];
int width, height, xoff, yoff, xper, yper;
int i;
int ok = 0;
@@ -46,28 +46,31 @@ int geometry(int *xpos, int *ypos, int *widw, int *widh, int scrw, int scrh)
strcpy(ysign, "+");
switch (i) {
case 0:
- ok = sscanf(vo_geometry, "%ix%i%1[+-]%i%1[+-]%i", &width, &height, xsign, &xoff, ysign, &yoff) == 6;
+ 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", &width, &height) == 2;
+ ok = sscanf(vo_geometry, "%ix%i%c", &width, &height, dummy) == 2;
break;
case 2:
- ok = sscanf(vo_geometry, "%1[+-]%i%1[+-]%i", xsign, &xoff, ysign, &yoff) == 4;
+ ok = sscanf(vo_geometry, "%1[+-]%i%1[+-]%i%c",
+ xsign, &xoff, ysign, &yoff, dummy) == 4;
break;
case 3:
- ok = sscanf(vo_geometry, "%i%%:%i%%", &xper, &yper) == 2;
+ ok = sscanf(vo_geometry, "%i%%:%i%1[%]%c", &xper, &yper, dummy, dummy) == 3;
break;
case 4:
- ok = sscanf(vo_geometry, "%i:%i%%", &xoff, &yper) == 2;
+ ok = sscanf(vo_geometry, "%i:%i%1[%]%c", &xoff, &yper, dummy, dummy) == 3;
break;
case 5:
- ok = sscanf(vo_geometry, "%i%%:%i", &xper, &yoff) == 2;
+ ok = sscanf(vo_geometry, "%i%%:%i%c", &xper, &yoff, dummy) == 2;
break;
case 6:
- ok = sscanf(vo_geometry, "%i:%i", &xoff, &yoff) == 2;
+ ok = sscanf(vo_geometry, "%i:%i%c", &xoff, &yoff, dummy) == 2;
break;
case 7:
- ok = sscanf(vo_geometry, "%i%%", &xper) == 1;
+ ok = sscanf(vo_geometry, "%i%1[%]%c", &xper, dummy, dummy) == 2;
break;
}
}
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index 49ff146ba0..0dbc600847 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -119,14 +119,24 @@ struct xvctx {
static void allocate_xvimage(struct vo *, int);
+static void fixup_osd_position(struct vo *vo, int *x0, int *y0, int *w, int *h)
+{
+ struct xvctx *ctx = vo->priv;
+ *x0 += ctx->image_width * (vo->panscan_x >> 1)
+ / (vo->dwidth + vo->panscan_x);
+ *w = av_clip(*w, 0, ctx->image_width);
+ *h = av_clip(*h, 0, ctx->image_height);
+ *x0 = FFMIN(*x0, ctx->image_width - *w);
+ *y0 = FFMIN(*y0, ctx->image_height - *h);
+}
+
static void draw_alpha_yv12(void *p, int x0, int y0, int w, int h,
unsigned char *src, unsigned char *srca,
int stride)
{
struct vo *vo = p;
struct xvctx *ctx = vo->priv;
- x0 += ctx->image_width * (vo->panscan_x >> 1)
- / (vo->dwidth + vo->panscan_x);
+ fixup_osd_position(vo, &x0, &y0, &w, &h);
vo_draw_alpha_yv12(w, h, src, srca, stride,
ctx->xvimage[ctx->current_buf]->data +
ctx->xvimage[ctx->current_buf]->offsets[0] +
@@ -141,8 +151,7 @@ static void draw_alpha_yuy2(void *p, int x0, int y0, int w, int h,
{
struct vo *vo = p;
struct xvctx *ctx = vo->priv;
- x0 += ctx->image_width * (vo->panscan_x >> 1)
- / (vo->dwidth + vo->panscan_x);
+ fixup_osd_position(vo, &x0, &y0, &w, &h);
vo_draw_alpha_yuy2(w, h, src, srca, stride,
ctx->xvimage[ctx->current_buf]->data +
ctx->xvimage[ctx->current_buf]->offsets[0] +
@@ -157,8 +166,7 @@ static void draw_alpha_uyvy(void *p, int x0, int y0, int w, int h,
{
struct vo *vo = p;
struct xvctx *ctx = vo->priv;
- x0 += ctx->image_width * (vo->panscan_x >> 1)
- / (vo->dwidth + vo->panscan_x);
+ fixup_osd_position(vo, &x0, &y0, &w, &h);
vo_draw_alpha_yuy2(w, h, src, srca, stride,
ctx->xvimage[ctx->current_buf]->data +
ctx->xvimage[ctx->current_buf]->offsets[0] +