summaryrefslogtreecommitdiffstats
path: root/video/out/vo.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-08 01:35:44 +0200
committerwm4 <wm4@nowhere>2013-06-28 20:34:46 +0200
commit3382a6f6e48c7e093c2b7e0e4a0e28b60a084358 (patch)
treecc50df6d6ae5ffa6b1f7d3eb4e816a3afcfd1641 /video/out/vo.c
parent823e0c511bea235be06d5e2037ef9d0b345d9405 (diff)
downloadmpv-3382a6f6e48c7e093c2b7e0e4a0e28b60a084358.tar.bz2
mpv-3382a6f6e48c7e093c2b7e0e4a0e28b60a084358.tar.xz
video: add a new method to configure filters and VOs
The filter chain and the video ouputs have config() functions. They are strictly limited to transfering the video size and format. Other parameters (like color levels) have to be transferred separately. Improve upon this by introducing a separate set of reconfig() functions, which use mp_image_params to carry format parameters. This struct contains all image format related parameters from config(), plus additional parameters such as colorspace. Change vf_rotate to use it, as well as vo_opengl. vf_rotate is just an example/test case, but vo_opengl will need it later. The intention is also to get rid of VOCTRL_SET_YUV_COLORSPACE. This information is now handed to the VOs via reconfig(). The getter, VOCTRL_GET_YUV_COLORSPACE, will still be needed though.
Diffstat (limited to 'video/out/vo.c')
-rw-r--r--video/out/vo.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index c621f37472..02d51bf7b6 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -406,21 +406,34 @@ static int event_fd_callback(void *ctx, int fd)
return MP_INPUT_NOTHING;
}
-int vo_config(struct vo *vo, uint32_t width, uint32_t height,
- uint32_t d_width, uint32_t d_height, uint32_t flags,
- uint32_t format)
+int vo_reconfig(struct vo *vo, struct mp_image_params *params, int flags)
{
- aspect_save_videores(vo, width, height, d_width, d_height);
+ int d_width = params->d_w;
+ int d_height = params->d_h;
+ aspect_save_videores(vo, params->w, params->h, d_width, d_height);
if (vo_control(vo, VOCTRL_UPDATE_SCREENINFO, NULL) == VO_TRUE) {
- determine_window_geometry(vo, d_width, d_height);
+ determine_window_geometry(vo, params->d_w, params->d_h);
d_width = vo->dwidth;
d_height = vo->dheight;
}
+ vo->dwidth = d_width;
+ vo->dheight = d_height;
- int ret = vo->driver->config(vo, width, height, d_width, d_height, flags,
- format);
- vo->config_ok = (ret == 0);
+ struct mp_image_params p2 = *params;
+ p2.d_w = vo->aspdat.prew;
+ p2.d_h = vo->aspdat.preh;
+
+ int ret;
+ if (vo->driver->reconfig) {
+ ret = vo->driver->reconfig(vo, &p2, flags);
+ } else {
+ // Old config() takes window size, while reconfig() takes aspect (!)
+ ret = vo->driver->config(vo, p2.w, p2.h, d_width, d_height, flags,
+ p2.imgfmt);
+ ret = ret ? -1 : 0;
+ }
+ vo->config_ok = (ret >= 0);
vo->config_count += vo->config_ok;
if (vo->registered_fd == -1 && vo->event_fd != -1 && vo->config_ok) {
mp_input_add_key_fd(vo->input_ctx, vo->event_fd, 1, event_fd_callback,