Commit Graph

1224 Commits

Author SHA1 Message Date
Kacper Michajłow c6833a9307 stream_curl: add libcurl-based stream backend
Introduces stream_http, an internal libcurl-driven backend for http://
and https:// URLs. Runs all transfers on a dedicated curl multi thread
with a producer-side ring buffer, and exposes HTTP/2 multiplexing,
QUIC/HTTP/3 (when libcurl supports it), HSTS and TCP keep-alive.

Should generally be more stable and faster than FFmpeg HTTP/1.1 impl,
additionally connections are kept-alive between files open, so if you
open playlist of network files and navigate through them, it will re-use
the same connection.

Build is gated on the new 'libcurl' meson option (auto). When disabled
or unavailable, mpv silently falls back to FFmpeg's HTTP implementation.
2026-05-16 18:20:42 +02:00
Kacper Michajłow cdd3f1197f stream: split shared network options into their own sub-options
Will be useful for future commits
2026-05-16 18:20:42 +02:00
Kacper Michajłow 96ade17428 options: fix stream_lavf options struct name 2026-05-16 18:20:42 +02:00
nanahi 21351a0580 options/m_property: only get m_option info when needed
Micro optimization.
2026-05-12 21:39:34 +02:00
nanahi f98b114d58 options/m_property: use mp_require for log
log cannot be null on write path which is true for multiply and switch.
2026-05-12 21:39:34 +02:00
nanahi ae23198144 options/m_property: simplify m_property_multiply/m_property_switch
M_PROPERTY_GET_CONSTRICTED_TYPE is already acquired, just pass m_option
directly.
2026-05-12 21:39:34 +02:00
nanahi 6320792f1b options/m_property: try to get constricted type in m_property_do
When setting properties via M_PROPERTY_SET_NODE, the property value
is limited by static declared range. However, some properties like
volume handle dynamic M_PROPERTY_GET_CONSTRICTED_TYPE requests and
return runtime determined limits. M_PROPERTY_SET_NODE in this case
does not respect that limit, and allows setting to a value out of
range.

Fix this by always trying to use M_PROPERTY_GET_CONSTRICTED_TYPE
first so that the dynamic limits will be used.
2026-05-12 21:39:34 +02:00
nanahi 27ec68fbd8 options/m_property: add log null check to m_property_multiply
Similar to m_property_switch, cannot be null for write paths.
2026-05-12 21:39:34 +02:00
nanahi 13550bd31d options/m_property: extract m_property_switch to a function
Similar to m_property_multiply.
2026-05-12 21:39:34 +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 81611b4a4e input/dnd: move built-in drag and drop handling to mpv client
This moves the drag and drop handling to an internal mpv client,
removing the hardcoded handling from core.
2026-05-01 13:42:57 +02:00
nanahi 777401d7de options/m_property: add SUB_PROP_STRING_LIST
Helper used in next commits.
2026-05-01 13:42:57 +02:00
Kacper Michajłow 28ce461a84 options/m_option: add m_option_type_prop_array
Add adaptor for arrays of properties, this is not used as real option,
as those are always string list. But as a connector struct for creating
typed node arrays, in (sub)_properties.
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
Kacper Michajłow b4a7ea306e demux_{lavf,timeline}: add --flatten-editions
Lavf exposes programs/renditions as a flat track list tagged with
program_id. We respect this metadata and group tracks into their
respective programs, as tracks from different programs may be completely
unrelated to each other.

This commits adds an option to flatten the editions and ignore the
grouping.

Fixes: https://github.com/mpv-player/mpv/issues/17836#issuecomment-4345930205
2026-05-01 10:42:00 +02:00
Julian Orth 4c9262664c wayland: implement session management
If the compositor supports session management, the mpv window is always
added to a session. The user can manage multiple sessions by using
`--wayland-session=<human-readable-name>`. Human-readable names are
mapped to session ids via files under `~/.local/state/mpv/sessions`. The
file name is computed as a hash of XDG_CURRENT_DESKTOP and the
human-readable name.

If multiple mpv instances are started with the same session name, the
latter mpv instance takes over the session.

