summaryrefslogtreecommitdiffstats
path: root/video/filter/vf_expand.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/filter/vf_expand.c')
-rw-r--r--video/filter/vf_expand.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/video/filter/vf_expand.c b/video/filter/vf_expand.c
index 6d5b694613..69574efff3 100644
--- a/video/filter/vf_expand.c
+++ b/video/filter/vf_expand.c
@@ -55,10 +55,11 @@ static struct vf_priv_s {
//===========================================================================//
-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 *in,
+ struct mp_image_params *out)
{
+ int width = in->w, height = in->h;
+
vf->priv->exp_x = vf->priv->cfg_exp_x;
vf->priv->exp_y = vf->priv->cfg_exp_y;
vf->priv->exp_w = vf->priv->cfg_exp_w;
@@ -71,7 +72,7 @@ static int config(struct vf_instance *vf,
else if( vf->priv->exp_h<height ) vf->priv->exp_h=height;
if (vf->priv->aspect) {
float adjusted_aspect = vf->priv->aspect;
- adjusted_aspect *= ((double)width/height) / ((double)d_width/d_height);
+ adjusted_aspect *= ((double)width/height) / ((double)in->d_w/in->d_h);
if (vf->priv->exp_h < vf->priv->exp_w / adjusted_aspect) {
vf->priv->exp_h = vf->priv->exp_w / adjusted_aspect + 0.5;
} else {
@@ -86,15 +87,19 @@ static int config(struct vf_instance *vf,
if(vf->priv->exp_x<0 || vf->priv->exp_x+width>vf->priv->exp_w) vf->priv->exp_x=(vf->priv->exp_w-width)/2;
if(vf->priv->exp_y<0 || vf->priv->exp_y+height>vf->priv->exp_h) vf->priv->exp_y=(vf->priv->exp_h-height)/2;
- struct mp_imgfmt_desc fmt = mp_imgfmt_get_desc(outfmt);
+ struct mp_imgfmt_desc fmt = mp_imgfmt_get_desc(in->imgfmt);
vf->priv->exp_x = MP_ALIGN_DOWN(vf->priv->exp_x, fmt.align_x);
vf->priv->exp_y = MP_ALIGN_DOWN(vf->priv->exp_y, fmt.align_y);
- vf_rescale_dsize(&d_width, &d_height, width, height,
+ *out = *in;
+ out->w = vf->priv->exp_w;
+ out->h = vf->priv->exp_h;
+
+ vf_rescale_dsize(&out->d_w, &out->d_h, width, height,
vf->priv->exp_w, vf->priv->exp_h);
- return vf_next_config(vf,vf->priv->exp_w,vf->priv->exp_h,d_width,d_height,flags,outfmt);
+ return 0;
}
static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi)
@@ -140,7 +145,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt)
}
static int vf_open(vf_instance_t *vf){
- vf->config=config;
+ vf->reconfig=reconfig;
vf->query_format=query_format;
vf->filter=filter;
return 1;