diff options
author | wm4 <wm4@nowhere> | 2012-10-26 19:29:47 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-11-01 02:07:45 +0100 |
commit | 738aeb1c60c6ffe95e915e443598f8a51081bdfb (patch) | |
tree | c10472cd8e646344d0d5e2bf1644adcb002c424a /libvo | |
parent | 9ba52ea6efd41db9dbd08311380f7fa633e22aa2 (diff) | |
download | mpv-738aeb1c60c6ffe95e915e443598f8a51081bdfb.tar.bz2 mpv-738aeb1c60c6ffe95e915e443598f8a51081bdfb.tar.xz |
screenshot: let VOs pass colorspace information via mp_image
This removes the hack that screenshot_save() got the colorspace
information from the decoder. Instead, require the VOs to set the
colorspace information on the mp_images used to pass around the
screenshot data. This is more correct, as the image may have been
converted/modified in the video filter chain, although there's
nothing yet in the video filter chain which does this correctly.
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/vo_corevideo.m | 2 | ||||
-rw-r--r-- | libvo/vo_direct3d.c | 2 | ||||
-rw-r--r-- | libvo/vo_image.c | 3 | ||||
-rw-r--r-- | libvo/vo_opengl.c | 2 | ||||
-rw-r--r-- | libvo/vo_opengl_old.c | 2 | ||||
-rw-r--r-- | libvo/vo_vdpau.c | 2 |
6 files changed, 12 insertions, 1 deletions
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m index c05863145c..0fd8510f39 100644 --- a/libvo/vo_corevideo.m +++ b/libvo/vo_corevideo.m @@ -381,6 +381,8 @@ static mp_image_t *get_screenshot(struct vo *vo) image->w = vo->aspdat.prew; image->h = vo->aspdat.preh; + mp_image_set_colorspace_details(image, &p->colorspace); + return image; } diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c index 2fa71d0d70..773cd5fb76 100644 --- a/libvo/vo_direct3d.c +++ b/libvo/vo_direct3d.c @@ -1804,6 +1804,8 @@ static mp_image_t *get_screenshot(d3d_priv *priv) image->w = priv->vo->aspdat.prew; image->h = priv->vo->aspdat.preh; + mp_image_set_colorspace_details(image, &priv->colorspace); + return image; } diff --git a/libvo/vo_image.c b/libvo/vo_image.c index b00ee1af8f..7f80a16f35 100644 --- a/libvo/vo_image.c +++ b/libvo/vo_image.c @@ -104,6 +104,7 @@ static uint32_t draw_image(struct vo *vo, mp_image_t *mpi) mp_image_t img = *mpi; img.width = p->d_width; img.height = p->d_height; + mp_image_set_colorspace_details(&img, &p->colorspace); void *t = talloc_new(NULL); char *filename = talloc_asprintf(t, "%08d.%s", p->frame, @@ -113,7 +114,7 @@ static uint32_t draw_image(struct vo *vo, mp_image_t *mpi) filename = mp_path_join(t, bstr0(p->outdir), bstr0(filename)); mp_msg(MSGT_VO, MSGL_STATUS, "\nSaving %s\n", filename); - write_image(&img, &p->colorspace, p->opts, filename); + write_image(&img, p->opts, filename); talloc_free(t); diff --git a/libvo/vo_opengl.c b/libvo/vo_opengl.c index 92a280f49b..cc7b7bde40 100644 --- a/libvo/vo_opengl.c +++ b/libvo/vo_opengl.c @@ -1400,6 +1400,8 @@ static mp_image_t *get_screenshot(struct gl_priv *p) image->w = p->vo->aspdat.prew; image->h = p->vo->aspdat.preh; + mp_image_set_colorspace_details(image, &p->colorspace); + return image; } diff --git a/libvo/vo_opengl_old.c b/libvo/vo_opengl_old.c index f9262e417d..4823576290 100644 --- a/libvo/vo_opengl_old.c +++ b/libvo/vo_opengl_old.c @@ -828,6 +828,8 @@ static mp_image_t *get_screenshot(struct vo *vo) image->w = vo->aspdat.prew; image->h = vo->aspdat.preh; + mp_image_set_colorspace_details(image, &p->colorspace); + return image; } diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index ba0e0993a2..3f5b7bc660 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -1365,6 +1365,8 @@ static struct mp_image *read_output_surface(struct vdpctx *vc, VdpStatus vdp_st; struct vdp_functions *vdp = vc->vdp; struct mp_image *image = alloc_mpi(width, height, IMGFMT_BGR32); + image->colorspace = MP_CSP_RGB; + image->levels = vc->colorspace.levels_out; // hardcoded with conv. matrix void *dst_planes[] = { image->planes[0] }; uint32_t dst_pitches[] = { image->stride[0] }; |