Commit Graph
1174 Commits
Author SHA1 Message Date
Guido Cella 6eaf35866c command: add support for printing sub-lines
show-text ${sub-lines} can be used to print subtitle lines around the
current one and have them hide automatically.
2026-05-20 23:21:49 +02:00
nanahi ed2e55b941 options: make player-operation-mode readable as a property
Make it readable as a property so that scripts and conditional
autoprofiles can customize behavior depending if player is
launched as pseudo gui mode.
2026-05-09 15:01:09 +02:00
nanahi 0ec3015339 player/external_files: remove handling related to update sub exts
This is only used to update the list for player internal sub ext matching.
Since this handling now lives in the dnd client, it can be removed from
core, which also eliminates a global variable.
2026-05-01 13:42:57 +02:00
nanahi 87ccb6022c command: add dropped-file property
This adds dropped-file property which contains a list of dropped files
and the type of the drop. This allows clients to implement custom drag
and drop handling.
2026-05-01 13:42:57 +02:00
nanahi 41fb7f9eb2 command: use string list helper for option-info 2026-05-01 13:42:57 +02:00
Kacper Michajłow f5857d3b87 demux_lavf: support multiple program mappings per stream
Each stream can belong to multiple programs, we have to support that.
Previously track could belong only to single program.
2026-05-01 11:41:31 +02:00
Kacper Michajłow eedadc24ae player/command: hide dependent tracks
They are unusable on thier own, and shouldn't be selected by the user.
Those tracks are ment to be used internally.
2026-05-01 10:42:00 +02:00
Guido Cella 5f02e1b8a2 sub: add sub-lines property
Return all subtitle lines in memory with text, start and end.

I did not name this sub-all so it cannot be misinterpreted as referring
to all subtitle tracks.

Closes #12810.
2026-04-25 19:58:52 +02:00
Kacper Michajłow 382e3e74e8 player/command: add more precision to avsync pretty print
To better see close to zero values, instead of just clamping to 0.
2026-04-25 07:15:37 +02:00
Kacper Michajłow 99b9d9491d player/command: add more precision to av speed correction pretty print
Those values are often very small, but it's still good information to
have how they are changing.

This brings those values closes to old `%+.05f%%` that were used here.
2026-04-25 07:15:37 +02:00
nanahi 25e9a0c740 player/command: remove inaccurate comment in cmd_mouse 2026-04-18 21:13:46 +02:00
nanahi bceb1eeaf4 Revert "player/command: don't send mouse move event on mouse leave request"
There is no reason to do this, since VOs do report mouse position when
outside of window in some cases.

This reverts commit 3ff7b04790.
2026-04-18 21:13:46 +02:00
Guido Cella 8f66c0982f command: log menu-data changes at trace level instead of verbose
Avoid spamming the log.
2026-04-18 17:45:03 +02:00
Mike Will d0df98f701 command: allow metadata to be set manually 2026-04-18 05:37:38 +02:00
Kacper Michajłow 6c165fe46e demux_lavf: add support for programs
This adds proper support for MPEG-TS programs and HLS variants. Now
program selection is exposed as editions and tracks are grouped under
such edition. If there are external tracks added, they are available in
all editions.
2026-04-17 18:30:43 +02:00
Kacper Michajłow 85bdf63a48 player/command: simplify and fix new-line handling
Remove dead code, make it work also when there is not tracks.
2026-04-17 18:30:43 +02:00
nanahi e0fe1a45d2 command: fix race in reading pad_buttons_pressed
mp_input_get_tablet_pos stores the address to an array that is protected
by lock, and the content is accessed without acquiring lock.

Fix this by writing the values to an array inside mp_input_get_tablet_pos.

