History

m_option: deprecate setting -1 to --video-aspect-override

It's unfortunate that it is implemented this way since changing it will take time. This option should *really* be like OPT_CHOICE but with doubles and not integers. We don't have that though and implementing it is something for the future. Even if that was done today, this still couldn't be switched to since setting -1 has been the effective way for years to undo video-aspect stuff. So the approach is to just add another special keyword for this and tell people to use that instead. Note that setting 0 isn't deprecated since M_RANGE(0, 10) is totally fine and would work in the future if this option type ever gets redone.

Dudemanguy committed 1 year ago

Commit 18257371 parent cb91de23 files · +12 −2Browse files

Unified · Split

3 files
  1. DOCS/interface-changes/aspect-properties.txt +1 −0
  2. DOCS/man/options.rst +3 −2
  3. options/m_option.c +8 −0
DOCS/interface-changes/aspect-properties.txt+1−0
@@ -1 +1,2 @@
11 change the underlying type of the `aspect`, `par`, and `sar` sub-properties to double from float
2+deprecate setting `--video-aspect-override` to `-1` in favor of the newly added `original` choice
DOCS/man/options.rst+3−2
@@ -1572,7 +1572,7 @@ Video · 1571 unmodified lines
15721572
15731573 This option has no effect if ``--video-unscaled`` option is used.
15741574
1575−``--video-aspect-override=<ratio|no>``
1575+``--video-aspect-override=<ratio|no|original>``
15761576 Override video aspect ratio, in case aspect information is incorrect or
15771577 missing in the file being played.
15781578
@@ -1580,7 +1580,8 @@ Video · 1 unmodified line
15801580
15811581 :0: disable aspect ratio handling, pretend the video has square pixels
15821582 :no: same as ``0``
1583− :-1: use the video stream or container aspect (default)
1583+ :original: use the video stream or container aspect (default)
1584+ :-1: same as ``1`` (deprecated)
15841585
15851586 But note that handling of these special values might change in the future.
15861587
options/m_option.c+8−0
@@ -1119,12 +1119,20 @@ static int parse_double_aspect(struct mp_log *log, const m_option_t *opt, · 1118 unmodified lines
11191119
11201120 // Potentially allow -1 but forbid all other negative values.
11211121 if (opt->defval && *(double *)opt->defval == -1) {
1122+ if (bstr_equals0(param, "original")) {
1123+ if (dst)
1124+ VAL(dst) = -1.0;
1125+ return 1;
1126+ }
1127+
11221128 struct bstr rest;
11231129 double val = bstrtod(param, &rest);
11241130 if (bstr_eatstart0(&rest, ":") || bstr_eatstart0(&rest, "/"))
11251131 val /= bstrtod(rest, &rest);
11261132 if (val == -1 && dst) {
11271133 VAL(dst) = -1.0;
1134+ mp_warn(log, "Setting '%.*s' to '%.*s' is deprecated. "
1135+ "Set 'original' instead.\n", BSTR_P(param), BSTR_P(name));
11281136 return 1;
11291137 }
11301138 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t