1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 17:42:17 +00:00

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.)
This commit is contained in:
wm4 2012-10-20 19:31:44 +02:00
parent 842402c6ca
commit 8c75a38d5f
4 changed files with 8 additions and 24 deletions

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}