mirror of https://github.com/mpv-player/mpv
vf_format: allow forcing aspect ratio
Makes vf_dsize completely useless. Unfortunately, even our "official" encoding profiles still use it.
This commit is contained in:
parent
8585845c64
commit
8fbc64f74e
|
@ -319,6 +319,11 @@ Available filters are:
|
||||||
the video is scaled in both directions instead of just changing the
|
the video is scaled in both directions instead of just changing the
|
||||||
aspect ratio is an implementation detail, and might change later.
|
aspect ratio is an implementation detail, and might change later.
|
||||||
|
|
||||||
|
``<dar>``
|
||||||
|
Set the display aspect ratio of the video frame. This is a float,
|
||||||
|
but values such as ``[16:9]`` can be passed too (``[...]`` for quoting
|
||||||
|
to prevent the option parser from interpreting the ``:`` character).
|
||||||
|
|
||||||
|
|
||||||
``noformat[=fmt]``
|
``noformat[=fmt]``
|
||||||
Restricts the color space for the next filter without doing any conversion.
|
Restricts the color space for the next filter without doing any conversion.
|
||||||
|
|
|
@ -42,6 +42,7 @@ struct vf_priv_s {
|
||||||
int stereo_out;
|
int stereo_out;
|
||||||
int rotate;
|
int rotate;
|
||||||
int dw, dh;
|
int dw, dh;
|
||||||
|
double dar;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool is_compatible(int fmt1, int fmt2)
|
static bool is_compatible(int fmt1, int fmt2)
|
||||||
|
@ -104,6 +105,8 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in,
|
||||||
out->d_w = p->dw;
|
out->d_w = p->dw;
|
||||||
if (p->dh > 0)
|
if (p->dh > 0)
|
||||||
out->d_h = p->dh;
|
out->d_h = p->dh;
|
||||||
|
if (p->dar > 0)
|
||||||
|
vf_set_dar(&out->d_w, &out->d_h, out->w, out->h, p->dar);
|
||||||
|
|
||||||
// Make sure the user-overrides are consistent (no RGB csp for YUV, etc.).
|
// Make sure the user-overrides are consistent (no RGB csp for YUV, etc.).
|
||||||
mp_image_params_guess_csp(out);
|
mp_image_params_guess_csp(out);
|
||||||
|
@ -140,6 +143,7 @@ static const m_option_t vf_opts_fields[] = {
|
||||||
OPT_INTRANGE("rotate", rotate, 0, -1, 359),
|
OPT_INTRANGE("rotate", rotate, 0, -1, 359),
|
||||||
OPT_INT("dw", dw, 0),
|
OPT_INT("dw", dw, 0),
|
||||||
OPT_INT("dh", dh, 0),
|
OPT_INT("dh", dh, 0),
|
||||||
|
OPT_DOUBLE("dar", dar, 0),
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue