4177 Commits

Author SHA1 Message Date
Hubert Głuchowski
557e592511 ytdl_hook: recognize srv3 subtitle format if subrandr is present
This allows YouTube videos played directly from a URL to make use of
subrandr's SRV3 support if it is allowed by an overriden `sub-format`.
2025-12-23 07:01:29 +01:00
Hubert Głuchowski
a330318592 player/command: add subrandr-version property
Allows script to detect the presence of subrandr at runtime, useful for
determining whether this mpv instance can play SRV3 subtitles.
2025-12-23 07:01:29 +01:00
Guido Cella
a58e9e596b Revert "ytdl_hook: add chapters by parsing video's description"
This reverts commit e9c43258b8.

yt-dlp implemented its own parsing to extract chapters from the
descriptions of videos without chapter markers in the player over 3
years ago in https://github.com/yt-dlp/yt-dlp/commit/0fe51254 (the PR is
even inspired by mpv). Actually it was present even earlier in
youtube-dl but was removed for unknown reasons in
67299f23d8.
So we can remove our parsing code, as it is dead code that never runs if
yt-dlp's JSON already contains chapters.

And it seems that such videos without chapter markers are rare or
non-existing by now anyway - we can't find any.
https://www.youtube.com/watch?v=1v_4dL8l8pQ is linked from the yt-dlp PR
with the above commit, but now yt-dlp returns the Key moments as
chapters, so it can't be used for testing.

