mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-22 10:57:08 +00:00
f_decoder_wrapper: add --video-aspect-method=ignore
This adds --video-aspect-method=ignore to replace --video-aspect-override=0. --video-aspect-override=0 and --video-aspect-override=-1 will no longer be handled specially. For compatibility, 0 is mapped to always use ignore and -1 is always mapped to always use container. "no" is now the replacement for --video-aspect-override=-1, which is internally remapped to -2 to avoid using a deprecated value.
This commit is contained in:
@@ -1 +1,3 @@
|
||||
change the underlying type of the `aspect`, `par`, and `sar` sub-properties to double from float
|
||||
add `--video-aspect-method=ignore`
|
||||
change `--video-aspect-override=no` to respect `--video-aspect-method` option
|
||||
|
||||
@@ -1591,9 +1591,12 @@ Video
|
||||
|
||||
These values have special meaning:
|
||||
|
||||
:no: use the method of the ``--video-aspect-method`` option (default)
|
||||
:0: disable aspect ratio handling, pretend the video has square pixels
|
||||
:no: same as ``0``
|
||||
:-1: use the video stream or container aspect (default)
|
||||
(deprecated, use
|
||||
``--video-aspect-override=no --video-aspect-method=ignore`` instead)
|
||||
:-1: strictly prefer the container aspect ratio (deprecated, use
|
||||
``--video-aspect-override=no --video-aspect-method=container`` instead)
|
||||
|
||||
But note that handling of these special values might change in the future.
|
||||
|
||||
@@ -1603,7 +1606,7 @@ Video
|
||||
- ``--video-aspect-override=16:9`` or ``--video-aspect-override=1.7777``
|
||||
- ``--no-video-aspect-override`` or ``--video-aspect-override=no``
|
||||
|
||||
``--video-aspect-method=<bitstream|container>``
|
||||
``--video-aspect-method=<bitstream|container|ignore>``
|
||||
This sets the default video aspect determination method (if the aspect is
|
||||
_not_ overridden by the user with ``--video-aspect-override`` or others).
|
||||
|
||||
@@ -1614,6 +1617,8 @@ Video
|
||||
:bitstream: Strictly prefer the bitstream aspect ratio, unless the bitstream
|
||||
aspect ratio is not set. This is apparently the default behavior
|
||||
with XBMC/kodi, at least with Matroska.
|
||||
:ignore: Disable aspect ratio handling, pretend the video has square
|
||||
pixels.
|
||||
|
||||
The current default for mpv is ``container``.
|
||||
|
||||
|
||||
@@ -125,9 +125,9 @@ const struct m_sub_options dec_wrapper_conf = {
|
||||
{"video-rotate", OPT_CHOICE(video_rotate, {"no", -1}),
|
||||
.flags = UPDATE_IMGPAR, M_RANGE(0, 359)},
|
||||
{"video-aspect-override", OPT_ASPECT(movie_aspect),
|
||||
.flags = UPDATE_IMGPAR, M_RANGE(-1, 10)},
|
||||
.flags = UPDATE_IMGPAR, M_RANGE(-2, 10)},
|
||||
{"video-aspect-method", OPT_CHOICE(aspect_method,
|
||||
{"bitstream", 1}, {"container", 2}),
|
||||
{"bitstream", 1}, {"container", 2}, {"ignore", 3}),
|
||||
.flags = UPDATE_IMGPAR},
|
||||
{"vd-queue", OPT_SUBSTRUCT(vdec_queue_opts, vdec_queue_conf)},
|
||||
{"ad-queue", OPT_SUBSTRUCT(adec_queue_opts, adec_queue_conf)},
|
||||
@@ -140,7 +140,7 @@ const struct m_sub_options dec_wrapper_conf = {
|
||||
.size = sizeof(struct dec_wrapper_opts),
|
||||
.defaults = &(const struct dec_wrapper_opts){
|
||||
.correct_pts = true,
|
||||
.movie_aspect = -1.,
|
||||
.movie_aspect = -2.,
|
||||
.aspect_method = 2,
|
||||
.video_reverse_size = 1 * 1024 * 1024 * 1024,
|
||||
.audio_reverse_size = 64 * 1024 * 1024,
|
||||
@@ -557,12 +557,20 @@ static void fix_image_params(struct priv *p,
|
||||
// While mp_image_params normally always have to have d_w/d_h set, the
|
||||
// decoder signals unknown bitstream aspect ratio with both set to 0.
|
||||
bool use_container = true;
|
||||
if (opts->aspect_method == 1 && m.p_w > 0 && m.p_h > 0) {
|
||||
if (opts->aspect_method == 1 && m.p_w > 0 && m.p_h > 0 &&
|
||||
opts->movie_aspect != -1) {
|
||||
if (!quiet)
|
||||
MP_VERBOSE(p, "Using bitstream aspect ratio.\n");
|
||||
use_container = false;
|
||||
}
|
||||
|
||||
if (opts->aspect_method == 3 && opts->movie_aspect != -1) {
|
||||
if (!quiet)
|
||||
MP_VERBOSE(p, "Ignoring aspect ratio.\n");
|
||||
use_container = false;
|
||||
m.p_w = m.p_h = 1;
|
||||
}
|
||||
|
||||
if (use_container && c->par_w > 0 && c->par_h) {
|
||||
if (!quiet)
|
||||
MP_VERBOSE(p, "Using container aspect ratio.\n");
|
||||
|
||||
@@ -1113,7 +1113,7 @@ static int parse_double_aspect(struct mp_log *log, const m_option_t *opt,
|
||||
{
|
||||
if (bstr_equals0(param, "no")) {
|
||||
if (dst)
|
||||
VAL(dst) = 0.0;
|
||||
VAL(dst) = -2.0;
|
||||
return 1;
|
||||
}
|
||||
return parse_double(log, opt, name, param, dst);
|
||||
|
||||
Reference in New Issue
Block a user