Commit Graph

53621 Commits

Author SHA1 Message Date
Dudemanguy
38ad1ed03b command: normalize paths for path and track-list/N/external-filename
It's better for API users to actually get predictable results.
2025-02-01 16:12:03 +00:00
Dudemanguy
02c0b346eb command: simplify find_track_with_url handling
Now that mp_normalize_path can accept NULL and we have a shorthand for
expand + normalize, now is a good chance to simplify this to make it
less awkward.
2025-02-01 16:12:03 +00:00
Dudemanguy
6472e45e8b options/path: add mp_normalize_user_path shorthand
Expanding a path and then normalizing it is probably a common shorthand.
The reason to not incorporate this directly into mp_normalize_path is
because it requires the global struct which is out of scope for
path_utils so use this wrapper instead.
2025-02-01 16:12:03 +00:00
Dudemanguy
956cb2c49f various: simplify mp_normalize_path usage
If a talloc_ctx was being made solely for a onetime usage of getting a
normalized string, we can now just pass NULL instead and free the string
directly to make things easier.
2025-02-01 16:12:03 +00:00
Dudemanguy
0755edb327 misc/path_utils: allow passing NULL to mp_normalize_path
Instead of requiring the caller to pass an appropriate talloc_ctx,
mp_normalize_path will make its own internal allocations and cleanup as
needed.
2025-02-01 16:12:03 +00:00
Guido Cella
b2404e16dd console.lua: stop expanding ~/ in file completion
It is not needed to expand ~ in file completion as you type after
62c3aeb9c made commands themselves interpret it. We only need to call
expand-path on the directory before passing it to utils.readdir in order
to find files in it when it contains ~ placeholders. As a bonus this
will now also complete files in directories like ~~/ and ~state/.

This simplifies command completion, and was also the blocker for
splitting running commands out of console.lua, since I didn't know how
to replicate it through mp.input.
2025-02-01 16:11:30 +00:00
Guido Cella
6fb3ac1bc7 Revert "DOCS/man/input: document that shutdown is sent when scripts terminate"
This reverts commit 86383aef95.

shutdown isn't actually sent on exit() but only with internal options,
e.g. set osc no, which isn't relevant for users.
2025-02-01 16:11:18 +00:00
Guido Cella
86383aef95 DOCS/man/input: document that shutdown is sent when scripts terminate
shutdown is not sent only when the player quits, but also when
individual script are unloaded, either by calling exit() or by toggling
options like --osc.

This was already mentioned in javascript.rst so remove it from there.
2025-01-31 06:04:54 +01:00
Guido Cella
cada717416 Revert "console.lua: add pause_on_open script-opt"
This reverts commit 850e03d29f.

The previous commit solved this in a more general way. You can do:

[open-console]
profile-cond=p['user-data/mpv/console/open'] and p['current-tracks/video/albumart'] == false
profile-restore=copy
pause

Thankfully pause_on_open was just added and has not been in a release so
we can remove it.
2025-01-31 06:04:54 +01:00
Guido Cella
8669205d92 console.lua: add user-data/mpv/console/open
Fixes #15762.
2025-01-31 06:04:54 +01:00
Guido Cella
17e4cc5397 DOCS/man/input: reorder user-data's docs
user-data/mpv/ytdl was documented out of nowhere instead of together
with user-data/osc.
2025-01-31 06:04:54 +01:00
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