Our parsing was actually worse than yt-dlp's, because #16085 added an
option to disable it to fix the misdetection reported in #16081, but
yt-dlp correctly returns no chapter for that video
(https://www.youtube.com/watch?v=1v_4dL8l8pQ). So this code branch was
only running for misdetections, and by removing it that option is not
needed.
2025-12-19 18:06:14 +01:00
Guido Cella
acd3378c9b Revert "ytdl_hook: add option to extract chapters"
This reverts commit df1e71a7cc.

The next commit will make this unused since chapters will only be taken
from yt-dlp's JSON.
2025-12-19 18:06:14 +01:00
llyyr
4623a0a7e8 osc.lua: remove flags from disable_key_bindings
disable-section doesn't accept flags, and has no need for it either.

Fixes: c209d4f73b
2025-12-18 13:06:46 +01:00
nanahi
dbd7a905b6 clipboard-x11: request selection at init
XFixesSelectionNotifyEvent does not give an initial notification,
so initial selection needs to be requested manually.
2025-12-04 17:29:57 +01:00
nanahi
1ee207329a clipboard-x11: use separate properties to receive primary and clipboard
Fixes one of the property not being set when a client sets primary and
clipboard at the same time.
2025-12-04 17:29:57 +01:00
nanahi
6756e86384 player/command: fix playlist-remove argument requirement
playlist-remove has a required index argument, as indicated by the
documentation. However, in 332907e1d7
MP_CMD_OPT_ARG was mistakenly added, making it optional.
The effect of not specifying the argument is defaulting the index to 0
and always removing the first element in the playlist, which is not
expected.

Fix this by making the argument required.

Fixes: 332907e1d7
2025-11-30 14:21:09 +01:00
llyyr
b6c35b55a0 player/video: only set a/v speed factor to 1 when exiting display-sync
Previously this would be called on every frame presented, this only
needs to be called if display sync was active for the last frame but
isn't active anymore.

This hid the bug mentioned in #16947 if VO was active.
2025-11-26 19:18:25 +00:00
llyyr
ddd0fc0beb player/command: update speed filters for pitch-correction change too
Fixes #16947 for both audio only files as well as for files with video
which would only accidentally worked. See next commit
2025-11-26 19:18:25 +00:00
llyyr
b2156c7d30 ao_wasapi_utils,command,hwdec_vulkan: remove double semicolons
Cosmetic
2025-11-14 20:44:46 +00:00
Kacper Michajłow
d3ec15bca8 stats.lua: remove prefix from display luminance metadata
People are getting confused about "HDR10" part.
2025-10-31 12:53:43 +01:00
Guido Cella
1abd2a05f1 console.lua: don't clip items if OSD dimensions are not initialized
If you open the menu at startup, e.g. with --input-commands, it rarely
clips items completely because OSD dimensions are still 0, or as if they
were 100 because those are the default values before receiving property
notifications. Avoid this.
2025-10-31 12:53:31 +01:00
Guido Cella
e2bd1c6a88 {console/context_menu}.lua: don't apply --osd-blur to menu backgrounds 2025-10-29 15:36:35 +01:00
Guido Cella
813c112329 command: react to --force-window changes with no file playing
handle_force_window() is called in play_current_file() and
run_playloop(), so it is never triggered if you do mpv --idle and then
change force-window at runtime. Move the playloop call to the option
callbacks to fix this.

Fixes https://github.com/mpv-player/mpv/discussions/16956.

Giving the UPDATE_VO flag to --force-window would not fix this due to it
having no effect if there's isn't already a window, which prevents the
bug described in 544240c829. It would also reinit the VO unnecessarily
when cycling between force-window yes and immediate.
2025-10-29 15:12:42 +01:00
nanahi
1fec44cc6c clipboard: add --clipboard-xwayland option
On Wayland envitonments with Xwayland available but without
ext-data-control-v1, mpv will fall back to the X11 backend instead of
VO backend. This may result in clipboard not working properly between
mpv and native Wayland clients.

Fix this by disabling X11 backend on Wayland envitonments by default
and adding the --clipboard-xwayland option for manual override.
2025-10-27 20:01:47 +01:00
nanahi
7b660a5de9 console.lua: use clipboard property for x11 2025-10-27 20:01:47 +01:00
nanahi
4f03bc1779 clipboard-x11: add x11 clipboard backend
This adds the x11 clipboard backend and native clipboard support to x11.
Clipboard monitoring is supported.
2025-10-27 20:01:47 +01:00
Attila Fidan
2efbb29938 command: fix bluray angle stream detection
Fixes: eba7a11a2e ("player/command: do seamless angle change when bluray-angle is changed")
2025-10-27 20:00:52 +01:00
arch1t3cht
aa2dad035f stream_bluray: do not demux_flush on angle change
A demux_flush can cause corruption and a slight A/V desync, whereas
without it the angle will simply change on the next keyframe, as is
intended for seamless branching. If users want an instant angle change
they can still restart playback and seek to the current position
through Lua.
2025-10-23 11:41:16 +02:00
Kacper Michajłow
fdbe06a6bc player/lua: fix UB in integerness check 2025-10-15 21:59:55 +02:00
Kacper Michajłow
339ad7e49e player/javascript: fix mp.set_property_number for integer properties
Fixes: #16911
2025-10-15 21:59:55 +02:00
LordMZTE
df939d4fe8 osdep/linux-als: support ambient-light on Linux
This implements the ambient-light property on Linux using the sysfs
interface.
2025-10-15 21:59:42 +02:00
Guido Cella
0a53407a48 context_menu.lua: prevent some rare crashes
Fix crashes that won't happen in regular usage:

- If you open the menu with an empty menu-data and use keybindings
- If you open the menu with menu-data only containing hidden items
- If you invoke script-message-to context_menu select with the menu
  closed
2025-10-11 10:32:29 +02:00
Guido Cella
6e8283d377 context_menu.lua: add a missing return
The space key selects the current item so it shouldn't also try to
activate items with titles starting with space.
2025-10-11 10:32:29 +02:00
Guido Cella
67330ba2de select.lua: don't go beyond the max line length
Fixes 7be6095c23.
2025-10-10 08:44:03 +02:00
Kacper Michajłow
0fb40b654d stats.lua: split lines to make them shorter
Fixes: 92aeb63479
2025-10-10 06:14:42 +02:00
Kacper Michajłow
43b230b089 stats.lua: skip codec params if they are not available
Fixes: 2fd88ffbae
2025-10-10 06:14:42 +02:00
Kacper Michajłow
9252ff4ce1 player/playloop: set consistent video parameters in idle mode
Prefer RGBA if available to avoid configuring color conversion that
wouldn't be used anyway. And set sRGB primaries, just for consistency.
2025-10-10 06:14:42 +02:00
rach-md
7be6095c23 select.lua: rename some menus with proper name 2025-10-10 06:14:07 +02:00
llyyr
92aeb63479 stats.lua: make video block even when no video track
fixes formatting with `mpv --idle --force-window` with no files loaded
2025-10-10 05:41:56 +02:00
nanahi
67378b9c52 commands.lua: update screenshot commands flags 2025-10-06 04:27:13 +02:00
nanahi
d89add6eb2 screenshot: add osd and scaled flags to screenshot commands
Currently, screenshot being scaled and the presence of OSD and subtitles
cannot be independently controlled. This adds osd and scaled flags to
screenshot commands that make it possible to e.g. take screenshots with
only OSD without subtitles, or take screenshots at scaled resolution
without OSD or subtitles.

The "window" flag is now an alias of scaled+subtitles+osd, and is kept
for convenience.
2025-10-06 04:27:13 +02:00
Kacper Michajłow
4338880560 various: add MP prefix for {PRINTF,SCANF}_ATTRIBUTE 2025-10-05 21:34:29 +02:00
Attila Fidan
83fafbfbee cplugin: init pfn_mpv_get_time_ns
Fixes: fcebee9080 ("libmpv: add mpv_time_ns()")
2025-09-29 17:20:03 +02:00
Kacper Michajłow
cf393b12ac osc.lua: add indicator for buffering/loading 2025-09-29 01:45:47 +02:00
Guido Cella
cabee53ebd context_menu.lua: make gap a percentage of the font_size
Avoids having to update the gap for most users who just want to change
the font size.
2025-09-27 19:26:54 +02:00
Guido Cella
eac9ab275d console.lua: add gap script-opt 2025-09-27 19:26:54 +02:00
Guido Cella
d8123d81bd console.lua: increase the gap between menu items
Make it less cluterred.
2025-09-27 19:26:54 +02:00
nanahi
c1406fa5ec command: fix null dereference for invalid command in input-commands
mp_input_parse_cmd can return NULL. --input-commands=x segfaults with
null dereference. Fix this by adding null check.

Fixes: 533a684381
2025-09-27 18:32:47 +02:00
llyyr
be98b35c89 player/misc: show percentage progress for --stream-dump
Also use format modifiers instead of casting and fix type for `pos`
2025-09-23 18:45:15 +02:00
Guido Cella
f147b133f0 select.lua: add online documentation menu entry 2025-09-20 18:10:23 +02:00
Guido Cella
7c1a4acdb2 select.lua: add edit-config-file and edit-input-conf
Add script bindings to edit mpv.conf and input.conf, and add them to the
menu. These are useful as shortcuts, but the main motivation is that new
users often ask why they can't find mpv.conf and input.conf, so this
creates them if they don't exist.
2025-09-20 18:10:23 +02:00
ikas
0bbcc91e1b video/out/d3d11: add changing size support for composition mode 2025-09-19 02:26:08 +02:00
Guido Cella
8406834075 context_menu.lua: add this script
This implements a ASS context menu to be used on platforms other than
Windows.

The select script message will allow selecting an item with a single
click when releasing a mouse button, like in native context menus. This
is mainly useful to cycle pause with one click.
2025-09-15 04:12:57 +02:00
der richter
5e4a406194 command: fix type mismatch 2025-09-15 03:59:32 +02:00
arch1t3cht
eba7a11a2e player/command: do seamless angle change when bluray-angle is changed 2025-09-15 03:52:35 +02:00
Kacper Michajłow
4f08802ff1 osdep/w32_register: add register/unregister options for Windows
On Linux, we have `mpv.desktop`, and on macOS, we have `osxbundle`, both
of which handle file associations and protocol registration in the
system environment.

On Windows, this information is stored in the registry, so this commit
adds support for it.

It registers the application, supported file types, and supported
protocols, and adds an uninstall entry so users can remove all
registrations via the control panel. Note that this does not remove the
binary itself.

The implementation is fully portable. There are no external installers,
as mpv handles everything automatically. This should improve usability
when moving binaries and so on.

- `mpv --register` registers mpv (see verbose output for a list of actions).
- `mpv --unregister` reverts all changes made during installation.
- `mpv --register-rpath <string>` allows specifying a string to be
  prepended to `PATH` before running mpv. This is useful when using
external dependencies that shouldn't be added globally to `PATH`.
2025-09-15 03:47:35 +02:00
Attila Fidan
b9b3106d2f playloop: update window title in handle_force_window
When restarting or changing the VO while on the idle screen and using
force-window, this ensures that the new VO immediately receives a window
title.
2025-09-14 01:27:27 +02:00
Guido Cella
b9ceaf243d console.lua: don't autoselect the wrong completion
The first completion is automatically inserted when Tab was not pressed,
but this is unwanted when you already typed one of the completions which
is not the first one, move back the cursor and press Enter.

e.g. if the line is "set vid", you place the cursor before "v" and press
Enter, it runs "set ab-loop-avid".

Fix this by aborting when the text in front of the cursor matches one of
the completions.
2025-09-02 21:43:20 +02:00