b56e63e2a9 removed this because it was
deprecated and not clearly useful. This commit adds this operation back
to string lists and keyvalue lists, but with one important change. It
operates via the actual values and not indexes. So you can use
--foo-del=bar,bar2 to remove bar and bar2 from foo. The difference from
using -remove is that this is subject to escaping rules and has the same
caveats as -add. Note that -del wasn't added back to the object settings
list because you can already remove multiple items with -remove from it.
Done with 4a084c0df8. The reasoning was
that it was "confusing", but without using -add it is impossible to
append multiple items to a list in a single command and just overall
makes this less powerful. The code works fine. You might find yourself
in escaping hell, but that's on the user to deal with.
Also it's worth noting that -remove with object settings lists can
actually remove multiple items and unlike the other list option types.
The options in vd_lavc are all related, but they don't all require the
same thing for runtime changes. To avoid having to manually add UPDATE_*
to every single option flag, the options can be split into two separate
structs. The vd_lavc_conf becomes a catch all for all the --vd-lavc
options that require the full UPDATE_VD flag. The rest of the options
are split off into the new hwdec_conf instead. Additionally,
--vd-lavc-software-fallback is renamed to --hwdec-software-fallback and
moved to the hwdec_conf as well. The new name better reflects what it
does and it logically fits with those more. UPDATE_* flags are added on
everything now so these should all now be changeable on runtime.
There's several path-related options that do not handle common shortcuts
(like ~/). Fix this by using mp_get_user_path where appropriate which
expands the path so users get more intuitive behavior. Fixes#15598.
When using --prefetch-playlist, if demuxer options are changed in the
time window between the start of prefetching and the playback of the
next file, the old values are used. This includes setting demuxer
options in legacy extension auto profiles.
Fix this by setting a flag when demuxer options change and not using the
prefetched data when that flag is true.
UPDATE_DEMUXER is not added to demux.c's options because those already
support updates while playing.
The history could be formatted as CSV, but this requires escaping the
separator in the fields and doesn't work with paths and titles with
newlines. Or as JSON, but it is inefficient to reread and rewrite the
whole history on each new file, and doing so overwrites the history with
an empty file when writing without disk space left. So this uses a
hybrid of one JSON object per line to get the best of both worlds. This
is called NDJSON or JSONL.
Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
This is useful for text input in, for example, console.lua. Each
character in the commit string gets turned into an mpv key press.
Pre-edit strings are not handled, since there's currently no good way to
handle that or make it useful to text input scripts. Like win32, which I
tested in wine, another limitation is that the composition window is
always positioned at the top left of the window, since we cannot get
useful positioning hints from mpv scripts. It allows the composition
window to be within the window and avoids obstructing the console
prompt.
This can be enabled/disabled with --input-ime=<yes|no> (default: yes).
FLT_MIN is a small positive number (1.175494e-38), so the check v <
FLT_MIN introduced in 0e7f9c39dc made all 0 and negative float option
values error, e.g. panscan=0 or video-align-y=-1.
Fixes 0e7f9c39dc, fixes#15728.
OPT_FLOAT values currently reuses OPT_DOUBLE handling, but if a
finite double value is produced which is out of the float range,
it results in UB.
If the floating point implementation is IEEE-754, then the value is
converted to infinity and stored in the float. However, this still
does not work as intended, as infinity is rejected for OPT_DOUBLE
unless infinity is explicitly specified as the min/max range.
Fix this by adding another clamping stage after operating the values
as double. Finite double values are clamped between FLT_MIN and
FLT_MAX, and out of range error is signaled when suitable.
It is now handled internally by the libmpv profile.
Since `player` was the default option, the impact should be minimal, as it
is uncommon to override the default option with the same value.
yes/no args will function the same way as before this commit.
Update flags are often updated, so make space for expand them. Reorder
all values to make it easier to add new ones, until there is no more
space.
Co-authored-by: Guido Cella <guido@guidocella.xyz>
This ignores --video-align-{x,y} when the video is smaller than the
window in the respective direction.
After zooming in, panning and zooming out, this is useful to recenter
the video in the window.
Unlike doing this by observing osd-dimensions in a script, this is done
before rerendering, so you don't see the image being rendered uncentered
for an instant after zooming out, before being rerendered centered.
Also update --video-align docs while at it.
This doesn't work well with --video-pan-{x,y} because you can move the
output rectangle far away from the image, and when zooming out pan is
abruptly reset to the center. It doesn't feel like natural like zooming
out after changing --video-align-{x,y}. So this commit doesn't set pan
to 0. Also this leaves a way to move scaled images within the window
even with --video-recenter.
This adds a clipboard API with multiple backend and format support.
--clipboard-enable option can be toggled at runtime to turn native
clipboard on and off.
Instead of printing circles in show-text ${playlist}, ${chapter-list}
and ${edition-list}, introduce --osd-selected-color and
--osd-selected-outline-color to reduce clutter, make the selected item
easier to differentiate, and have visual consistency with select.lua.
The defaults are taken from the style of the selected item in the
console. These new options are also used there, replacing the hardcoded
styles. Due to being user-configurable, selected item styles are changed
to take priority over default item styles.
The default selected style is yellow and bold. The bold (hardcoded)
allows differentiating the selected item with color blindness. There is
also a separate --osd-selected-outline-color option defaulting to black,
since without it if the user changes --osd-outline-color yellow text
becomes unreadable without a black border. --osd-selected-back-color is
omitted for now.
Text and background colors are inverted for the selected item in the
terminal. This is hardcoded, adding an option is overkill.
A disadvantage of this commit is that if you run print-text ${playlist}
with a VO, the selected style ASS is printed to the terminal (but ASS
printed in the console is interpreted). This commit avoids printing the
reset ASS sequence for non-selected items to reduce clutter in this
case.
Disabled by default because it breaks sub-seek and playback in cases
where the user changes play-dir from + to - during runtime and past
"seen" events need to be re-rendered.
Available since dcc9eb722e
Elements are not parented to the add list, as they are directly copied
to the target list. Therefore, we need to clean them up manually.
Fixes: 1f5a67d8fa
Some properties, like `${decoder-list}`, are resource-intensive to
expand. Prevent fuzzing from generating strings with excessive
expansions to encourage shorter test cases.
Expanding properties on each playback frame for `osd-msg1` can be
demanding. However, in regular use cases, this typically isn’t an issue,
so implementing a caching solution wouldn’t be practical in real
scenarios.
Fixes timeouts on OSS-Fuzz.
This adds --osd-bar-marker-style option which can be used to
customize OSD bar marker style. In addition to the existing triangle
style, a new style option is added to draw markers as lines.