Commit Graph

53610 Commits

Author SHA1 Message Date
Dudemanguy
62c3aeb9cb command: expand paths for all commands with path arguments
Follow up to be15be3a83 with the same
reasoning.
2025-01-30 21:57:31 +00:00
Kacper Michajłow
caeda81bce ci/lint-commit-msg.py: add .rst from allowed extension skips
All .rst files changes are prefixed with DOCS/ so the ext can be skipped.
2025-01-30 19:34:31 +01:00
Kacper Michajłow
cd1e44c40b ci/lint-commit-msg.py: remove .py from allowed extension skips
Allow extension skip only on core files c/cpp/h/m/swift, for the rest
require ext.
2025-01-30 19:34:31 +01:00
Dudemanguy
814316fb2a command: add metadata sub-property for track-list
Requires a little bit of massaging for the key/value access to work
correctly, it's not terribly intrusive all things considered.
2025-01-30 15:24:38 +00:00
Dudemanguy
5c3262628e command: prefix all property functions with mp
This weird inconsistency was annoying.
2025-01-30 15:24:38 +00:00
Dudemanguy
d5cb5740cc player: print secondary subtitles on the terminal
Fixes #10118.
2025-01-30 15:20:29 +00:00
llyyr
72d976b3c1 m_option: reallow setting list options to no value to -clr them
d2c409c56b broke setting `--slang=` to
effectively `-clr` the option. Restore the behavior because scripts rely
on it.

Fixes: d2c409c56b
2025-01-29 23:55:43 +00:00
Kacper Michajłow
79e29787de osdep/terminal-unix: fix stop_cont_pipe leak
mpv_create/mpv_destroy would leak those.
2025-01-29 22:27:11 +01:00
Kacper Michajłow
82427df2ad fuzzer_load: don't dup3 fd if it already has a value we want
Unlike dup2, If oldfd equals newfd, then dup3() fails with the EINVAL.

Fixes: 1d352f8527
2025-01-29 22:27:11 +01:00
Dudemanguy
4c3eb16a47 m_option: add -clr to keyvalue list options
Seems to have been omitted by mistake and nobody ever noticed.
2025-01-29 20:45:13 +00:00
Dudemanguy
d2c409c56b m_option: reintroduce -del to string list and keyvalue list
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.
2025-01-29 20:45:13 +00:00
Dudemanguy
7456816217 m_option: undeprecate list option suffixes with multiple items
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.
2025-01-29 20:45:13 +00:00
Kacper Michajłow
90631b9e90 player/misc: check codec values for overflow
Found by OSS-Fuzz.
2025-01-29 20:15:47 +01:00
Dudemanguy
694817121a command: don't run UPDATE_{AD,VD} if the {ao,vo}_chain doesn't exist
As described in 544240c829, the callbacks
are all run on init so UPDATE_AD and UPDATE_VD both executed. While this
is probably not harmful, it is completely pointless work and results in
extra event notifications being sent. Just skip these if there is no
matching chain.
2025-01-29 15:07:42 +00:00
Dudemanguy
8c4ca44e24 vd_lavc: separate opts to two structs and reorganize
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.
2025-01-29 15:07:42 +00:00
Dudemanguy
838df2c252 ad_lavc: flag options with UPDATE_AD 2025-01-29 15:07:42 +00:00
Dudemanguy
be15be3a83 various: expand paths for all file/directory related options
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.
2025-01-29 14:49:06 +00:00
Dudemanguy
c7c09fdb8b command: fix spammy events when frame stepping forward with seek
The frame-step command also signals on up events. This is only useful
when using the default "play" mode. For seek mode, it triggers another
frame step which is not what you want. Rearrange the logic so the up
event is ignored for the seek flag. The frames check is also not needed
since add_step_frame already handles it.

Fixes 9661a3839b
2025-01-29 14:48:55 +00:00
Attila Fidan
3544728991 clipboard-wayland: initialize offer fd
Fixes: https://github.com/mpv-player/mpv/issues/15763
2025-01-29 13:19:04 +01:00
Kacper Michajłow
9251411627 vo_kitty: unlink shared memory only on vo close
We don't want to unlink on flip_page().

As a bonus fix leaked mpi image.

Fixes: af384df219
2025-01-29 06:47:35 +01:00
Christoph Heinrich
4fd9893f28 player/command: reinit video decoder when it's options change 2025-01-28 21:16:39 +00:00
Dudemanguy
eb612b29f2 DOCS/man/options: correct outdated --ad/--vd documentation
13add62cf0 removed support for the +
syntax for these options.
2025-01-28 15:48:15 +00:00
Dudemanguy
0e03fdf0f7 f_decoder_wrapper: allow changing --ad and --vd at runtime 2025-01-28 15:48:15 +00:00
Dudemanguy
8d665ac2df osc.lua: add visibility_modes script opt
This allows users to choose what visibility modes they want to cycle
through when calling the osc-visibilty cycle script binding.
2025-01-28 15:47:47 +00:00
Dudemanguy
fd4aa9b533 osc.lua: deprecate pointless script-messages
1a558bf5c2 effectively aliased the custom
OSC printing to actual mpv properties instead. These only exist for
backwards compatibility which hopefully will get removed one day so
instead deprecate them and warn users of what they should be using.
2025-01-28 15:47:47 +00:00
Dudemanguy
f663591acd DOCS/man/osc: document the second arg in some script commands 2025-01-28 15:47:47 +00:00
Kacper Michajłow
af384df219 vo_kitty: unlink shared memory on vo close 2025-01-28 07:59:47 +01:00
Kacper Michajłow
1d352f8527 stream_file: allow to open only our fd in case of fuzzing
This ensures that we don't open some other fd, for example when loading
playlist. Also filters out loading any local files.