Fixes: 0fbf20f057
2026-04-06 18:28:04 +02:00
nanahi cf957b4f2a player/command: use m_property_read_sub_validate when suitable
Avoids wasting resources on trivial requests.
2026-04-06 18:26:34 +02:00
nanahi 629205280c player/command: rename to mp_property_list_editions
Use mp prefix like everything else.
2026-04-06 18:26:34 +02:00
nanahi 7f28b8818a player/command: use m_property_read_sub for mouse-pos
Allows reading using sub property syntax.
2026-04-06 18:26:34 +02:00
Guido Cella 70b8b22c8b command: remove the deprecated time-start property
This has been deprecated for 11 years since 70df1608d6 so remove it. All
it does is return 0.
2026-04-01 22:09:25 +00:00
nanahi 4e6196e1a6 player/command: fix update-clipboard text-primary
It mistakenly updates text instead.
2026-04-02 00:05:27 +02:00
zenodity ae2384bce0 player/command: add default-value/choices arg fields to command-list
Add optional 'default-value' and 'choices' fields where appropriate
for command arguments in the 'command-list' property. Update
documentation to reflect the command-list schema change.

DOCS/interface-changes/command-list: add changes
2026-04-01 16:08:26 +02:00
NRK d79c4ad1e3 player/command: add env property
mainly so that env vars can be accessed from within config files.
2026-03-31 18:44:10 +00:00
nanahi f7f7cf18f3 command: add update-clipboard command
This uses the update_data request for clipboard backends that require it.
When clipboard monitoring is disabled, the backends will no longer
fetch data when it detects data change, and will now only do that when
receiving the update_data request.

The client now needs to run this command to update the clipboard content,
otherwise the property value is outdated.

This makes sure that applications that depend on "paste once" behavior
work correctly.

This command runs in a separate worker thread so that it can be used
as a "blocking" way to update clipboard until the update notification
arrives without blocking the playback core. It accepts a maximum timeout
parameter. This uses the existing mp_cancel mechanism to make sure this
command can be aborted and the worker threads will not stall the player
too much when quitting mpv.

For backends that do not support update_data, this command does nothing.
2026-03-21 16:05:36 +01:00
llyyr 022fbd16b9 meson: bump min libplacebo version to v7.360.1
This version contains critical fixes to swapchain selection, correct
mapping of sRGB TRC as well as fix for gpu hangs on anv. Bump the
minimum version because the mpv experience with previous version
shouldn't be endorsed or be considered acceptable by upstream.
2026-03-15 18:40:09 +01:00
Rudi Heitbaum 8ace278cbe various: fix Wdiscarded-qualifiers warnings
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-03-15 14:49:00 +01:00
NRK 3cd66d2fd7 command: avoid crashing the player with mmap
mmap in inherently crashy due to the file changing underneath
and requires esoteric SIGBUS handling [0] to use properly.

to reproduce, simply use "overlay-add" from a lua script with
invalid stride set and observe mpv crashing with SIGBUS.

here we're just copying the file content (introduced in
549a9ea) and munmaping it immediately so there's no real need
to be using mmap to begin with. avoid the issue entirely by just
reading the file directly with fseek+fread with optimization for
the common stride case.

one notable difference is that since dup-ed fds share same
offset, the source "fd" that's coming from client will now have
it's offset modified. `pread` could avoid this issue but it's
not supported on windows.

[0]: https://www.sublimetext.com/blog/articles/use-mmap-with-care
2026-03-12 15:58:53 +01:00
Kacper Michajłow 3ff7b04790 player/command: don't send mouse move event on mouse leave request 2026-03-10 08:56:23 +01:00
sfan5 07c3ff3725 command: reject negative offset for overlay-add 2026-03-09 15:43:32 +01:00
WhitePeter c401ef9c3b screenshot: use mp_strip_ext for %F
Reuse existing functionality, see previous commit introducing above
function.
2026-03-03 03:06:39 +01:00
Kacper Michajłow e54cee1b23 player/command: apply expand-properties modifier also for string lists 2026-02-27 20:18:42 +01:00
Guido Cella 3b555c349c command: let playlist-play-index current preserve file-local-options
If you set file-local-options/foo at runtime and run playlist-play-index
current or playlist-play-index $current_pos, file-local-options/foo is
reset. Add a flag to make it preserve file-local-options.

The advantage of this change is that it allows binding Ctrl+r set
file-local-options/start ${=time-pos}; playlist-play-index current yes
to reload the current file while preserving all options, independently
of --no-config, --watch-later-options or --reset-on-next-file, and
without writing watch later files to disk. It also preserves
file-local-options set on the CLI unlike loadfile.
2026-02-27 09:21:14 +01:00
nanahi 4e2f3ce4b9 command: add track-list/N/demux-duration property 2026-02-24 19:36:33 +01:00
Simon Bruder 534b2d2ea6 {demux,player}: expose original and commentary track flags
Those flags were added to the Matroska specification together with the
already implemented hearing-impaired and visual-impaired flags.