Upon session restoration, the mpv window is restored by the compositor
according to its state from the previous session. What that entails is
compositor policy.
2026-04-24 15:36:44 +00:00
alydev d40a29190d demux_playlist: add support for 'strm' playlist
The .strm format consists of a URI or local path as the sole contents
of a text file, this is parsed by software like Emby or Jellyfin to
treat remote streams or paths as if they are in the local filesystem.
This commit adds .strm to mpv's internal list of playlist file formats,
and points it to the handler for .m3u files as they should be
compatible. .strm doesn't need all the features of .m3u/.m3u8, but the
features do not cause issues with the relatively barebones playlist
format of .strm.
2026-04-22 03:23:50 +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
nanahi d711657833 options/m_option: use bstr_find_in_list0
Removes redundant find_list_bstr function.
2026-04-17 04:09:23 +02:00
nanahi da2739f44f various: don't check if endptr is null for strto[udll]
These functions always set endptr to non-null so there is no need to
check.
2026-04-17 04:09:23 +02:00
NRK 9251f871b6 options: preparse --shuffle
needed in order to correctly handle --directory-mode=auto

Fixes: https://github.com/mpv-player/mpv/issues/17601
2026-04-06 18:27:27 +02:00
nanahi 9bf9bb50de options/m_option: fix valid format in geometry option help message
/WS format is accepted.
2026-04-06 18:23:25 +02:00
nanahi 94d06bc727 options/m_option: allow /WS geometry parameter usable without XYWH
This allows specifying workspace while using autofit for window size
or leave it as default instead of mandatory geometry in pixels.
2026-04-06 18:23:25 +02:00
llyyr de118fdb70 m_option: don't allow m_geometry_apply to make a coordinate 0
Same reasoning as the previous commit.
2026-03-30 00:53:18 +00: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
Kacper Michajłow e54cee1b23 player/command: apply expand-properties modifier also for string lists 2026-02-27 20:18:42 +01:00
llyyr e09a1d12f2 m_option: also clamp OPT_FLOAT values for float_set
This incorrectly used clamp_double function after 0e7f9c39dc when it
should've always used clamp_float instead. Use clamp_float instead

Fixes: 0e7f9c39dc ("m_option: correctly clamp OPT_FLOAT values")
2026-02-24 19:41:53 +01:00
Kacper Michajłow ae119448b2 m_option: remove duplicated code for float/double range check
The float version was missing "default" case. This fixes options with
M_OPT_DEFAULT_NAN.

Fixes: 0e7f9c3
Fixes: #17436
2026-02-24 19:41:53 +01:00
zenodity f439c7f62c m_option: fix x:y mode format when printing geometry
Previously, x:y mode geometry strings were incorrectly printed
using the WxH+x+y format.
2026-02-22 22:31:40 +01:00
nanahi d6e7fb0597 options/options: add several audio extentions
mp1 - MPEG-1 Audio Layer I
mp2 - MPEG-1 Audio Layer II
mpc - Musepack
tak - Tom's lossless Audio Kompressor
tta - The True Audio
2026-01-20 07:49:17 +01:00
Hubert Głuchowski 2b78ac44a9 demux/demux_sbr: allow configuring probe size 2025-12-23 07:01:29 +01:00
Hubert Głuchowski bb97882c9a sub: add subrandr renderer support
subrandr is a subtitle rendering library which aims to render
SRV3 (YouTube) subtitles and WebVTT subtitles accurately.

Currently in mpv WebVTT subs are rendered via ffmpeg conversion to ASS
which throws away a lot of the style and completely disregards
the WebVTT non-region-cue positioning algorithm. Furthermore if
one wants to render some more complex SRV3 subtitles one has to
resort to external converters since it's not even supported by ffmpeg.

However subrandr is able to render SRV3 subtitles natively with support
for the most commonly used features. It can render ruby text without
relying on font metrics during conversion which is obviously fragile,
and it can perform correct scaling using the exact calculations used by
YouTube instead of making up ASS approximations. Similarly it follows
the WebVTT spec for the features of WebVTT that it supports (mostly).

It's not perfect of course and there's still many things it doesn't do
or does wrong but those are things that can be incrementally improved
outside of mpv.
2025-12-23 07:01:29 +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
Kacper Michajłow 9a85ae3ee0 m_option: be more resilent to new enum additions
Unfortunately we don't have control over libplacebo and cannot
synchronize such changes, so just return `<unknown>` to be forward
compatible with any possible changed.

