From 8c75a38d5fb5f399a66a79dc08b30e201ac5ef33 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 20 Oct 2012 19:31:44 +0200 Subject: VO: fix screenshot size with -geometry The -geometry switch works by modifying the d_width/d_height values passed to VOs. Moreover, d_width/d_height seem to be subject to the -monitorpixelaspect option. Screenshots should not be influenced by this. Change screenshot supporting VOs to use the original d_width/d_height values stored in vo->aspdat.prew/h. (Not all uses of -geometry did this. E.g. --geometry=900x560+0+20 did.) --- libvo/vo_direct3d.c | 9 ++------- libvo/vo_opengl_old.c | 8 ++------ libvo/vo_vdpau.c | 7 ++----- libvo/vo_xv.c | 8 ++------ 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index f8c9054b97..3270ec9ef1 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -144,8 +144,6 @@ typedef struct d3d_priv { fullscreen */ int src_width; /**< Source (movie) width */ int src_height; /**< Source (movie) heigth */ - int src_d_width; /**< Source (movie) aspect corrected width */ - int src_d_height; /**< Source (movie) aspect corrected heigth */ int border_x; /**< horizontal border value for OSD */ int border_y; /**< vertical border value for OSD */ int image_format; /**< mplayer image format */ @@ -1598,9 +1596,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, return VO_ERROR; } - priv->src_d_width = d_width; - priv->src_d_height = d_height; - if ((priv->image_format != format) || (priv->src_width != width) || (priv->src_height != height)) @@ -1858,8 +1853,8 @@ static mp_image_t *get_screenshot(d3d_priv *priv) return NULL; } - image->w = priv->src_d_width; - image->h = priv->src_d_height; + image->w = priv->vo->aspdat.prew; + image->h = priv->vo->aspdat.preh; return image; } diff --git a/libvo/vo_opengl_old.c b/libvo/vo_opengl_old.c index d302504846..dcb1103b8e 100644 --- a/libvo/vo_opengl_old.c +++ b/libvo/vo_opengl_old.c @@ -95,8 +95,6 @@ struct gl_priv { uint32_t image_width; uint32_t image_height; uint32_t image_format; - uint32_t image_d_width; - uint32_t image_d_height; int many_fmts; int have_texture_rg; int ati_hack; @@ -615,8 +613,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, p->image_height = height; p->image_width = width; p->image_format = format; - p->image_d_width = d_width; - p->image_d_height = d_height; p->is_yuv = mp_get_chroma_shift(p->image_format, &xs, &ys, NULL) > 0; p->is_yuv |= (xs << 8) | (ys << 16); glFindFormat(format, p->have_texture_rg, NULL, &p->texfmt, &p->gl_format, @@ -1092,8 +1088,8 @@ static mp_image_t *get_screenshot(struct vo *vo) image->width = p->image_width; image->height = p->image_height; - image->w = p->image_d_width; - image->h = p->image_d_height; + image->w = vo->aspdat.prew; + image->h = vo->aspdat.preh; return image; } diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index 594829b394..053405a806 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -155,7 +155,6 @@ struct vdpctx { bool dropped_frame; uint64_t dropped_time; uint32_t vid_width, vid_height; - uint32_t vid_d_width, vid_d_height; uint32_t image_format; VdpChromaType vdp_chroma_type; VdpYCbCrFormat vdp_pixel_format; @@ -880,8 +879,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, vc->image_format = format; vc->vid_width = width; vc->vid_height = height; - vc->vid_d_width = d_width; - vc->vid_d_height = d_height; free_video_specific(vo); if (IMGFMT_IS_VDPAU(vc->image_format) && !create_vdp_decoder(vo, 2)) @@ -1531,8 +1528,8 @@ static struct mp_image *get_screenshot(struct vo *vo) image->width = vc->vid_width; image->height = vc->vid_height; - image->w = vc->vid_d_width; - image->h = vc->vid_d_height; + image->w = vo->aspdat.prew; + image->h = vo->aspdat.preh; return image; } diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 42ddde890a..922fd55cf7 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -77,8 +77,6 @@ struct xvctx { uint32_t image_width; uint32_t image_height; uint32_t image_format; - uint32_t image_d_width; - uint32_t image_d_height; int is_paused; struct vo_rect src_rect; struct vo_rect dst_rect; @@ -193,8 +191,6 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, ctx->image_height = height; ctx->image_width = width; ctx->image_format = format; - ctx->image_d_width = d_width; - ctx->image_d_height = d_height; if ((ctx->max_width != 0 && ctx->max_height != 0) && (ctx->image_width > ctx->max_width @@ -517,8 +513,8 @@ static mp_image_t *get_screenshot(struct vo *vo) w, h, image->stride[p2], xv_image->pitches[2]); } - image->w = ctx->image_d_width; - image->h = ctx->image_d_height; + image->w = vo->aspdat.prew; + image->h = vo->aspdat.preh; return image; } -- cgit v1.2.3