This also allows to remove custom filtering from fuzzer itself.
2025-01-28 07:59:04 +01:00
Dudemanguy
9661a3839b command: allow frame-step to go through multiple frames and/or seek
Previously, the default behavior of frame-step and frame-back-step is to
play forward 1 frame or seek back 1 frame. We keep this behavior but
introduce additional flags to control the exact behavior of the frame
stepping. The first argument simply specifies how many frames to go
through. The second argument specifies whether to play video to step
through frames or to seek to step through frames. Playing through the
video to step through frames only works going forwards (otherwise it
will always seek). In theory we could use backwards playback for this,
but that can be decided later.

As a minor note, MPSEEK_BACKSTEP is renamed to MPSEEK_FRAMESTEP since
forward seeks can use this as well. Fixes #10128.
2025-01-28 04:20:16 +00:00
Guido Cella
57962e9980 DOCS/man/select: document the menu script-binding
Also remove select/ from the last 2 script bindings.
2025-01-27 21:21:26 +01:00
Guido Cella
1f6bba19d7 osc.lua: add an icon for the miscellaneous menu
Add the generic menu to bar layouts to provide discoverability for the
select menus to users who don't realize you can right click OSC buttons.

There's no space to add it in box layout.
2025-01-27 21:06:50 +01:00
Guido Cella
e07c78f2db TOOLS/mpv-osd-symbols.sfdir: add a menu icon
Taken from the last freely licensed version of Symbola and manually
adjusted the number in the glyph file to match the adjacent arrows.

Saving sfdir with fontforge also automatically removed the O flag from 2
existing glyphs. According to
https://fontforge.org/docs/techref/sfdformat.html "O" just meant "the
character was open when last saved", so it doesn't change anything
visible.
2025-01-27 21:06:50 +01:00
Guido Cella
118ef75c27 TOOLS/mpv-osd-symbols.sfdir: document how to add icons 2025-01-27 21:06:50 +01:00
Guido Cella
3e0b3373df select.lua: add a miscellaneous menu 2025-01-27 21:06:50 +01:00
Guido Cella
24db17d10f loadfile: discard prefetched files if demuxer options changed
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.
2025-01-27 19:32:52 +00:00
Guido Cella
130128762b command: group flag updates together 2025-01-27 19:32:52 +00:00
Kacper Michajłow
75efb04e08 demux_mkv: limit RealAudio packet size to 128 MiB
It should be more than enough for this and avoids some huge allocations
on broken files. 128 MiB is already huge for audio buffer, but better
than 4 GiB...
2025-01-27 18:54:24 +01:00
Guido Cella
3fdc5338cc DOCS/man/select: add this file
Also update console's documentation.
2025-01-27 18:53:36 +01:00
Guido Cella
e2090533cf select.lua: select from the watch history with g-h
Implement selection of the entries in the watch history.

The last entry in the selector deletes the history file.
2025-01-27 18:53:28 +01:00
Guido Cella
b75ed73f4f loadfile: optionally save the watch history
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>
2025-01-27 18:53:28 +01:00
Guido Cella
a3cc06f754 misc: make json_append() non-static
This will be used to write json with a bstr in the next commit.

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2025-01-27 18:53:28 +01:00
Guido Cella
908dc02eb9 misc: extract mp_find_non_filename_media_title() from command.c
This will be used to write the title in the watch history.
2025-01-27 18:53:28 +01:00
nanahi
27db2e1d50 DOCS/man: add documentation of wayland backend and properties 2025-01-27 18:51:31 +01:00
nanahi
ab461e0209 console.lua: use clipboard property for native Wayland backend
This backend does not require the window focus quirk handling,
and also supports primary selection.
2025-01-27 18:51:31 +01:00
nanahi
3be195e616 console.lua: autocomplete clipboard/text-primary property 2025-01-27 18:51:31 +01:00
nanahi
481646da37 command: add current-clipboard-backend property
Useful to know which clipboard backend is active.
2025-01-27 18:51:31 +01:00
nanahi
b2165c263a clipboard: add function to get clipboard backend name
Some platforms like Wayland may have support for multiple backends,
so add this function to make it possible to determine the current
active backend.
2025-01-27 18:51:31 +01:00
nanahi
46e2f55338 command: add clipboard/text-primary property
This property contains the text in the primary selection.
2025-01-27 18:51:31 +01:00
nanahi
9f2ac08851 clipboard-wayland: add Wayland clipboard backend
This adds a "native" Wayland clipboard backend based on the
ext-data-control-v1 protocol.
This backend overcomes the limitation of the VO (Wayland core protocol)
backend, and does not require the presence of the VO window to receive clipboard
updates.
This backend also supports primary selection if supported by the compositor.

The backend runs in a separate thread, so clipboard reading
does not stall the player like the VO backend.
2025-01-27 18:51:31 +01:00
nanahi
589e34cebd clipboard-vo: use clipboard parent log context
This adds clipboard backend names to backend-specific logs,
e.g. clipboard/vo.
2025-01-27 18:51:31 +01:00