Function: escapeAfParam()
function escapeAfParam(value: string): string;
Defined in: packages/player/src/filters.ts:114
Escape one filter sub-option key or value the way mpv itself does.
mpv's serialiser (options/m_option.c: append_param) writes a parameter
verbatim when every character is in mpv's NAMECH alphabet, and otherwise as
%<bytecount>%<string>. Its parser accepts exactly that form
(read_subparam, the bstr_eatstart0(&p, "%") branch), so applying the same
rule here makes the compiled string byte-identical to what reading the af
property back returns — which is what the round-trip test asserts.
The rule itself lives in subparam.ts because loadfile's per-file option
list is read back by the same mpv function and needs the identical
treatment; this name is kept as the filter-facing spelling of it.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | Raw key or value. |
Returns
string
The escaped form, safe to place in an af string.