Mercurial > mplayer.hg
comparison libmpcodecs/vf_expand.c @ 29624:b73705bd899f
Always keep a backup of the expand values from the command-line, so values
will be recalculated correctly e.g. after aspect change and -vf expand=aspect=4/3
command line.
author | reimar |
---|---|
date | Thu, 10 Sep 2009 16:49:20 +0000 |
parents | d401b1eefcad |
children | 209b805a26a9 |
comparison
equal
deleted
inserted
replaced
29623:7075d11f3535 | 29624:b73705bd899f |
---|---|
22 | 22 |
23 #include "m_option.h" | 23 #include "m_option.h" |
24 #include "m_struct.h" | 24 #include "m_struct.h" |
25 | 25 |
26 static struct vf_priv_s { | 26 static struct vf_priv_s { |
27 // These four values are a backup of the values parsed from the command line. | |
28 // This is necessary so that we do not get a mess upon filter reinit due to | |
29 // e.g. aspect changes and with only aspect specified on the command line, | |
30 // where we would otherwise use the values calculated for a different aspect | |
31 // instead of recalculating them again. | |
32 int cfg_exp_w, cfg_exp_h; | |
33 int cfg_exp_x, cfg_exp_y; | |
27 int exp_w,exp_h; | 34 int exp_w,exp_h; |
28 int exp_x,exp_y; | 35 int exp_x,exp_y; |
29 int osd; | 36 int osd; |
30 double aspect; | 37 double aspect; |
31 int round; | 38 int round; |
192 if(outfmt == IMGFMT_MPEGPES) { | 199 if(outfmt == IMGFMT_MPEGPES) { |
193 vf->priv->passthrough = 1; | 200 vf->priv->passthrough = 1; |
194 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); | 201 return vf_next_config(vf,width,height,d_width,d_height,flags,outfmt); |
195 } | 202 } |
196 if (outfmt == IMGFMT_IF09) return 0; | 203 if (outfmt == IMGFMT_IF09) return 0; |
204 vf->priv->exp_x = vf->priv->cfg_exp_x; | |
205 vf->priv->exp_y = vf->priv->cfg_exp_y; | |
206 vf->priv->exp_w = vf->priv->cfg_exp_w; | |
207 vf->priv->exp_h = vf->priv->cfg_exp_h; | |
197 // calculate the missing parameters: | 208 // calculate the missing parameters: |
198 #if 0 | 209 #if 0 |
199 if(vf->priv->exp_w<width) vf->priv->exp_w=width; | 210 if(vf->priv->exp_w<width) vf->priv->exp_w=width; |
200 if(vf->priv->exp_h<height) vf->priv->exp_h=height; | 211 if(vf->priv->exp_h<height) vf->priv->exp_h=height; |
201 #else | 212 #else |
430 vf->start_slice=start_slice; | 441 vf->start_slice=start_slice; |
431 vf->draw_slice=draw_slice; | 442 vf->draw_slice=draw_slice; |
432 vf->get_image=get_image; | 443 vf->get_image=get_image; |
433 vf->put_image=put_image; | 444 vf->put_image=put_image; |
434 mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d, osd: %d, aspect: %lf, round: %d\n", | 445 mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d, osd: %d, aspect: %lf, round: %d\n", |
435 vf->priv->exp_w, | 446 vf->priv->cfg_exp_w, |
436 vf->priv->exp_h, | 447 vf->priv->cfg_exp_h, |
437 vf->priv->exp_x, | 448 vf->priv->cfg_exp_x, |
438 vf->priv->exp_y, | 449 vf->priv->cfg_exp_y, |
439 vf->priv->osd, | 450 vf->priv->osd, |
440 vf->priv->aspect, | 451 vf->priv->aspect, |
441 vf->priv->round); | 452 vf->priv->round); |
442 return 1; | 453 return 1; |
443 } | 454 } |
444 | 455 |
445 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) | 456 #define ST_OFF(f) M_ST_OFF(struct vf_priv_s,f) |
446 static m_option_t vf_opts_fields[] = { | 457 static m_option_t vf_opts_fields[] = { |
447 {"w", ST_OFF(exp_w), CONF_TYPE_INT, 0, 0 ,0, NULL}, | 458 {"w", ST_OFF(cfg_exp_w), CONF_TYPE_INT, 0, 0 ,0, NULL}, |
448 {"h", ST_OFF(exp_h), CONF_TYPE_INT, 0, 0 ,0, NULL}, | 459 {"h", ST_OFF(cfg_exp_h), CONF_TYPE_INT, 0, 0 ,0, NULL}, |
449 {"x", ST_OFF(exp_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL}, | 460 {"x", ST_OFF(cfg_exp_x), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL}, |
450 {"y", ST_OFF(exp_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL}, | 461 {"y", ST_OFF(cfg_exp_y), CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL}, |
451 {"osd", ST_OFF(osd), CONF_TYPE_FLAG, 0 , 0, 1, NULL}, | 462 {"osd", ST_OFF(osd), CONF_TYPE_FLAG, 0 , 0, 1, NULL}, |
452 {"aspect", ST_OFF(aspect), CONF_TYPE_DOUBLE, M_OPT_MIN, 0, 0, NULL}, | 463 {"aspect", ST_OFF(aspect), CONF_TYPE_DOUBLE, M_OPT_MIN, 0, 0, NULL}, |
453 {"round", ST_OFF(round), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL}, | 464 {"round", ST_OFF(round), CONF_TYPE_INT, M_OPT_MIN, 1, 0, NULL}, |
454 { NULL, NULL, 0, 0, 0, 0, NULL } | 465 { NULL, NULL, 0, 0, 0, 0, NULL } |
455 }; | 466 }; |