diff options
author | wm4 <wm4@nowhere> | 2013-06-08 01:35:44 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-28 20:34:46 +0200 |
commit | 3382a6f6e48c7e093c2b7e0e4a0e28b60a084358 (patch) | |
tree | cc50df6d6ae5ffa6b1f7d3eb4e816a3afcfd1641 /video/filter/vf_rotate.c | |
parent | 823e0c511bea235be06d5e2037ef9d0b345d9405 (diff) | |
download | mpv-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/filter/vf_rotate.c')
-rw-r--r-- | video/filter/vf_rotate.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/video/filter/vf_rotate.c b/video/filter/vf_rotate.c index 0e5fbdbd37..94132848fb 100644 --- a/video/filter/vf_rotate.c +++ b/video/filter/vf_rotate.c @@ -65,21 +65,24 @@ static void rotate(unsigned char* dst,unsigned char* src,int dststride,int srcst } } -static int config(struct vf_instance *vf, int width, int height, - int d_width, int d_height, - unsigned int flags, unsigned int outfmt) +static int reconfig(struct vf_instance *vf, struct mp_image_params *p, int flags) { if (vf->priv->direction & 4) { - if (width < height) + if (p->w < p->h) vf->priv->direction &= 3; } if (vf->priv->direction & 4) - return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); - struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(outfmt); - int a_w = MP_ALIGN_DOWN(width, desc.align_x); - int a_h = MP_ALIGN_DOWN(height, desc.align_y); - vf_rescale_dsize(&d_width, &d_height, width, height, a_w, a_h); - return vf_next_config(vf, a_h, a_w, d_height, d_width, flags, outfmt); + return vf_next_reconfig(vf, p, flags); + struct mp_imgfmt_desc desc = mp_imgfmt_get_desc(p->imgfmt); + int a_w = MP_ALIGN_DOWN(p->w, desc.align_x); + int a_h = MP_ALIGN_DOWN(p->h, desc.align_y); + vf_rescale_dsize(&p->d_w, &p->d_h, p->w, p->h, a_w, a_h); + p->w = a_h; + p->h = a_w; + int t = p->d_w; + p->d_w = p->d_h; + p->d_h = t; + return vf_next_reconfig(vf, p, flags); } static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) @@ -113,7 +116,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) } static int vf_open(vf_instance_t *vf, char *args){ - vf->config=config; + vf->reconfig=reconfig; vf->filter=filter; vf->query_format=query_format; vf->priv=malloc(sizeof(struct vf_priv_s)); |