aspect: add --video-unscaled=downscale-big

This commit is contained in:
rr- 2016-08-19 10:24:26 +02:00 committed by wm4
parent 23993e91f3
commit ed644b0d33
3 changed files with 13 additions and 7 deletions

View File

@ -738,10 +738,11 @@ Video
choices if you encounter video that has the wrong aspect ratio in mpv,
but seems to be correct in other players.
``--video-unscaled``
``--video-unscaled=<no|yes|downscale-big>``
Disable scaling of the video. If the window is larger than the video,
black bars are added. Otherwise, the video is cropped. The video still
can be influenced by the other ``--video-...`` options.
black bars are added. Otherwise, the video is cropped, unless the option
is set to ``downscale-big``, in which case the video is fit to window. The
video still can be influenced by the other ``--video-...`` options.
Note that the scaler algorithm may still be used, even if the video isn't
scaled. For example, this can influence chroma conversion. The video will

View File

@ -454,7 +454,8 @@ const m_option_t mp_opts[] = {
OPT_FLOATRANGE("video-pan-y", vo.pan_y, 0, -3.0, 3.0),
OPT_FLOATRANGE("video-align-x", vo.align_x, 0, -1.0, 1.0),
OPT_FLOATRANGE("video-align-y", vo.align_y, 0, -1.0, 1.0),
OPT_FLAG("video-unscaled", vo.unscaled, 0),
OPT_CHOICE("video-unscaled", vo.unscaled, 0,
({"no", 0}, {"yes", 1}, {"downscale-big", 2})),
OPT_FLAG("force-rgba-osd-rendering", force_rgba_osd, 0),
OPT_CHOICE_OR_INT("video-rotate", video_rotate, 0, 0, 359,
({"no", -1})),

View File

@ -27,10 +27,12 @@
#include "sub/osd.h"
static void aspect_calc_panscan(struct mp_vo_opts *opts,
int w, int h, int d_w, int d_h, bool unscaled,
int w, int h, int d_w, int d_h, int unscaled,
int window_w, int window_h, double monitor_par,
int *out_w, int *out_h)
{
w *= monitor_par;
int fwidth = window_w;
int fheight = (float)window_w / d_w * d_h / monitor_par;
if (fheight > window_h || fheight < h) {
@ -51,9 +53,11 @@ static void aspect_calc_panscan(struct mp_vo_opts *opts,
}
if (unscaled) {
fwidth = w * monitor_par;
fheight = h;
vo_panscan_area = 0;
if (unscaled != 2 || (w <= window_w && h <= window_h)) {
fwidth = w;
fheight = h;
}
}
*out_w = fwidth + vo_panscan_area * opts->panscan * f_w;