summaryrefslogtreecommitdiffstats
path: root/video/out/vo_xv.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-10 02:02:24 +0100
committerwm4 <wm4@nowhere>2013-01-13 17:39:32 +0100
commitd77d9fb933e0e7dc34de02f3d0c13791ddd80114 (patch)
treeca45e0f9d753e7ee7b5bd142eb2aed1638bf391c /video/out/vo_xv.c
parent1568161aadf24ee3a6d982612b7380f8b1dc4a58 (diff)
downloadmpv-d77d9fb933e0e7dc34de02f3d0c13791ddd80114.tar.bz2
mpv-d77d9fb933e0e7dc34de02f3d0c13791ddd80114.tar.xz
mp_image: require using mp_image_set_size() for setting w/h
Setting the size of a mp_image must be done with mp_image_set_size() now. Do this to guarantee that the redundant fields (like chroma_width) are updated consistently. Replacing the redundant fields by function calls would probably be better, but there are too many uses of them, and is a bit less convenient. Most code actually called mp_image_setfmt(), which did this as well. This commit just makes things a bit more explicit. Warning: the video filter chain still sets up mp_images manually, and vf_get_image() is not updated.
Diffstat (limited to 'video/out/vo_xv.c')
-rw-r--r--video/out/vo_xv.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/video/out/vo_xv.c b/video/out/vo_xv.c
index cc4d55777d..46fe4649f5 100644
--- a/video/out/vo_xv.c
+++ b/video/out/vo_xv.c
@@ -318,8 +318,7 @@ static struct mp_image get_xv_buffer(struct vo *vo, int buf_index)
XvImage *xv_image = ctx->xvimage[buf_index];
struct mp_image img = {0};
- img.w = img.width = ctx->image_width;
- img.h = img.height = ctx->image_height;
+ mp_image_set_size(&img, ctx->image_width, ctx->image_height);
mp_image_setfmt(&img, ctx->image_format);
bool swapuv = ctx->image_format == IMGFMT_YV12;
@@ -398,10 +397,9 @@ static mp_image_t *get_screenshot(struct vo *vo)
struct mp_image *res = alloc_mpi(img.w, img.h, img.imgfmt);
copy_mpi(res, &img);
vf_clone_mpi_attributes(res, &img);
+ mp_image_set_display_size(res, vo->aspdat.prew, vo->aspdat.preh);
// try to get an image without OSD
mp_draw_sub_backup_restore(ctx->osd_backup, res);
- res->display_w = vo->aspdat.prew;
- res->display_h = vo->aspdat.preh;
return res;
}