They allow specifying whether a track is a commentary track or in the
original language without relying on the free-form track name, which
makes consistent tagging and parsing by machines easier.

Ref: https://github.com/ietf-wg-cellar/matroska-specification/pull/447
Ref: https://www.rfc-editor.org/rfc/rfc9559#name-original-flag
Ref: https://www.rfc-editor.org/rfc/rfc9559#name-commentary-flag
2026-02-20 20:31:04 +01:00
Dudemanguy 76a5eba991 player: don't mangle current playlist entry before initialization
Scripts and things using the client API can load up playlists in a
specific order and choose what file to start playing on by using the
loadfile or loadlist commands with the play argument. However if
starting from idle mode, it is possible to send these commands before
all scripts finish initializing. mpv's core then does a prepare_playlist
call on its own for startup which will nuke the current playlist entry
set by the API user and lead to an unexpected item being played. Fix
this by not unconditionally setting pl->current to NULL allow callers to
optionally always overwrite it by getting the first item in the playlist
(e.g. if it's called after startup anywhere else in the code). Other
options like --playlist-start or --shuffle are allowed to win if they
happen to be set.
2026-02-12 04:42:32 +00:00
Dudemanguy ee843f4db7 player/command: fix repeatable frame stepping with the seek argument
730062b510 fixed the problem with mouse
buttons but unfortunately we forgot to include repeated commands in the
condition. This effectively made any variant of "frame-step X seek"
unrepeatable even though it was supposed to be. So just allow those in
add_step_frame too.

Fixes #17348.
2026-01-31 01:20:14 +00:00
Guido Cella df7ac1d931 command: add the default-menu property
This property contains the builtin etc/menu.conf, and will be used by
select.lua. It is undocumented because it is for internal usage.
2026-01-25 20:56:42 +01:00
Guido Cella 7858e1fdaf command: remember the language when reloading tracks
In 5871ba8f3e I took the language from the filename when reloading
tracks noting "that backing up t->lang and restoring it if nt->lang is
NULL would work incorrectly when lang is in the stream and it is removed
before reloading", but actually external tracks don't have language in
the stream, it is set in the container, and reload commands only affect
external tracks. So just back up the language before reloading and then
restore the old language.

This preserves the language after reloading when it is not in the
filename but it was specified manually in an add command, e.g. sub-add
foo.srt '' '' en.

Hearing impaired, forced and default flags were already being set from
their values from before reloading the track, so setting them again from
the filename only caused the same issue that they would get unset if
they were manually added with add commands.

We still don't restore the old language if nt->lang is already set for
the edge case of doing something like sub-add foo.mkv and changing the
foo.mkv's sub track language before reloading.
2026-01-22 00:10:02 +01:00
Guido Cella 2c893e8f30 command: set the language of added tracks from the filename
If you do sub-add foo.en.srt, it doesn't set lang=en.

Fix this by extracting the language from the filename, along with
hearing impaired, forced and default flags.

If a language is explicitly passed to sub-add and related commands, that
takes priority.
2026-01-22 00:10:02 +01:00
Mohammad AlSaleh 313beaf241 player: make effective image_display_duration playback_speed aware
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2026-01-21 11:40:20 +01:00
Guido Cella fc86b96a8a various: don't normalize playlist filenames again
Since the previous commit normalized playlist filenames when they are
stored, the code normalizing them can be simplified back to how it was
before implementing normalization.
2026-01-12 15:10:37 +00:00
Dudemanguy 11c020f526 player/command: refactor loadfile and loadlist commands to use flags
We should have done this ages ago. These commands essentially consist of
a combination of a load action and whether or not playback should be
started. The old `-play` aliases are kept for backwards compatibility.
2026-01-10 01:00:58 +00:00
nanahi a3350e2fbb command: add libplacebo-version property
Similar to other core library dependencies.
2026-01-02 20:04:32 +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
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 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
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
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