Note that this should be updated ASAP to support new values.
2025-11-28 18:28:06 +01:00
Kacper Michajłow 10c9b3381b options: add mxf to video file extensions list 2025-10-15 22:00:08 +02:00
llyyr be5e606377 sub: make --sub-fix-timing configurable
Instead of hardcoding the threshold and keep duration in a header,
expose them as options for users to configure and set old hardcoded
values as the new defaults for those options.
2025-10-05 21:35:20 +02:00
Kacper Michajłow b4c2471174 options: reduce swapchain-depth to 2 by default
It's enough to not wait for the flip and start with next frame and in
the same time minimized latency which helps display-sync modes, that are
not aware about swapchain depth.
2025-09-27 22:15:13 +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
arch1t3cht eba7a11a2e player/command: do seamless angle change when bluray-angle is changed 2025-09-15 03:52:35 +02:00
arch1t3cht e6e7083ce6 options: remove leftover bluray_device field
This was moved to stream_bluray_opts in
8a7704ea89.
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
verygoodlee 4c17803b91 options: delete the duplicated extension "wav" in --audio-exts
fixes: 44a3a3293f
2025-08-14 22:26:34 +02:00
Dudemanguy 29307c26ba Reapply "various: expand paths for all file/directory related options"
This reverts commit 43fda5442f.
2025-08-08 01:07:00 +00:00
Dudemanguy e0d06ecedc Revert "m_option: automatically expand paths for M_OPT_FILE options"
It would be nice to expand all path arguments for free in the option
code, but life isn't so simple. Because of string list options, we have
to expand at parsing time. Because of libmpv, mpv_global has to be
passed around a million places. Even after doing all that, there's still
a drawback where anything defined in builtin.conf (used for setting
default profiles and such) will be unable to correctly resolve paths if
the user uses --config-dir. Nothing currently defined in builtin.conf
would be subject to that and it's not likely that anyone would add
anything that would be, but it's a limitation that can't be changed
because this has to be parsed before the user's command line and before
mpv_global is set. There's also another problem of pretty printing paths
which are now always full paths instead of relative ones. It's not so
nice if the user's home path is something very long. This could be dealt
with by saving an unexpanded path in some field in the opt somewhere and
then doing that for pretty printing but with all this extra
complication, it's questionable if there's really any net gain at the
end of the day. Calling mp_get_user_path on some opt->whatever is a lot
simpler and always works. So this commit goes back to the old model
along with the following reverts/reapplies.

This reverts commit 9b7374ea40.
2025-08-08 01:07:00 +00:00
nanahi 8b0b186147 options: handle runtime wid change
Add UPDATE_VO flag to the --wid option so that the window embedding
can be changed at runtime without needing to reset another UPDATE_VO
option.
2025-08-05 19:59:16 +02:00
Dudemanguy 43fda5442f Revert "various: expand paths for all file/directory related options"
Since the option system now handles all the path expansion
automatically, these recent changes can be reverted for simplicity.

This reverts commit be15be3a83.
2025-07-22 17:52:41 +00:00
Dudemanguy 9b7374ea40 m_option: automatically expand paths for M_OPT_FILE options
Unfortunately, I've already done most of the legwork on expanding paths
manually in the code everytime we encounter one of these options, but it
is completely possible to do it during the option parsing/copying. All
option value setting should go through m_config_set_option_raw at some
point, so this is a good target place to put this logic. Additionally,
the M_OPT_FILE flag already exists for any option that is meant to be
have path values as arguments, so we just needed to add an m_option
method to do this. Fundamentally, this is exactly the same as
m_option_copy except that we potentially expand the value string. A new
expand function pointer is now added and we implement it for the two
option types where this is relevant: OPT_STRING and OPT_PATHLIST.
Furthermore, a m_option_copy_and_expand wrapper is added to handle which
function pointer should be used. With this change, this means that all
path values located in any opt->value pointer should automatically be
expanded and users of the value no longer have to manually do this
themselves. Of course, that means that there's now a ton of redundancy
in the code that can be eliminated. That will be cleaned up in the next
commits.
2025-07-22 17:52:41 +00:00
Dudemanguy 4ee4444b68 options/path: fix a lie in comment
During the original PR, that was true but mp_normalize_path was changed
in 0755edb327 to allow NULL talloc_ctx.
Deleting the comment was forgotten since it was never true when the
commits were merged, so do it now.
2025-07-16 13:42:38 +00:00
Dudemanguy 5c4c27e6b1 m_option: remove unneeded legacy syntax parsing
This code got shuffled around over the years but fundamentally it was
first introduced in 2c22fcd350 to fix a
parsing issue with specifically the af and vf options. Syntax like af*
and vf* used to be valid and this was part of dealing with that case.
Later 50008adf4a completely changed this
and ripped out support for the wildcard behavior. But these few lines to
deal with the special case were never removed. The token splitting has
been unnecessary for years and is confusing, so clean this up and
finally remove it.
2025-07-15 18:06:14 +00:00