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 @@
1change the underlying type of the `aspect`, `par`, and `sar` sub-properties to double from float1change the underlying type of the `aspect`, `par`, and `sar` sub-properties to double from float
2deprecate 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
1572 1572
1573 This option has no effect if ``--video-unscaled`` option is used.1573 This option has no effect if ``--video-unscaled`` option is used.
1574 1574
1575``--video-aspect-override=<ratio|no>``1575``--video-aspect-override=<ratio|no|original>``
1576 Override video aspect ratio, in case aspect information is incorrect or1576 Override video aspect ratio, in case aspect information is incorrect or
1577 missing in the file being played.1577 missing in the file being played.
1578 1578
@@ -1580,7 +1580,8 @@ Video · 1 unmodified line
1580 1580
1581 :0: disable aspect ratio handling, pretend the video has square pixels1581 :0: disable aspect ratio handling, pretend the video has square pixels
1582 :no: same as ``0``1582 :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)
1584 1585
1585 But note that handling of these special values might change in the future.1586 But note that handling of these special values might change in the future.
1586 1587
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
1119 1119
1120 // Potentially allow -1 but forbid all other negative values.1120 // Potentially allow -1 but forbid all other negative values.
1121 if (opt->defval && *(double *)opt->defval == -1) {1121 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
1122 struct bstr rest;1128 struct bstr rest;
1123 double val = bstrtod(param, &rest);1129 double val = bstrtod(param, &rest);
1124 if (bstr_eatstart0(&rest, ":") || bstr_eatstart0(&rest, "/"))1130 if (bstr_eatstart0(&rest, ":") || bstr_eatstart0(&rest, "/"))
1125 val /= bstrtod(rest, &rest);1131 val /= bstrtod(rest, &rest);
1126 if (val == -1 && dst) {1132 if (val == -1 && dst) {
1127 VAL(dst) = -1.0;1133 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));
1128 return 1;1136 return 1;
1129 }1137 }
1130 }1138 }

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