mirror of
https://github.com/mpv-player/mpv
synced 2024-12-23 15:22:09 +00:00
vf_format: add w, h parameters
Yes, this thing became vf_scale through the back door.
This commit is contained in:
parent
eb1d50ba20
commit
ee4a8f0d57
@ -321,6 +321,10 @@ Available mpv-only filters are:
|
||||
Set the rotation the video is assumed to be encoded with in degrees.
|
||||
The special value ``-1`` uses the input format.
|
||||
|
||||
``<w>``, ``<h>``
|
||||
If not 0, perform conversion to the given size. Ignored if
|
||||
``convert=yes`` is not set.
|
||||
|
||||
``<dw>``, ``<dh>``
|
||||
Set the display size. Note that setting the display size such that
|
||||
the video is scaled in both directions instead of just changing the
|
||||
|
@ -50,12 +50,14 @@ struct vf_format_opts {
|
||||
int chroma_location;
|
||||
int stereo_in;
|
||||
int rotate;
|
||||
int w, h;
|
||||
int dw, dh;
|
||||
double dar;
|
||||
int convert;
|
||||
};
|
||||
|
||||
static void set_params(struct vf_format_opts *p, struct mp_image_params *out)
|
||||
static void set_params(struct vf_format_opts *p, struct mp_image_params *out,
|
||||
bool set_size)
|
||||
{
|
||||
if (p->colormatrix)
|
||||
out->color.space = p->colormatrix;
|
||||
@ -85,6 +87,10 @@ static void set_params(struct vf_format_opts *p, struct mp_image_params *out)
|
||||
if (p->rotate >= 0)
|
||||
out->rotate = p->rotate;
|
||||
|
||||
if (p->w > 0 && set_size)
|
||||
out->w = p->w;
|
||||
if (p->h > 0 && set_size)
|
||||
out->h = p->h;
|
||||
AVRational dsize;
|
||||
mp_image_params_get_dsize(out, &dsize.num, &dsize.den);
|
||||
if (p->dw > 0)
|
||||
@ -115,7 +121,7 @@ static void vf_format_process(struct mp_filter *f)
|
||||
par.color.levels = MP_CSP_LEVELS_TV;
|
||||
}
|
||||
|
||||
set_params(priv->opts, &par);
|
||||
set_params(priv->opts, &par, true);
|
||||
|
||||
if (par.imgfmt != outfmt) {
|
||||
par.imgfmt = outfmt;
|
||||
@ -135,7 +141,7 @@ static void vf_format_process(struct mp_filter *f)
|
||||
if (!priv->opts->convert && frame.type == MP_FRAME_VIDEO) {
|
||||
struct mp_image *img = frame.data;
|
||||
|
||||
set_params(priv->opts, &img->params);
|
||||
set_params(priv->opts, &img->params, false);
|
||||
mp_image_params_guess_csp(&img->params);
|
||||
}
|
||||
|
||||
@ -187,6 +193,8 @@ static const m_option_t vf_opts_fields[] = {
|
||||
OPT_CHOICE_C("chroma-location", chroma_location, 0, mp_chroma_names),
|
||||
OPT_CHOICE_C("stereo-in", stereo_in, 0, mp_stereo3d_names),
|
||||
OPT_INTRANGE("rotate", rotate, 0, -1, 359),
|
||||
OPT_INT("w", w, 0),
|
||||
OPT_INT("h", h, 0),
|
||||
OPT_INT("dw", dw, 0),
|
||||
OPT_INT("dh", dh, 0),
|
||||
OPT_DOUBLE("dar", dar, 0),
|
||||
|
Loading…
Reference in New Issue
Block a user