summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-10-01 13:21:56 -0500
committerDudemanguy <random342@airmail.cc>2023-10-07 02:41:27 +0000
commitda4f11803febd0e75d3d62a965e17731bd328506 (patch)
tree1005b2176a25dd45080f6b699697fa6399f96fb1
parent50b23a8c4493517fa2130250d22d94bca4e27804 (diff)
downloadmpv-da4f11803febd0e75d3d62a965e17731bd328506.tar.bz2
mpv-da4f11803febd0e75d3d62a965e17731bd328506.tar.xz
demux: change the default of metadata-codepage to auto
There's really no reason not to do this especially since sub-codepage already defaults to auto. Also change logging in charset_conv since telling us that the data is UTF-8 if the passed codepage value is "auto" or "utf-8" is really not useful information (that's the expectation).
-rw-r--r--DOCS/interface-changes.rst1
-rw-r--r--DOCS/man/options.rst7
-rw-r--r--demux/demux.c2
-rw-r--r--misc/charset_conv.c3
4 files changed, 7 insertions, 6 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index b9fbb9739c..62d271bcb1 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -97,6 +97,7 @@ Interface changes
- add `--window-affinity` option
- `--config-dir` no longer forces cache and state files to also reside in there
- deprecate `--demuxer-cue-codepage` in favor of `--metadata-codepage`
+ - change the default of `metadata-codepage` to `auto`
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index eb1fc01542..df8ff154e4 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -7315,10 +7315,9 @@ Miscellaneous
filters.
``--metadata-codepage=<codepage>``
- Codepage for various input metadata (default: ``utf-8``). This affects how
- file tags, chapter titles, etc. are interpreted. You can for example set
- this to ``auto`` to enable autodetection of the codepage. (This is not the
- default because non-UTF-8 codepages are an obscure fringe use-case.)
+ Codepage for various input metadata (default: ``auto``). This affects how
+ file tags, chapter titles, etc. are interpreted. In most cases, this merely
+ evaluates to UTF-8 as non-UTF-8 codepages are obscure.
See ``--sub-codepage`` option on how codepages are specified and further
details regarding autodetection and codepage conversion. (The underlying
diff --git a/demux/demux.c b/demux/demux.c
index d3da4a0fd1..e0b585e376 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -142,7 +142,7 @@ const struct m_sub_options demux_conf = {
[STREAM_VIDEO] = 1,
[STREAM_AUDIO] = 10,
},
- .meta_cp = "utf-8",
+ .meta_cp = "auto",
},
.get_sub_options = get_demux_sub_opts,
};
diff --git a/misc/charset_conv.c b/misc/charset_conv.c
index f649057fe8..3668f3b652 100644
--- a/misc/charset_conv.c
+++ b/misc/charset_conv.c
@@ -114,7 +114,8 @@ const char *mp_charset_guess(void *talloc_ctx, struct mp_log *log, bstr buf,
int r = bstr_validate_utf8(buf);
if (r >= 0 || (r > -8 && (flags & MP_ICONV_ALLOW_CUTOFF))) {
- mp_verbose(log, "Data looks like UTF-8, ignoring user-provided charset.\n");
+ if (strcmp(user_cp, "auto") != 0 && !mp_charset_is_utf8(user_cp))
+ mp_verbose(log, "Data looks like UTF-8, ignoring user-provided charset.\n");
return "utf-8";
}