Compare commits

...
510 Commits
Author SHA1 Message Date
sfan5 41f6a64506 Release 0.41.0 2025-12-21 20:08:20 +01:00
llyyr 17cfad0b74 wayland: use rendering intent enum instead of magic value 2025-12-21 17:26:08 +00:00
llyyr 51ae55bdc9 wayland: support color-management-v1 version 2 2025-12-21 17:26:08 +00:00
der richter f93df58a8e osxbundle: add new macOS 26 compatible App icon
generated with the Icon Composer project:

actool ./icon.icon \
  --compile ./ \
  --app-icon icon \
  --enable-on-demand-resources NO \
  --development-region en \
  --target-device mac \
  --platform macosx \
  --include-all-app-icons \
  --minimum-deployment-target 10.15 \
  --output-partial-info-plist /dev/null \
  --standalone-icon-behavior all

actool will generate an Assets.car file which is compatible with all the
new Theme variants of macOS 26 (default, dark, monochrome, tinted, etc).
it also generates an old icns file as a fallback, only default style.

since the new Assets.car file can't be used from cocoa directly, without
using private APIs, we still use the icns file when used from CLI.
this also means that from CLI only the default icon is used and the
macOS theming doesn't have any effect.

the macOS theming mechanism only works with the bundle and a Assets.car
file. all icons are generated on the fly depending on the Theme. this
generation has no public API and the mechanism would need to be
replicated by hand. to replicate this behaviour at least three different
icns would need to be generated, tinting needs to be implemented,
several system events need to be subscribed, and this wouldn't guarantee
the same look as the system mechanism. also none of the tools make it
possible to generate macOS 26 compatible icns file, besides for the
default file, since it at least is missing the necessary padding.
2025-12-21 11:48:52 +01:00
Kacper Michajłow efc44d05ff vo: trigger manual redraws at most at slightly over display fps
This is workaround for some windowing platforms that break when they get
too many present requests.

Fixes: #17082
2025-12-21 11:30:31 +01:00
NewUserHa 08dbdd8486 DOCS/man/options: clearify that gpu-next support d3d11va and everything 2025-12-19 19:19:09 +01:00
Niklas Haas 02f47c8825 mp_image: check all components for pl_bit_encoding in mp_image_setfmt
This matches the full logic used in vo_gpu_next.
2025-12-19 18:17:46 +01:00
Kacper Michajłow a310a65d35 vo: put vo states into union
They won't be used together. Could be refactored to put them into priv,
but for now, let's avoid doing bigger refactor.
2025-12-19 18:08:20 +01:00
Kacper Michajłow 93b68d7fe2 meson: remove png icons from win32 resource depend
They are not used, everything is already packed in mpv-icon.ico.
2025-12-19 18:08:20 +01:00
Kacper Michajłow c35e10c2da vo: remove unused configs from context 2025-12-19 18:08:20 +01:00
Julian Orth ae211f7f1b wayland: convert luminance values to libplacebo space
Signed-off-by: Julian Orth <[email protected]>
2025-12-19 18:08:02 +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
https://github.com/ytdl-org/youtube-dl/commit/67299f23d8b1894120e875edf97440de87e22308.
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
Kacper Michajłow 6739fd490b filters/f_decoder_wrapper: reinit decoder on audio-spdif opt change
Fixes: #17072
2025-12-18 13:07:13 +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
Kacper Michajłow 122abdfec3 video/out/aspect: don't overflow intermediate values in scaling calc
This fixes calculation of scaling bounds with extreme video zoom levels.

Fixes: https://github.com/mpv-player/mpv/discussions/17123
2025-12-15 01:46:40 +01:00
Kacper Michajłow 5d89f15e97 video/out/gpu/hwdec: load native D3D RA hwdec drivers first
There is no reason to load EGL/VAAPI first as it would fail in default gpu
context/api anyway, on Windows.
2025-12-14 13:42:22 +01:00
llyyr f7be2ee3e9 ao_aaudio: set content type if --audio-set-media-role is enabled 2025-12-13 15:18:12 +01:00
llyyr e99daecbdb ao_audiotrack: set content type if --audio-set-media-role is enabled 2025-12-13 14:46:55 +01:00
llyyr d07e4c7935 ao_pulse: set media.role if --audio-set-media-role enabled 2025-12-13 14:46:55 +01:00
llyyr 1a802b1810 ao_pipewire: avoid setting any media.role by default
This adds option `--audio-set-media-role` to configure whether mpv
should set media roles to supported audio APIs or not. Disabled by
default.

By default, WirePlumber restores the volume of each application to
whatever the last application with the same media role used. This is
completely insane behavior, and I couldn’t find any way for a user to
opt out of it on my end. The `state-stream.lua` script responsible for
this mess only uses media.role if the property is present, so the only
reliable workaround is simply not to set one at all.

This WirePlumber behavior is inherited from PulseAudio, which also
exhibits the same behavior to this day.

This commit also mirrors the same change made to ao_pulse in 2015:
b7325b2f64

See also: https://gitlab.freedesktop.org/pipewire/wireplumber/-/issues/489
2025-12-13 14:46:55 +01:00
Kacper Michajłow 95c7599c41 ci/win32: downgrade meson to 1.9.2
1.10.0 fails to build cmake projects.

See: https://github.com/mesonbuild/meson/issues/15360
2025-12-08 22:23:08 +01:00
der richter 3c867c14c0 mac/vulkan: log opaque state (direct-to-display possible) of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know when the layer is opaque and direct-to-display is
possible.

log opaque state.
2025-12-08 19:13:32 +01:00
der richter ae746aa3a7 mac/vulkan: log display sync active state of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know when display sync is activated

log display sync active state.
2025-12-08 19:13:32 +01:00
der richter ac41d5f176 mac/vulkan: log HDR active state of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know when HDR is activated

log HDR active state.
2025-12-08 19:13:32 +01:00
der richter f2d1f2a3c4 mac/vulkan: log EDR changes of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know which EDR data is used/mapped to.

log EDR data changes to actually see which EDR data was chosen.
2025-12-08 19:13:32 +01:00
der richter 83d9de42bc mac/vulkan: log colorspace changes of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know which colorspace is used/mapped to.

log colorspace changes to actually see which colorspace was chosen.
2025-12-08 19:13:32 +01:00
der richter 5cfdbc24d9 mac/vulkan: log pixel format changes of metal layer
since we have a mapping layer between vulkan and metal (MoltenVK) we
don't actually know which pixel format is used/mapped to.

log pixel format changes to actually see which format was chosen. only
those 9 formats are valid for a CAMetalLayer.
https://developer.apple.com/documentation/quartzcore/cametallayer/pixelformat
2025-12-08 19:13:32 +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
Kacper Michajłow 72dbcf119a ci: update some github actions 2025-11-30 17:50:10 +01:00
sfan5 3a4e0fc200 ci/mingw: update dependency versions 2025-11-30 17:21:28 +01:00
sfan5 393b3fc115 ci/mingw: use a mirror instead of ftp.gnu.org
it's apparently constantly down these days...
2025-11-30 17:21:28 +01:00
sfan5 584b368972 demux_playlist: clarify reason for HLS detection
see 0b1c3e8de2
2025-11-30 17:21:28 +01:00
sfan5 2ad27be8be demux_lavf: remove 'bin' format from blacklist
A probing function was implemented in ffmpeg 4.0:
<https://github.com/FFmpeg/FFmpeg/commit/8f6a71f7f13d21614f5140e672976e96dca04af8>
2025-11-30 17:21:28 +01:00
Guido Cella 4614dd6859 etc/mpv.conf: replace the --sharpen example
gpu-next doesn't support --sharpen and it is now the default VO, so
replace it with something that actually works.
2025-11-30 14:21:28 +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
Lynne 69e7341e8a vd_lavc: enable hwdec for DPX by default
Another Vulkan compute codec was merged in FFmpeg, for DPX.
2025-11-30 14:20:52 +01:00
Kacper Michajłow 23f9381b80 mp_image: add ycgco-{re,ro} support
Fixes: #17077
2025-11-28 18:28:06 +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
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
Jun Bo Bi 57d9d4eb42 ao/aaudio: implement aaudio backend for android 2025-11-25 20:29:42 +01:00
Jun Bo Bi 24000e3b3f meson: added option to disable audiotrack 2025-11-25 20:29:42 +01:00
Leo Izen 8469605191 video/image_writer: use image->params.repr to determine depth
The previous method used in 2b38b382cf doesn't properly determine the
original depth. We use image->params.repr.bits.color_depth to determine
that now.

Fixes #16398.

Signed-off-by: Leo Izen <[email protected]>
2025-11-23 18:18:36 -05:00
Guido Cella f6c116491a DOCS/man/input: don't discourage hook usage
This paragraph was added 10 years ago in f8dc5db315. Hooks are now
commonly used both in internal (ytdl_hook, auto_profiles) and external
scripts (e.g. https://github.com/mpv-player/mpv/issues?q=mp.add_hook).
They are the only way to handle events synchronously and nobody is just
going to change the API and break all scripts at this point, so remove
the warning.
2025-11-21 14:51:07 +01:00
der richter 1f4cf13e8b meson: print cocoa for feature summary
should be mentioned similar to x11 and wayland.
2025-11-21 14:50:11 +01:00
Kacper Michajłow 52525dceb8 demux: clear packet pool when upper memory limit is lowered
This clears packets from the pool, that would never be reused under new
settings. Note that depending on demuxer state this clears only unused
packets, in some cases demuxer may still hold more packets than the new
limit. Fox example demuxer doesn't forcefully clear forward cache when
reducing the size.

Also keep packet pool, even if current file is not cached, this is
useful for all sorts of things and may be useful for next file.

This act only on user options values, regardless of internal demuxer
caching state, which can vary depending on track type or source.
2025-11-20 20:35:00 +01:00
Guido Cella e6885cb926 misc/path_utils: don't normalize -
This fixes options like --audio-file=- and avoids returning $PWD/- as
path and stream-open-filename when playing from standard input.

It will also allow storing playlist filenames as normalized without
checking for - at the caller.

Fixes 23b57e9f7f.
2025-11-18 20:23:08 +00:00
llyyr accf0cc67e wayland: correct geometry handling for rotated outputs 2025-11-18 20:22:51 +00:00
llyyr 7482608939 wayland: fix condition for setting image description
We need both a color surface and parametric support to attempt to apply
image description, not either one.

Fixes: 0a32f988ba ("wayland: move initial color management setup earlier in the init")
2025-11-17 04:35:32 +00:00
Dudemanguy 0a32f988ba wayland: move initial color management setup earlier in the init
When this was originally implemented, there was a dependency on waiting
for certain events from the compositor so it was placed after the
original roundtrip. Since b3abe3975b
removed the need for most of these conditions, we can more logically
place the creation of the color_surface and color_surface_feedback
earlier in the process and leave the wl_display_roundtrip as the true
final call for the wayland init process.
2025-11-17 01:40:28 +00:00
llyyr 9379c0706d wayland: only print color repr message if we actually set anything 2025-11-16 22:50:14 +00:00
llyyr 0b2cc5a3c1 wayland: remove unused primaries/tf/luminance feature flags 2025-11-16 22:50:14 +00:00
llyyr 16b2a54776 wayland: always use get_preferred instead of get_preferred_parametric
Compositor will probably give us a parametric description anyway, but
mpv can handle icc files if it gives us one so allow compositors to give
us an icc file.
2025-11-16 22:50:14 +00:00
llyyr dff5929733 wayland: assume all image description is parametric until icc_file event
If we used get_preferred_parametric to get this image description, then
it is guaranteed to be parametric. If we used get_preferred to get this
image description, then it may or may not be parametric depending on the
compositor. If we receive an icc_file event, then the image description
is not parametric.
2025-11-16 22:50:14 +00:00
llyyr b3abe3975b wayland: remove icc feature check and simplify handling icc file
The only part of the protocol that is behind this feature is the
create_icc_creator which we don't use. We also seem to confuse the
presence of this feature to mean that the compositor will always give us
non-parametric image descriptions but these two things have no relation
with each other. Remove the feature check and use
`wl->supports_parametric` to decide if we want to use `get_preferred` or
`get_preferred_parametric` instead.

This also removes error messages for when the compositor doesn't support
parametric descriptions or when the compositor doesn't support
icc_v2_v4.

The user needs to set `icc-profile-auto` for the icc_file path to work
properly which isn't ideal but I'm not sure what to do about this and
likely won't make any big changes right before a release.
2025-11-16 22:50:14 +00:00
Kacper Michajłow 701201b13c ci/win32: bump ffmpeg to 8.0 2025-11-15 17:08:47 +01:00
Kacper Michajłow 0f5fafdaad osdep/compiler: fix typo in MP_ASSERT_UNREACHABLE 2025-11-15 01:25:37 +01:00
Kacper Michajłow 83cedd1074 meson: define WINICONV_CONST to strip const from win-iconv 2025-11-15 01:25:37 +01:00
Kacper Michajłow 4489ef54d9 ci/win32: fix aom CRT type to be consistent with the rest of the build 2025-11-15 01:25:37 +01:00
llyyr b2156c7d30 ao_wasapi_utils,command,hwdec_vulkan: remove double semicolons
Cosmetic
2025-11-14 20:44:46 +00:00
Kacper Michajłow a21e47c45d ao_pipewire: fix mapping of wide channels 2025-11-14 21:41:15 +01:00
Kacper Michajłow 867e808f6c ci/openbsd: update to 7.8
Update to cross-platform-actions 0.30.0.
2025-11-14 21:41:07 +01:00
Dudemanguy 8b3698f9fe github/workflows: fix libXpresent installation on freebsd
The x is uppercase now.
2025-11-14 21:36:58 +01:00
Thomas Lange 7815181b19 ao_pipewire: fix copy paste error in channel mapping 2025-11-13 18:57:22 +01:00
nanahi 2e5e2938dd meson.build: print drm for feature summary
Similar to X11 and Wayland, it is a platform with gpu/gpu-next support
and worths to mention.
2025-11-10 08:33:15 +01:00
Kacper Michajłow bbafb74880 vo_gpu_next: limit min_luma to 1000:1 contrast ratio in SDR mode 2025-11-07 02:42:42 +01:00
Kacper Michajłow 9b1d47ece1 mp_image: map hwdec format parameters correctly 2025-11-07 02:15:32 +01:00
der richter 28ef6b780c ci/mac: add macOS 15 intel runner
replacement for the old macOS 13 runner. the last and only intel runner.
2025-11-05 20:20:42 +01:00
der richter 1e8f0185d8 ci/mac: move our test runner to the newest macOS 26 runner 2025-11-05 20:20:42 +01:00
der richter 22bbe3b884 ci/mac: add macOS 26 runner 2025-11-05 20:20:42 +01:00
der richter 337ef24b68 ci/mac: use oldest Xcode version on oldest macOS runner 2025-11-05 20:20:42 +01:00
der richter 768db30557 ci/mac: remove deprecated macOS 13 runner
the macOS 13 runners will be removed on 4th December.
2025-11-05 20:20:42 +01:00
der richter 1b9998a620 osxbundle: make bundle category configurable and default to video
in a13a674363 we set the default category
for the bundle to games, to get certain benefits like better rendering
timing, better bluetooth latency, better threading, etc (bundle only).

though this also prevents low power modes and wrongly categories the app
for spotlight search etc.

set the default category to video and add an option to set the category
to games if one wishes to.
2025-11-05 19:23:26 +01:00
Kacper Michajłow 5b0cfe8849 ci/tumbleweed: disable sanitizers for GCC build
It produces some bogus warnings when UBSAN is enabled:
../demux/demux_mf.c:103:22: error: ‘%s’ directive argument is null [-Werror=format-overflow=]

Which is clearly not possible at this point.
2025-11-04 21:50:06 +01:00
Kacper Michajłow 07622820d8 .lsan_suppressions: remove no longer needed suppression 2025-11-04 21:50:06 +01:00
Kacper Michajłow c3ba7bc0b1 ci: remove -Wno-error=deprecated
No longer needed and will let us spot deprecations sooner.
2025-11-04 21:50:06 +01:00
ckath 8364b122ee TOOLS/lua/autoload.lua: stop initial file from being added twice
this happened right after going to the next file
2025-11-04 20:53:35 +01:00
Kacper Michajłow 04055e5806 video/out/gpu/video: change treat-srgb-as-power22 default to auto
We want to have symmetry on the input and output. Also outputting sRGB
encoded image to gamma 2.2 display is clipping blacks. 2.2 displays are
more common and are reference sRGB display, which is what we should
target.
2025-11-04 20:51:50 +01:00
Kacper Michajłow 25aa402f1d ci/build-msys2.sh: disable pdf-build for clangarm64
See: https://github.com/msys2/MINGW-packages/issues/26007
2025-11-03 14:18:18 +01:00
Alex James 0a606d9e18 osxbundle: read version from version.h
osxbundle.py currently reads the version number from MPV_VERSION, while
Meson first tries git describe before falling back to MPV_VERSION.
Update osxbundle.py to try reading the version number from version.h
before falling back to MPV_VERSION. This ensures that the version number
in the bundle matches the output of mpv --version.
2025-11-01 14:41:18 +01:00
der richter ffd47de51d mac/common: fix window position on multi monitor setups
on multi monitor setups the position of the window was wrongly computed
when the position was forced, eg the calculated rectangle was screen
relative but the function expected absolute coordinates.

this is a regression from 50042f5ee0 and
#15500, where support for --force-window-position was introduced. this
worked in simple one monitor setups and in some cases on multi monitor
setups by sheer coincidence.

calculate the absolute position of the window by taking the screen into
account when needed.

Fixes #16929
2025-11-01 13:57:49 +01: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
sfan5 609acc7cf2 meson: warn if building with SDL2
I previously tried to enable sdl2-gamepad by default and the CI turned all red.
In detail:
- SDL_config.h has macros that conflict with ours
- memory leaks caused the tests to fail
- main=SDL_main redefinition broke MSYS builds

The options remain disabled by default, but lets warn our users a bit.
2025-10-31 12:53:04 +01:00
sfan5 8649b64e57 meson: remove redundant sdl2 option
This disables the individual options by default, since they were gated by the parent option before.
2025-10-31 12:53:04 +01:00
llyyr 454d9eb361 wayland: log display luminance values alongside other preferred img desc 2025-10-29 17:37:17 +01:00
llyyr 22c149e615 wayland: replace comment with log message 2025-10-29 17:37:17 +01:00
llyyr 98847f5f0b wayland: log connector name for wl_output in more places
Fixes: b8ab1074eb
2025-10-29 15:37:29 +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
Kacper Michajłow 0a84c0a204 vo_gpu_next: add workaround for broken linear output in libplacebo
See: https://code.videolan.org/videolan/libplacebo/-/merge_requests/759
2025-10-29 15:36:15 +01:00
Kacper Michajłow 9b4341643f video/out/gpu/video: add --sdr-adjust-gamma 2025-10-29 15:36:15 +01:00
Kacper Michajłow 3e628c8d64 vo_gpu_next: linearize sRGB as a pure 2.2 power function
sRGB reference display is defined a 2.2 gamma device. To preserve the
look of the sRGB as mastered on such device, linearize it as such.

Note that sRGB encoding is piecewise with linear segment, which creates
mismatch to pure power 2.2 function, but this is intended to be viewed
on such display.

See:
IEC 61966-2-1-1999
https://community.acescentral.com/t/srgb-piece-wise-eotf-vs-pure-gamma/4024
https://github.com/KhronosGroup/DataFormat/issues/19
https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/12
https://github.com/dylanraga/win11hdr-srgb-to-gamma2.2-icm
2025-10-29 15:36:15 +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 6b01391142 meson.build: add libx11 as x11 clipboard dependency
Should resolve possible link errors.
2025-10-28 13:57:37 +01:00
Kacper Michajłow 532bac0b68 wayland_common: always prefer the PQ transfer for HDR output
Fixes: #16972
2025-10-28 10:38:55 +01:00
sfan5and茶茶 e23e72bd49 vo/context_android: fix surface tearing on resize
It's not clear why this is needed, but it works (on my device).

fixes https://github.com/mpv-android/mpv-android/issues/991

Co-authored-by: 茶茶 <[email protected]>
2025-10-27 23:30:04 +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 0a88720245 .pre-commit-config: add requestor to ignore list 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
nanahi ce3f11ed55 .github/ISSUE_TEMPLATE: add --msg-time to log file instruction
Logs produced with the terminal output method do not have timestamps
logged by default, unlike --log-file.

Add --msg-time to the instruction to retain this information.
2025-10-27 20:01:25 +01:00
nanahi 8ac52fd1ab various: use mp_sleep_ns 2025-10-27 20:00:59 +01:00
nanahi 8410f3157d TOOLS/lua/test-hooks.lua: drop sleep amount suffix
Not POSIX.
2025-10-27 20:00:59 +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
Lynne f181907aff vd_lavc: add ProRes RAW to the list of default hwdec codecs
Unlike all other codecs, ProRes RAW is pretty much guaranteed to be slow
as hell on the CPU, always having thousands of tiles. And even on a very
slow GPU, a CPU decode won't be anywhere near to usable to make a difference.
2025-10-27 19:52:57 +01:00
Attila Fidan 44685344a5 vo_dmabuf_wayland: request redraw on resize
Fixes panning the video while it's paused and the OSD isn't redrawing.
wayland_common since c25129339d requests
redraw when there is a resize event so there was no issue with xdg
resizing but that isn't applicable to resizing due to panscan options
changing.
2025-10-26 18:34:15 +00: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 99d6d4c1c2 sub/osd_libass: change add_osd_ass_event argument to bstr
This allows to remove one dummy tmp allocation.
2025-10-19 18:35:40 +02:00
Kacper Michajłow 233e89698e video/out/gpu/video: make the target-contrast limit higher
OLEDs report min luminance of 0.0002 nits, while we couldn't set this
with options due to limit. Set limit, so that we cannot exceed the hdr
black value used in libplacebo in worst case scenario of target peak 10
nits.
2025-10-15 22:00:19 +02:00
Kacper Michajłow d204051d93 vo_gpu_next: use reported display contrast value also in SDR mode
It is useful in SDR mode to use correct target-contrast too.
2025-10-15 22:00:19 +02:00
Kacper Michajłow 10c9b3381b options: add mxf to video file extensions list 2025-10-15 22:00:08 +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 f9d4e19888 TOOLS/lua/gamma-auto: update on timer when on Linux
The Linux implementation of ambient-light is not observable.
2025-10-15 21:59:42 +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
nanahi ad59ff1b4a DOCS/man/input: document command-list contents
Forgotten in 029bb593e7.
2025-10-11 18:32:01 +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 2412feaf49 mp_image: use correct scaling for nominal peak
Fixes copy-paste error

Fixes: add2bf50cd
2025-10-10 06:24:17 +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 add2bf50cd mp_image: use pl_color_space_nominal_luma_ex() to set nominal csp peak 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
Kacper Michajłow b5c538a9c7 vo_gpu_next: add --hdr-reference-white 2025-10-10 06:12:35 +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
Kacper Michajłow e70bb8802f ci/lint-commit-msg.py: modernize type hint 2025-10-07 22:11:02 +02:00
Kacper Michajłow 3ae5521367 mp_image: keep chroma location consistent for non-subsampled formats
Could also be set to unknown, but let's keep it center, so any fallbacks
in other places wouldn't trigger. In practice it shouldn't be used for
non-subsampled formats.
2025-10-07 18:50:53 +02:00
Kacper Michajłow 7dd035e937 vf_format: add some basic HDR10 metadata
Can be extended if needed.
2025-10-07 07:56:18 +02:00
Kacper Michajłow 96ce2d199d vf_format: add --vf=format=transfer alias 2025-10-07 07:56:18 +02:00
Kacper Michajłow 3c1abdb7bb DOCS/man/vf: add missing st428 in vf_format 2025-10-07 07:56:18 +02:00
Kacper Michajłow 3d39d992d0 av_common: check if position is not negative 2025-10-07 07:55:26 +02:00
Kacper Michajłow a0c4d7b1ca demux/cue: fix crash when there are no tracks 2025-10-07 07:55:26 +02:00
Emmanuel Gil Peyrot 6083cf13f2 wayland: fix displaying non-subsampled formats
Fix regression introduced in 90e3e104d9,
where all non-chroma subsampled formats (e.g. rgb8 or yuv444p) will
trigger a protocol error and get disconnected by the compositor due to
setting the chroma location on the color representation object.

GNOME-Shell 49 will emit this protocol error otherwise:
```
wp_color_representation_surface_v1#54: error 3: Commit contains a color representation with chroma location set and a buffer with a pixel format which is not 4:2:0 subsampled
```

How to reproduce:
- Run gnome-shell 49
- Run `mpv --vo=dmabuf-wayland some-image.png`
2025-10-06 22:00:30 +00:00
Emmanuel Gil Peyrot 4c885905e7 img_format: add a helper to determine if chroma is 4:2:0 subsampled
Only YUV formats which are subsampled once in both width and height will
return true (so for instance NV12 or P010), other formats will return
false.
2025-10-06 22:00:30 +00:00
llyyr 8a9c0fe05d wayland: log color-representation information as well 2025-10-06 21:40:51 +00:00
llyyr 162fa47be1 wayland: log the image description we try to set 2025-10-06 21:40:51 +00:00
llyyr 042bfd9e05 wayland: always set max_cll/max_fall
These have nothing to do with whether the compositor supports
set_mastering_display_primaries protocol feature or not and are always
available
2025-10-06 21:40:51 +00:00
Attila Fidan c2a211ca1c vo_dmabuf_wayland: unset video viewport source when force_window
The video viewport source rectangle is prevented from being set while
force_window, but we should also unset it because it will be set if a
video is played before entering force_window. Fixes out_of_buffer error
from Weston and wlroots in this scenario.
2025-10-06 21:40:36 +00:00
Kacper Michajłow 33f38423b3 vo_gpu_next: add --border-background=blur and --background-blur-radius 2025-10-06 16:27:50 +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
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 df4bd5d1c8 DOCS/man/options: mention --target-gamut in colorspace hint mode
The description was not complete saying only about --target-prim.
2025-10-05 21:35:00 +02:00
Kacper Michajłow 20bf508b9d vo_gpu_next: don't force PQ output for SDR sources if target is unknown
We currently force PQ output when target_csp() is not available, to
preserve compatibility with backends that do not support it and to
enable HDR on them. However, for SDR transfers we can safely skip this
and simply use the source mode instead.

Ultimately, this "force PQ" mode needs to be removed, but target_csp()
is still not implemented for all relevant backends.
2025-10-05 21:35:00 +02:00
Kacper Michajłow 24647365a3 meson: don't define _UCRT_NOISY_NAN
The issue has been fixed in Windows SDK, if you are using affected SDK
version, update or downgrade to the working one.

See: https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907
2025-10-05 21:34:29 +02:00
Kacper Michajłow 6c047794dd osdep/compiler: use __MINGW_{PRINTF,SCANF}_FORMAT for attribute format
This ensures that we test format string for the actual impl that is
being used. Depending if UCRT is used and if __USE_MINGW_ANSI_STDIO is
defined the implementation capabilities may differ.

Note that we don't explicitly define __USE_MINGW_ANSI_STDIO anymore,
this is defined implicitly in mingw headers, if needed. We don't support
ancient mingw versions that does not define it correctly for c11.
2025-10-05 21:34:29 +02:00
Kacper Michajłow 883db51ad0 osdep/compiler: refactor MP_ASSERT_UNREACHABLE 2025-10-05 21:34:29 +02:00
Kacper Michajłow 4338880560 various: add MP prefix for {PRINTF,SCANF}_ATTRIBUTE 2025-10-05 21:34:29 +02:00
Guido Cella 2f7543f808 DOCS/man/input: document that screenshot-raw works in scripts
Use the same wording as expand-text and similar commands.
2025-10-05 11:50:34 +02:00
Kacper Michajłow 17a3ac4cf2 mp_image: add support for AVAlphaMode 2025-10-04 03:26:57 +02:00
Dudemanguy e821a360df github/workflows: reduce timeout for BSD builds
Sometimes the VMs that these run in spin forever so it's good to have
some timeout. 30 minutes is way longer than what we need. When these are
successful, they complete in under 10 minutes (especially freebsd which
is very fast). If we're at the 15 minute mark, the VM is stuck spinning
forever so just abort.
2025-10-02 18:20:10 +00:00
Dudemanguy c946297e38 github/workflows: update cross-platform-actions to v0.29.0 and freebsd
Bigger number better.
2025-10-02 18:20:10 +00:00
Dudemanguy 9b4e8fcb07 test/libmpv_common: fflush stdout and stderr in fail 2025-10-02 15:15:48 +00:00
Dudemanguy 3bbb94077d test/libmpv: use common wrappers for properties and commands
This is mainly for better, more descriptive logging when something goes
wrong and fails. Common operations that manipulate properties and
commands go through shared functions that do better detailed logging.
Also it means we don't need check_api_error around anymore so get rid of
that. libmpv_lifetime is left untouched since that one is a bit special
and works a little differently.
2025-10-02 15:15:48 +00:00
Dudemanguy e0cf3f8061 test/libmpv_encode: use libmpv_common.h
De-duplicates some code.
2025-10-02 15:15:48 +00:00
Dudemanguy 6179a24741 vo_dmabuf_wayland: actually reuse OSD buffers
c958990833 was supposed to implement this,
but it got forgotten and the placeholder code which just
created/destroyed every buffer for every frame was left. Oops. Finally
fix this a couple of years later.

Fixes #16863.
2025-10-02 00:32:21 +00:00
Kacper Michajłow 05656cdae7 mp_image: assume content has sRGB transfer when is full range
BT.1886 is mostly limited to TV production which is almost exclusively
limited range. sRGB for full range is better guess, if no better
information is available.
2025-09-30 01:07:36 +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
llyyr 7e6f7b3f66 wayland: demote image_description_ready log to trace
this happens on every frame
2025-09-29 10:20:52 +02:00
llyyr ad3c43f9b6 wayland: log preferred surface feedback details
Useful for debugging
2025-09-29 10:20:52 +02:00
llyyr 7037ff4563 wayland: only unset image description if we couldn't set a new one
set_image_description replaces the old image description, so we don't
need to call unset_image_description unconditionally. Only call it if we
couldn't set an image description.

This helps with the lack of synchronization between VO pageflips and
wayland protocol events mentioned in the previous commit.
2025-09-29 01:47:44 +02:00
llyyr f0883cdde1 wayland: call pl_color_space_infer before comparing target_params
Calling `pl_color_space_infer` on `wl->target_param` can cause the
`pl_color_space_equal` check to fail on every frame if any values were
changed by `pl_color_space_infer`. This will cause us to believe
target_params get changed on every frame, and we'll end up in a state
where wayland events happen in the following order indefinitely:

  -> wp_color_management_surface_v1#45.set_image_description(...)
  -> wp_color_management_surface_v1#45.unset_image_description()
  -> wl_surface#9.commit()
  -> wp_color_management_surface_v1#45.set_image_description(...)
  -> wp_color_management_surface_v1#45.unset_image_description()
  -> wl_surface#9.commit()

Since image_description is double buffered, we always queue an unset to
the pending state before each commit. As a result, no commit ever
carries a valid image_description.

Taking the sample file in the issue as an example, we end up in this
state because the file has `min_luma == 0` but `pl_color_space_infer`
normalizes this value to `min_luma == 0.000001`. This makes it so that
we store a different `target_param` to `vo_wayland_state` on every frame
than the one received from `vo_get_target_params`. So we end up setting
image description on every frame in this case.

The key problem here is that `set_color_management` isn't blocking the
thread until `set_image_description is called`, so vo->driver->flip_page
is called before this finishes.

This commit fixes the problem by doing any operations that could change
`wl->target_param` first before doing any equality checks to skip
changing to image description pointlessly.

This fixes the problem in the issue that image_description is never set
on such files. The synchronization problem is fixed in a later commit,
because otherwise setting image_description on every frame could have
adverse frame time effects

Fixes: https://github.com/mpv-player/mpv/issues/16825
2025-09-29 01:47:44 +02:00
Attila Fidan 3020439e5a video/out/wayland_common: fix crash when uninit without display
Fixes: 39c9d1acb4 ("video/out/vulkan/context_wayland: implement target_csp for wayland")
2025-09-29 01:45:57 +02:00
Kacper Michajłow cf393b12ac osc.lua: add indicator for buffering/loading 2025-09-29 01:45:47 +02:00
nanahi 9422a6dc52 osdep/terminal-unix: use numpad keycodes
Use the dedicated numpad keycodes for +-*/.
2025-09-29 01:45:37 +02:00
Kacper Michajłow db2b4362c7 vo_gpu_next: add --target-colorspace-hint-strict option 2025-09-27 22:16:59 +02:00
Kacper Michajłow 2a85ac806f vo_gpu_next: respect --target-gamut in colorspace hint 2025-09-27 22:16:59 +02:00
Kacper Michajłow f65a61e488 osdep/w32_register: register url protocols if they don't exist yet
Some protocols may not exist, add them so the mapping to url handler
works correctly. Note that protocols are not removed, only the handler
is. They will remain unassociated, after unregister.

Fixes: #16832
2025-09-27 22:16:36 +02:00
Kacper Michajłow 4499f16215 osdep/w32_register: don't mark io.mpv.url as url protocol 2025-09-27 22:16:36 +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
Kacper Michajłow 8f6a4e50a2 Revert "vo: set swapchain-depth to 1 in display sync modes"
Allows to not wait for flip. Instead of forcing depth for display-sync
modes we will reduce default value instead.

This reverts commit d7495e4ea6.
Fixes: #16823
2025-09-27 22:15:13 +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
Dudemanguy 74b47cfcb4 test/libmpv_test_sdh_filter: start test paused and at 1 second
There is some race condition where MPV_EVENT_PROPERTY_CHANGE sometimes
gives us sub-text with an empty string which is unwanted and causes the
test to fail. Avoid this by starting the file at 1 second and paused
which hopefully avoids this. Do some additional checking on the actual
MPV_EVENT_PROPERTY_CHANGE as well to make sure we don't try to read
something we shouldn't.
2025-09-25 16:49:40 +00: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
Kacper Michajłow ee0f701347 vo: remove "slack" frames from swapchain
Those are controlled by the `--swapchain-depth` option and is already
set to 3 by default. There is no need to add hardcoded hidden frame of
"slack". Users can adjust depth by changing the config.
2025-09-23 01:25:06 +02:00
Kacper Michajłow d7495e4ea6 vo: set swapchain-depth to 1 in display sync modes
All the math and interpolation assumes immediate presentation of the
frame. VO is driven by VSYNC and it is expected that current frame that
we render will be displayed on current present call, without delay.
2025-09-23 01:25:06 +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
der richter 764da9919c ci/mac: add test runner for oldest macOS target
only meant for testing the oldest macOS target we support, currently
10.15, to catch possible usages of features that are not supported and
not properly guarded.

since dependencies are not build for that taget it will lead to a
partially broken build.
2025-09-16 02:47:33 +02:00
der richter a9cccbcd15 ci/mac: remove unnecessary cc and ccx variables 2025-09-16 02:47:33 +02:00
der richter 56ca37014b ci/mac: pin homebrew for macOS 13 runner to last working version
since macOS 13 is now unsupported and homebrew also dropped support for
it too, the macOS 13 bottle downloads were removed. leading to either
a broken or very long dependency installation (build from source).

to fix, pin the last known working homebrew version for macOS 13 where
the bottle download links weren't removed yet. for this to work we need
to disable (auto) update of homebrew.
2025-09-16 02:38:25 +02:00
ikas 6996c065c8 video/out/d3d11: return unknown color space when use composition 2025-09-16 02:38:01 +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 af4e4fed44 meson: disable swift when cocoa not available or disabled
it doesn't make sense to build the swift parts without cocoa because
the swift bridge would be missing and it's impossible to interact
with the swift parts from obj-c, swift depends on cocoa/appkit/etc, and
the cocoa main function/main loop is missing making anything
cocoa/appkit/GUI crash on use.

like this it is possible to build mpv on macOS without cocoa, it will
fallback to the unix main function and mpv can run in 'headless' mode,
eg you can use it from CLI, it won't spawn any App icon/menu/etc, and
you can use everything that isn't related to cocoa/appkit/GUI like audio
playback. anything other will make mpv segfault, for example sdl2 and
its vo, since it tries to spawn a window.
2025-09-15 03:59:55 +02:00
der richter b4151d4449 meson: properly add path-mac.c to path_source and don't overwrite it
path-mac.c was not properly set as path_source for macOS. it didn't lead
to any errors because it was added to the normal source files. though
in the case of tests and for certain setups the mac path symbols were
not found.

to fix that properly add path-mac.c to path_source (additional to
path_darwin.c), remove it from the normal source files and don't
overwrite it later with the posix or darwin path.

this was overlooked in 9db8182 and #11374
2025-09-15 03:59:32 +02:00
der richter 065af28bc2 mac/dialog: fix build for macOS older than 11
UniformTypeIdentifiers is only available since macOS 11.
added in 6b0e4f7 and #15859.

guard the allowedContentTypes UTType property of the NSOpenPanel and
add a dummy struct UTType and dummy allowedContentTypes property on
macOS versions that don't have those available.
2025-09-15 03:59:32 +02:00
der richter a4d818b4f9 mac/compat: fix building with swift version lower than 5.7
currently we use the withLock function with NSCondition and NSLock,
which are not available on swift versions lower than 5.7. we only added
compatibility fallbacks for NSCondition though. introduced in 1364c80
and #14334.

instead of only adding the fallback to a specific class add it to the
whole protocol all the locking classes use, similar to the actual
implementation.
2025-09-15 03:59:32 +02:00
der richter 00415f1457 osdep/mac/meson: fallback to swift build for old swift versions
with commit 8d20b72 and PR #15442 we switched to the recommended swiftc
compiler for building our swift code. this lead to some
incompatibilities with swift versions prior to 5.8, where a new linker
was introduced.

work around that problem by using the old swift frontend build for older
swift versions. this can be removed when we remove the support for those
old versions.

Fixes #15591
2025-09-15 03:59:32 +02:00
der richter 5e4a406194 command: fix type mismatch 2025-09-15 03:59:32 +02:00
der richter 300b53de62 ci/mac: use oldest available xcode toolchain for macOS 13 runner
using the oldest xcode toolchain will test some code paths that weren't
previously tested, eg older SDK and swift versions.
2025-09-15 03:59:32 +02:00
cryeprecision 4a5a9a58a7 sub: remove upper limits of margin-x and margin-y 2025-09-15 03:58:50 +02:00
arch1t3cht eba7a11a2e player/command: do seamless angle change when bluray-angle is changed 2025-09-15 03:52:35 +02:00
arch1t3cht 31bd176357 stream_bluray: add bluray-angle option
1-index angles to be consistent with DVD angles in mpv and with the
1-indexing in other applications like libbluray's example programs.

The three existing calls to bd_get_title_info all only access the
duration, the playlist, and the number of angles, which do not depend on
the passed angle, so they can keep being called with angle 0 for
simplicity.

Documentation taken from before
35e8b6c1e6.

Fixes #5012.
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
arch1t3cht 7b791733ce stream_bluray: show number of angles in title list 2025-09-15 03:52:35 +02:00
Kacper Michajłow 0d03e0565f osdep/win32-console-wrapper: remove stray include 2025-09-15 03:47:35 +02:00
Kacper Michajłow 7ee677c773 meson: add mpv-register and mpv-unregister helpers on Windows
They call `--register` / ``--unregister` for users who don't want to open
console and do it manually, this is one-click solution.
2025-09-15 03:47: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
nanahi 34b6439dc6 input/keycodes: fix combo key handling for - key
The current handling tries to handle the edge case where the current key
in a combo key is -, but when the current key is not - and the next key
is -, it misdetects - as separator and fails to parse correctly.

Fix this by restricting the handling to situations where the current key
is -.

Fixes: ce2367725e
2025-09-14 01:25:38 +02:00
Jan Ekström d837c43656 {demux_mkv,TOOLS/matroska}: map, expose hearing/visual impaired flags
Were brought up recently in the user channel, and seemed like an
easy enough win. Unfortunately `sh_stream` currently lacks other
fields, so the rest of the flags will be added as the player's
functionality gets extended further.

Ref: https://datatracker.ietf.org/doc/rfc9559/
2025-09-11 19:25:12 +03:00
nanahi 77dee9be2f DOCS/man/options: add usage note for --wid=0 for win32 2025-09-07 18:19:44 +02:00
nanahi 7a5ecf1c06 video/out/w32_common: support --wid=0
Similar to X11, this makes mpv attach to the desktop wallpaper window
(make the system create one if it does not yet exist) as parent,
which makes mpv display as desktop wallpaper behind desktop icons.

Lika an actual wallpaper, mpv will not receive any keyboard or mouse
input in this mode. It can still be controlled through terminal and IPC.
2025-09-07 18:19:44 +02:00
der richter b290781675 mac/title: fix mouse position when snapped to position from title bar
when the window is snapped to a position by dragging the title bar the
corresponding left mouse up event is prevented by the system snap event,
which leads to the window moving state not being reset and no mouse
position changes being reported. which makes UI elements unresponsive.

explicitly subscribe to left mouse up events for the whole app instead
of the mouse events from the title bar and reset the moving state.

Fixes #16732
2025-09-07 13:53:55 +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
NotMithical 6269f4ffce ytdl_hook.lua: add support for VP9 profile 2 2025-09-02 21:42:14 +02:00
Guido Cella efb70d7f27 TOOLS/lua/autocrop.lua: don't error if hwdec-current is nil
hwdec-current can be either "no" or nil.

Fixes #16739.
2025-08-29 19:08:29 +02:00
Andarwinux 42fd091e47 osdep/win32/meson: use files() instead current_source_dir()
In reproducible builds, meson.current_source_dir() also leaks absolute paths, so it's better to use files() instead

ref: https://mesonbuild.com/Reference-manual_builtin_meson.html#mesoncurrent_source_dir

> You do not need to use this function!
> When passing files from the current source directory to a function since that is the default. Also, you can use the files() function to refer to files in the current or any other source directory instead of constructing paths manually with meson.current_source_dir().
2025-08-29 19:07:46 +02:00
der richter 0f910ec51c mac/common: render first frame on init if possible
since commit 5010c24 the initial window always shows a black frame
instead of the actual first rendered frame of the video, since the
visibility of the window for the initial render is always false. in the
worst case the first shown frame wasn't the intended first rendered
frame.

to prevent this, initial always allow rendering till the window is shown
or minimised. afterwards it will respect the occlusion state as before.

in the case of slow render pipeline initialisation and no frame being
ready to be rendered, it will still show a black frame.
2025-08-28 15:23:33 +02:00
der richter 78458a55ef mac/common: add support for force-render option 2025-08-28 15:23:33 +02:00
low-batt 9f153e2a20 mac/vulkan: fix frame not displayed when paused
add event handler for when window's occlusion state changes and now
indicates some or all of the window is visible.

handling of the event is needed due to the addition of a visibility
check for rendering that was added in commit 5010c24.

Fixes #16693
2025-08-24 12:58:26 +02:00
Kacper Michajłow 5faec4e6af ci/win32: disable libjxl tests
The need additional dependencies, that we don't need to build.
2025-08-24 01:42:00 +02:00
Kacper Michajłow 0e966ba071 stats.lua: show also min_luma if max_luma is nominal SDR
Useful to see set black point.
2025-08-24 01:21:35 +02:00
Shengyu Qu 90e3e104d9 wayland: add usage of set_chroma_location for wp-color-representation-v1
Previous implementation of wp-color-representation-v1 omitted usage of
set_chroma_location, so add it.

Signed-off-by: Shengyu Qu <[email protected]>
2025-08-23 14:59:40 +00:00
sfan5 80d2a6a7ed ytdl_hook.lua: don't crash if playlist entries don't have an usable URL
see #16717
2025-08-23 15:02:46 +02:00
sfan5 194ce88ac3 player/command: fix missing property update for some hwdec changes
fixes #16710
2025-08-22 08:38:02 +02:00
sfan5 653e241ac3 DOCS/lua: fix mistyped function name 2025-08-22 08:38:02 +02:00
sfan5 521e162420 DOCS/input: clarify value of hwdec-current
This can never be false, or a boolean at all.
2025-08-22 08:38:02 +02:00
nanahi bde63fe092 wayland_common: handle wayland events in VOCTRL_CHECK_EVENTS
VOCTRL_CHECK_EVENTS is used to handle input and redraw events, so it is
necessary to check the input events from the windows system when this is
called. X11 already does this, and win32 does not need to do this since
the input events are processed in the UI thread, not VO thread.

However, this is not done on wayland. On wayland, input events are only
processed in vo_wayland_wait_frame and vo_wayland_wait_events.

If Vulkan gpu api is used, then vo_wayland_wait_frame is only called in
wayland_vk_swap_buffers, and only when using the internal vsync, and not
when fifo protocol is being used.

vo_wayland_wait_events is only called in wait_vo. However, unlike
VOCTRL_CHECK_EVENTS which is sent on every VO render loop, wait_vo is not
called when the VO has a frame to redraw immediately, which can happen
often in display-sync modes. In the worst case, this is never called.

All of the above result in situations where inputs and other wayland
events not being handled in time while not rendering, or rapid rendering
with wayland internal vsync disabled.

Fix this by checking wayland events in VOCTRL_CHECK_EVENTS, similar to X11,
to make sure these events are handled.
2025-08-20 13:34:54 +00:00
Philip Langdale 12a78257a8 vo/vulkan: sync recommended Vulkan 1.x features from ffmpeg
This second set of additional features are ones from extensions that were
incorporated into Vulkan eventually. As we do not require Vulkan to be newer
than 1.2, we must request the 1.3 and 1.4 features via their original
original extensions, while the others can use the core feature structs.

This change assumes that libplacebo can correctly merge features using their
old extensions or using the core feature structs.
2025-08-18 08:44:35 -07:00
Philip Langdale 91e0b6cbda vo/vulkan: sync recommended extensions and features from ffmpeg
Over time, the list of requested extensions and features has diverged from
ffmpeg (libhwcontext_vulkan), and while this isn't guaranteed to cause
problems, as it depends on driver behaviour, it definitely makes it hard to
compare validation errors between the two implementations.

This change requests the extensions/features which have not been incorporated
into any Vulkan version.
2025-08-18 08:44:35 -07:00
Kacper Michajłow 6b96aff174 vo_gpu_next: initialize min_luma correctly
This is also important in non-hint mode and hint SDR mode.

Fixes `--target-contrast=auto`.
2025-08-18 04:47:04 +02:00
Dudemanguy ce7ea3d8ea path-unix: support ~~desktop path expansion
xdg-user-dirs is basically the standard for defining user desktop
directories on linux/bsd. To account for locales and languages, we
basically have to parse the config file (~/.config/user-dirs.dirs)
directly. That or call xdg-user-dir. Either way, it's a little more
complicated than the others, but still doable enough.
2025-08-17 16:58:00 +00:00
Kacper Michajłow 07572dc83c vd_lavc: don't select software output format if hwdec failed
Let us fallback fully to software decoder. There is an issue in ffmpeg
where if we return software format here for hwdec threading context it
will be assumed to be usable, but not accelerated, which would be fine,
but later it causes assertion failure when copying avctx context
between decoding threads in ffmpeg.

Avoid this issue, but returing NONE format after we failed.
2025-08-15 20:24:19 +02:00
Kacper Michajłow dbda70a11c vd_lavc: add --hwdec-threads
No reason to not enable threads if lavc supports them, same as for
software decoding. Might help with pipelining of decoding and filtering.

Performance difference may vary, but in my testing everything is working
as expected and I didn't notice any regressions.

Set to 2 threads by default as conservative value that should resolve
stalling issue, while also not spawn too many cpu threads, which won't
help with hwdec anyway and only can cause too deep queue of hardware
surfaces.

Fixes: #16578
2025-08-15 20:24:19 +02:00
Kacper Michajłow fcb50a77bb vd_lavc: fix AVCodecContext use in get_format callback
When using more than one threads, the callback can be called from
different thread from sibling avctx, we cannot use our main one to query
codec/hw_frames paramters.

Use context provided in callback arg to fix that.
2025-08-15 20:24:19 +02:00
Kacper Michajłow 7653cc8f09 vo_gpu_next: respect ICC profile color space
When ICC profile is applied, use it also in hint to ensure correct
target colorspace configuration. ICC profile takes precedence over
anything else, to make sure libplacebo internally interpret it the same.

Fixes: #16646
2025-08-14 22:32:43 +02:00
Kacper Michajłow 227d958d29 vo_gpu_next: don't use unitialized min_luma in some cases
Also double check if 1e-7 doesn't underflow float.
2025-08-14 22:32:10 +02:00
verygoodlee 4c17803b91 options: delete the duplicated extension "wav" in --audio-exts
fixes: 44a3a3293f
2025-08-14 22:26:34 +02:00
Kacper Michajłow 3132ad62a3 vo_gpu_next: don't hint colorspace when ICC profile is used
We don't know which colorspace the profile were created from. We could
set hint to ICC target colorspace, but it would be ambiguous, because it
doesn't say which colorspace were configured in practice.

Additionally on Wayland with all the color management the client side
ICC correction is not supported, because we cannot set pass-through
mode.

Conceptually we should use VK_COLOR_SPACE_PASS_THROUGH_EXT to get
"direct" access to display response, but while this may work on macOS,
on Wayland it means "don't configure csp", instead of "configure to
pass-through", which means colorspace would have to be configured
externally, which is also not possible, see [1].

You can also see [2] for more discussion on the topic.

For now let's not hint any colospace and leave libplacebo in default
selection. Which restores previous status quo. This can be improved in
future, but for now this fixes use of ICC profiles in default mpv
config.

[1] https://gitlab.freedesktop.org/pq/color-and-hdr/-/issues/27
[2] https://github.com/haasn/libplacebo/issues/324

Fixes: #16646
2025-08-13 03:52:10 +02:00
Attila Fidan 211c9cb7c9 stream_libarchive: seek source stream to 0 before probing
If p->mpa = NULL due to an error during a seek or fill_buffer, then when
archive_entry_seek(), if newpos != s->pos, reopen_archive() ->
mp_archive_new() -> mp_archive_probe(), which asserts stream_tell(src)
== 0. This won't be the case if the previous mpa left the source stream
seeked in the middle of the file.

For example, in samples in archives where avformat_find_stream_info
takes a long time, if playback is aborted while the demuxer is doing
that, reading from the source stream will stop working due to cancels
being triggered. When archive_entry_seek() and newpos != s->pos,
reopen_archive() -> mp_archive_new_raw() -> archive_read_open1() fails
and returns with mpa == NULL due to reads not working. Then when another
seek happens, reopen_archive() -> mp_archive_new() -> mp_archive_probe()
-> assertion failed.

One solution is to have reopen_archive return STREAM_ERROR if the stream
is cancelled, since nothing useful can happen in this case. But there
are other situations where p->mpa could become NULL (fatal errors), and
it is supposed to be possible to seek back to a working area of the
archive.

Fixes: https://github.com/mpv-player/mpv/issues/15174
2025-08-12 18:38:50 +02:00
Kacper Michajłow 01b7edcc71 stats.lua: round max-cll to integer
In source-dynamic mode this can be converted from PQ, round it to
integer, same as max-luma already is.
2025-08-09 20:42:17 +02:00
Kacper Michajłow 91b10ffe2c vo_gpu_next: when tone-mapping, set better maxCLL value 2025-08-09 20:42:17 +02:00
llyyr e011596bc3 vo_vdpau: recommend vaapi directly instead of vo in emulated case 2025-08-08 09:48:53 +02:00
llyyr dfc232a44b vo_{vaapi,vdpau}: recommend gpu-next over gpu
Missed in d21b1f159c
2025-08-08 09:48:53 +02:00
Dudemanguy 2b74582fcb Revert "various: remove unneeded option path expansion handling"
Fixes #16573.

This reverts commit 137d5374bd.
2025-08-08 01:07:00 +00:00
Dudemanguy 6a5eb8c229 Reapply "external_files: parse ~ in --{sub,audio}-paths"
This reverts commit 768ad8f035.
2025-08-08 01:07:00 +00:00
Dudemanguy ed7b1aca0b DOCS/interface-changes: add backticks to tls-options
It's what is normally done.
2025-08-08 01:07:00 +00:00
Dudemanguy 26373c5497 Reapply "options: parse tls-related options as path"
This reverts commit 5c4c067ee6.
2025-08-08 01:07:00 +00: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 a664eede96 Revert "test: always build path_source and options/path.c for test_utils"
No longer needed.

This reverts commit afbd3abb20.
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
sfan5 866da80979 vo_gpu_next: fix resetting --glsl-shader-opts
fixes: #16638
2025-08-07 18:35:42 +02:00
Kacper Michajłow c4bc4f6d5b stream_bluray: use bd_get_main_title() to get main title
It uses a more sophisticated heuristic for title selection. It not only
selects the longest title but also considers quality and chapters. Refer
to the libbluray source for details.

No documentation change, "longest" option will still look for the
longest, just may work better now.

Fixes selection of title on some discs.
2025-08-06 18:04:46 +02:00
Kacper Michajłow 9681bda7d5 meson: bump libbluray requirement to 0.5.0
Released 2013-12-21. Will be used for bd_get_main_title().
2025-08-06 18:04:46 +02:00
Kacper Michajłow bdca44773a stream: remove stream_info_bdnav
It was disabled in 3b3170aedb.
2025-08-06 18:04:46 +02:00
Kacper Michajłow b6d8336658 stream_dvdnav: fix --edition when dvd:// is not used directly
When directory is redirected to dvd demuxer, --edition was ignored.
2025-08-06 18:04:46 +02:00
Kacper Michajłow 218561fe69 stream_bluray: fix --edition when bd:// is not used directly
When directory is redirected to bd demuxer, --edition was ignored.
2025-08-06 18:04:46 +02:00
LordMZTE b7c92c77a4 vo_gpu_next: allow unsetting LUTs
This adds support for unsetting a LUT set by the target-lut or image-lut
property by setting the property to an empty string. Previously, this
would cause an attempt to read a file named ''.
2025-08-06 18:04:05 +02:00
Dudemanguy 5b2bcc55db test: add some tests for the sub_sdh_filter 2025-08-06 13:57:38 +00:00
Dudemanguy cc7f9e3ce8 test/libmpv: inline some test-specific helpers in libmpv_common
These functions could be useful for any libmpv test and in fact
check_string was already duplicated in a couple of places. Inline them
in libmpv_common.
2025-08-06 13:57:38 +00:00
Dudemanguy b5c629fd12 filter_sdh: convert --sub-sdh-enclosures to a string list
This lets users specify any possible pair of characters to remote text
from in the SDH filter as opposed to the old way which would
automatically map ( to ) internally.

Additionally, this fixes #16597 because the old implementation relied on
looping over a single string using strlen for matching chars. That
doesn't work because strlen loops over bytes and non-ASCII characters
can have multiple bytes leading to false positives since the bytes could
match. There's various ways to deal with this, but simply using mpv's
internal stringlist type sidesteps that problem.
2025-08-06 13:57:38 +00:00
Kacper Michajłow cc660f8609 fuzzers: set fontconfig sysroot
Allows to specify custom fontconfig sysroot. Useful for fuzzing
environments where we might use specific config, font or the system wide
config is not available.
2025-08-06 03:14:58 +02:00
Andarwinux 0232ff27a8 ci/mingw: add lcms2
fixes #16614
2025-08-06 01:28:18 +02:00
nanahi 9b1a4366e9 DOCS/man/options: document special wid value -1
This value can be used to tell mpv to detach from the existing parent
into its own window.
2025-08-05 19:59:16 +02: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
heather7283 91b79d961a client: don't take ownership of result if it is not returned
This fixes memory leak that occured when NULL was passed as result.
2025-08-05 18:18:28 +02:00
nanahi 1d71523407 video/out: make ra_fns const 2025-08-05 03:10:33 +02:00
nanahi ce8032a8ca video/out/gpu/context: make context lists const 2025-08-05 03:10:33 +02:00
nanahi c82d9317a3 filters/f_swresample: make fudge_pairs const 2025-08-05 03:10:33 +02:00
Louis Pate 86e12929aa various: fix Wpedantic warnings 2025-08-01 11:56:38 +02:00
Attila Fidan 21e7c36349 demux_libarchive: normalize stream URL path before escaping
Path normalization can introduce pipe characters from the current
working directory when opening relative paths, which will make the
stream split the path and entry name prematurely. Escape the normalized
path, not the other way around.

Fixes: 440f35a26d ("demux_libarchive: normalize the stream url path")
2025-07-31 15:25:52 +02:00
Kacper Michajłow 03cafa10a7 ci: remove custom rust install step from windows-11-arm job
It is available in image itself now.

See: https://github.com/actions/partner-runner-images/issues/77
2025-07-30 19:44:16 +02:00
Guido Cella 71a6535b05 DOCS: fix FILES section title in links 2025-07-30 16:22:18 +00:00
sfan5 a6f3236c3a ytdl_hook.lua: don't pass any format to youtube-dl by default
yt-dlp changed its default format from `bv+ba/b` to `bv*+ba/b`, which we want to follow
since it fixes the behavior with some streaming sites.

The note that "sometimes youtube-dl returns a format that mpv cannot use" was added in
43c13e5ea2 but it's not clear what it refers to.

fixes #16388
2025-07-28 11:22:13 +02:00
sfan5 2168e3d82c ytdl_hook.lua: get rid of outdated youtube-dl hint
It has never worked for yt-dlp anyway and the relevant error messages
already tell people to update.
2025-07-28 11:22:13 +02:00
Kacper Michajłow 9546e0f7f8 vo_gpu_next: allow UINT upload if no other format is supported 2025-07-28 11:22:08 +02:00
nanahi eaf8a3e8cf DOCS/man/options: add hint to list default sub extensions
Similar to other -exts options.
2025-07-27 15:36:12 +02:00
Louis Pate 73c2118710 meson: add -Woverflow to test flags 2025-07-26 20:13:28 +02:00
Louis Pate 1e64262f1f test: fix Woverflow by using uint8_t array 2025-07-26 20:13:28 +02:00
Attila Fidan 7e94d691b5 demux_libarchive: escape '%' in stream URL path
Opening paths that are detected as archives which contain
'%[0-9A-Fa-f][0-9A-Fa-f]' will fail, because such sequence is treated as
a percent-encoded value when the path gets unescaped causing the path to
be mangled. Escape '%' to prevent this from happening.

Fixes: 2b280f4522 ("stream: libarchive wrapper for reading compressed archives")
2025-07-26 20:12:34 +02:00
Guido Cella b47fd2842a command: normalize stream-open-filename
Since 38ad1ed03b path is normalized but stream-open-filename is not,
making the docs where it says that they are the same wrong, so normalize
stream-open-filename too.
2025-07-24 15:10:44 +00:00
nanahi ff1bb2ff4b Revert "clipboard-wayland: flush display after creating data sources"
Not needed anymore. After data sources are created, the next loop
iteration of clipboard_wayland_dispatch_events will immediately start
and flush display.

This reverts commit c399422722.
2025-07-24 00:35:56 +02:00
nanahi d579527576 clipboard-wayland: create data sources in clipboard thread
Currently, it is done in set_data which is called by core.
It was never meant to do so and it is not thread safe when data
sources are created while a seat is being added/removed.

Fix this by passing a message to clipboard thread instead so that
it is done in a thread safe way.
2025-07-24 00:35:56 +02:00
nanahi 05d0971337 clipboard-wayland: add death message
Used to signal clipboard backend uninit.
2025-07-24 00:35:56 +02:00
nanahi c37756c6a1 clipboard-wayland: rename death pipe to message pipe
Will be used in next commits.
2025-07-24 00:35:56 +02:00
Dudemanguy 71b2324621 player/configfiles: stop parenting mp_get_playback_resume_dir to mpctx
There's no reason for the string to live forever for the lifetime of
mpv. We can free it when we're done. Calling the current-watch-later-dir
property could technically grow memory forever previously.
2025-07-22 17:52:41 +00:00
Dudemanguy 137d5374bd various: remove unneeded option path expansion handling
Same reasoning as the previous commits. This is now handled by the
option system so we can remove the redundancy.
2025-07-22 17:52:41 +00:00
Dudemanguy 768ad8f035 Revert "external_files: parse ~ in --{sub,audio}-paths"
The paths loaded here are already expanded so we can simplify.

This reverts commit 1a25f8c9fb.
2025-07-22 17:52:41 +00:00
Dudemanguy 5c4c067ee6 Revert "options: parse tls-related options as path"
Since the core option parsing does this, we no longer need special
handling here.

This reverts commit 43e83dc74b.
2025-07-22 17:52:41 +00: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 afbd3abb20 test: always build path_source and options/path.c for test_utils
Because the previous commit started using mp_get_user_path in core
m_option files, various tests failed with undefined references due to
these two files not being included. Add them to the common list of
test_utils files.
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
llyyr 9871ed5e38 wayland: leave window geometry unset
The xdg-shell spec states: "If never set, the value is the full bounds
of the surface, including any subsurfaces. This updates dynamically on
every commit. This unset is meant for extremely simple clients"

mpv's window geometry is never anything other than the full bounds of
the surface, including any surfurfaces, so we don't need to set this
ourselves. This was added in 828dd65ef8 to
workaround a Weston bug, and isn't needed anymore.

Tested on wlroots compositors, kwin and weston.
2025-07-22 17:47:23 +00:00
Oliver Freyermuth 7bfc038528 stream_dvb: allow to enforce DVB-S/T for old zap format channels.conf
If a card supports both DVB-T/T2 or DVB-S/S2, channels.conf.{sat,ter}
was always interpreted as DVB-T2 / DVB-S2 before this change.
After this change, using channels.conf.{sat1,ter1} will enforce
interpretation as DVB-S/T.
The superior VDR channel config format is still the recommended solution
for such cards as it allows to specify the delivery system variant per
channel, but enforcing T2/S2 for cards supporting it whenever the zap
format is used does not seem reasonable.
2025-07-22 08:29:21 +02:00
Kacper Michajłow 0ac07305fb vo_gpu_next: override levels even when hinting colorspace
Color levels is not part of signaled colorspace.

Fixes: b91b71a444
Fixes: #16564
2025-07-21 21:03:55 +02:00
Dudemanguy 440f35a26d demux_libarchive: normalize the stream url path
38ad1ed03b was supposed to normalize all
path names, but the path from the libarchive demuxer works differently.
We need to normalize it within the demuxer itself so you get something
like "archive://<absolute path to archive>" in the property.

Fixes #16247.
2025-07-16 13:42:38 +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
Thomas Hebb 036fae317c sub/lavc_conv: prevent corruption after switching WebM WebVTT subs
WebVTT subtitles in WebM require special logic, and we signal that using
the "webvtt-webm" codec name, which is not part of FFmpeg. That worked
fine until commit 94859997b8 ("sub: update codec info") added a call
to mp_codec_info_from_av(), which overwrites our codec name with
FFmpeg's the first time the subtitle decoder is initialized. As a
result, WebM WebVTT subtitles are currently not rendered correctly after
switching subtitle tracks. Fix the issue by resetting the codec name
after calling mp_codec_info_from_av().
2025-07-16 13:41:54 +00:00
Thomas Hebb 6c720f0f49 sub/lavc_conv: remove unneeded strdup
We originally took the codec name as a separate parameter, making this
talloc_strdup() good hygiene. But since commit 73779a8c70
("sub/lavc_conv: take sd context as a parameter for lavc_conv_create"),
we take the name from the sd context, whose other fields we already
reference. So it should be safe just to copy the pointer like we do in
sub/sd_lavc.c.
2025-07-16 13:41:54 +00:00
Kacper Michajłow dd2cccec19 sub/ass_mp: revert some unwanted changes
We want to add padding around the whole bitmap, not within it. Smaller
parts are rendered onto bigger bitmap. Remove leftover padding code.

Fixes: e2fc75434e
2025-07-16 01:49:29 +02:00
Kacper Michajłow 7d3870b7f8 DOCS/man/options: add a note about MAINPRESUB and gpu-next 2025-07-16 00:12:45 +02:00
Kacper Michajłow 2da63bb4eb vo_gpu_next: reduce fp conversions in overlay color
This is cosmetic, shouldn't matter in practice.
2025-07-16 00:12:45 +02:00
Kacper Michajłow 3a7a027f44 vo_gpu_next: add support for blend-subtitles=video
Render subs and video resolution. Important for performance of some
heavy typesetting.
2025-07-16 00:12:45 +02:00
Kacper Michajłow e2fc75434e sub/ass_mp: add missing padding for ass packer
This ensures it is safe to sample packed image with bilinear filtering.
2025-07-16 00:12:45 +02:00
Kacper Michajłow 55043cb5c8 vo_gpu_next: don't do partial updates on hint luminance
This ensures that we don't mix maxCLL if target already has max_luma.
This can be opt-in with mode=source and manual target-peak override. No
need to merge to much things.
2025-07-16 00:09:49 +02: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
Dudemanguy 2763390c15 input/cmd: use m_option_set_node_or_string
Like the previous commit, this has a conditional that matches exactly
what this helper function is supposed to do. For logging reasons, we
can't completely remove the val->format comparison, but it can be
simplified to be cleaner.
2025-07-15 18:06:14 +00:00
Dudemanguy 04ca4fd1ed m_config_frontend: use m_option_set_node_or_string
There is a usage of m_option_parse which exactly mirrors the intention
of the helper function m_option_set_node_or_string. Instead of
duplicating the logic, just call the m_option_set_node_or_string
instead.
2025-07-15 18:06:14 +00:00
Dudemanguy 024628eb4b m_option: change m_option_set_node_or_string to accept bstr directly
It's easier for potential callers of this to convert char to bstr than
vice versa. Internally, the function uses bstr anyway so just eliminate
the conversion and let callers do it. The next commit will add another
caller of this where the bstr param is preferable.
2025-07-15 18:06:14 +00:00
Dudemanguy fdbea0fe66 vo_dmabuf_wayland: don't set HDR metadata on SDR transfers
This probably didn't do anything previously, but technically SDR
transfers could theoretically have HDR metadata and we would set them.
This isn't worth supporting so skip this step for SDR.
2025-07-15 01:22:41 +00:00
Dudemanguy 699054cfd9 vo_dmabuf_wayland: use pl_color_space_infer on HDR transfers
vo_gpu_next already does this. If we have HDR, try to fill out any
missing values before doing validation.
2025-07-15 01:22:41 +00:00
Dudemanguy 8f9a10fd45 vo_dmabuf_wayland: tighten up hdr metadata sanity checking
1a70de259d added some sanity checking to
these values to avoid throwing a protocol error (which are fatal) since
the wayland protocol is very strict about the ranges of these values.
Let's tighten up the checks just a little bit to be on the safe side. If
the min_luma is not less than max_luma, consider this a hard error. We
won't set any hdr metadata at all if this happens. For max_fall and
max_cll, we leave mostly the same as before where the value gets set to
0 if it doesn't pass the wayland protocol specification. For the case
where max_fall is greater than max_cll, consider this invalid and set
both values to 0.
2025-07-15 01:22:41 +00:00
nanahi 86e884bc4a video/out/gpu/video: fix target colorspace for redrawed frames
Fixes oversaturation when pause/redrawn with Windows HDR mode on.
2025-07-15 01:42:21 +02:00
Dudemanguy 1fbf1e1d91 encode: simplify all initial blocking logic for encoding
0ab3184526 introduced most of the stuff
being removed here. The idea is that when doing encoding the core should
wait until everything is initialized. This is true, but the old
implementation is overly complicated and confusing. What we need is for
both the AO to be initialized and the VO to be reconfigured for encoding
to start. Because of the way initialization works, the VO reconfig
always happens first. Changing the order in playloop would of course
break this assumption, but we can trust that nobody would arbitrarily do
that. So all that needs to be done here is that write_video should wait
until the AO is up before pushing frames. And that only applies in
encoding mode and if there is a selected audio stream in the first
place. This is a simple check.

With that in place, all of this extra junk can be dropped. We don't need
special booleans or events for the simple task of making sure the AO and
VO are both up.
2025-07-14 22:09:49 +00:00
Jens Peters ff595049e9 docs: document tablet pad properties 2025-07-14 22:07:24 +00:00
Jens Peters 0fbf20f057 wayland: expose tablet pad buttons to input system
Expose all buttons state to the Client-API for usage in e.g. lua.
2025-07-14 22:07:24 +00:00
Jens Peters 4d12a60be2 docs: document tablet input 2025-07-14 22:07:24 +00:00
Jens Peters db60145c2d wayland: move tablet tool handling to mpv input system
Upgrade tablet input to first class citizen similar like
touch input, but more simple since use case for now is
mouse emulation only.

Keep state for coordinates and in-proximity.
Introduce property for disabling tablet input.
Introduce Client-API property `tablet-pos`.
2025-07-14 22:07:24 +00:00
Jens Peters 43a030452c wayland: add tablet tool handlers for tap, motion and button
Just simple mouse emulation for now.
2025-07-14 22:07:24 +00:00
Jens Peters 992cb27529 wayland: set tablet tool cursors
Always update the pointer cursor and all tablet tool cursors together.
Also ensure a visible cursor on proximity-in.
2025-07-14 22:07:24 +00:00
Jens Peters 7177976dc5 wayland: wire tablet pad group listener
This ensures that tablet pad objects that belong to a group,
thus rings and strips, are all properly destroyed on removal
or shutdown.

Note that event listeners for ring a strip are not added
since we are not (yet) interested in them and they are not
needed for proper destroy.
2025-07-14 22:07:24 +00:00
Jens Peters 549bc390e6 wayland: wire tablet pad listener
This ensures that tablet pad objects are properly destroyed on
removal or shutdown, even if we are not (yet) interested in
tablet pad events.
2025-07-14 22:07:24 +00:00
Jens Peters 0ef3b1d1bc wayland: wire tablet tool listener
Setup tablet tool events, we want to use motion, tip and
button events later.
2025-07-14 22:07:24 +00:00
Jens Peters 785540f7e9 wayland: wire tablet listener
This ensures that tablet objects are properly destroyed on
removal or shutdown, even if we are not really interested
in tablet events.
2025-07-14 22:07:24 +00:00
Jens Peters 48804a24f8 wayland: wire tablet seat listener
Tablets require their own tablet manager and tablet
seats since multiple tablets/pens can be connected to
a single seat. So this is unfortunately a lot of
wiring.
2025-07-14 22:07:24 +00:00
Jens Peters f73586ddd4 wayland: build tablet protocol unconditionally
The tablet protocol is supported in the current winimum
wayland-protocols version, so we can always build this.
Note that this is still the unstable version, once the
minimum required wayland-protocol version is 1.35, the
stable version of protocol can be included.
2025-07-14 22:07:24 +00:00
Kacper Michajłow bd2118026b ci: add rust support 2025-07-12 20:40:04 +02:00
Dudemanguy 08d7d049d1 build: install encoding-profiles.conf into the system data directory
fd4e3af740 originally started installing
it, and we've been doing it ever since then. The value of having all of
these encoding profiles predefined by default is pretty dubious since a
lot of them are pretty old ('MP4 for Nokia N900' being a shining
example) and mpv is not really a good encoding tool anyways. Let's treat
it like the other conf files in etc and install it in the data directory
for reference. If someone really uses these, they can copy the file over
locally to their mpv config directory and it'll still work fine.
2025-07-12 14:01:54 +00:00
llyyr 329c5294aa meson: remove wayland-protocol 1.39 check from top level meson.build
We do this check inside video/out/meson.build, and the subdirectory is
included before this already
2025-07-12 13:59:11 +00:00
llyyr 112f0000cb wayland: use _SINCE_VERSION instead of checking for enum constant
We can't use #ifndef with an enumerator, this would evaluate to always
be true
2025-07-11 21:54:01 -05:00
Kacper Michajłow 88f34229c6 fuzzers/common: stop after 15 events if there is not playback reset
We wait for timeout and stop fuzzing, but if there are events spammed
this timeout never fire, so instead limit the number of events after
playback reset.
2025-07-12 01:57:43 +02:00
Kacper Michajłow 84596abd83 demux_lavf: disable demuxer-lavf-o for fuzzing
This is raw option passed to lavf and can be used to inject complex
filters and so on, avoid this for fuzzing as it more fuzzing ffmpeg side
anyway and causes issues with timeouts for some big processing.
2025-07-12 01:57:43 +02:00
Kacper Michajłow f07dbb3aef demux_edl: limit to 3 parts for fuzzing
There is no need to test huge playlists, 3 elements it enough to test
parsing.
2025-07-12 01:57:43 +02:00
Kacper Michajłow fec62de298 demux: add nested demuxer depth limit
Useful for demux_edl where it is possible to have huge nested tree of
demuxers and they are added recursively, which causes stack overflow in
some cases.

Found by OSS-Fuzz.
2025-07-12 01:57:43 +02:00
llyyr d21b1f159c vo: move vo_gpu_next above vo_gpu in probe order 2025-07-12 01:34:02 +02:00
Kacper Michajłow da538f3f29 d3d11_helpers: add caching of dxgi factory until it's current
Also cache last dxgi output, to avoid enumerating outputs, this is done
on every frame and we want to minimize impact of it.

While at it refactor and split loading libraries.
2025-07-11 21:53:58 +02:00
Kacper Michajłow 0b6feb993b vo_gpu_next: add source-dynamic mode to colorspace hint 2025-07-11 21:53:58 +02:00
Kacper Michajłow 72fe8fe3ea vo_gpu_next: infer best containing primaries for raw primaries 2025-07-11 21:53:58 +02:00
Kacper Michajłow 84c9eafaa9 vo_gpu_next: override target params when pass_colorspace is used
pass_colorspace mode is special and doesn't set parameters on the
swapchain, so don't use swapchain reported parameters.
2025-07-11 21:53:58 +02:00
Kacper Michajłow c5c1477eb4 vo_gpu_next: change --target-colorspace-hint to auto by default
Auto mode will also enable hint for SDR formats if target metadata is
reported by current output context.
2025-07-11 21:53:58 +02:00
Kacper Michajłow ce076de31f vo_gpu_next: add --target-colorspace-hint-mode option
Useful to actually set target display paramters to colorspace hint.
2025-07-11 21:53:58 +02:00
Kacper Michajłow 5b1df3c5d9 command: add video-params/prim-* properies
Available if raw primaries differ than named primaries value.
2025-07-11 21:53:58 +02:00
Kacper Michajłow 8b64a5d937 video/out/vulkan/context_win: add support for getting colorspace 2025-07-11 21:53:58 +02:00
Kacper Michajłow b352fcb90a d3d11_helpers: refactor target colorspace code
Instead of using IDXGISwapChain::GetContainingOutput create new DXGI
interface on each query. This may not be as efficient, but it solves the
issue where metadata is not updated after changing display settings.
DXGI caches parameters on swapchain creation and never updates it.

Also refactor it so it can be used from other contexts.

Note that DXGI is not D3D11, it's mixed in mpv code, may be cleaned in
the future.
2025-07-11 21:53:58 +02:00
Julian Orth 39c9d1acb4 video/out/vulkan/context_wayland: implement target_csp for wayland
This implements target_csp in terms of the preferred color description
of the video surface.
2025-07-11 21:53:58 +02:00
Kacper Michajłow e72bc1fefc video/out/d3d11/context: add missing white point and max fall metadata 2025-07-11 21:53:58 +02:00
Guido Cella f471f8cfa5 DOCS/man/input: only sequence prefixes need to be unbound
Reword this paragraph making it clear that as long as a and a-b are not
bound, the a-b-c binding works even if b is bound.

The 4-key limit for sequences was raised to 16 by a5dbf34094, because
MP_MAX_KEY_DOWN is used for both the number of keys that can be held
down and for the key history size. Just remove the related sentence
since you're never going to need sequences longer than 16 keys.
2025-07-10 11:05:48 +03:00
dyphire 00dbdf122b DOCS/man/options: blend-subtitles affects hdr subtitle peak behavior 2025-07-09 18:59:12 +02:00
Kacper Michajłow 9baadc6cc9 player/loadfile: limit playlist length to 3 for fuzzing
We have 5 seconds limit for file playback, so 10 items it's bit much. 3
should be enough to cover some file switching and so on.
2025-07-09 00:08:37 +02:00
ourfor 7df09125f3 video/out/d3d11: add d3d11 composition mode support 2025-07-07 00:09:08 +02:00
Kacper Michajłow b91b71a444 vo_gpu_next: if colorspace is set on swapchain respect its parameters
If color space hint is enabled respect configured parameters of
swapchain. When color space hint is disabled, override output freely.

This fixes possible fallback or other decisions about output made during
the swapchain color space negotiation.
2025-07-06 18:02:06 +02:00
dyphire 3f6038f6cc select.lua: refactor subtitle parse
Avoid repeated display of the same content at the same subtitle time

Keep blank lines for both lrc and srt formats
2025-07-06 17:18:10 +02:00
dyphire f7707e4dd9 vo_gpu_next: add options to control subtitles peak for HDR output
Users may want to have darker subtitle brightness for HDR viewing

Closed https://github.com/mpv-player/mpv/issues/13680
2025-07-06 16:00:51 +02:00
nanahi b9ed523c36 DOCS/man/options: document target-prim display-p3
This is common in most consumer "wide gamut" displays since everyone
copies Apple.
2025-07-06 15:18:53 +02:00
dyphire cbea6013e4 player/command: add a default flag to the track add commands 2025-07-06 12:52:22 +02:00
dyphire 2d149e007f misc/language: parse default tag from external subtitle tracks 2025-07-06 12:52:22 +02:00
Kacper Michajłow db7bc5949a vo_gpu_next: be smarter about target colorspace selection
When targeting SDR on display with enabled HDR, compositor will have to
convert SDR to HDR transfer before sending this to display. Resulting in
most certainly wrong output.

To avoid this always convert SDR to target transfer function when
hinting, this way, we do the conversion in mpv and not defer it down the
pipeline.

Unfortunately it's not very portable to detect if we have HDR display
output and "guess" if what we send to display will be correctly
interpreted or not. But we do this when we can.

Also don't force target_peak value from auto detection, use value from
libplacebo.
2025-07-05 23:42:00 +02:00
Kacper Michajłow 3c95d65986 Revert "vo_gpu_next: don't set target peak for SDR output transfers"
I clearly meant SDR output on HDR display only, this commit was wrong.

This reverts commit 0470a3062a.
2025-07-05 23:42:00 +02:00
nanahi 11d3ad635f DOCS/interface-changes: add --prefetch-playlist default change 2025-07-05 21:29:37 +02:00
nanahi e7eefcd490 Revert "manpage: clarify that you can prefetch m3u8 urls"
This commit is based on incorrect information, see previous commit.
It also deletes the correct information the prefetch starts when the
current file is fully load.

The commit also misunderstood the comment about m3u8 urls. It refers to
the prefetching of file data inside the m3u8 stream manifest data, which
has nothing to do with mpv playlists when the m3u8 urls are opened as one
stream by ffmpeg.

The original comment was not very clear about this, so add more details
about this.

This reverts commit d4bf179e78.
2025-07-05 21:29:37 +02:00
nanahi c301667515 Revert "options: default to --prefetch-playlist=yes"
The decision was based on incorrect assumption that this option
"only opens a connection to the next file, and the cache of the next
video starts empty", a prequisite of the assumption that this option
has no major drawbacks, including incurring unwanted network traffic.

The assumption can be proven incorrect by testing with networked files
in playlist. With log level set to debug, the following lines are shown
after the next file is prefetched, while monitoring of network traffic
shows constant network traffic after the currect file cache reading
reaches EOF, which triggers prefetching:

[cplayer] Opening done: <url to prefetched file>
[lavf] select track 0
[lavf] select track 1
[lavf] EOF reached.
[ffmpeg] AVIOContext: Statistics: 37139315 bytes read, 0 seeks

It is clear that saying "there is nothing to prefetch after the first
frame" is a complete lie: in fact, it fetches the whole file to the
demuxer cache, according to the demuxer cache settings. And when the next
file plays, it also starts with full cache rather than "an empty cache".

In fact, what this option really does is written in
556e204a11: --prefetch-playlist calls
demux_start_prefetch() which does the same thing as the
--demuxer-cache-wait option:

"Before starting playback, read data until either the end of the file was
reached, or the demuxer cache has reached maximum capacity."

This is exactly what is happening with the testing. This option will indeed
cause large amount of unwanted network traffic - a concern raised in the
discussion concerning this option.

Revert this commit since it's based on incorrect assumption, and subsequent
incorrect conclusions derived from it in the subsequent discussions.

This reverts commit 978b219889.
2025-07-05 21:29:37 +02:00
Kacper Michajłow 5f927c6333 fuzzers: limit input size to 100KiB
While testing larger inputs can be useful for uncovering bugs related to
processing large data or inefficiencies in memory allocation, it also
makes the fuzzing process slower and more fragile.

Beyond the obvious slowdown, there are OOM issues and even in libFuzzer.
Specifically, in fuzzer::InputCorpus::AddToCorpus, after a few hours of
fuzzing, we accumulate so many inputs that memory usage exceeds our
quota. This could be mitigated in other ways, such as dumping data early
or shortening the fuzzing run duration. However, in practice, these huge
inputs are often not very useful.

This change will also encourage the fuzzer to mutate existing data
rather than continually adding more bytes to input, because it give
higher coverage. Which in turn will produce higher quality corpus.

The 100 KiB limit could be reduced further. It's still quite large, let's
see how it performs. I believe even 10 KiB might be sufficient or less.

This issue is especially noticeable in the Matroska fuzzer, because we
add input data there, which is bigger and sets max_len high in fuzzer
itself.

In a perfect world, we wouldn't need to impose such limits, but in
reality, we face constraints in both memory and compute resources.

I'll monitor coverage and fuzzing results after this change and adjust
as needed. Unfortunately, this will discard all existing corpus entries
larger than the limit, but that's expected.
2025-07-05 16:35:00 +02:00
Guido Cella 614e3c4223 console.lua: bind Ctrl+y to copy
Make Ctrl+y copy the input line to the clipboard, or the currently
selected item in the menu.

The vi key to copy is used because Ctrl+c is already bound.

Alternative bindings are:
Ctrl+x to cut, but this also clears the line.
Ctrl+shift+c like in terminals, but this is harder to press, and this
commit works differently from terminals anyway since you don't manually
highlight characters, it just copies the whole line.
Alt+w, the emacs copy binding, but unless you use emacs this is weird
and unfamiliar.
2025-07-05 01:20:02 +02:00
Kacper Michajłow 0470a3062a vo_gpu_next: don't set target peak for SDR output transfers
Also don't use ICC luma value if target is SDR. Basically setting
max_luma for SDR target is not working well with libplacebo, so avoid
this.
2025-07-05 01:18:05 +02:00
nanahi db99bca912 video/out/vo_gpu_next: implement background tile options for gpu-next
These options are already supported in pl_render_params.
2025-07-05 01:17:25 +02:00
nanahi 63defa7708 video/out/gpu/video: add options to control background tile appearance
Add options to control background tile colors and size and vo_gpu
implementation.
This allows a dark mode tile pattern.
2025-07-05 01:17:25 +02:00
Kacper Michajłow 570c5ec849 m_option: add m_opt_choice_str_def
Most users of this function doesn't expect it to return NULL, with
exception of Stereo-3D video mode. Which is a list directly linked to
Matroska specification, and used as value check in demux_mkv and also
when printing format.

There already was a MP_STEREO3D_NAME_DEF macro, so just promote this to
more generic function.

Fixes assert on invalid value found by OSS-Fuzz.
Fixes double evaluation in MP_STEREO3D_NAME_DEF macro.
2025-07-04 15:46:39 +02:00
MarieVelter42 89427a4201 osc.lua: fix volume icon not updating while paused
Volume icon in the OSC did not update when mute toggled or
volume changed while playback was paused and mouse was idle.

This commit adds observers for mute and volume properties to
request_tick(), ensuring OSC updates immediately on mute or
volume changes, even if playback is paused and mouse is idle.
2025-07-04 10:17:04 +02:00
jsaowji 89c3f4d5c1 demux_cue: ignore mcn 2025-07-04 10:16:45 +02:00
nanahi a043624ea6 osc.lua: fix element touch handling
On some compositors, when all touch points disappear the compositors
reset the mouse position, which moves the mouse out of the osc element
trigger area so mouse up events do not happen.

Fix this by tracking the last touch position and use that as the virt
mouse position if the screen is recently touched.
2025-06-29 18:16:54 +02:00
rkscv 5f8d5f8e8b DOCS/man/lua: fix spacing issues 2025-06-29 11:41:44 +02:00
llyyr 591522c38f wayland: check if we have color representation manager first
before using it
2025-06-28 21:30:24 +00:00
Dudemanguy ed8954e8cf wayland: add support for wp-color-representation-v1
This is yet another color-related protocol for wayland. It's pretty
simple compared to the color-management protocol, and there's no real
reason to not advertise the color representation to compositors that
might find it useful.
2025-06-27 23:38:48 +00:00
nanahi 18defc8530 stats.lua: fix append_property exclusions
f676a9ff20 changed some append_property
calls to append, but append does not support the exclusion feature
which results in "HW: no" shown when no hwdec is active when this
was not displayed before.

Fix this by adding option to append_property to use get_property_cached.

Fixes: f676a9ff20
2025-06-20 16:13:14 +02:00
Dudemanguy 494afa4115 test/libmpv_test_track_selection: add a test for regional languages
Relevant for the forced subtitle case where we want a regional audio
language like en-US to match eng language subtitles. The general
matching logic is covered in the language test already.
2025-06-19 20:18:02 +00:00
Dudemanguy 580f2ecbd5 player/loadfile: match audio and subtitle language with mp_match_lang
For matching the audio language with the track subtitle language,
strcasecmp is insufficient since it only allows exact matches and misses
the language regional variant. Fix this by simply using mp_match_lang
instead.

Fixes #16461.
2025-06-19 20:18:02 +00:00
Norgerman e8ade130fa ci/win32: enable libaom 2025-06-12 18:08:32 +02:00
Norgerman e612f419f3 ci/win32: manually install cmake to fix cpu detection issue 2025-06-12 18:08:32 +02:00
Kacper Michajłow 47bc7b2a07 ytdl_hook.lua: add support for HEVC 2025-06-10 17:52:25 +02:00
Roman Bochagov 59d5f774a4 ao_avfoundation: fix memory leak
Fix memory leak in ao_avfoundation caused by audio device switching.

Fixes #16283
2025-06-09 19:31:48 +02:00
Kacper Michajłow a418d21635 github/workflows/lint: exclude font.props from xml check 2025-06-06 10:45:52 +02:00
sfan5 6b178e4f5a misc/path_utils: create folders with 0777 mode
This better matches other Unix tools.
Note that in practice the umask downgrades this to 0755 or 0775, so folders don't actually end up world-readable.
2025-06-02 15:59:05 +02:00
sfan5 9db49973f2 misc/path_utils: check existence first in mp_mkdirp() 2025-06-02 15:59:05 +02:00
sfan5 013e76e1c0 player: create missing folders for watch-history-path
fixes: #16357
2025-06-02 15:59:05 +02:00
sfan5 c4a00b2c85 player: handle unavailable options while writing watch-later file
fixes: #16410
2025-06-02 15:59:05 +02:00
sfan5 7182991bc4 sub/lavc_conv: also log decoder used 2025-06-02 15:59:05 +02:00
sfan5 6c6e81314a DOCS/libmpv: clarify that handle used by cplugin cannot be destroyed 2025-06-02 15:59:05 +02:00
sfan5 0f26d9f1ee sub/sd_lavc: fix condition for probing output type
This fixes decoding with libaribb24.
closes #16384
2025-06-02 15:59:05 +02:00
nanahi 730062b510 command: fix frame step with mouse buttons
c7c09fdb8b made frame step with seek flag
ignore key ups. However, for commands with emit_on_up flag set, which can
happen with mouse buttons, command should only be triggered on key ups.
This results in frame-step command with seek flag triggered on mouse down
instead of mouse up, and frame-back-step command not working with mouse.

Fix this by making sure that step is triggered depending on the emit_on_up
flag.

Fixes: c7c09fdb8b
2025-05-31 10:01:22 +02:00
sfan5 063a9b8c89 sd_lavc: log some useful information 2025-05-31 09:59:54 +02:00
sfan5 c0efee0512 video/image_writer: improve logging of conversions and encoder 2025-05-31 09:59:54 +02:00
sfan5 cf00b07536 various: use MP_ARRAY_SIZE macro 2025-05-31 09:59:54 +02:00
Kacper Michajłow 1d1535ff91 ci/openbsd: bump to 7.7 and remove ffmpeg subproject 2025-05-23 00:13:23 +02:00
Patrick Wang 43e83dc74b options: parse tls-related options as path 2025-05-21 14:43:24 +00:00
Kacper Michajłow 8407df979f sub/osd_libass: don't rerender OSD if not changed
Rendering OSD on every frame draw is quite heavy, even if some of the
rendering parts are cached, it still takes significant amount of time,
depending of payload can take 8-10 ms just to do the text shaping.

Instead render only when we need it.
2025-05-21 09:45:43 +02:00
Kacper Michajłow 817372ac96 demux_lavf: check if context is correctly passed to callbacks by ffmpeg
To catch ffmpeg bugs early, instead of crashing or worse.
2025-05-17 21:33:58 +02:00
Dudemanguy f9ec3d2c25 wayland: allow potential dragging of maximized windows
The locked_size restriction also prevents dragging from working on
maximized and tiled windows. A compositor may choose to restrict this
anyway (esp. tiling window managers), but there's no harm in sending the
request if it supports it. The only thing we really need to block here
is the fullscreen case. Fixes #16338.
2025-05-14 13:49:37 +00:00
Kacper Michajłow 4522929741 ci/win32: revert back ffmpeg to meson-7.1 branch
Also fixes jpegxl build after upstream changes. It wasn't enabled
correctly before.
2025-05-13 20:11:34 +02:00
Attila Fidan c399422722 clipboard-wayland: flush display after creating data sources
The data source requests are prepared inside create_data_sources from a
different thread than the clipboard thread, so it is necessary to flush
here. Otherwise, if mpv is not already managing the current selection,
we'll have to wait until the clipboard thread reenters
clipboard_wayland_dispatch_events for the request to be sent to the
compositor and have the other clients be sent new the new selection,
which may take up to 10 seconds.
2025-05-13 13:41:48 +00:00
Christopher Degawa b3070d1255 build: move check for DXGI_DEBUG_D3D11 down
video/out/gpu/d3d11_helpers.c requires it as well, and it's possible to
have egl-angle-win32 enabled without d3d11.

Signed-off-by: Christopher Degawa <[email protected]>
2025-05-09 12:47:44 +02:00
Kacper Michajłow 95c882dddc ci/win32: pin ffmpeg revision to the latest working one
Until this is fixed upstream:
https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg/-/issues/56
2025-05-09 12:44:47 +02:00
xyfish 139591a078 libarchive: try to use utf8 pathname 2025-05-08 00:46:23 +02:00
Ryan Hendrickson 3baf2e1ef8 DOCS/man/options: equivalent -> analogous 2025-05-08 00:45:57 +02:00
Guido Cella d702e5fec8 console.lua: set compute_bounds and hidden at startup
There is no need to set them every time the width is calculated.
2025-05-03 22:45:10 +02:00
Guido Cella 4194522344 console.lua: rename option_color_to_ass to color_option_to_ass
It is more correct English.
2025-05-03 22:45:10 +02:00
sfan5 e663cbc037 vo: move vo_mediacodec_embed to not be the default on Android 2025-05-03 18:13:35 +03:00
Kacper Michajłow 61be670716 ra_d3d11: mark cache_magic as nonstring for GCC 15 2025-04-28 15:54:12 +02:00
Kacper Michajłow cf3e332abb osdep/win32/smtc: workaround GCC 15 bogus template warning
Drop it to warning, even if -Werror is in effect. Interesting part is
that this makes this warning disappear completely. GCC diagnostics at
its finest.
2025-04-28 15:54:12 +02:00
Kacper Michajłow 22aacb4008 misc/language: mark arrays as nonstring for GCC 15
Fixes unterminated-string-initialization warnings.
2025-04-28 15:54:12 +02:00
Kacper Michajłow f8cef99033 demux_lavf: replace deprecated usage of stack allocated AVPackets
sizeof(AVPacket) being part of an ABI is deprecated. This was the last
remaining stack usage, missed in previous related change.

Note that we still use sizeof(AVPacket) and sizeof(AVBufferRef) in
demux_packet_estimate_total_size(). But it's safe, the worse that can
happen is that we underestimate the size on mismatch.

Fixes: cb15bc4324
2025-04-27 16:53:57 +02:00
Kacper Michajłow b72d6aa0e1 demux_lavf: fix unconstrained cache size with wrapped AVFrame packets
Fixes excessive memory usage with avdevice input. After [1] packets
returned from avdevice contains wrapped AVFrame. mpv estimates packet
size to limit how many of them are cached. The size were not correctly
calculated, because packed contained only AVFrame* and not the actual
data in buffer. Fix this by calculating wrapped size and add it to our
size estimation.

[1] https://github.com/FFmpeg/FFmpeg/commit/6ca43a9675d651d7ea47c7ba2fafb1bf831c4d0b
2025-04-27 16:53:57 +02:00
nanahi b47c805fa2 various: remove redundant return
void return type functions don't need a final return statement.
2025-04-27 00:10:31 +02:00
Leo Izen 2b38b382cf video/image_writer: tag bits_per_raw_sample when pixfmt changes
This populates the AVCodecContext->bits_per_raw_sample field value
when the pixel format of the screenshot being written doesn't match the
pixel format of the original video. For example, if the original video
was 10-bit and the screenshot is 16-bit, it populates this field so the
encoder can make use of it.

Currently libjxl and png encoders are known to accept this tag and set
the corresponding metadata (via BitDepthHeader, or sBIT).

This feature is only enabled if screenshot-sw=yes is enabled, because
screenshots from a hardware buffer are always natively at max-depth.

Signed-off-by: Leo Izen <[email protected]>
2025-04-25 05:39:48 -04:00
nanahi f147df1393 wayland: print errno strerror for data offer read/write 2025-04-22 22:07:48 +00:00
nanahi 26cb87a2d7 DOCS/man/input: add documentation for Wayland and macOS clipboard write
Wayland clipboard writing is added. macOS clipboard writing was
already implemented but it was forgotten to update the documentation.
2025-04-22 22:07:48 +00:00
nanahi 788b362d5f clipboard-wayland: support clipboard writing
This adds clipboard writing support for the native Wayland clipboard
backend for the ext-data-control-v1 protocol. Both clipboard and
primary selection are supported.
2025-04-22 22:07:48 +00:00
nanahi 688922ee85 video/out/wayland_common: support clipboard writing
This adds clipboard writing support for the VO clipboard backend
when a Wayland VO is active for the wayland core protocol.
2025-04-22 22:07:48 +00:00
nanahi ccd52142f5 video/out/wayland_common: rename dnd_ddev to data_device
The data device is used for both dnd and clipboard, so change it to
a better name.
2025-04-22 22:07:48 +00:00
nanahi 615ee4d9f5 video/out/wayland_common: save last user input serial
This is required for setting selection for clipboard writing.
2025-04-22 22:07:48 +00:00
llyyr b8ab1074eb wayland: log output user-friendly wl_output name
make and model aren't guaranteed to be available, so print the name as
well. This is usually just the connector name e.g. HDMI-A-1.
2025-04-21 15:33:52 +00:00
llyyr 35a98de55e wayland: log when direct scanout is active
Useful for debugging issues with certain AMD GPUs that have problems
that are only present in zero copy scenarios
2025-04-21 15:33:45 +00:00
Guido Cella 3600c716ea console.lua: fix crash when pressing Ctrl+l
Pressing Ctrl+l with selectable items without having called input.get()
earlier caused a crash.

Fixes a6024b562a.
2025-04-18 12:02:47 +02:00
Kacper Michajłow 94bc7315bd video/zimg: set alpha to ZIMG_ALPHA_STRAIGHT in all cases except premul
Fixes: 6a96b15cf4 ("video/csputils: add missing alpha choice")
Fixes: #16255
2025-04-17 21:50:18 +02:00
Guido Cella 01b51d1f72 options: add cue to --playlist-exts's defaut value 2025-04-17 21:40:04 +02:00
llyyr 0dc24a2301 sub/osd: set osd-shaper to complex by default
I'd rather not argue about which is better so go back to status quo,
users can use the more sensible option of "simple" if it doesn't break
anything (which it won't).

Using simple has benefits of growing memory usage slower and much faster
OSD rendering when complex isn't needed.

Simple breaks rendering complex glyphs like Material font icons

Fixes: https://github.com/tomasklaen/uosc/issues/1086
Fixes: f24611980c ("sub/osd: add osd-shaper and set it to simple by default")
2025-04-17 15:44:15 +02:00
yumcookiez df1e71a7cc ytdl_hook: add option to extract chapters 2025-04-17 00:37:13 +02:00
Guido Cella 498a9bf464 console.lua: center correctly within OSC margins
Center in the middle of the rectangle surrounded by the OSC instead of
in the center of the window.
2025-04-17 00:17:01 +02:00
Guido Cella 4dfe92fa27 console.lua: replace font script-opt with monospace_font
Allow configuring the monospace font without also changing the
proportional font. The proportional font is configured with the standard
--osd-font.
2025-04-17 00:13:19 +02:00
Guido Cella 42660a8c23 console.lua: say focused instead of selected
The selected term was causing confusion e.g. in
https://github.com/mpv-player/mpv/pull/15711#issuecomment-2676060139.
Saying either focused or current makes more sense since the item is not
actually selected until you click or press Enter.
2025-04-17 00:08:16 +02:00
Kacper Michajłow 1f809734b2 options: add ivf to video extensions 2025-04-17 00:07:49 +02:00
Kacper Michajłow ceb949216e options/m_option: assert if choice value is valid
This function should never be called with invalid values. That would
mean some of our internal state is invalid.
2025-04-17 00:07:39 +02:00
Kacper Michajłow 6a96b15cf4 video/csputils: add missing alpha choice 2025-04-17 00:07:39 +02:00
Guido Cella b554d43cde select.lua: display editions when before the first edition
When the first edition is not at the start of the file but after the
current time position, the current-edition property is -1, which
prevented displaying any edition.

Fixes https://github.com/mpv-player/mpv/issues/16073#issuecomment-2787316609
2025-04-17 00:07:22 +02:00
Guido Cella d059f648fa console.lua: repurpose case_sensitive to only affect exact searches
case_sensitive originally only affected Tab completion. It defaulted to
yes outside of Windows just to emulate the bad defaults of bash and zsh
(not fish, which has better defaults and defaults to case-insensitive
completion). This was already silly, but then it affected the fuzzy
autocompletion and case-sensitive fuzzy completion is even more silly.
And since 0b3cc3a167, it accidentally stopped affecting even that,
because the completion via script message never checked for the option.
Nobody even noticed this, meaning that nobody was relying on fuzzy
autocompletion being case-sensitive.

Just make case_sensitive only affect the new exact search, and make it
default to no on all platforms. Though IMO the search could just always
be case-insensitive.
2025-04-17 00:01:27 +02:00
Guido Cella 4cb5f7aa1f console.lua: implement exact matching
Allow matching items exactly instead of fuzzily when prefixing the
search with ' (like in fzf) or with
--script-opt=console-exact_match=yes.

This is mainly useful to filter history entries chronologically.

You can also specify multiple search terms delimited by spaces. But '
makes every term an exact match, unlike fzf where you need to place it
before every word, since we can't hook into fzy's algorithm.

Closes #14587.
2025-04-17 00:01:27 +02:00
Kacper Michajłow bff0d59cbe stats.lua: set plot_{perfdata,vsync_ratio,vsync_jitter} to no
Disables perf graphs from stats.lua. They are relatively expensive to
render, causes a lot of memory to be used for caches which are never
reused because graph is rarely the same. And most importantly those
graphs are not that useful beyond quick visual inspection of jitter.

Can be enable in script-opt if needed. Cache graph is left enabled,
because it shows if cache readhead grows or not nicely.
2025-04-16 23:58:46 +02:00
Kacper Michajłow fd1007260c stats.lua: add stats-plot_cache script-opt
Allows to disable cache graphs on page 3 of stats.lua.

Fixes: #13894
2025-04-16 23:58:46 +02:00
Mike Will d1d2d9a0bb osc.lua: update OSC on playlist position changes
Fixes: 168fb56fe8
2025-04-16 23:58:28 +02:00
Kacper Michajłow 0ab46993d8 video/out/gpu/context: enable debug_extra for Vulkan 2025-04-16 23:58:12 +02:00
llyyr f24611980c sub/osd: add osd-shaper and set it to simple by default
This is a change in default for libass with harfbuzz enabled, previously
it would choose the best available shaper.

Harfbuzz isn't really needed for mpv's OSD and it comes with a
significant performance penalty, so use simple instead
2025-04-16 23:58:02 +02:00
llyyr efba6e7e5a sub/sd_ass: add sub-{glyph-limit,bitmap-max-size} 2025-04-16 23:58:02 +02:00
llyyr fc972d2049 sub/osd: add osd-{glyph-limit,bitmap-max-size} 2025-04-16 23:58:02 +02:00
llyyr ad61018294 sub/osd: add osd-prune-delay 2025-04-16 23:58:02 +02:00
Kacper Michajłow 66c92a1a6c Revert "ci/win32: pin shaderc version to fix build errors"
The symbols were moved around, so it's now possible to link everything
without those libs, which are stub only now.

This reverts commit 94e100e389.
2025-04-16 19:16:26 +02:00
Kacper Michajłow 0fe6ad8afc ci: add Windows Arm builds 2025-04-16 19:16:26 +02:00
Kacper Michajłow d506a18a85 video/out/opengl/common: prevent MemoryBarrier collision
MemoryBarrier definition colides with our gl->MemoryBarrier().

https://learn.microsoft.com/windows/win32/api/winnt/nf-winnt-memorybarrier
2025-04-16 19:16:26 +02:00
llyyr 4697f7cb86 DOCS/man/mpv: document alt+v to toggle secondary sub track visibility
Fixes: 62f225ef9d ("sub/osd: hide secondary subtitles if secondary-sub-visibility is false")
2025-04-15 11:46:37 +02:00
Kacper Michajłow 27c08affb1 vd_lavc: prefer non-copy hwdec before falling back to -copy variant
Now that multiple hwdec APIs are available per platform (Vulkan, vaapi)
we should probe native first and fallback to -copy only after it fails.
2025-04-13 19:04:20 +02:00
nanahi 896b3400f3 clipboard-wayland: read already sent data when the fd is hung up
A "hung up" fd only indicates that the other end of the pipe is closed.
This can happen when the other client has already sent some data into
the pipe and closed its end. This should not be treated as an error,
and reading data should proceed until read() returns 0 or -1.

Premuturely destroying offer in this case breaks getting selection
data. Change it so that the cleanup on error happens after the selection
data is read.

Fixes: d20ded876d
2025-04-13 16:30:58 +02:00
Kacper Michajłow cc02a47a48 vd_lavc: prefer Vulkan hwdec when available
If Vulkan hwdec is exposed by the system, use this as it provides better
compatibility with native Vulkan rendering.

This avoid issues with importing VkImages through DMABUF interop from
nvdec or vaapi on drivers that doesn't support DMABUF.

Try native Vulkan hwdec first which will resolve compatibility issues if
available. If not it will fallback to using vaapi/nvdec like before.
2025-04-13 16:30:20 +02:00
showergum 44816ef8ff console.lua: default prompt to an empty string
Calling input.select() without a prompt argument was failing due to
attempting to concatenate a nil value.

Before mpv 0.40 the prompt defaulted to ">" so this is expected to
work as evident from the example code.
2025-04-12 20:55:34 +02:00
Guido Cella 91337443ad DOCS/man/options: fix link to Conditional auto profiles 2025-04-12 20:32:10 +02:00
Guido Cella 12b3de21c4 DOCS/man/input: remove reference to the removed --clipboard-enable 2025-04-12 20:32:10 +02:00
Guido Cella 150b6d7b90 DOCS: remove references to the removed slave mode 2025-04-12 20:32:10 +02:00
Dudemanguy 8c28e24c89 vo_dmabuf_wayland: set hwdec_type in reconfig based off of imgfmt
The old way of setting it during init isn't really accurate. It's
possible for a VADisplay to exist, but for some other hwdec to be
desired (e.g. like vulkan). It mostly worked OK because vaapi and
drmprime are generally exclusive but to be more correct we can simply
check the imgfmt in reconfig instead to correctly determine the type.
2025-04-12 04:35:36 +00:00
Dudemanguy 2bc3bddfb9 vo_dmabuf_wayland: only load needed hardware decoding drivers
The previous way of loading hardware decoding via image formats actually
loaded more things than needed such as cuda. This is because things like
cuda do actually support IMGFMT_VAAPI so the request would try to probe
it and it would fail. Instead of doing that, we can just specifically
request the only two drivers that we actually care about: vaapi and
drmprime.
2025-04-12 04:35:36 +00:00
Kacper Michajłow 3d5949366c {osd,msg}: use PU{1,2} for escape codes instead of invalid Unicode
Some languages actually require strings to be valid UTF-8, unlike C
which couldn't care less as long as it is NULL terminated.

Change triggered by Python support, but is also useful for Rust and Java.
2025-04-09 18:09:03 +02:00
Dudemanguy 43ce03c519 vo_dmabuf_wayland: don't resize if dst rect is 0
Evidently it is possible for some compositors to trigger an external
resize before the very first initial reconfig. This can't work and will
fail in various ways. Check this case and bail out. Fixes #16202.
2025-04-08 22:15:57 +00:00
Kacper Michajłow 5bc5489e56 video/sws_utils: limit sws-cvs and sws-chs to [-100, 100]
Makes no sense to create filters with some huge offsets.
2025-04-08 22:24:47 +02:00
Kacper Michajłow 1bd6e28780 vd_lavc: limit frame size to 8k when fuzzing
To speed it up and avoid OOMs.
2025-04-08 22:24:47 +02:00
Kacper Michajłow 99d442d299 options/m_option: add missing newline in log 2025-04-08 22:24:47 +02:00
Kacper Michajłow 6f7e1e4359 ci/freebsd: update to 14.2
FreeBSD supports only two latest minor versions, since 14.3 has been
released, packages for 14.1 are not longer available. Bump to 14.2,
since action doesn't have images for 14.3 yet.
2025-04-08 08:51:43 +02:00
VincentVerdynanta 4a0684db33 sd_ass: handle past subs with unknown duration on every decode
Unknown duration subtitle handling must be executed on every decode
call, because we are actually adjusting the duration value of subtitles
that are decoded in the past. It should not only execute when the
newest packet has an unknown duration.
2025-04-08 00:22:54 +00:00
NRK b09e06a920 osdep/threads: prefer using thread_local
C11 uses _Thread_local as the keyword, which thread_local macro
is defined to (inside of <threads.h>, which mpv doesn't use):
https://port70.net/~nsz/c/c11/n1570.html#7.26.1p3

C23 promotes thread_local to a keyword and marks _Thread_local
as obsolete and to be avoided in new code:
https://www.iso-9899.info/n3220.html#6.4.1p3

so just use thread_local directly, which is future-proof while
having a fallback define in osdep/threads.h for pre-C23 cases.
2025-04-06 17:01:33 +02:00
Kacper Michajłow 07571859ac player/scripting: fix race condition when destroying clients
Clients run in detached threads and are waited to signal when they are
finished with self mpv_destroy() call. Problem is that after detached
thread calls this function, mpv consider this client to be done and can
do whatever. One example is when mpv exits and wait for scripts to
finish we got race condition, because mpv (main thread) can exit first
and the detached thread calls ta_free() which crashes, because we may
have already destroyed things that the thread depends on.

I've seen this crash on FreeBSD CI job (libmpv-lifetime test), where the
libmpv.so has been unloaded while the thread was still doing ta_free()

```
==5081==ERROR: AddressSanitizer: SEGV on unknoun address 0x000001111806 (pc 0x000001111806 bp 0x7fffdedf4e40 sp 0x7fffdedf4e08 T40)
==5081==The signal is caused by a READ memory access.
    #0 0x1111806  (<unknown module>)
    #1 0x803cd6900 in ta_free /home/runner/work/mpv/mpv/build/../ta/ta.c:243:5
    #2 0x803a2fc87 in run_script /home/runner/work/mpv/mpv/build/../player/scripting.c:93:5
    #3 0x803a2ffe0 in script_thread /home/runner/work/mpv/mpv/build/../player/scripting.c:99:5
    #4 0x2c451a in asan_thread_start(void*) /usr/src/contrib/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28
    #5 0x80034fb04  (/lib/libthr.so.3+0x10b04)
```

Note the 0x1111806 jump which is completelly bogus.

Fix this by doing mpv_destroy() as a last step in detached threads.
2025-04-02 23:46:11 +02:00
NRK 22f4ff44c5 misc/random: add mp_rand_in_range32()
removes awkward back-and-forth int -> double -> int conversion.
the last step also broke uniformity, though it likely doesn't
matter much in mpv's playlist shuffle context.
2025-04-02 17:28:49 +02:00
NRK b968dec77d misc/random: improve the fallback case
c365e2f7 added av_random_bytes() to avoid multiple
threads/processes getting the same seed. but the fallback case
still suffers from it.

also mix in a function pointer, which hopefully is randomized
per process due to ASLR (20+ years old technology) along with
the stack position which will be different on different threads.
2025-04-02 17:28:49 +02:00
NRK b3d461e3aa misc/random: use av_random_bytes() for the whole seed
splitmix was used since it's recommended by the official xoshiro
site [0] as a "radically different" PRNG to avoid correlation of
similar seeds. av_random_bytes() is cryptographically secure
and so we don't have to worry about that. so just use it to
initialize the whole state.

[0]: https://prng.di.unimi.it/
2025-04-02 17:28:49 +02:00
NRK dd29542f6f misc/random: eliminate mutex
mutex itself was probably more costly than the PRNG itself. and
locking PRNGs is almost universally not recommended. simply add
a state parameter that the caller can hold to avoid locks.
2025-04-02 17:28:49 +02:00
Kacper Michajłow 36ea2354be ci/win32: don't use CMake 4.0
CMake has been updated to 4.0 which breaks compatibility with all
project targeting version < 3.5. See for more user stories:
https://github.com/actions/runner-images/issues/11926

Remove 4.0 from path and use the one from VS installation which is
working for now. Generally we want to use only tools from VS
installation, but unfortunately Windows image provided by GHA have
polluted PATH which already causes issues in the past, that's why we
remove yet another directory from PATH.

The affected project in our case is https://github.com/webmproject/sjpeg
which is build as part of libjxl.
2025-04-02 02:09:36 +02:00
Kacper Michajłow 30869ddb90 ci/build-win32.ps1: update wrap to expose ffmpeg executable
Also list dependencies, they are overriden now in upstream meson.build.

For subtitle selection tests.

See: https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg/-/commit/7601055639e789cdeeff793c48eaaf3186a70aad
2025-04-01 21:27:45 +02:00
Kacper Michajłow baf2fd2f28 osdep/language-win: fix use of GetSystemPreferredUILanguages()
The buffer size were never set to 0, after first call. To retrive the
size both buffer has to be NULL and size 0. Otherwise it fails.

While at it refactor whole thing and use returned count as sanity limit.
2025-04-01 21:27:45 +02:00
Kacper Michajłow cce45aa054 test/libmpv_test_track_selection: fix locale check
The size of the buffer was never set so the Get*PreferredUILanguages()
were just returning ERROR_INSUFFICIENT_BUFFER.

Fix the buffer size and use the returned count as sanity limit.

Fixes the test.
2025-04-01 21:27:45 +02:00
Kacper Michajłow 06a983ef2f test/libmpv_test_track_selection: fix compilation with Windows SDK 2025-04-01 21:27:45 +02:00
Leo Izen 5870c95e89 filters: automatically flip video if displaymatrix indicates so
Currently we check AV_FRAME_DATA_DISPLAYMATRIX for its rotation factor
but not for its flip factor, which could happen with some input files.
This commit adds and autovflip filter, which is applied before the
autorotate filter to flip vertically before rotating. It also changes
the displaymatrix reading code to output to mp_image->params.vflip so
it can be autoinserted as necessary.

Signed-off-by: Leo Izen <[email protected]>
2025-03-31 14:07:47 -04:00
Guido Cella 52a95d91bd positioning.lua: validate that an amount is passed
Instead of crashing, show the correct usage when running pan-x, pan-y or
cursor-centric with script-message, or with script-binding but no
argument.
2025-03-31 12:04:37 +02:00
Guido Cella f0c3d466f9 DOCS/man/osc: fix custom button example formatting
The examples for each button were rendered in the same line.
2025-03-31 12:02:03 +02:00
verygoodlee f837e951af select.lua: simplify the time formatting function
The C version of time formatting function has been exposed to lua,
so why not use it, `osc.lua` and `stats.lua` are already using it.
2025-03-31 11:57:06 +02:00
Tom Grimwood-Taylor a407e13f83 misc/language: add a forced flag to the track add commands 2025-03-31 11:47:52 +02:00
Tom Grimwood-Taylor f608780032 misc/language: parse forced tag from external subtitle tracks
Fixes: mpv-player#16060
2025-03-31 11:47:52 +02:00
Leo Izen 2e215cc6a5 demux/demux_playlist: mark fd:// as self-expanding
The playlist demuxer won't propagate the protocol forward to its entries
if its protocol is on a whitelist, for example data:// or memory:// etc.

This commit adds fd:// to that list because that should not be expected
to work.

Signed-off-by: Leo Izen <[email protected]>
2025-03-31 11:34:57 +02:00
Kacper Michajłow 5ba7ee5137 demux_mpv: add missing URL unescape 2025-03-28 22:40:09 +01:00
Kacper Michajłow 94e100e389 ci/win32: pin shaderc version to fix build errors
See: https://github.com/KhronosGroup/glslang/issues/3914
2025-03-28 19:40:44 +01:00
Kacper Michajłow 26b29fba02 demux_mkv: fix compilation after deprecated definitions removal
See: https://github.com/FFmpeg/FFmpeg/commit/822432769868da325ba03774df1084aa78b9a5a0
2025-03-28 19:40:44 +01:00
sfan5 08939665fe DOCS: clarify some minor points in the release policy 2025-03-28 16:19:48 +01:00
llyyr d20ded876d clipboard-wayland: prevent reading from hung up fd
This causes mpv to use up 100% of a core if there's an offer for a
mime_type that mpv doesn't accept with ext_data_control clipboard
backend.
2025-03-28 16:08:36 +01:00
Dudemanguy 9cca045511 wayland: lrint some width/height calculations 2025-03-28 13:53:08 +00:00
Dudemanguy 9826e96ecc wayland: use logical coordinates when setting the opaque region
Core wayland works in the surface local/logical coordinates so the width
and height values should really be divided by the scale factor.
2025-03-28 13:53:08 +00:00
Kacper Michajłow 38439dd531 threads: remove unused recursive mutex support
After removal of `MP_MUTEX_RECURSIVE` from vdpau.c there are no more
clients of recursive mutex. Remove all the code related to it. This
commit can be reverted if in the future it is needed again. For now
let's not keep dead code.
2025-03-26 19:16:21 +01:00
Lynne 9964104a6e vd_lavc: enable FFv1 hwaccel by default
FFmpeg recently got a hardware accelerated decoder for FFv1.
The decoder has been tested on all major vendors and operating systems.
Intel support is currently disabled as all of their drivers have issues
with buffer device addresses.
Since its a software-defined implementation, internal issues can be fixed
and the overall implementation optimized further.

With that, I think it should be safe to enable it by default.
2025-03-26 18:40:58 +01:00
Kacper Michajłow 74d3c2f0e7 mp_image: set repr.alpha and repr.bits when mapping AVFrame
Fixes invalid colors with gpu-next direct mapping of some formats.
2025-03-26 18:39:40 +01:00
Kacper Michajłow d9f27bd0f1 video/vdpau: change is_preempted bool to atomic
And eliminate recursive lock. This doesn't have to be guarded by mutex,
if for some reason preemption happens while we are handling preemption,
we remember the flag and do the dance gain. This is even nicer than
locking preemption callback.
2025-03-26 18:31:54 +01:00
한승민 513ccb9227 DOCS/interface-changes/kitty-passthrough: option addition notice 2025-03-26 18:25:49 +01:00
한승민 699a0bec42 vo_kitty: use priv as talloc context
- `priv` is used as `talloc_ctx`/`ta_parent` in `bstr_xappend_*` calls.
- `free_bufs` no longer frees `priv->cmd.start`.
- `bstr_*_passthrough` functions have been stripped off the `bstr_x`
  prefix.
2025-03-26 18:25:49 +01:00
한승민 ccad32e961 vo_kitty: remove DCS_GUARD_* macros
The `DCS_GUARD_*` macros have been removed in the favor of actual
functions
2025-03-26 18:25:49 +01:00
한승민 8edabd5644 vo_kitty: do not add trailing NULL byte in payload
In the past `strlen` was used in the write function, which omitted the
trailing NULL byte, however with the addition of `bstr` API the NULL
byte produced by `av_base64_encode` in the output is also written to
stdout, this causes terminals (namely Ghostty) to not display the frame.

There was also an additional edge case where if the entire output is
less than 4096 bytes the finishing escape sequence `\033_Gm=0;` was
never emitted. Adding a check for this after the for loop fixes this
behavior.
2025-03-26 18:25:49 +01:00
한승민 d9dc84c0fc vo_kitty: add auto-multiplexer-passthrough option
Terminal multiplexers like (screen, tmux, ...) do not support the kitty
image protocol (as of yet), to go around this DCS escape sequences are
used (`\ePtmux;...\e\` for tmux, `\eP...\e\` for screen). This option
allows passing thorugh the kitty image escape sequences.

`\033\\` suffixes from `KITTY_ESC_IMG_SHM` and `KITTY_ESC_DELETE_ALL`
have been removed. This makes it easier to wrap the escape sequences in
a DCS control sequence since there will be no `\033` in them to escape
(as multiplexers require escaping the escapes within the DCS data
string). `DCS_GUARD_WRITE` and `DCS_GUARD_APPEND` macros have been added
to wrap escape sequences in DCS control sequence based on the
availability of the `priv->dcs_prefix` property.
2025-03-26 18:25:49 +01:00
한승민 aad5329fd1 vo_kitty: reallocate cmd.start on reconfigure
`priv->cmd.start` is being freed in `reconfig` without being allocated
again this caused a segfault if `flip_page` was called after `reconfig`.
This segfault could be triggered by sending a SIGWINCH (resizing the
terminal).
2025-03-26 18:25:49 +01:00
Dudemanguy 0c3f1c0f6e build: make drm optional again for vo_dmabuf_wayland
We used to deal more directly with drm-specific things, but that has all
since been removed and is known to not be needed. We can relax the build
requirements some more since vo_dmabuf_wayland will simply error out if
no hwdec backend is available at init.
2025-03-26 15:31:08 +01:00
DudemanguyandKacper Michajłow a9dccf22a1 build: use a drm_fourcc header check for vaapi on gl
The underlying interop only needs the DRM fourcc defined in the header.

Co-authored-by: Kacper Michajłow <[email protected]>
2025-03-26 15:31:08 +01:00
Guido Cella e88864aef3 commands.lua: add remember_input script-opt
Allow clearing the input line on close. Fixes #16104.
2025-03-26 14:56:48 +01:00
Guido Cella ba80e447a6 console.lua: use a variadic function 2025-03-26 14:48:37 +01:00
Dudemanguy 1b231b4e57 wayland: accept version 2 of the cursor-shape protocol
The version 2 changes only add some enums which makes zero difference to
us so we can just allow the newer version.
2025-03-26 02:19:44 +00:00
Guido Cella 6ec0d06aa9 console.lua: use double quotes
Make it consistent with other scripts.
2025-03-26 02:53:01 +01:00
nanahi af1ac0f685 playloop: only notify MP_EVENT_INPUT_PROCESSED when needed
MP_EVENT_INPUT_PROCESSED is used to notify mouse and touch position
updates, but it is currently notified for all input commands even when
they have nothing to do with mouse position. This results in unnecessary
acquisition and comparision of mouse and touch positions for all commands.

Optimize this by checking whether the command is marked as requiring the
event notification, and only notify if that is true.
2025-03-26 01:33:21 +01:00
nanahi ca6e26399f input: mark mouse and touch position update in mp_cmd
This makes it possible to distinguish these dummy commands
for position update notification from other commands.
2025-03-26 01:33:21 +01:00
nanahi f676a9ff20 stats.lua: cache some properties
Some properties can take a long time to query, especially those which
require voctrl like current-window-scale and display-names.

Similar to d37521b5ef, make the script
observe these properties and cache the values to avoid querying them
on every refresh. This alleviates the issue when holding down "i" key
for a while and releasing it results in stats being stuck on display
for a long time because of the time required to query there properties.
2025-03-26 01:30:46 +01:00
nanahi e70d67f7ca DOCS/man/options: remove bogus messages about the client API
The messages referred to "no" prefixes like --no-audio not working with
the client API. The language was removed in
b1ee92ad4a.

Remove the messages which are bogus and incorrect now.
2025-03-26 01:29:52 +01:00
Kacper Michajłow f972cb6dc4 meson: disable stack protector for mpv.com
This is a bare runner for mpv.exe. There is no need for a stack
protector here and when it is forced to be added by -fno-stack-protector
it complains about missing symbols, because we don't link any standard
libs here.

Fixes:
undefined symbol: __stack_chk_fail
undefined symbol: __stack_chk_guard

We could define those, but mpv.com wrapper doesn't need it.
2025-03-26 01:28:50 +01:00
sfan5 97cb16d683 RELEASE_NOTES: remove accidental BOM
linting is good and all but does this check really need to fail on every single commit from now on?
2025-03-25 18:39:00 +01:00
sfan5 2da0b49038 Update MPV_VERSION 2025-03-25 18:36:18 +01:00
288 changed files with 9254 additions and 2397 deletions

No files matched your search

+1 -1
View File
@@ -14,7 +14,7 @@ trim_trailing_whitespace = true
[.git/COMMIT*]
max_line_length = 72
[{osdep/dirent-win.h,TOOLS/osxbundle/mpv.app/Contents/PkgInfo}]
[{osdep/dirent-win.h,TOOLS/osxbundle/mpv.app/Contents/PkgInfo,TOOLS/osxbundle/mpv.app/Contents/Resources/Assets.car}]
charset = unset
insert_final_newline = unset
indent_style = unset
@@ -94,7 +94,7 @@ body:
attach it to the issue.
If you have trouble producing a log file, you can alternatively use `--gpu-debug -v -v`,
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
@@ -88,7 +88,7 @@ body:
at `~/Library/Logs/mpv.log`. You can jump to that file via the `Help > Show log File…` menu.
If you have trouble producing a log file, you can alternatively use `--gpu-debug -v -v`,
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
@@ -89,7 +89,7 @@ body:
attach it to the issue.
If you have trouble producing a log file, you can alternatively use `--gpu-debug -v -v`,
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
+1 -1
View File
@@ -87,7 +87,7 @@ body:
attach it to the issue.
If you have trouble producing a log file, you can alternatively use `--gpu-debug -v -v`,
If you have trouble producing a log file, you can alternatively use `--gpu-debug --msg-time -v -v`,
save the terminal output to a file, and attach it to the issue.
+94 -65
View File
@@ -36,16 +36,18 @@ jobs:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
TARGET: ${{ matrix.arch }}-w64-mingw32
RUST_TARGET: ${{ matrix.arch }}-pc-windows-gnu
strategy:
fail-fast: false
matrix:
include:
- target: i686-w64-mingw32
- arch: i686
wine: wine32
- target: x86_64-w64-mingw32
- arch: x86_64
wine: wine64
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Get time
id: get_time
@@ -55,32 +57,31 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ matrix.target }}-
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ env.TARGET }}-
- name: Install dependencies
run: |
rustup target add ${{ env.RUST_TARGET }}
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --no-install-recommends -y ccache g++-mingw-w64 gcc-multilib meson nasm ninja-build pkgconf ${{ matrix.wine }} wine
sudo apt-get install --no-install-recommends -y ccache g++-mingw-w64 gcc-multilib python3-pip nasm ninja-build pkgconf ${{ matrix.wine }} wine
python -m pip install meson
- name: Install Meson Wraps
run: |
mkdir subprojects -p
meson wrap install mujs
meson subprojects download
- name: Build libraries
run: |
./ci/build-mingw64.sh
env:
TARGET: ${{ matrix.target }}
- name: Build with meson
id: build
run: |
./ci/build-mingw64.sh meson pack
env:
TARGET: ${{ matrix.target }}
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
@@ -103,9 +104,9 @@ jobs:
run: |
cat ./mingw_build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: mpv-${{ matrix.target }}
name: mpv-${{ env.TARGET }}
path: mpv-git-*.zip
- name: Save Cache
@@ -113,17 +114,29 @@ jobs:
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
win32:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
arch: "x64"
os: "windows-latest"
- target: aarch64-pc-windows-msvc
arch: "arm64"
os: "windows-11-arm"
env:
VS: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise"
CC: "ccache clang"
CXX: "ccache clang++"
CC_LD: "lld"
CXX_LD: "lld"
CC_LD: "lld-link"
CXX_LD: "lld-link"
WINDRES: "llvm-rc"
RUST_LD: "lld-link"
RUSTC: "rustc --target ${{ matrix.target }}"
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: "${{ github.workspace }}\\.ccache"
CCACHE_MAXSIZE: 500M
@@ -133,7 +146,7 @@ jobs:
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Get time
id: get_time
@@ -144,13 +157,14 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: x86_64-windows-msvc-${{ steps.get_time.outputs.timestamp }}
restore-keys: x86_64-windows-msvc-
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ matrix.target }}-
- name: Install dependencies
run: |
python -m pip install meson
python -m pip install meson==1.9.2
choco install ccache nasm
./ci/install-cmake.ps1 -arch ${{ matrix.arch }}
- name: Update Meson WrapDB
run: |
@@ -165,10 +179,11 @@ jobs:
id: build
run: |
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' -and `
$_ -ne 'C:\Program Files\CMake\bin' -and `
$_ -ne 'C:\Strawberry\c\bin' }) -join ';'
$env:PATH += ';C:\Program Files\NASM'
$env:PATH = "$pwd\cmake\bin;" + $env:PATH + ';C:\Program Files\NASM'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }}"
./ci/build-win32.ps1
- name: Print build log
@@ -180,10 +195,11 @@ jobs:
id: tests
run: |
$env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' -and `
$_ -ne 'C:\Program Files\CMake\bin' -and `
$_ -ne 'C:\Strawberry\c\bin' }) -join ';'
$env:PATH += ';C:\Program Files\NASM'
$env:PATH = "$pwd\cmake\bin;" + $env:PATH + ';C:\Program Files\NASM'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }}"
meson test -C build -t 2
- name: Print meson test log
@@ -191,11 +207,12 @@ jobs:
run: |
cat ./build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
with:
name: mpv-x86_64-windows-msvc
name: mpv-${{ matrix.target }}
path: |
build/mpv.???
build/mpv-*.bat
build/vulkan-*.dll
!build/mpv.lib
@@ -204,30 +221,27 @@ jobs:
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: x86_64-windows-msvc-${{ steps.get_time.outputs.timestamp }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
cc:
- "clang"
cxx:
- "clang++"
os:
- "macos-13"
- "macos-14"
- "macos-15"
include:
- os: "macos-13"
arch: "intel"
- os: "macos-14"
arch: "arm"
xcode: "Xcode_15.2"
xcode: "Xcode_15.0"
- os: "macos-15"
arch: "arm"
- os: "macos-15-intel"
- os: "macos-26"
arch: "arm"
- os: "macos-26"
arch: "test"
swift: "-target arm64-apple-macosx10.15"
target: "10.15"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Remove stray upstream python binary symlinks under /usr/local
run: |
@@ -245,20 +259,27 @@ jobs:
- name: Install dependencies
run: |
brew update
if [[ -n "${{ matrix.homebrew }}" ]]; then
export HOMEBREW_NO_AUTO_UPDATE=1
cd "$(brew --repo homebrew/core)"
git checkout --force ${{ matrix.homebrew }}
else
brew update
fi
brew install -q autoconf automake pkgconf libtool python freetype fribidi little-cms2 \
luajit libass ffmpeg meson uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers
luajit libass ffmpeg meson rust uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers
- name: Build with meson
id: build
run: |
./ci/build-macos.sh
env:
CC: "${{ matrix.cc }}"
CXX: "${{ matrix.cxx }}"
TRAVIS_OS_NAME: "${{ matrix.os }}"
SWIFT_FLAGS: "${{ matrix.swift }}"
MACOSX_DEPLOYMENT_TARGET: "${{ matrix.target }}"
- name: Create App Bundle
if: ${{ matrix.arch != 'test' }}
run: |
meson compile -C build macos-bundle
tar -czvf mpv.tar.gz -C build mpv.app
@@ -278,9 +299,10 @@ jobs:
run: |
cat ./build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v5
if: ${{ matrix.arch != 'test' }}
with:
name: mpv-${{ matrix.os }}-${{ matrix.arch }}
name: mpv-${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }}
path: mpv.tar.gz
linux:
@@ -303,7 +325,7 @@ jobs:
ld: "lld"
args: "-Db_lto=true -Db_lto_mode=thin"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build with meson
id: build
@@ -318,7 +340,6 @@ jobs:
- name: Run meson tests
id: tests
run: |
export LSAN_OPTIONS="suppressions=${GITHUB_WORKSPACE}/.lsan_suppressions"
meson test -C build
- name: Print meson test log
@@ -334,14 +355,13 @@ jobs:
CC: "clang"
CXX: "clang++"
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Build with meson
id: build
run: |
meson setup build \
--werror \
-Dc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \
-Dfuzzers=true -Dlibmpv=true -Dcplayer=false
meson compile -C build fuzzers
@@ -358,7 +378,7 @@ jobs:
# used features to test build compatibility. Musl is a nice bonus as well
image: alpine:3.19
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Install dependencies
run: |
apk update
@@ -379,6 +399,7 @@ jobs:
libxscrnsaver-dev \
meson \
musl-dev \
rust \
samurai
- name: Build with meson
@@ -403,14 +424,14 @@ jobs:
openbsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 30 # avoid any weirdness with the VM
timeout-minutes: 15 # avoid any weirdness with the VM
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Test in OpenBSD VM
uses: cross-platform-actions/action@v0.25.0
uses: cross-platform-actions/action@v0.30.0
with:
operating_system: openbsd
version: '7.5'
version: '7.8'
run: |
sudo pkg_add -U \
cmake \
@@ -432,6 +453,7 @@ jobs:
pulseaudio \
python3 \
rubberband \
rust \
sdl2 \
shaderc \
spirv-cross \
@@ -448,14 +470,14 @@ jobs:
freebsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 30 # avoid any weirdness with the VM
timeout-minutes: 15 # avoid any weirdness with the VM
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Test in FreeBSD VM
uses: cross-platform-actions/action@v0.25.0
uses: cross-platform-actions/action@v0.30.0
with:
operating_system: freebsd
version: '14.1'
version: '14.3'
run: |
sudo pkg update
sudo pkg install -y \
@@ -475,7 +497,7 @@ jobs:
libplacebo \
libXinerama \
libxkbcommon \
libxpresent \
libXpresent \
libXv \
luajit \
meson \
@@ -486,6 +508,7 @@ jobs:
pulseaudio \
python3 \
rubberband \
rust \
sekrit-twc-zimg \
sdl2 \
sndio \
@@ -500,14 +523,19 @@ jobs:
fi
msys2:
runs-on: windows-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
sys:
- clang64
- mingw64
- ucrt64
include:
- sys: "clang64"
os: "windows-latest"
- sys: "mingw64"
os: "windows-latest"
- sys: "ucrt64"
os: "windows-latest"
- sys: "clangarm64"
os: "windows-11-arm"
defaults:
run:
shell: msys2 {0}
@@ -517,7 +545,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
@@ -543,6 +571,7 @@ jobs:
python:p
rst2pdf:p
rubberband:p
rust:p
shaderc:p
spirv-cross:p
uchardet:p
+2 -1
View File
@@ -13,7 +13,8 @@ jobs:
gh cache list -L 100 --json id,key,ref -S last_accessed_at -O desc --jq '
map(select(.key | startswith("x86_64-w64-mingw32-") or
startswith("i686-w64-mingw32-") or
startswith("x86_64-windows-msvc-"))) |
startswith("aarch64-pc-windows-msvc-") or
startswith("x86_64-pc-windows-msvc-"))) |
group_by(.ref) |
map({
ref: .[0].ref,
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
check-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Docs
run: |
sudo apt-get install --no-install-recommends -y python3-docutils rst2pdf
+2 -2
View File
@@ -41,14 +41,14 @@ jobs:
report-timeouts: true
output-sarif: true
- name: Upload Crash
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts
path: ./out/artifacts
- name: Upload Sarif
if: always() && steps.build.outcome == 'success'
uses: github/codeql-action/upload-sarif@v3
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: cifuzz-sarif/results.sarif
checkout_path: cifuzz-sarif
+7 -7
View File
@@ -13,7 +13,7 @@ jobs:
commit-msg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
fetch-depth: 50
@@ -24,20 +24,20 @@ jobs:
swift:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: norio-nomura/[email protected]
lua:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: lunarmodules/luacheck@v1
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Check
id: check
uses: astral-sh/ruff-action@v3
@@ -50,7 +50,7 @@ jobs:
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: python/mypy@master
with:
install_project_dependencies: no
@@ -60,12 +60,12 @@ jobs:
editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker -config .editorconfig-checker.json
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: pre-commit/[email protected]
-1
View File
@@ -1 +0,0 @@
leak:FcFontSetSort
+2 -1
View File
@@ -8,6 +8,7 @@ repos:
- id: check-json
- id: check-shebang-scripts-are-executable
- id: check-xml
exclude: ^TOOLS/mpv-osd-symbols.sfdir/font.props$
- id: check-yaml
- id: end-of-file-fixer
exclude: ^TOOLS/osxbundle/mpv.app/Contents/PkgInfo$
@@ -18,5 +19,5 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
args: ["--ignore-words-list", "datas,DNE,enew,HDA,numer,ontop,optionA,Paeth,pathc,inout"]
args: ["--ignore-words-list", "ALS,als,datas,DNE,enew,HDA,numer,ontop,optionA,Paeth,pathc,inout,requestor"]
exclude: ^misc/language.c$
+1 -1
View File
@@ -76,7 +76,7 @@ which bootstraps a MinGW-w64 toolchain and builds mpv along with its dependencie
cat <<EOF > subprojects/ffmpeg.wrap
[wrap-git]
url = https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git
revision = meson-7.1
revision = meson-8.0
depth = 1
[provide]
libavcodec = libavcodec_dep
+3 -6
View File
@@ -97,12 +97,9 @@ Device targets
As the options for various devices can get complex, profiles can be used.
An example profile file for encoding is provided in
etc/encoding-profiles.conf in the source tree. This file is installed and loaded
by default. If you want to modify it, you can replace and it with your own copy
by doing::
mkdir -p ~/.mpv
cp /etc/mpv/encoding-profiles.conf ~/.mpv/encoding-profiles.conf
etc/encoding-profiles.conf in the source tree. mpv will read any file
named ``encoding-profiles.conf`` in either the local or system
configuration directories.
Keep in mind that the default profile is the playback one. If you want to add
options that apply only in encoding mode, put them into a ``[encoding]``
+65
View File
@@ -30,7 +30,72 @@ Interface changes
::
--- mpv 0.42.0 ---
--- mpv 0.41.0 ---
- the value of `--tls-ca-file` is now expanded as a path
- the value of `--tls-cert-file` is now expanded as a path
- the value of `--tls-key-file` is now expanded as a path
- the `--sub-sdh-enclosures` option is now a string list option
- rename `console-selected_color` script-opt to `console-focused_color`
- rename `console-selected_back_color` script-opt to `console-
focused_back_color`
- mediacodec_embed is no longer the default `vo` on Android. Set the option
explicitly if you want to use it and are aware of the limitations.
- change `--target-colorspace-hint` to `auto` by default. Auto mode will
also enable hint for SDR formats if target metadata is reported by current
output context.
- change `--prefetch-playlist` default to `no`
- add `--clipboard-xwayland` option
- add `video-params/prim-*` properties
- add `stats-plot_cache` script-opt
- disable `stats-plot_{perfdata,vsync_ratio,vsync_jitter}` by default
- add `scaled` and `osd` flags to screenshot commands
- add `forced` flag to track add commands
- add `default` flag to track add commands
- add `console-monospace_font` script-opt
- remove `console-font` script-opt
- add `console-gap` script-opt
- add `console-exact_match` script-opt
- make `console-case_sensitive` only affect exact searches and change the to
default to no on platforms other than Windows
- add `commands-remember_input` script-opt
- add `--wid=0` support for win32
- add `--vo-kitty-auto-multiplexer-passthrough=<yes|no>`
- add `--vf=format=transfer` alias
- add `--vf=format=min-luma`
- add `--vf=format=max-luma`
- add `--vf=format=max-cll`
- add `--vf=format=max-fall`
- add `--treat-srgb-as-power22`
- add `--sdr-adjust-gamma`
- add `--target-colorspace-hint-strict` option
- add `--target-colorspace-hint-mode` option
- add `--sub-hdr-peak` option
- add `--sub-fix-timing-threshold`
- add `--sub-fix-timing-keep`
- add `--register` and `--unregister`
- add `--osd-prune-delay`
- add `--osd-glyph-limit`
- add `--osd-bitmap-max-size`
- add `--sub-glyph-limit`
- add `--sub-bitmap-max-size`
- add `--osd-shaper`
- add `--input-tablet-emulate-mouse` option
- add `--image-subs-hdr-peak` option
- add `--hwdec-threads`
- add `--hdr-reference-white`
- add `--d3d11-output-mode` enable use specific output mode for creating the
D3D11 swapchain
- add `--d3d11-composition-size=<WxH>` support for d3d11 composition mode
- add `--border-background=blur`
- add `--background-blur-radius`
- add `--bluray-angle`
- add `--background-tile-size` option
- add `--background-tile-color-0` and `--background-tile-color-1` options
- add --audio-set-media-role, disabled by default. This effectively changes
the behavior for ao_pipewire
- `encoding-profiles.conf` is no longer installed by default into the system
configuration directory and is instead installed in the data directory
--- mpv 0.40.0 ---
- undeprecate list option suffixes that work with multiple items
- add `-del` to string list and keyvalue list options
+7 -1
View File
@@ -49,4 +49,10 @@ Configurable Options
``history_path``
Default: ``~~state/command_history.txt``
The file path for ``persist_history`` (see `PATHS`_).
The file path for ``persist_history`` (see `FILES`_).
``remember_input``
Default: yes
Whether to remember the input line and cursor position when closing the
console, and prefill it the next time it is opened.
+26 -12
View File
@@ -90,6 +90,9 @@ Ctrl+v
Shift+INSERT
Paste text (uses the primary selection on X11 and Wayland).
Ctrl+y
Copy the current line to the clipboard.
TAB and Ctrl+i
Cycle through completions.
@@ -124,12 +127,12 @@ option. The configuration syntax is described in `mp.options functions`_.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
``font``
The font name.
``monospace_font``
Default: platform dependent
When necessary to align completions in a grid, a monospace font depending on
the platform is the default. When there are no completions, ``--osd-font``
is the default.
The monospace font used when there are completions to align in a grid.
When there are no completions, ``--osd-font`` is used.
``font_size``
Default: 24
@@ -148,6 +151,11 @@ Configurable Options
The transparency of the menu's background. Ranges from 0 (opaque) to 255
(fully transparent).
``gap``
Default: 0.2
The gap between menu items, specified as a percentage the font size.
``padding``
Default: 10
@@ -184,25 +192,31 @@ Configurable Options
Whether to scale the console with the window height. Can be ``yes``, ``no``,
or ``auto``, which follows the value of ``--osd-scale-by-window``.
``selected_color``
``focused_color``
Default: ``#222222``
The color of the selected item.
The color of the focused item.
``selected_back_color``
``focused_back_color``
Default: ``#FFFFFF``
The background color of the selected item.
The background color of the focused item.
``match_color``
Default: ``#0088FF``
The color of characters that match the searched string.
``case_sensitive``
Default: no on Windows, yes on other platforms.
``exact_match``
Default: no
Whether autocompletion is case sensitive. Only works with ASCII characters.
Whether to match menu search queries exactly instead of fuzzily. Without
this option, prefixing queries with ``'`` enables exact matching.
``case_sensitive``
Default: no
Whether exact searches are case sensitive. Only works with ASCII characters.
``history_dedup``
Default: true
+98
View File
@@ -0,0 +1,98 @@
CONTEXT MENU SCRIPT
===================
This script provides a context menu for platforms without integration with a
native context menu. On these platforms, it can be disabled entirely using the
``--load-context-menu=no`` option. On platforms where the integration is
implemented, it is already disabled by default.
Script messages
---------------
``open``
Show the context menu.
``select``
Select the focused item when there is one.
Configuration
-------------
This script can be customized through a config file
``script-opts/context_menu.conf`` placed in mpv's user directory and through
the ``--script-opts`` command-line option. The configuration syntax is
described in `mp.options functions`_.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
``font_size``
Default: 14
The font size.
``gap``
Default: 0.2
The gap between menu items, specified as a percentage the font size.
``padding_x``
Default: 8
The horizontal padding of the menu.
``padding_y``
Default: 4
The vertical padding of the menu.
``menu_outline_size``
Default: 0
The size of the menu's border.
``menu_outline_color``
Default: ``#FFFFFF``
The color of the menu's border.
``corner_radius``
Default: 5
The radius of the menu's corners.
``scale_with_window``
Default: auto
Whether to scale sizes with the window height. Can be ``yes``, ``no``, or
``auto``, which follows the value of ``--osd-scale-by-window``.
When sizes aren't scaled with the window, they are scaled by
``display-hidpi-scale``.
``focused_color``
Default: ``#222222``
The color of the focused item.
``focused_back_color``
Default: ``#FFFFFF``
The background color of the focused item.
``disabled_color``
Default: ``#555555``
The color of disabled items.
``seconds_to_open_submenus``
Default: 0.2
The number of seconds to open submenus after the cursor enters items
associated with one.
``seconds_to_close_submenus``
Default: 0.2
The number of seconds to close submenus after the cursor enters a parent
menu.
+140 -32
View File
@@ -3,8 +3,7 @@ COMMAND INTERFACE
The mpv core can be controlled with commands and properties. A number of ways
to interact with the player use them: key bindings (``input.conf``), OSD
(showing information with properties), JSON IPC, the client API (``libmpv``),
and the classic slave mode.
(showing information with properties), JSON IPC and the client API (``libmpv``).
input.conf
----------
@@ -75,10 +74,25 @@ It's also possible to bind a command to a sequence of keys:
(This is not shown in the general command syntax.)
If ``a`` or ``a-b`` or ``b`` are already bound, this will run the first command
that matches, and the multi-key command will never be called. Intermediate keys
can be remapped to ``ignore`` in order to avoid this issue. The maximum number
of (non-modifier) keys for combinations is currently 4.
Key matching
------------
mpv maintains key press history. If the current key completes one or more bound
sequences (including single-key bindings), then mpv chooses the longest. If this
sequence is bound to ``ignore``, then tracking continues as if nothing was
matched. Otherwise, it triggers the command bound to this sequence and clears
the key history.
Note that while single-key bindings override builtin bindings, this is not the
case with multi-key sequences. For example, a ``b-c`` sequence in input.conf
would be overridden by a builtin binding ``b``. In this case, if you don't care
about ``b``, you can bind it to ``ignore``.
As a more complex example, if you want to bind both ``b`` and ``a-b-c``, then it
won't work, because ``b`` would override ``a-b-c``. However, binding ``a-b`` to
``ignore`` would allow that, because after ``a-b`` the longest match ``a-b`` is
ignored, and a following ``c`` would trigger the sequence ``a-b-c`` while ``b``
alone would still work.
Key names
---------
@@ -673,6 +687,14 @@ Track Manipulation
Marks the track as suitable for the visually impaired.
<forced>
Marks the track as forced.
<default>
Marks the track as default.
<attached-picture> (only for ``video-add``)
Marks the track as an attached picture, same as ``albumart`` argument
@@ -1397,16 +1419,21 @@ Screenshot Commands
Multiple flags are available (some can be combined with ``+``):
<video>
Save the video image in its original resolution, without OSD or
subtitles. This is the default when no flag is specified, and it does
not need to be explicitly added when combined with other flags.
<scaled>
Save the video image in the current playback resolution.
<subtitles> (default)
Save the video image, in its original resolution, and with subtitles.
Save the video image with subtitles.
Some video outputs may still include the OSD in the output under certain
circumstances.
<video>
Like ``subtitles``, but typically without OSD or subtitles. The exact
behavior depends on the selected video output.
<osd>
Save the video image with OSD.
<window>
Save the contents of the mpv window. Typically scaled, with OSD and
subtitles. The exact behavior depends on the selected video output.
Save the contents of the mpv window, with OSD and subtitles.
This is an alias of ``scaled+subtitles+osd``.
<each-frame>
Take a screenshot each frame. Issue this command again to stop taking
screenshots. Note that you should disable frame-dropping when using
@@ -1414,6 +1441,9 @@ Screenshot Commands
frame was dropped. This flag can be combined with the other flags,
e.g. ``video+each-frame``.
The exact behaviors of all flags other than ``each-frame`` depend on the
selected video output.
Older mpv versions required passing ``single`` and ``each-frame`` as
second argument (and did not have flags). This syntax is still understood,
but deprecated and might be removed in the future.
@@ -1440,9 +1470,10 @@ Screenshot Commands
expansion as described in `Property Expansion`_.
``screenshot-raw [<flags> [<format>]]``
Return a screenshot in memory. This can be used only through the client
API. The MPV_FORMAT_NODE_MAP returned by this command has the ``w``, ``h``,
``stride`` fields set to obvious contents.
Return a screenshot in memory. This can be used only through the client API
or from a script using ``mp.command_native``. The MPV_FORMAT_NODE_MAP
returned by this command has the ``w``, ``h``, ``stride`` fields set to
obvious contents.
The ``format`` field is set to the format of the screenshot image data.
This can be controlled by the ``format`` argument. The format can be one of
@@ -1862,10 +1893,10 @@ Hooks
Hooks are synchronous events between player core and a script or similar. This
applies to client API (including the Lua scripting interface). Normally,
events are supposed to be asynchronous, and the hook API provides an awkward
and obscure way to handle events that require stricter coordination. There are
no API stability guarantees made. Not following the protocol exactly can make
the player freeze randomly. Basically, nobody should use this API.
events are supposed to be asynchronous, and the hook API provides a way to
handle events that require stricter coordination. Not following the protocol
exactly can make the player freeze. Use with caution, avoid if synchronous event
handling is not required.
The C API is described in the header files. The Lua API is described in the
Lua section.
@@ -2667,7 +2698,7 @@ Property list
``hwdec-current``
The current hardware decoding in use. If decoding is active, return one of
the values used by the ``hwdec`` option/property. ``no``/false indicates
the values used by the ``hwdec`` option/property. ``no`` indicates
software decoding. If no decoder is loaded, the property is unavailable.
``hwdec-interop``
@@ -2795,6 +2826,18 @@ Property list
``video-params/avg-pq-y``
Average PQ luminance of a frame, as reported by peak detection (in PQ, 0-1)
``video-params/prim-red-x``, ``video-params/prim-red-y``
Red primary chromaticity coordinates, available only if differs from ``video-params/primaries``
``video-params/prim-green-x``, ``video-params/prim-green-y``
Green primary chromaticity coordinates, available only if differs from ``video-params/primaries``
``video-params/prim-blue-x``, ``video-params/prim-blue-y``
Blue primary chromaticity coordinates, available only if differs from ``video-params/primaries``
``video-params/prim-white-x``, ``video-params/prim-white-y``
White point chromaticity coordinates, available only if differs from ``video-params/primaries``
When querying the property with the client API using ``MPV_FORMAT_NODE``,
or with Lua ``mp.get_property_native``, this will return a mpv_node with
the following contents:
@@ -2830,6 +2873,14 @@ Property list
"scene-max-b" MPV_FORMAT_DOUBLE
"max-pq-y" MPV_FORMAT_DOUBLE
"avg-pq-y" MPV_FORMAT_DOUBLE
"prim-red-x" MPV_FORMAT_DOUBLE
"prim-red-y" MPV_FORMAT_DOUBLE
"prim-green-x" MPV_FORMAT_DOUBLE
"prim-green-y" MPV_FORMAT_DOUBLE
"prim-blue-x" MPV_FORMAT_DOUBLE
"prim-blue-y" MPV_FORMAT_DOUBLE
"prim-white-x" MPV_FORMAT_DOUBLE
"prim-white-y" MPV_FORMAT_DOUBLE
``dwidth``, ``dheight``
Video display size. This is the video size after filters and aspect scaling
@@ -2916,7 +2967,7 @@ Property list
Whether the window has focus. Might not be supported by all VOs.
``ambient-light``
Ambient lighting condition in lux. (macOS only)
Ambient lighting condition in lux. Only observable on macOS (macOS and Linux only)
``display-names``
Names of the displays that the mpv window covers. On X11, these
@@ -3012,6 +3063,12 @@ Property list
Read-only - mpv's window id. May not always be available, i.e due to window
not being opened yet or not being supported by the VO.
``display-swapchain``
Read-only - Direct3D 11 swapchain address. Returns an int64 type value
representing the memory address of the D3D11 swapchain. May not always be
available, i.e d3d11-output-mode is not set to ``composition`` or the VO
does not support it.
``mouse-pos``
Read-only - last known mouse position, normalized to OSD dimensions.
@@ -3055,6 +3112,26 @@ Property list
"y" MPV_FORMAT_INT64
"id" MPV_FORMAT_INT64
``tablet-pos``
Read-only - last known tablet tool (pen) position, normalized to OSD dimensions,
and tool state.
Has the following sub-properties:
``tablet-pos/x``, ``tablet-pos/y``
Last known coordinates of the tablet tool.
``tablet-pos/tool-in-proximity``
Boolean - whether a tablet tool is currently in proximity of the tablet
surface / hovers above the tablet surface.
``tablet-pos/tool-tip``,
The state of the tablet tool tip, ``up`` or ``down.``
``tablet-pos/tool-stylus-btn1``, ``tablet-pos/tool-stylus-btn2``, ``tablet-pos/tool-stylus-btn3``
The state of tablet tool side buttons, ``pressed`` or ``released``.
``tablet-pos/pad-focus``
Boolean - whether a tablet pad is currently focused.
``tablet-pos/pad-btns/N``
The state of the Nth tablet pad button, ``pressed`` or ``released``.
``sub-ass-extradata``
The current ASS subtitle track's extradata. There is no formatting done.
The extradata is returned as a string as-is. This property is not
@@ -3969,11 +4046,42 @@ Property list
``command-list``
The list of input commands. This returns an array of maps, where each map
node represents a command. This map currently only has a single entry:
``name`` for the name of the command. (This property is supposed to be a
replacement for ``--input-cmdlist``. The option dumps some more
information, but it's a valid feature request to extend this property if
needed.)
node represents a command. This map has the following entries:
``name``
The name of the command.
``vararg``
Whether the command accepts a variable number of arguments.
``args``
An array of maps, where each map node represents an argument with the
following entries:
``name``
The name of the argument.
``type``
The name of the argument type, like ``String`` or ``Integer``.
``optional``
Whether the argument is optional.
When querying the property with the client API using ``MPV_FORMAT_NODE``,
or with Lua ``mp.get_property_native``, this will return a mpv_node with
the following contents:
::
MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP (for each command entry)
"name" MPV_FORMAT_STRING
"vararg" MPV_FORMAT_FLAG
"args" MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP
"name" MPV_FORMAT_STRING
"type" MPV_FORMAT_STRING
"optional" MPV_FORMAT_FLAG
``input-bindings``
The list of current input key bindings. This returns an array of maps,
@@ -4016,19 +4124,19 @@ Property list
This property is read-only, and change notification is not supported.
``clipboard``
The clipboard contents, only works when native clipboard
(``--clipboard-enable``) is supported on the platform.
The clipboard contents. Only works when native clipboard is supported on the
platform.
Depending on the platform, some sub-properties, writing to properties,
or change notifications are not currently functional.
This has a number of sub-properties:
``clipboard/text`` (RW)
The text content in the clipboard (Windows, Wayland and macOS only).
Writing to this property sets the text clipboard content (Windows only).
The text content in the clipboard.
Writing to this property sets the text clipboard content
``clipboard/text-primary``
The text content in the primary selection (Wayland only).
``clipboard/text-primary`` (RW)
The text content in the primary selection (X11 and Wayland only).
.. note::
+3 -2
View File
@@ -38,7 +38,7 @@ A C plugin must export the following function::
int mpv_open_cplugin(mpv_handle *handle)
The plugin function will be called on loading time. This function does not
The plugin function will be called on loading time. This function must not
return as long as your plugin is loaded (it runs in its own thread). The
``handle`` will be deallocated as soon as the plugin function returns.
@@ -52,7 +52,8 @@ behavior.
Within the plugin function, you can call libmpv API functions. The ``handle``
is created by ``mpv_create_client()`` (or actually an internal equivalent),
and belongs to you. You can call ``mpv_wait_event()`` to wait for things
happening, and so on.
happening, and so on. However do not call ``mpv_destroy()`` or
``mpv_terminate_destroy()`` on this handle.
Note that the player might block until your plugin calls ``mpv_wait_event()``
for the first time. This gives you a chance to install initial hooks etc.
+3 -3
View File
@@ -7,7 +7,6 @@ mpv provides the built-in module ``mp``, which contains functions to send
commands to the mpv core and to retrieve information about playback state, user
settings, file information, and so on.
These scripts can be used to control mpv in a similar way to slave mode.
Technically, the Lua code uses the client API internally.
Example
@@ -175,7 +174,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
as possible), and upon completion, fn is called. fn has three arguments:
``fn(success, result, error)``:
``success``
``success``
Always a Boolean and is true if the command was successful,
otherwise false.
@@ -446,7 +445,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
the property will be passed as second argument to ``fn``, using
``mp.get_property_<type>`` to retrieve it. This means if ``type`` is for
example ``string``, ``fn`` is roughly called as in
``fn(name, mp.get_property_string(name))``.
``fn(name, mp.get_property(name))``.
If possible, change events are coalesced. If a property is changed a bunch
of times in a row, only the last change triggers the change function. (The
@@ -491,6 +490,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
the timer is re-added after the function fn is run.
Returns a timer object. The timer object provides the following methods:
``stop()``
Disable the timer. Does nothing if the timer is already disabled.
This will remember the current elapsed time when stopping, so that
+6 -6
View File
@@ -161,6 +161,9 @@ O
v
Toggle subtitle visibility.
Alt+v
Toggle secondary subtitle visibility.
j and J
Cycle through the available subtitles.
@@ -399,11 +402,6 @@ Ctrl+Wheel up/down
Context Menu
-------------
.. warning::
This feature is experimental. It may not work with all VOs. A libass based
fallback may be implemented in the future.
Context Menu is a menu that pops up on the video window on user interaction
(mouse right click, etc.).
@@ -587,7 +585,7 @@ Name Meaning
``~~global/`` The global config path (such as ``/etc/mpv``), if available
(not on win32).
``~~osxbundle/`` The macOS bundle resource path (macOS only).
``~~desktop/`` The path to the desktop (win32, macOS).
``~~desktop/`` The path to the desktop.
``~~exe_dir/`` The path to the directory containing ``mpv.exe`` (for config
file purposes, ``$MPV_HOME`` will override this) (win32 only).
``~~cache/`` The path to application cache data (``~/.cache/mpv/``).
@@ -1545,6 +1543,8 @@ works like in older mpv releases:
.. include:: select.rst
.. include:: context_menu.rst
.. include:: positioning.rst
.. include:: lua.rst
+468 -59
View File
@@ -21,7 +21,7 @@ Track Selection
audio.
``--slang=<languagecode[,languagecode,...]>``
Equivalent to ``--alang``, for subtitle tracks.
Analogous to ``--alang``, for subtitle tracks.
This is a string list option. See `List Options`_ for details.
@@ -35,7 +35,7 @@ Track Selection
Portuguese subtitles if available, and otherwise any Portuguese subtitles.
``--vlang=<...>``
Equivalent to ``--alang`` and ``--slang``, for video tracks.
Analogous to ``--alang`` and ``--slang``, for video tracks.
This is a string list option. See `List Options`_ for details.
@@ -47,7 +47,6 @@ Track Selection
``--audio`` is an alias for ``--aid``.
``--aid=no`` or ``--audio=no`` disables audio playback.
(The latter variant does not work with the client API.)
.. note::
@@ -103,7 +102,6 @@ Track Selection
``--sub`` is an alias for ``--sid``.
``--sid=no`` or ``--sub=no`` disables subtitle decoding.
(The latter variant does not work with the client API.)
``--vid=<ID|auto|no>``
Select video channel. ``auto`` selects the default, ``no`` disables video.
@@ -111,7 +109,6 @@ Track Selection
``--video`` is an alias for ``--vid``.
``--vid=no`` or ``--video=no`` disables video playback.
(The latter variant does not work with the client API.)
If video is disabled, mpv will try to download the audio only if media is
streamed with youtube-dl, because it saves bandwidth. This is done by
@@ -1007,18 +1004,15 @@ Program Behavior
I have no idea.
``--ytdl-format=<ytdl|best|worst|mp4|webm|...>``
Video format/quality that is directly passed to youtube-dl. The possible
values are specific to the website and the video, for a given url the
available formats can be found with the command
``youtube-dl --list-formats URL``. See youtube-dl's documentation for
available aliases.
(Default: ``bestvideo+bestaudio/best``)
``--ytdl-format=<|ytdl|best|worst|mp4|webm|...>``
Format selection string that is directly passed to youtube-dl.
The possible values are specific to the website and the video, for a given
URL the available formats can be found with the command
``youtube-dl -F URL``. See youtube-dl's documentation for available aliases.
(Default: empty)
The ``ytdl`` value does not pass a ``--format`` option to youtube-dl at all,
and thus does not override its default. Note that sometimes youtube-dl
returns a format that mpv cannot use, and in these cases the mpv default
may work better.
An empty value or ``ytdl`` does not pass a ``--format`` option to youtube-dl
at all, and thus uses its default format selection behavior.
``--ytdl-raw-options=<key>=<value>[,<key>=<value>[,...]]``
Pass arbitrary options to youtube-dl. Parameter and argument should be
@@ -1069,6 +1063,11 @@ Program Behavior
Enable the builtin script that lets you select from lists of items (default:
yes). By default, its keybindings start with the ``g`` key.
``--load-context-menu=<yes|no>``
Enable the builtin script that implements a context menu. Defaults to
``yes`` on platforms where integration with a native context menu is not
implemented, and to ``no`` on platform where it is.
``--load-positioning=<yes|no>``
Enable the builtin script that provides various keybindings to pan videos
and images (default: yes).
@@ -1169,7 +1168,7 @@ Watch History
``--watch-history-path=<path>``
The path in which to store the watch history. Default:
``~~state/watch_history.jsonl`` (see `PATHS`_).
``~~state/watch_history.jsonl`` (see `FILES`_).
This file contains one JSON object per line. Its ``time`` field is the UNIX
timestamp when the file was opened, its ``path`` field is the normalized
@@ -1360,17 +1359,17 @@ Video
Actively supported hwdecs:
:d3d11va: requires ``--vo=gpu`` with ``--gpu-context=d3d11`` or
:d3d11va: requires ``--vo=gpu`` or ``--vo=gpu-next`` with ``--gpu-context=d3d11`` or
``--gpu-context=angle`` (Windows 8+ only)
:d3d11va-copy: copies video back to system RAM (Windows 8+ only)
:videotoolbox: requires ``--vo=gpu`` (macOS 10.8 and up),
:videotoolbox: requires ``--vo=gpu`` or ``--vo=gpu-next`` (macOS 10.8 and up),
or ``--vo=libmpv`` (iOS 9.0 and up)
:videotoolbox-copy: copies video back into system RAM (macOS 10.8 or iOS 9.0 and up)
:vaapi: requires ``--vo=gpu``, ``--vo=vaapi`` or ``--vo=dmabuf-wayland`` (Linux only)
:vaapi: requires ``--vo=gpu``, ``--vo=gpu-next``, ``--vo=vaapi`` or ``--vo=dmabuf-wayland`` (Linux only)
:vaapi-copy: copies video back into system RAM (Linux with some GPUs or Windows)
:nvdec: requires ``--vo=gpu`` (Any platform CUDA is available)
:nvdec: requires ``--vo=gpu`` or ``--vo=gpu-next`` (Any platform CUDA is available)
:nvdec-copy: copies video back to system RAM (Any platform CUDA is available)
:drm: requires ``--vo=gpu`` (Linux only)
:drm: requires ``--vo=gpu`` or ``--vo=gpu-next`` (Linux only)
:drm-copy: copies video back to system RAM (Linux only)
:vulkan: requires ``--vo=gpu-next`` (Any platform with Vulkan Video Decoding)
:vulkan-copy: copies video back to system RAM (Any platform with Vulkan Video Decoding)
@@ -1832,7 +1831,7 @@ Video
You can get the list of allowed codecs with ``mpv --vd=help``. Remove the
prefix, e.g. instead of ``lavc:h264`` use ``h264``.
By default, this is set to ``h264,vc1,hevc,vp8,vp9,av1,prores``. Note that
By default, this is set to ``h264,vc1,hevc,vp8,vp9,av1,prores,prores_raw,ffv1,dpx``. Note that
the hardware acceleration special codecs like ``h264_vdpau`` are not
relevant anymore, and in fact have been removed from FFmpeg in this form.
@@ -1851,6 +1850,15 @@ Video
``mpv --hwdec=vdpau --hwdec-codecs=h264,mpeg2video``
Enable vdpau decoding for h264 and mpeg2 only.
``--hwdec-threads=<N>``
Number of threads used for hardware decoding (default: 4). This, as opposed
to vd-queue, enables frame and slice threading in libavcodec. It can help
with pipelining the decoding process and improve performance. The exact
behavior depends on the hardware decoder API used.
If this is set to 0, the number of threads will be automatically determined
by the number of CPU cores available.
``--hwdec-software-fallback=<yes|no|N>``
Fallback to software decoding if the hardware-accelerated decoder fails
(default: 3). If this is a number, then fallback will be triggered if
@@ -1987,7 +1995,7 @@ Video
missed vsyncs, but increases visible latency. This option only mandates an
upper limit, the implementation can use a lower latency than requested
internally. A setting of 1 means that the VO will wait for every frame to
become visible before starting to render the next frame. (Default: 3)
become visible before starting to render the next frame. (Default: 2)
Audio
-----
@@ -1996,7 +2004,7 @@ Audio
If this is enabled (default), playing with a speed different from normal
automatically inserts the ``scaletempo2`` audio filter. You can insert
filters besides ``scaletempo2`` and modify their params using
`Conditional auto profiles`:
`Conditional auto profiles`_:
::
@@ -2367,7 +2375,7 @@ Audio
Use ``--help=audio-exts`` to see default extensions.
``--audio-file-paths=<path1:path2:...>``
Equivalent to ``--sub-file-paths`` option, but for auto-loaded audio files.
Analogous to ``--sub-file-paths`` option, but for auto-loaded audio files.
This is a path list option. See `List Options`_ for details.
@@ -2376,6 +2384,14 @@ Audio
if you want to force a different audio profile (e.g. with PulseAudio),
or to set your own application name when using libmpv.
``--audio-set-media-role=<yes|no>``
If enabled, mpv will set the appropriate media role on supported audio
servers to indicate whether mpv is playing a video or an audio-only file.
This is disabled by default since per media role volumes have often caused
unexpected and confusing behavior.
Default: no.
``--audio-buffer=<seconds>``
Set the audio output minimum buffer. The audio device might actually create
a larger buffer if it pleases. If the device creates a smaller buffer,
@@ -2620,6 +2636,18 @@ Subtitles
from forward to backward during runtime for events that were already
"seen" and need to be rendered again, if those events got pruned.
``--sub-glyph-limit=<value>``
Set the maximum number of cached glyphs in libass cache for the subtitle
track. 0 means libass uses its default value.
Default: 0.
``--sub-bitmap-max-size=<value>``
Set the maximum bitmap cache size in libass cache for the subtitle track. 0
means libass uses its default value. This accepts values in MB.
Default: 0.
``--sub-ass-styles=<filename>``
Load all SSA/ASS styles found in the specified file and use them for
rendering text subtitles. The syntax of the file is exactly like the ``[V4
@@ -2767,6 +2795,22 @@ Subtitles
canvas size. Can be useful to test broken subtitles, which often happen
when the video was transcoded, while attempting to keep the old subtitles.
``--image-subs-hdr-peak=<sdr|video|10-10000>``
Controls the image subtitle diffuse white level in cd/m² (nits) for HDR
output (default: sdr). ``sdr`` is 203 cd/m² for standard SDR white, while
``video`` uses video metadata. (``--vo=gpu-next`` only)
This also affects image subtitle brightness in HDR tone mapping with
``--blend-subtitles=<yes|video>``.
``--sub-hdr-peak=<sdr|10-10000>``
Controls the text subtitle and OSD diffuse white level in cd/m² (nits)
for HDR output (default: sdr). ``sdr`` is 203 cd/m² for standard SDR white.
(``--vo=gpu-next`` only)
This also affects text subtitle brightness in HDR tone mapping with
``--blend-subtitles=<yes|video>``.
``--sub-ass=<yes|no>``
Render ASS subtitles natively (default: yes).
@@ -2804,6 +2848,7 @@ Subtitles
using drag and drop.
This is a string list option. See `List Options`_ for details.
Use ``--help=sub-auto-exts`` to see default extensions.
``--sub-codepage=<codepage>``
You can use this option to specify the subtitle codepage. uchardet will be
@@ -2845,8 +2890,19 @@ Subtitles
``--sub-fix-timing=<yes|no>``
Adjust subtitle timing is to remove minor gaps or overlaps between
subtitles (if the difference is smaller than 210 ms, the gap or overlap
is removed).
subtitles.
See also: ``--sub-fix-timing-threshold`` and ``--sub-fix-timing-keep``.
``--sub-fix-timing-threshold=<amount>``
Set the threshold in milliseconds for fixing subtitle timing (default: 210).
If the gap between two subtitle events is smaller than this, the gap is
removed.
``--sub-fix-timing-keep=<amount>``
Set the minimum duration in milliseconds for subtitle events to be
considered for timing fixes (default: 400). If a subtitle event has a
duration smaller than this, its timing is not changed.
``--sub-forced-events-only=<yes|no>``
Enabling this displays only forced events within subtitle streams. Only
@@ -3136,13 +3192,13 @@ Subtitles
Default: ``no``.
``--sub-filter-sdh-enclosures=<string>``
Specify a string of characters that ``--sub-filter-sdh`` will use to potentially
remove text. Text that is enclosed within characters specified by this string will
be removed. Note that bracket characters with known pairs (such as ``(`` or ``[``)
will be mapped internally to their matching right hand character, so you only need
to specify left hand characters.
Specify pairs of characters that ``--sub-filter-sdh`` will use to
potentially remove text. This is a string list option. See `List Options`_
for details. Text that is enclosed within each specified pair will be
removed. Note that parenthesis pairs (normal and full width) are treated as
a special case and require ``--sub-fitler-sdh-harder`` to be removed.
Default: ``([(``.
Default: ``(),[],()``
``--sub-filter-regex-...=...``
Set a list of regular expressions to match on text subtitles, and remove any
@@ -3613,7 +3669,7 @@ Window
``--force-render``
Forces mpv to always render frames regardless of the visibility of the
window. Currently only affects X11 and Wayland VOs since they are the
window. Currently only affects X11, Wayland and macvk VOs since they are the
only ones that have this optimization (i.e. everything else always renders
regardless of visibility).
@@ -3685,12 +3741,15 @@ Window
environments. This functionality was removed in 0.33.0, but it is possible to
call the ``xdg-screensaver`` command line program from a user script instead.
``--wid=<ID>``
``--wid=<ID|-1>``
This tells mpv to attach to an existing window. If a VO is selected that
supports this option, it will use that window for video output. mpv will
scale the video to the size of this window, and will add black bars to
compensate if the aspect ratio of the video is different.
An ID of value ``-1`` is interpreted specially, and mpv will detach from
the currently attached window to its own window.
On X11, the ID is interpreted as a ``Window`` on X11. Unlike
MPlayer/mplayer2, mpv always creates its own window, and sets the wid
window as parent. The window will always be resized to cover the parent
@@ -3700,13 +3759,25 @@ Window
On win32, the ID is interpreted as ``HWND``. Pass it as value cast to
``uint32_t`` (all Windows handles are 32-bit), this is important as mpv will
not accept negative values. mpv will create its own window and set the
wid window as parent, like with X11.
wid window as parent, like with X11. The value ``0`` is interpreted
specially, and mpv will draw on top of the desktop wallpaper and below
desktop icons.
On Android, the ID is interpreted as ``android.view.Surface``. Pass it as a
value cast to ``intptr_t``. Use with ``--vo=mediacodec_embed`` and
``--hwdec=mediacodec`` for direct rendering using MediaCodec, or with
``--vo=gpu --gpu-context=android`` (with or without ``--hwdec=mediacodec``).
.. note::
On win32, if desktop wallpaper transition occurs (e.g. setting desktop
slideshow of multiple images in Windows settings) and an ID value ``0``
is used, Windows may sometimes destroy the window mpv is attached to.
mpv will simply treat this as a quit signal in this case.
To prevent this from happening, set a static desktop wallpaper,
such as single image or pure color.
``--window-dragging=<yes|no>``
Move the window when clicking on it and moving the mouse pointer (default: yes).
@@ -3841,6 +3912,10 @@ Disc Devices
Some DVDs contain scenes that can be viewed from multiple angles.
This option tells mpv which angle to use (default: 1).
``--bluray-angle=<ID>``
Some Blu-ray discs contain scenes that can be viewed from multiple angles.
This option tells mpv which angle to use (default: 1).
Equalizer
@@ -4231,17 +4306,17 @@ Demuxer
``--prefetch-playlist=<yes|no>``
Prefetch next playlist entry while playback of the current entry is ending
(default: yes).
This does not prefill the cache with the video data of the next URL.
Prefetching video data is supported only for the current playlist entry,
and depends on the demuxer cache settings (on by default). This merely
opens the URL of the next playlist entry as soon the current URL is fully
read.
(default: no). This merely opens the URL of the next playlist entry as soon
as the current URL is fully read.
This does **not** work with URLs resolved by the ``youtube-dl`` wrapper,
and it won't.
This does not affect HLS streams (``.m3u8`` URLs). Such stream by itself is
internally a playlist of data segments, but is treated as a single media
item by mpv. HLS prefetching depends on the demuxer cache settings and is
on by default.
This can occasionally make wrong prefetching decisions. For example, it
can't predict whether you go backwards in the playlist, and assumes you
won't edit the playlist.
@@ -4514,6 +4589,11 @@ Input
for mouse key bindings and scripts which read mouse positions for platforms
which do not support ``--native-touch=no`` (e.g. Wayland).
``--input-tablet-emulate-mouse=<yes|no>``
Emulate mouse move and button presses for tablet events (default: yes).
Wayland only.
``--input-dragging-deadzone=<N>``
Begin the built-in window dragging when the mouse moves outside a deadzone of
``N`` pixels while the mouse button is being held down (default: 3). This only
@@ -4789,6 +4869,26 @@ OSD
``--osd-fonts-dir=<path>``
See ``--sub-fonts-dir`` for details. Defaults to ``~~/fonts``.
``--osd-glyph-limit=<value>``
Set the maximum number of cached glyphs in libass cache for the OSD.
0 means libass uses its default value.
Default: 0.
``--osd-bitmap-max-size=<value>``
Set the maximum bitmap cache size in libass cache for the OSD. 0 means
libass uses its default value. This accepts values in MB.
Default: 0.
``--osd-prune-delay=<-1|seconds>``
Set the delay for automatic pruning of events from memory in libass.
Disabled by default. See also ``--sub-ass-prune-delay``.
``--osd-shaper=<simple|complex>``
Set the text layout engine used by libass for the OSD. Default: complex.
See also ``--sub-shaper``
Screenshot
----------
@@ -5570,8 +5670,11 @@ DVB
``--dvbin-file=<filename>``
Instructs mpv to read the channels list from ``<filename>``. The default is
in the mpv configuration directory (usually ``~/.config/mpv``) with the
filename ``channels.conf.{sat,ter,cbl,atsc,isdbt}`` (based on your card
type) or ``channels.conf`` as a last resort.
filename ``channels.conf.{sat,sat1,ter,ter1,cbl,atsc,isdbt}`` (based on your
card type) or ``channels.conf`` as a last resort.
For cards supporting multiple delivery systems of the same kind, i.e.
DVB-T/T2 or DVB-S/S2, T2/S2 is assumed, unless the file extension
is ``ter1`` or ``sat1``.
Please note that using specific file name with card type is recommended,
since the legacy channel format is not fully standardized
so autodetection of the delivery system may fail otherwise.
@@ -6092,6 +6195,14 @@ them.
support D3D11. While the extended GPU features will work with WARP, they
can be very slow.
``--d3d11-output-mode=<auto|window|composition>``
Use a specific output mode for creating the D3D11 swapchain. "composition"
will not create a window. If you want to use the D3D11 GPU backend in WinUI
applications, you need to set this to "composition". "window" will create
a window and use the DWM to present the video. "auto" is the same as
"window". After creating the swapchain, you can get the swapchain address
(int64 type value) by getting the ``display-swapchain`` property.
``--d3d11-feature-level=<12_1|12_0|11_1|11_0|10_1|10_0|9_3|9_2|9_1>``
Select a specific feature level when using the D3D11 GPU backend. By
default, the highest available feature level is used. This option can be
@@ -6437,6 +6548,14 @@ them.
The image, after conversion to RGB, but before
``--blend-subtitles=video`` is applied.
.. note::
With ``--vo=gpu``, ``MAIN`` and ``MAINPRESUB`` are separate shader
stages, this allows rendering overlays directly onto the pre-scaled
video stage. ``--vo=gpu-next`` does not support this feature,
and as such, the ``MAINPRESUB`` shader stage does not exist.
It is still valid to refer to this name in shaders, but it is
handled identically to ``MAIN``.
MAIN (resizable)
The main image, after conversion to RGB but before upscaling.
@@ -6834,6 +6953,13 @@ them.
Android with ``--gpu-context=android`` only.
``--d3d11-composition-size=<WxH>``
Set size of the output for d3d11 composition mode.
When use composition mode, there is no window, must set the output size by
the embedding application.
Windows with ``--gpu-context=d3d11`` and ``--d3d11-output-mode=composition`` only.
``--gpu-sw``
Continue even if a software renderer is detected. This only works with
OpenGL/Vulkan backends. For d3d11, see ``--d3d11-warp``.
@@ -6961,11 +7087,117 @@ them.
image's native colorspace and output normalized non-linear RGB.
``--target-colorspace-hint=<auto|yes|no>``
Automatically configure the output colorspace of the display to pass
through the input values of the stream (e.g. for HDR passthrough), if
possible. In ``auto`` mode, the target colorspace is only set,
if the display signals support for HDR colorspace.
Requires a supporting driver and ``--vo=gpu-next``. (Default: ``no``)
When enabled, output colorspace metadata will be set on the swapchain
depending on the GPU context and platform this may affect compositor/display.
This can be used for "HDR passthrough" and to set the output colorspace
for SDR content. In ``auto`` mode, the target colorspace is only set if the
current display parameters are known. Currently, this is supported on
Wayland, D3D11 and winvk contexts. The ``yes`` option will always try to set
the colorspace, you may need to adjust the ``--target-*`` options to match
your display capabilities.
Requires a supporting driver and ``--vo=gpu-next``. (Default: ``auto``)
.. note::
Auto detected target colorspace metadata is not guaranteed to be always
best choice. It depends on your compositor, driver, and display
capabilities. However in most cases ``auto`` mode should work fine.
``--target-colorspace-hint-mode=<target|source|source-dynamic>``
Select which metadata to use for the ``--target-colorspace-hint``.
(Only for ``--vo=gpu-next``)
target
Uses metadata based on the target display's actual capabilities. This
mode adapts the source content to the target display before output.
Note: HDR primaries are not overridden by the ``--target-prim`` option
this only affects the enclosing container for the colorspace.
``--target-gamut`` can be used to limit the output gamut if needed.
source
Uses the source content's metadata. This is the traditional
"HDR passthrough" mode (SDR too), where it is assumed that the compositor
and display will handle the colorspace directly and perform any necessary
mappings.
source-dynamic
The same as ``source``, but uses dynamic per-scene metadata instead of
static HDR10. This is experimental and depends on the display's ability
to react to metadata changes. Note that this does not send full HDR10+
or Dolby Vision metadata, but uses that information to produce HDR10
with per-scene luminance values.
Default is ``target``. If target display parameters are not available, this
will fall back to ``source``. Note that this is done on individual properties
basis, i.e. it will merge source params into target for unknown properties,
though not the other way around.
``--target-*`` options override the metadata in both modes.
.. note::
The ICC profile always takes precedence over any metadata.
.. note::
It is highly recommended to use ``--target-colorspace-hint=<auto|yes>``
to ensure the output colorspace is set correctly. This is crucial for
all non-sRGB content, even SDR, to allow the compositor, driver, and
display to properly interpret the signal.
Unfortunately, it's not as easy as it sounds. While mpv performs
high-quality color processing, we cannot guarantee what will happen
after the signal leaves mpv. Therefore, you may need to adjust additional
settings to ensure proper output. A one-size-fits-all default is not
feasible.
Now with the backstory out of the way:
For HDR output the default of ``target`` should work fine, it will
automatically infer the best target HDR parameters and surface format.
For compatibility, displays are assumed to be in HDR mode, unless it's
reported otherwise. (you can override this with ``--target-trc``).
This way the HDR metadata is set and hopefully the compositor will
handle the rest. If the input is SDR, it will be converted to PQ with
primaries set to source values.
For SDR output, for targets where mpv cannot determine whether the target
is HDR or SDR, you can use ``source`` mode. Metadata set will match the
input colorspace. In case of HDR input, it will be passthrough as-is.
Alternatively, you can use ``target`` mode and set ``--target-trc`` to
a SDR transfer function. This way any input will be converted to SDR.
Use the stats display to verify the input and output colorspace settings.
TL;DR: Use ``--target-colorspace-hint=auto`` and adjust ``--target-*``
parameters to match your target display capabilities, until it looks best
for you. Use `Conditional auto profiles`_ for specific adjustments. Avoid
using ``--target-colorspace-hint=no`` unless it's sRGB content, but even
then it's better to set the colorspace metadata.
.. note::
Additional chatter about the "HDR passthrough" mode: There is a belief
that this mode should send the source HDR signal as-is to the display,
and the display will magically handle it, no matter what. This is not
always true. In some cases it is better to send the HDR signal
tone-mapped to the target display's capabilities, and the best way to do
this is within mpv itself.
This is generally handled by either the compositor or the GPU driver.
You can probably find HDR "calibration" options somewhere in your system.
You can choose which metadata to send to the display and manually tweak
it using the ``--target-*`` options. You can also try
``--inverse-tone-mapping`` if you want to make everything appear more
HDR-like.
Your mileage may vary, this highly depends on the target display, there
is no single answer, but try experimenting, you may be surprised.
``--target-colorspace-hint-strict``
When enabled (default), the configured swapchain colorspace (with the hint)
will be respected. In this mode, the ``--target-*`` options act only as a
hint, while the negotiated swapchain format is used for rendering output.
This ensures correct results, since downstream processing depends on the
signaled colorspace. When disabled, the swapchain colorspace will be
overridden to match the ``--target-*`` options. (Only for ``--vo=gpu-next``)
``--target-prim=<value>``
Specifies the primaries of the display. Video colors will be adapted to
@@ -6996,6 +7228,8 @@ them.
CIE 1931 RGB (not to be confused with CIE XYZ)
dci-p3
DCI-P3 (Digital Cinema Colorspace), SMPTE RP431-2
display-p3
DCI-P3 with a D65 white point
v-gamut
Panasonic V-Gamut (VARICAM) primaries
s-gamut
@@ -7100,12 +7334,71 @@ them.
the gamut you want to limit colors to. Takes the same values as
``--target-prim``. (Only for ``--vo=gpu-next``)
.. note::
If the selected gamut is wider, it will be limited to ``--target-prim``.
Additionally, if ``--target-colorspace-hint`` is specified, the signaled
gamut will be limited to the supported gamut of the swapchain. Which may
differ from the requested ``--target-prim``.
``--target-lut=<file>``
Specifies a custom LUT file (in Adobe .cube format) to apply to the colors
before display on-screen. This LUT is fed values in normalized RGB, after
encoding into the target colorspace, so after the application of
``--target-trc``. (Only for ``--vo=gpu-next``)
``--hdr-reference-white=<auto|10-1000000>``
Specifies the assumed peak brightness of the mastering display for SDR
content, in cd/m² (nits). This is used as HDR diffuse white level for SDR
content. Essentially this is the SDR brightness in HDR container.
Default is 203 cd/m². (Only for ``--vo=gpu-next``)
.. note::
This option overrides the ``--target-peak`` if is set and the target
transfer function is SDR. This way you can control SDR output separately
from HDR output.
``--sdr-adjust-gamma=<auto|yes|no>``
SDR transfer functions are often ambiguous or mismatched. Even if files are
tagged with a specific function (e.g. ``bt.709``), the actual content may
not match. For example, most screen capture software tags its output as
``bt.709``, but the content is usually a direct sRGB capture.
On the target side, "sRGB" is also ambiguous, some displays are factory
calibrated to a pure power 2.2 gamma, while others may use the sRGB
piecewise curve. Both of which are typically configured as "sRGB" in the
swapchain configuration. Similar inconsistencies exist across compositor
implementations of color management, as different platforms handle this in
different ways. See also ``--treat-srgb-as-power22``.
Additionally, ``bt.1886`` requires display contrast ratio to be known for
correct rendering, which is often unavailable. Use``--target-contrast`` to
specify it.
This option controls whether SDR content should have its gamma adjusted.
It only applies to the "sRGB" swapchain target configuration, since that is
the most common and ambiguous case. If set to ``no``, content tagged as
``sRGB``, ``gamma2.2`` or ``bt.1886`` will be rendered as-is. If set to
``yes``, it will be converted based on the available metadata.
``auto`` (default) behaves like ``no``, except when ``--target-trc`` is
explicitly set, in which case it behaves like ``yes``.
Generally it's recommended to enable this option, if you can ensure that
both source and target metadata is correct.
(Only for ``--vo=gpu-next``)
``--treat-srgb-as-power22=<no|input|output|both|auto>``
When enabled, sRGB is (de)linearized using a pure power 2.2 curve instead of
the standard sRGB piecewise transfer function.
``auto`` behaves like ``both``, with possible platform-specific adjustments
to ensure a consistent appearance. Depending on the platform, the sRGB EOTF
used by the system compositor may differ.
The default is ``auto``. (Only for ``--vo=gpu-next``)
``--tone-mapping=<value>``
Specifies the algorithm used for tone-mapping images onto the target
display. This is relevant for both HDR->SDR conversion as well as gamut
@@ -7194,8 +7487,10 @@ them.
Specifies the contrast (slope) at the knee point. Defaults to 1.0.
``--inverse-tone-mapping``
If set, allows inverse tone mapping (expanding SDR to HDR). Not supported
by all tone mapping curves. Use with caution. (``--vo=gpu-next`` only)
If set, allows inverse tone mapping (expanding dynamic range). Can be used
for upscaling SDR content to HDR, or for making HDR content brighter.
Not supported by all tone mapping curves. Use with caution.
(``--vo=gpu-next`` only)
``--tone-mapping-max-boost=<1.0..10.0>``
Upper limit for how much the tone mapping algorithm is allowed to boost
@@ -7427,6 +7722,19 @@ them.
If ``video`` is selected, the behavior is similar to ``yes``, but subs are
drawn at the video's native resolution, and scaled along with the video.
.. note:: ``--vo=gpu-next`` with ``--blend-subtitles=video`` will
correctly follow ``--video-rotate`` if rotated in 90-degree steps.
.. warning:: With ``--vo=gpu-next``, the ``--blend-subtitles=video`` mode
blends the subtitles after scaling the video, similar to
``--blend-subtitles=yes``. The difference is that the subtitles
are rendered at the video's native resolution and then scaled
separately to blend with the video. This is useful for
performance reasons, as it allows subtitles to be rendered at a
lower resolution, but it does not have the same effect as
hardsubbing, which would require blending before scaling. This
may change in the future.
.. warning:: This changes the way subtitle colors are handled. Normally,
subtitle colors are assumed to be in sRGB and color managed as
such. Enabling this makes them treated as being in the video's
@@ -7442,7 +7750,10 @@ them.
Blend the frame against the background color (``--background-color``,
normally black).
tiles
Blend the frame against a 16x16 gray/white tiles background (default).
Blend the frame against a checkerboard pattern with colors specified
in the ``--background-tile-color-0`` and ``--background-tile-color-1``
options and tile size specified in the ``--background-tile-size`` option
(default).
none
Do not blend the frame and leave the alpha as is.
@@ -7453,13 +7764,26 @@ them.
Use that instead.
``--background-color=<color>``
Color used to draw parts of the mpv window not covered by video. See the
``--sub-color`` option for how colors are defined.
Color used to draw parts of the mpv window not covered by video in
``--background=color`` mode.
See the ``--sub-color`` option for how colors are defined.
``--border-background=<none|color|tiles>``
``--background-tile-color-0=<color>``, ``--background-tile-color-1=<color>``
Colors used to draw parts of the mpv window not covered by video in
``--background=tiles`` mode.
See the ``--sub-color`` option for how colors are defined.
``--background-tile-size=<1-4096>``
Tile size used to draw parts of the mpv window not covered by video in
``--background=tiles`` mode (default: 16).
``--border-background=<none|color|tiles|blur>``
Same as ``--background`` but only applies to the black bar/border area of
the window. ``vo=gpu-next`` only. Defaults to ``color``.
``--background-blur-radius=<radius>``
The blur radius (in pixels) to use for ``--border-background=blur``
``--opengl-rectangle-textures``
Force use of rectangle textures (default: no). Normally this shouldn't have
any advantages over normal textures. Note that hardware decoding overrides
@@ -7748,6 +8072,11 @@ Miscellaneous
``--media-controls=<yes|no>``
(Windows only)
Enable integration of media control interface SystemMediaTransportControls.
Windows may display "Unknown app" or show a missing mpv icon in the media
control panel. To fully support it, you need to register mpv using the
``--register`` command.
Default: yes (except for libmpv)
``--force-media-title=<string>``
@@ -7968,6 +8297,10 @@ Miscellaneous
``mac``
macOS backend.
``x11``
X11 backend. This backend is only available if the X server
supports the ``Xfixes`` extension.
``wayland``
Wayland backend. This backend is only available if the compositor
supports the ``ext-data-control-v1`` protocol.
@@ -7981,8 +8314,6 @@ Miscellaneous
This is an object settings list option. See `List Options`_ for details.
``--clipboard-monitor=<yes|no>``
(Windows, Wayland and macOS only)
Enable clipboard monitoring so that the ``clipboard`` property can be
observed for content changes (default: no). This only affects clipboard
implementations which use polling to monitor clipboard updates.
@@ -7992,3 +8323,81 @@ Miscellaneous
On Wayland, this option only has effect on the ``wayland`` backend, and
not for the ``vo`` backend. See ``current-clipboard-backend`` property for
more details.
``--clipboard-xwayland=<yes|no>``
Enable X11 clipboard backend in suspected Wayland environments
(default: no).
Depending on the Wayland compositor, using X11 backend may result in mpv
unable to acquire clipboard data from native Wayland clients. Disabling the
X11 backend when Wayland backend is unavailable makes mpv fallback to the
VO backend which allows clipboard to work properly.
``--register``
(Windows only) (available also as mpv-register helper)
Registers mpv as a media player on Windows. This includes adding registry
entries to associate mpv with media files and protocols, as well as enabling
autoplay handlers for Blu-ray, DVD, and CD-Audio.
Note that the registration is done in-place, so the current mpv.exe path will
be used. If you move mpv after registering it, you can re-run this command to
update the registry entries. You can also ``--unregister`` at any time and
using any mpv binary that supports this command, it doesn't have to be
specifically the one that was used to register it.
When using this option, mpv will exit after completing the process.
To see a detailed list of operations, run mpv with the ``-v`` option.
The list of the file extensions to register, can be controlled with the
``--video-exts``, ``--audio-exts``, ``--image-exts``, ``--playlist-exts``
and ``--archive-exts`` options.
By default, mpv will be registered for the current user. To register it for
all users, run mpv as an administrator with this option. However, this is
not recommended, as registering it per user is generally preferable.
You can unregister mpv from the Windows Settings or by running mpv with the
``--unregister`` option.
``--register-rpath=<string>``
(Windows only)
When registering with ``--register``, this option allows you to specify the
path(s) to prepend so that mpv can find the necessary DLLs. The specified
string will be prepended to the runtime PATH whenever mpv is executed.
This is useful for setting up paths to external libraries required by mpv
without adding them to the global PATH environment variable.
The format of the string follows the same structure as the PATH environment
variable, a semicolon-separated list of paths.
.. note::
This sets the ``App Paths`` for mpv in the Windows registry, which
Windows Shell uses to locate the executable and its dependencies. As a
result, mpv can be launched seamlessly in most cases, but not in every
scenario. Notably, running mpv from the command line does not use
`ShellExecute` under the hood, it uses `CreateProcess`, which does not
handle the ``App Paths`` registry key.
To work around this, you can create a small wrapper PowerShell script that
runs ``Start-Process <mpv path>`` and all will work as expected.
``--unregister``
(Windows only) (available also as mpv-unregister helper)
Unregisters mpv as a media player on Windows, undoing all changes made by
the ``--register`` option. This will not remove mpv binary itself.
You can use any mpv binary that supports this command, to unregister, doesn't
have to be specifically the one that was used to register it.
Windows Settings Application entry is tied to the mpv.exe path. If you
remove the binary, it will not work. However, you can still unregister it
using this command, register it in a new location, or restore mpv to its
original location.
If mpv was previously registered for all users, run this command as an
administrator to remove it for all users.
+13 -11
View File
@@ -603,20 +603,22 @@ Custom Buttons
Additional script-opts are available to define custom buttons in ``bottombar``
and ``topbar`` layouts.
.. admonition:: Example to add loop and shuffle buttons
.. admonition:: Example to add loop, shuffle and speed buttons
custom_button_1_content=🔁
custom_button_1_mbtn_left_command=cycle-values loop-file inf no
custom_button_1_mbtn_right_command=cycle-values loop-playlist inf no
::
custom_button_2_content=🔀
custom_button_2_mbtn_left_command=playlist-shuffle
custom_button_1_content=🔁
custom_button_1_mbtn_left_command=cycle-values loop-file inf no
custom_button_1_mbtn_right_command=cycle-values loop-playlist inf no
custom_button_3_content=⏱
custom_button_3_mbtn_left_command=add speed 1
custom_button_3_mbtn_right_command=set speed 1
custom_button_3_wheel_up_command=add speed 0.25
custom_button_3_wheel_down_command=add speed -0.25
custom_button_2_content=🔀
custom_button_2_mbtn_left_command=playlist-shuffle
custom_button_3_content=⏱
custom_button_3_mbtn_left_command=add speed 1
custom_button_3_mbtn_right_command=set speed 1
custom_button_3_wheel_up_command=add speed 0.25
custom_button_3_wheel_down_command=add speed -0.25
Script Commands
~~~~~~~~~~~~~~~
+27 -8
View File
@@ -10,18 +10,17 @@ console and do operations on the selected item. It can be disabled using the
Key bindings
------------
When using ``mp.input.select``, typing printable characters does a fuzzy search
of the presented items, and key bindings listed in `CONSOLE`_ are extended with
the following:
When using ``mp.input.select``, the key bindings listed in `CONSOLE`_ are
extended with the following:
ENTER, Ctrl+j and Ctrl+m
Confirm the selection of the highlighted item.
Select the focused item.
UP and Ctrl+p
Select the item above, or the last one when the first item is selected.
Focus the item above, or the last one when the first item is selected.
DOWN and Ctrl+n
Select the item below, or the first one when the last item is selected.
Focus the item below, or the first one when the last item is selected.
PGUP and Ctrl+b
Scroll up one page.
@@ -29,9 +28,12 @@ PGUP and Ctrl+b
PGDN and Ctrl+f
Scroll down one page.
Ctrl+y
Copy the focused item to the clipboard.
MBTN_LEFT
Confirm the selection of the highlighted item, or close the console if
clicking outside of the menu rectangle.
Select the item under the cursor, or close the console if clicking outside
of the menu rectangle.
WHEEL_UP
Scroll up.
@@ -39,6 +41,12 @@ WHEEL_UP
WHEEL_DOWN
Scroll down.
Typing printable characters does a fuzzy search of the presented items.
If the query starts with ``'``, only exact matches are filtered. You can also
specify multiple search terms delimited by spaces, and only items matching all
terms are filtered.
Script bindings
---------------
@@ -119,6 +127,17 @@ Available script bindings are:
print its value on the OSD, which is useful for long values that get
clipped.
``edit-config-file``
Open ``mpv.conf`` in the system text editor, creating it if it doesn't
already exist.
``edit-input-conf``
Open ``input.conf`` in the system text editor, creating it if it doesn't
already exist.
``open-docs``
Open mpv's online documentation in the browser.
``menu``
Show a menu with miscellaneous entries.
+9 -3
View File
@@ -121,17 +121,23 @@ Configurable Options
Whether to clip lines to the terminal width.
``plot_perfdata``
Default: yes
Default: no
Show graphs for performance data (page 2).
``plot_vsync_ratio``
Default: yes
Default: no
``plot_vsync_jitter``
Default: yes
Default: no
Show graphs for vsync and jitter values (page 1). Only when toggled.
``plot_cache``
Default: yes
Show graphs for cache values (page 3). Only when toggled.
``plot_tonemapping_lut``
Default: no
+27 -4
View File
@@ -261,15 +261,15 @@ Available mpv-only filters are:
:dci-p3: DCI-P3 (Digital Cinema)
:v-gamut: Panasonic V-Gamut primaries
``<gamma>``
Gamma function the source file was encoded with. Normally this should be set
``<transfer>`` or ``<gamma>``
Transfer function the source file was encoded with. Normally this should be set
in the file header, but when playing broken or mistagged files this can be
used to override the setting.
This option only affects video output drivers that perform color management.
If this option is set to ``auto`` (which is the default), the gamma will
be set to BT.1886 for YCbCr content, sRGB for RGB content and Linear for
be set to BT.1886 for YCbCr content, sRGB for RGB content and st428 for
XYZ content.
Available gamma functions are:
@@ -290,6 +290,7 @@ Available mpv-only filters are:
:v-log: Panasonic V-Log transfer curve
:s-log1: Sony S-Log1 transfer curve
:s-log2: Sony S-Log2 transfer curve
:st428: Digital Cinema Distribution Master (XYZ)
``<sig-peak>``
Reference peak illumination for the video file, relative to the
@@ -322,6 +323,27 @@ Available mpv-only filters are:
Whether or not to include HDR10+ metadata (default: yes). If
disabled, any HDR10+ metadata will be stripped from frames.
``<min-luma>``
Set the minimum luminance value for the mastering display metadata.
This is a float value in nits (cd/m²).
.. note::
0.0 means undefined, which is the default. To set 0.0 as actual value,
use a very small value like 1e-6.
``<max-luma>``
Set the maximum luminance value for the mastering display metadata.
This is a float value in nits (cd/m²).
``<max_cll>``
Set the maximum content light level for the mastering display
metadata. This is a float value in nits (cd/m²).
``<max_fall>``
Set the maximum frame-average light level for the mastering
display metadata. This is a float value in nits (cd/m²).
``<film-grain=yes|no>``
Whether or not to include film grain metadata (default: yes). If
disabled, any film grain metadata will be stripped from frames.
@@ -357,13 +379,14 @@ Available mpv-only filters are:
Force a specific scaler backend, if applicable. This is a debug option
and could go away any time.
``<alpha=auto|straight|premul>``
``<alpha=auto|straight|premul|none>``
Set the kind of alpha the video uses. Undefined effect if the image
format has no alpha channel (could be ignored or cause an error,
depending on how mpv internals evolve). Setting this may or may not
cause downstream image processing to treat alpha differently, depending
on support. With ``convert`` and zimg used, this will convert the alpha.
libswscale and other FFmpeg components completely ignore this.
``none`` is available only starting from libplacebo vN.344.0.
``lavfi=graph[:sws-flags[:o=opts]]``
Filter video using FFmpeg's libavfilter.
+21 -13
View File
@@ -16,8 +16,8 @@ This is an object settings list option. See `List Options`_ for details.
See ``--vo=help`` for a list of compiled-in video output drivers.
The recommended output driver is ``--vo=gpu``, which is the default. All
other drivers are for compatibility or special purposes. If the default
The recommended output driver is ``--vo=gpu-next``, which is the default.
All other drivers are for compatibility or special purposes. If the default
does not work, it will fallback to other drivers (in the same order as
listed by ``--vo=help``).
@@ -27,6 +27,17 @@ This is an object settings list option. See `List Options`_ for details.
Available video output drivers are:
``gpu-next``
Video renderer based on ``libplacebo``. This supports almost the same set
of features as ``--vo=gpu``. See `GPU renderer options`_ for a list.
Should generally be faster and higher quality, while also implementing some
features specific to ``gpu-next``, but some features may be intentionally
omitted or there may be functional differences to ``--vo=gpu``.
See here for a list of known differences:
https://github.com/mpv-player/mpv/wiki/GPU-Next-vs-GPU
``gpu``
General purpose, customizable, GPU-accelerated video output driver. It
supports extended scaling methods, dithering, color management, custom
@@ -57,17 +68,6 @@ Available video output drivers are:
with ``rgb32f``. If you have problems, you can also try enabling the
``--gpu-dumb-mode=yes`` option.
``gpu-next``
Experimental video renderer based on ``libplacebo``. This supports almost
the same set of features as ``--vo=gpu``. See `GPU renderer options`_ for a
list.
Should generally be faster and higher quality, but some features may still
be missing or misbehave. Expect (and report!) bugs. See here for a list of
known differences and bugs:
https://github.com/mpv-player/mpv/wiki/GPU-Next-vs-GPU
``xv`` (X11 only)
Uses the XVideo extension to enable hardware-accelerated display. This is
the most compatible VO on X, but may be low-quality, and has issues with
@@ -455,6 +455,14 @@ Available video output drivers are:
This option is not implemented on Windows.
``--vo-kitty-auto-multiplexer-passthrough=<yes|no>`` (default: no)
Automatically detect terminal multiplexer to passthrough escape
sequences. This allows the image protocol to work in multiplexers that
might not support the kitty image protocol by passing through the
escape sequences directly to the terminal.
Currently only supports tmux and GNU screen.
``sixel``
Graphical output for the terminal, using sixels. Tested with ``mlterm`` and
``xterm``.
+8 -8
View File
@@ -1,7 +1,7 @@
Release Policy
==============
Once or twice a year, a new release is cut off of the master branch and
A few times a year, a new release is cut off of the master branch and
assigned a 0.X.Y version number, where X is incremented each time a release
contains breaking changes, such as changed options or added/removed features,
and Y is incremented if a release contains only bugfixes and other minor
@@ -30,9 +30,9 @@ While on master:
number if necessary)
- Run `TOOLS/gen-interface-changes.py` to refresh `DOCS/interface-changes.rst`,
edit manually as necessary.
and edit manually as necessary.
- Delete all `.txt` files in the `DOCS/interface-changes` directory except for `example.txt`.
- Delete all `.txt` files in `DOCS/interface-changes/` except for `example.txt`.
- Create signed commit with changes.
@@ -41,11 +41,11 @@ While on master:
- Push release branch (`release/0.X`) and tag to GitHub.
- Create a new GitHub release using the content of `RELEASE_NOTES` related to
the new version.
the new version. Check the "Create a discussion for this release" box.
- Re-add -UNKNOWN suffix to version in `MPV_VERSION` file.
- Re-add -UNKNOWN suffix to version in `MPV_VERSION` file and commit.
If necessary (to e.g. exclude commits already on master), the release can
If necessary (e.g. to exclude commits already on master), the release can
be done on a branch with different commit history. The release branch **must**
then be merged to master so `git describe` will pick up the tag.
@@ -55,7 +55,7 @@ This does not apply to patch releases, which are tagged directly on the
Release notes template
----------------------
Here is a template that can be used for writing the `RELEASE_NOTES` file:
Here is a template that should be used for writing the `RELEASE_NOTES` file:
```markdown
Release 0.X.Y
@@ -127,7 +127,7 @@ When creating a new point release its changes should be added on top of the
the current 0.X branch will be included. This way the `RELEASE_NOTES` file
can be used by distributors as changelog for point releases too.
The changelog of lists all changes since the last release, including those
The changelog lists all changes since the last release, including those
that have been backported to patch releases already. Except for the
"Key highlights" section they are ordered chronologically with older commits
at the top.
+1 -1
View File
@@ -1 +1 @@
0.40.0
0.41.0
+104 -98
View File
@@ -1,22 +1,20 @@
Release 0.40.0
Release 0.41.0
==============
We are excited to announce the release of mpv 0.40.0.
We are excited to announce the release of mpv 0.41.0.
Key highlights:
* Console: Enhanced autocompletion and visual styling
* OSC: New selection menu accessible by right-clicking common buttons
* HDR is now natively supported when using direct rendering (DRM),
as well as dmabuf-wayland on Linux
* Native clipboard access for scripts via new `clipboard` property
* New command menu, with common actions easily accessible
* Enhanced select.lua with new selection options for watch history, editions, DVD/Blu-Ray titles
* New positioning.lua script script for cursor-centric zooming and drag to pan
* Better stream support for Blu-ray, DVD and CDDA
* Track selection improvements and better metadata display
* Added osd-box / sub-box / box profiles to easily enable box styled OSD/OSC
* Windows support in umpv helper script
* The libplacebo based `gpu-next` is now the default, over `gpu`
* Vulkan hardware decoding is preferred over other APIs
* New context_menu.lua script for right-click context menus
* AAudio backend for modern, HNI-free audio output on Android
* Improved default color management for gpu-next, and handling on Wayland
* Color representation protocol support for Wayland
* Tablet input support for Wayland
* Clipboard writing support for Wayland and a clipboard backend for X11
* Ambient light support on Linux (using sysfs ALS)
* Built-in helpers to register mpv as a media app on Windows
This release requires FFmpeg 6.1 or newer and libplacebo 6.338.2 or newer.
@@ -24,110 +22,118 @@ This release requires FFmpeg 6.1 or newer and libplacebo 6.338.2 or newer.
## New
- vf_d3d11vpp: add NVIDIA RTX Video HDR support
- context_drm_gl: add support for HDR metadata
- positioning.lua: add new script for video alignment and zooming
- umpv: add Windows support
- command: add clipboard property with native backends for Windows, macOS, and Wayland
- select.lua: add watch history, edition, DVD/Blu-Ray titles and more selection options
- input.conf: add cursor-centric zoom and drag-to-pan bindings
- wayland: add support for wp-color-management-v1 protocol
- console.lua: add persistent command history
- stats.lua: add timecode display
- options: add --playlist-exts and --archive-exts
- wayland_common: support IME usage via text-input-v3
- command: add multiple track metadata and properties
- vo_gpu_next: add chroma location and HDR metadata to shader parameters
- player/screenshot: support more formats for screenshot-raw command
- demux_mkv: add `--demuxer-mkv-crop-compat` option
- misc/language: parse hi/sdh/cc tags from external subtitle tracks
- wayland: support xdg-activation
- player: add mpv:// protocol
- clipboard-wayland: support clipboard writing
- wayland: add support for wp-color-representation-v1
- wayland: tablet input support
- vo_gpu_next: add support for blend-subtitles=video
- meson: add mpv-register and mpv-unregister helpers on Windows
- context_menu.lua: add this script
- select.lua: add edit-config-file and edit-input-conf
- osc.lua: add indicator for buffering/loading
- osdep/linux-als: support 'ambient-light' property on Linux
- clipboard-x11: add x11 clipboard backend
- ao/aaudio: implement native AAudio backend for Android
## Changed
- meson: build libmpv by default
- command: enhance track and playlist display information
- input.conf: improve numpad key bindings
- osc.lua: add custom buttons support and improved mouse bindings
- console.lua: inherit OSD styles and colors
- options: default to --prefetch-playlist=yes
- osc.lua: add slimbottombar and slimtopbar layouts
- command: improve frame-step to go through multiple frames
- wayland: use wp-presentation v2 if available
- various: reorganize options into more logical groups
- vo_gpu_next: improve target colorspace handling
- options: disable `--input-ime` by default (enabled on demand)
- vd_lavc: prefer Vulkan hwdec when available
- vd_lavc: prefer non-copy hwdec before falling back to -copy variant
- vo: move vo_mediacodec_embed to not be the default on Android
- sub/osd_libass: don't rerender OSD if not changed
- vo: prefer vo_gpu_next over vo_gpu by default
- vo_gpu_next: respect ICC profile color space over any metadata
- vo_gpu_next: linearize sRGB as a pure 2.2 power function
- meson: warn if building with SDL2 due to known problems
- osxbundle: make bundle category configurable and default to video
- ao_pipewire: avoid setting any media.role by default
# Options and Commands
## Added
- sd_ass: introduce sub-ass-prune-delay
- player: add an optional mute flag when framestepping
- command: add clipboard/text-primary property
- command: add current-clipboard-backend property
- command: add notify-property command
- options: add --script-opt alias for --script-opts-append
- options: add --osd-bar-marker-{size,style} options
- options: add --input-ime for improved text input
- options: add --video-recenter
- options: add --clipboard-backends
- options: add --wayland-internal-vsync
- options: add --sub-scale-signs
- sub: add control for libass caching options (glyph-limit, bitmap-max-size)
- vo: add options to control background tile appearance (transparency)
- command: add default and forced flags to the track add commands
- vo_gpu_next: add options to control subtitle peak for HDR output
- video/out/d3d11: add d3d11 composition mode support
- vd_lavc: add --hwdec-threads
- stream_bluray: add --bluray-angle
- vo_gpu_next: add options to control output colorspace metadata more precisely
- sub: make --sub-fix-timing configurable
- vo_gpu_next: add --hdr-reference-white
- audio/out: add --audio-set-media-role
## Changed
- options: rename --load-osd-console to --load-console
- player: improve track selection for multi-component languages
- options: improve frame-step command to handle multiple frames
- input.conf: make Alt+BS reset --video-align-{x,y}
- command: print track metadata when changing track
- command: print track-list with enhanced metadata
## Deprecated
- options: deprecate `--gamma-auto` (use gamma-auto.lua script instead)
- options: deprecate undocumented --cdda-span-{a,b} options
- options: revert --prefetch-playlist default back to 'no'
- vo_gpu_next: change --target-colorspace-hint to 'auto' by default
- options: handle runtime --wid change
- options: reduce swapchain-depth to 2 by default
- screenshot: add osd and scaled flags to screenshot commands
# Fixes and Minor Enhancements
- f_hwtransfer: ensure that we convert to full range rgb with scale_vaapi
- win32: fix window size restore after maximize state
- build: fix dynamic generation of mpv.desktop file protocols
- player/sub: avoid pointlessly redecoding subs
- x11: remove nvidia blacklist logic from --x11-present=auto
- osc.lua: seek to the nearest chapter when right clicking the seekbar
- command: fix keybind command with sequence keys
- video/out/wayland_common: fix crash with multi-seat drag and drop
- demux: reclaim demux_packets to reduce memory allocator pressure
- demux_cue: only accept TRACK with AUDIO type
- player/loadfile: strip common filename part from external track title
- build: remove unused dvdread dependency
- wayland: fix vertical resizing and scaling issues
- console.lua: improve completion and visual appearance
- sub/osd: default to a semitransparent black back color
- player: improve playlist handling with prefetch
- drm: parse EDID using libdisplay-info (which is now a required dependency)
- win32: fix window size restore after maximize state
- hwdec_d3d11va: align image mapper dimensions to a multiple of 2
- wayland: fix DnD with focus follow mouse
- player: store external filenames as normalized
- player: properly handle secondary subtitles on the terminal
- demux_mkv: add support for chroma location
- vo_dmabuf_wayland: improve and fix format selection
- player: fix combination of --loop-playlist + --shuffle + --prefetch-playlist
- vo_kitty: add auto-multiplexer-passthrough option
- vd_lavc: enable FFv1 hwaccel by default
- clipboard-wayland: prevent reading from hung up fd
- demux_mkv: fix compilation after deprecated definitions removal
- filters: handle flipping video if displaymatrix indicates so
- player/scripting: fix race condition when destroying clients
- {osd,msg}: use PU codepoints for escape codes instead of invalid UTF-8
- vo_dmabuf_wayland: only load needed hardware decoding drivers
- video/image_writer: tag accurate bit depth
- demux_lavf: fix unconstrained cache size with wrapped AVFrame packets
- libarchive: fix reading name of certain UTF-8 files
- sub/sd_lavc: fix decoding with libaribb24
- ao_avfoundation: fix memory leak
- osc.lua: fix volume icon not updating while paused
- context_wayland: implement target_csp for wayland
- vo_gpu: fix target colorspace for redrawn frames
- vo_dmabuf_wayland: don't set HDR metadata on SDR transfers
- vo_gpu_next: don't do partial updates on hint luminance
- sub/ass_mp: add missing padding for ass packer
- stream_dvb: allow to enforce DVB-S/T for old zap format channels.conf
- demux_libarchive: fix reading archives with '%' in stream URL path
- vo_gpu_next: allow UINT upload if no other format is supported
- ytdl_hook.lua: fix incorrect default format used with yt-dlp
- vo_gpu_next: allow unsetting LUTs
- stream_bluray: use bd_get_main_title() to get main title
- vo_gpu_next: when tone-mapping, set better maxCLL value
- stream_libarchive: seek source stream to 0 before probing
- path-unix: support ~~desktop path expansion
- ytdl_hook.lua: don't crash if playlist entries don't have an usable URL
- mac/vulkan: fix frame not displayed when paused
- mac/common: render first frame on init if possible
- video/out/w32_common: support --wid=0
- demux_mkv: map and expose hearing/visual impaired flags
- player/misc: show percentage progress for --stream-dump
- command: fix null dereference for invalid command in input-commands
- cplugin: fix missing init of pfn_mpv_get_time_ns
- vo_dmabuf_wayland: actually reuse OSD buffers
- mp_image: add support for AVAlphaMode
- vo_gpu_next: add --border-background=blur and --background-blur-radius
- demux/cue: fix crash when there are no tracks
- vf_format: add some basic HDR10 metadata
- vo/context_android: fix surface tearing on resize
- meson: remove redundant 'sdl2' option
- mac/common: fix window position on multi monitor setups
- vo_gpu_next: limit min_luma to 1000:1 contrast ratio in SDR mode
- ao_pipewire: fix some incorrect channel mappings
- wayland: correct geometry handling for rotated outputs
- demux: clear packet pool when upper memory limit is lowered
- mp_image: add ycgco-{re,ro} support
- wayland: convert luminance values to libplacebo space
- vo: trigger manual redraws at most at slightly over display fps
- osxbundle: add new macOS 26 compatible App icon
- wayland: support color-management-v1 version 2
This listing is not complete. Check DOCS/client-api-changes.rst for a history
of changes to the client API, and DOCS/interface-changes.rst for a history
of changes to other user-visible interfaces.
A complete changelog can be seen by running `git log v0.39.0..v0.40.0`
A complete changelog can be seen by running `git log v0.40.0..v0.41.0`
in the git repository or by visiting
<https://github.com/mpv-player/mpv/compare/v0.39.0...v0.40.0>.
<https://github.com/mpv-player/mpv/compare/v0.40.0...v0.41.0>.
+1 -1
View File
@@ -205,7 +205,7 @@ local function detect_crop()
return
end
local hwdec_current = mp.get_property("hwdec-current")
local hwdec_current = mp.get_property("hwdec-current", "no")
if hwdec_current:find("-copy$") == nil and hwdec_current ~= "no" and
hwdec_current ~= "crystalhd" and hwdec_current ~= "rkmpp" then
hwdec_backup = mp.get_property("hwdec")
+3
View File
@@ -372,6 +372,9 @@ local function find_and_add_entries()
added_entries[entry.filename] = true
end
-- stop initial file from being added twice
added_entries[path] = true
local append = {[-1] = {}, [1] = {}}
for direction = -1, 1, 2 do -- 2 iterations, with direction = -1 and +1
for i = 1, MAX_ENTRIES do
+8 -1
View File
@@ -19,4 +19,11 @@ local function lux_changed(_, lux)
mp.set_property_number("gamma-factor", gamma)
end
mp.observe_property("ambient-light", "number", lux_changed)
if mp.get_property("platform") == "linux" then
-- observing ambient-light isn't supported on Linux
mp.add_periodic_timer(1, function()
lux_changed(nil, mp.get_property_number("ambient-light"))
end)
else
mp.observe_property("ambient-light", "number", lux_changed)
end
+1 -1
View File
@@ -1,7 +1,7 @@
local utils = require("mp.utils")
local function hardsleep()
os.execute("sleep 1s")
os.execute("sleep 1")
end
local hooks = {"on_before_start_file", "on_load", "on_load_fail",
+2
View File
@@ -88,6 +88,8 @@ elements_matroska = (
"FlagEnabled, b9, uint",
"FlagDefault, 88, uint",
"FlagForced, 55aa, uint",
"FlagHearingImpaired, 55ab, uint",
"FlagVisualImpaired, 55ac, uint",
"FlagLacing, 9c, uint",
"MinCache, 6de7, uint",
"MaxCache, 6df8, uint",
+15 -9
View File
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import fileinput
import os
import re
import shutil
import subprocess
from optparse import OptionParser
@@ -34,9 +35,10 @@ def copy_bundle(binary_name, src_path):
def copy_binary(binary_name):
shutil.copy(binary_name, target_binary(binary_name))
def apply_plist_template(plist_file, version):
def apply_plist_template(plist_file, version, category):
print(">> setting bundle category to " + category)
for line in fileinput.input(plist_file, inplace=True):
print(line.rstrip().replace("${VERSION}", version))
print(line.rstrip().replace("${VERSION}", version).replace("${CATEGORY}", category))
def sign_bundle(binary_name):
sign_directories = ["Contents/Frameworks", "Contents/MacOS"]
@@ -48,12 +50,12 @@ def sign_bundle(binary_name):
subprocess.run(["codesign", "--force", "-s", "-", path])
subprocess.run(["codesign", "--force", "-s", "-", bundle_path(binary_name)])
def bundle_version(src_path):
def bundle_version(build_path):
version = "UNKNOWN"
version_path = os.path.join(src_path, "MPV_VERSION")
if os.path.exists(version_path):
x = open(version_path)
version = x.read()
version_h_path = os.path.join(build_path, "common", "version.h")
if os.path.exists(version_h_path):
x = open(version_h_path)
version = re.findall(r"#define\s+VERSION\s+\"v(.+)\"", x.read())[0]
x.close()
return version
@@ -63,6 +65,9 @@ def main():
parser.add_option("-s", "--skip-deps", action="store_false", dest="deps",
default=True,
help="don't bundle the dependencies")
parser.add_option("-c", "--category", action="store", dest="category",
type="choice", choices=["video", "games"], default="video",
help="sets bundle category")
(options, args) = parser.parse_args()
@@ -70,9 +75,10 @@ def main():
parser.error("incorrect number of arguments")
else:
binary_name = args[0]
build_path = os.path.dirname(binary_name)
src_path = args[1] if len(args) > 1 else "."
version = bundle_version(src_path).rstrip()
version = bundle_version(build_path).rstrip()
print(f"Creating macOS application bundle (version: {version})...")
print("> copying bundle skeleton")
@@ -80,7 +86,7 @@ def main():
print("> copying binary")
copy_binary(binary_name)
print("> generating Info.plist")
apply_plist_template(target_plist(binary_name), version)
apply_plist_template(target_plist(binary_name), version, options.category)
if options.deps:
print("> bundling dependencies")
+3 -1
View File
@@ -120,6 +120,8 @@
<string>mpv</string>
<key>CFBundleIconFile</key>
<string>icon</string>
<key>CFBundleIconName</key>
<string>icon</string>
<key>CFBundleIdentifier</key>
<string>io.mpv</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -133,7 +135,7 @@
<key>NSHighResolutionCapable</key>
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<string>public.app-category.${CATEGORY}</string>
<key>LSEnvironment</key>
<dict>
<key>MallocNanoZone</key>
Binary file not shown.
+16
View File
@@ -98,6 +98,22 @@ typedef const char * const (mp_ch_layout_tuple)[2];
{7, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g)}}
#define MP_CHMAP8(a, b, c, d, e, f, g, h) \
{8, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g), MP_SP(h)}}
#define MP_CHMAP9(a, b, c, d, e, f, g, h, i) \
{9, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g), MP_SP(h), MP_SP(i)}}
#define MP_CHMAP10(a, b, c, d, e, f, g, h, i, j) \
{10, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g), MP_SP(h), MP_SP(i), MP_SP(j)}}
#define MP_CHMAP11(a, b, c, d, e, f, g, h, i, j, k) \
{11, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g), MP_SP(h), MP_SP(i), MP_SP(j), MP_SP(k)}},
#define MP_CHMAP12(a, b, c, d, e, f, g, h, i, j, k, l) \
{12, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g), MP_SP(h), MP_SP(i), MP_SP(j), MP_SP(k), MP_SP(l)}}
#define MP_CHMAP13(a, b, c, d, e, f, g, h, i, j, k, l, m) \
{13, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g), MP_SP(h), MP_SP(i), MP_SP(j), MP_SP(k), MP_SP(l), MP_SP(m)}}
#define MP_CHMAP14(a, b, c, d, e, f, g, h, i, j, k, l, m, n) \
{14, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g), MP_SP(h), MP_SP(i), MP_SP(j), MP_SP(k), MP_SP(l), MP_SP(m), MP_SP(n)}}
#define MP_CHMAP15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) \
{15, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g), MP_SP(h), MP_SP(i), MP_SP(j), MP_SP(k), MP_SP(l), MP_SP(m), MP_SP(n), MP_SP(o)}}
#define MP_CHMAP16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) \
{16, {MP_SP(a), MP_SP(b), MP_SP(c), MP_SP(d), MP_SP(e), MP_SP(f), MP_SP(g), MP_SP(h), MP_SP(i), MP_SP(j), MP_SP(k), MP_SP(l), MP_SP(m), MP_SP(n), MP_SP(o), MP_SP(p)}}
#define MP_CHMAP_INIT_MONO {1, {MP_SPEAKER_ID_FC}}
#define MP_CHMAP_INIT_STEREO MP_CHMAP2(FL, FR)
+2 -2
View File
@@ -183,7 +183,7 @@ static int best_overlap_offset_float(struct priv *s)
float *target = (float *)s->buf_overlap + num_channels;
int num_samples = s->samples_overlap - num_channels;
int step_size = 3;
float history[3] = {};
float history[3] = {0};
float best_distance = FLT_MAX;
int best_offset_approx = 0;
@@ -232,7 +232,7 @@ static int best_overlap_offset_s16(struct priv *s)
int16_t *target = (int16_t *)s->buf_overlap + num_channels;
int num_samples = s->samples_overlap - num_channels;
int step_size = 3;
int32_t history[3] = {};
int32_t history[3] = {0};
int32_t best_distance = INT32_MAX;
int best_offset_approx = 0;
+50
View File
@@ -0,0 +1,50 @@
/* Stream builder functions */
AAUDIO_FUNCTION(AAudio_createStreamBuilder, aaudio_result_t, AAudioStreamBuilder **builder)
AAUDIO_FUNCTION(AAudioStreamBuilder_setDeviceId, void, AAudioStreamBuilder *builder, int32_t deviceId)
AAUDIO_FUNCTION(AAudioStreamBuilder_setSampleRate, void, AAudioStreamBuilder *builder, int32_t sampleRate)
AAUDIO_FUNCTION(AAudioStreamBuilder_setChannelCount, void, AAudioStreamBuilder *builder, int32_t channelCount)
AAUDIO_FUNCTION(AAudioStreamBuilder_setSamplesPerFrame, void, AAudioStreamBuilder *builder, int32_t samplesPerFrame)
AAUDIO_FUNCTION(AAudioStreamBuilder_setFormat, void, AAudioStreamBuilder *builder, aaudio_format_t format)
AAUDIO_FUNCTION(AAudioStreamBuilder_setSharingMode, void, AAudioStreamBuilder *builder, aaudio_sharing_mode_t sharingMode)
AAUDIO_FUNCTION(AAudioStreamBuilder_setDirection, void, AAudioStreamBuilder *builder, aaudio_direction_t direction)
AAUDIO_FUNCTION(AAudioStreamBuilder_setBufferCapacityInFrames, void, AAudioStreamBuilder *builder, int32_t numFrames)
AAUDIO_FUNCTION(AAudioStreamBuilder_setPerformanceMode, void, AAudioStreamBuilder *builder, aaudio_performance_mode_t mode)
AAUDIO_FUNCTION(AAudioStreamBuilder_setDataCallback, void, AAudioStreamBuilder *builder, AAudioStream_dataCallback callback, void *userData)
AAUDIO_FUNCTION(AAudioStreamBuilder_setFramesPerDataCallback, void, AAudioStreamBuilder *builder, int32_t numFrames)
AAUDIO_FUNCTION(AAudioStreamBuilder_setErrorCallback, void, AAudioStreamBuilder *builder, AAudioStream_errorCallback callback, void *userData)
AAUDIO_FUNCTION(AAudioStreamBuilder_openStream, aaudio_result_t, AAudioStreamBuilder *builder, AAudioStream **stream)
AAUDIO_FUNCTION(AAudioStreamBuilder_delete, aaudio_result_t, AAudioStreamBuilder *builder)
/* Stream control functions */
AAUDIO_FUNCTION(AAudioStream_close, aaudio_result_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_requestStart, aaudio_result_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_requestPause, aaudio_result_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_requestFlush, aaudio_result_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_requestStop, aaudio_result_t, AAudioStream *stream)
/* Stream query functions */
AAUDIO_FUNCTION(AAudioStream_getState, aaudio_stream_state_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_waitForStateChange, aaudio_result_t, AAudioStream *stream, aaudio_stream_state_t inputState, aaudio_stream_state_t *nextState, int64_t timeoutNanoseconds)
AAUDIO_FUNCTION(AAudioStream_read, aaudio_result_t, AAudioStream *stream, void *buffer, int32_t numFrames, int64_t timeoutNanoseconds)
AAUDIO_FUNCTION(AAudioStream_write, aaudio_result_t, AAudioStream *stream, const void *buffer, int32_t numFrames, int64_t timeoutNanoseconds)
AAUDIO_FUNCTION(AAudioStream_setBufferSizeInFrames, aaudio_result_t, AAudioStream *stream, int32_t numFrames)
AAUDIO_FUNCTION(AAudioStream_getBufferSizeInFrames, int32_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getFramesPerBurst, int32_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getBufferCapacityInFrames, int32_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getFramesPerDataCallback, int32_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getXRunCount, int32_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getSampleRate, int32_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getChannelCount, int32_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getSamplesPerFrame, int32_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getDeviceId, int32_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getFormat, aaudio_format_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getSharingMode, aaudio_sharing_mode_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getPerformanceMode, aaudio_performance_mode_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getDirection, aaudio_direction_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getFramesWritten, int64_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getFramesRead, int64_t, AAudioStream *stream)
AAUDIO_FUNCTION(AAudioStream_getTimestamp, aaudio_result_t, AAudioStream *stream, clockid_t clockid, int64_t* framePosition, int64_t* timeNanoseconds)
/* Utility functions */
AAUDIO_FUNCTION(AAudio_convertResultToText, const char *, aaudio_result_t returnCode)
AAUDIO_FUNCTION(AAudio_convertStreamStateToText, const char*, aaudio_stream_state_t state)
+4
View File
@@ -0,0 +1,4 @@
/* Stream builder functions - API 28 */
AAUDIO_FUNCTION(AAudioStreamBuilder_setUsage, void, AAudioStreamBuilder *builder, aaudio_usage_t usage)
AAUDIO_FUNCTION(AAudioStreamBuilder_setContentType, void, AAudioStreamBuilder *builder, aaudio_content_type_t contentType)
AAUDIO_FUNCTION(AAudioStreamBuilder_setSessionId, void, AAudioStreamBuilder* builder, aaudio_session_id_t sessionId)
+1
View File
@@ -0,0 +1 @@
AAUDIO_FUNCTION(AAudioStreamBuilder_setChannelMask, void, AAudioStreamBuilder *builder, aaudio_channel_mask_t channelMask)
+9 -2
View File
@@ -54,12 +54,16 @@ extern const struct ao_driver audio_out_wasapi;
extern const struct ao_driver audio_out_pcm;
extern const struct ao_driver audio_out_lavc;
extern const struct ao_driver audio_out_sdl;
extern const struct ao_driver audio_out_aaudio;
static const struct ao_driver * const audio_out_drivers[] = {
// native:
#if HAVE_ANDROID
#if HAVE_AUDIOTRACK
&audio_out_audiotrack,
#endif
#if HAVE_AAUDIO
&audio_out_aaudio,
#endif
#if HAVE_AUDIOUNIT
&audio_out_audiounit,
#endif
@@ -145,6 +149,8 @@ const struct m_sub_options ao_conf = {
{"audio-client-name", OPT_STRING(audio_client_name), .flags = UPDATE_AUDIO},
{"audio-buffer", OPT_DOUBLE(audio_buffer),
.flags = UPDATE_AUDIO, M_RANGE(0, 10)},
{"audio-set-media-role", OPT_BOOL(audio_set_media_role),
.flags = UPDATE_AUDIO},
{0}
},
.size = sizeof(OPT_BASE_STRUCT),
@@ -180,6 +186,7 @@ static struct ao *ao_alloc(bool probing, struct mpv_global *global,
.log = mp_log_new(ao, log, name),
.def_buffer = opts->audio_buffer,
.client_name = talloc_strdup(ao, opts->audio_client_name),
.set_media_role = opts->audio_set_media_role
};
talloc_free(opts);
ao->priv = m_config_group_from_desc(ao, ao->log, global, &desc, name);
@@ -362,7 +369,7 @@ int ao_query_and_reset_events(struct ao *ao, int events)
}
// Returns events that were set by this calls.
int ao_add_events(struct ao *ao, int events)
static int ao_add_events(struct ao *ao, int events)
{
unsigned prev_events = atomic_fetch_or(&ao->events_, events);
unsigned new = events & ~prev_events;
+1 -3
View File
@@ -43,7 +43,6 @@ enum aocontrol {
enum {
AO_EVENT_RELOAD = 1,
AO_EVENT_HOTPLUG = 2,
AO_EVENT_INITIAL_UNBLOCK = 4,
};
enum {
@@ -80,6 +79,7 @@ struct ao_opts {
char *audio_device;
char *audio_client_name;
double audio_buffer;
bool audio_set_media_role;
};
struct ao *ao_init_best(struct mpv_global *global,
@@ -104,8 +104,6 @@ bool ao_is_playing(struct ao *ao);
struct mp_async_queue;
struct mp_async_queue *ao_get_queue(struct ao *ao);
int ao_query_and_reset_events(struct ao *ao, int events);
int ao_add_events(struct ao *ao, int events);
void ao_unblock(struct ao *ao);
void ao_request_reload(struct ao *ao);
void ao_hotplug_event(struct ao *ao);
+509
View File
@@ -0,0 +1,509 @@
/*
* AAudio audio output driver
*
* Copyright (C) 2024 Jun Bo Bi <jambonmcyeah@gmail.com>
*
* This file is part of mpv.
*
* mpv is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <dlfcn.h>
#include <stdint.h>
#include <aaudio/AAudio.h>
#include <android/api-level.h>
#include "ao.h"
#include "audio/format.h"
#include "common/common.h"
#include "common/msg.h"
#include "internal.h"
#include "options/m_option.h"
#include "osdep/timer.h"
struct priv {
AAudioStream *stream;
int32_t device_id;
aaudio_session_id_t session_id;
int32_t buffer_capacity;
aaudio_performance_mode_t performance_mode;
int64_t presented;
int64_t discarded;
int device_api;
void *lib_handle;
#define AAUDIO_FUNCTION(name, ret, ...) ret (*name)(__VA_ARGS__);
#include "aaudio_functions26.inc"
#include "aaudio_functions28.inc"
#include "aaudio_functions32.inc"
#undef AAUDIO_FUNCTION
};
struct function_map {
const char *symbol;
int offset;
};
#define AAUDIO_FUNCTION(name, ret, ...) {#name, offsetof(struct priv, name)},
static const struct function_map lib_functions26[] = {
#include "aaudio_functions26.inc"
};
static const struct function_map lib_functions28[] = {
#include "aaudio_functions28.inc"
};
static const struct function_map lib_functions32[] = {
#include "aaudio_functions32.inc"
};
#undef AAUDIO_FUNCTION
static const struct {
int api_level;
int length;
const struct function_map *functions;
} lib_functions[] = {
{26, MP_ARRAY_SIZE(lib_functions26), lib_functions26},
{28, MP_ARRAY_SIZE(lib_functions28), lib_functions28},
{32, MP_ARRAY_SIZE(lib_functions32), lib_functions32}
};
/*
* There is no documentation in AAudio for the order of positions for AAudio.
* It's assumed to work the same way as AudioTrack (even the order of the bits
* for the position mask is the same for both)
* See https://developer.android.com/reference/android/media/AudioFormat#channelPositionMask
*/
static const struct mp_chmap aaudio_default_chmaps[] = {
{0}, /* empty */
MP_CHMAP_INIT_MONO, /* mono */
MP_CHMAP_INIT_STEREO, /* stereo */
MP_CHMAP3(FL, FR, FC), /* 3.0 */
MP_CHMAP4(FL, FR, BL, BR), /* quad */
MP_CHMAP5(FL, FR, FC, BL, BR), /* 5.0 */
MP_CHMAP6(FL, FR, FC, LFE, BL, BR), /* 5.1 */
MP_CHMAP7(FL, FR, FC, LFE, BL, BR, BC), /* 6.1 */
MP_CHMAP8(FL, FR, FC, LFE, BL, BR, SL, SR), /* 7.1 */
{0},
MP_CHMAP10(FL, FR, FC, LFE, BL, BR, SL, SR, TSL, TSR), /* 7.1.2 */
{0},
MP_CHMAP12(FL, FR, FC, LFE, BL, BR, SL, SR, TFL, TFR, TBL, TBR), /* 7.1.4 */
{0},
MP_CHMAP14(FL, FR, FC, LFE, BL, BR, SL, SR, TFL, TFR, TBL, TBR, WL, WR), /* 9.1.4 */
{0},
MP_CHMAP16(FL, FR, FC, LFE, BL, BR, SL, SR, TFL, TFR, TBL, TBR, TSL, TSR, WL, WR) /* 9.1.6 */
};
static const struct mp_chmap aaudio_chmaps[] = {
{0}, /* empty */
/*
* This should be `{1, {MP_SP(FL)}}` according to spec
* but `mp_chmap_sel` doesn't like it
*/
MP_CHMAP_INIT_MONO, /* mono */
MP_CHMAP_INIT_STEREO, /* stereo */
MP_CHMAP3(FL, FR, LFE), /* 2.1 */
MP_CHMAP3(FL, FR, FC), /* 3.0 */
MP_CHMAP3(FL, FR, BC), /* 3.0 (back) */
MP_CHMAP4(FL, FR, FC, LFE), /* 3.1 */
MP_CHMAP4(FL, FR, TSL, TSR), /* 2.0.2 */
MP_CHMAP5(FL, FR, LFE, TSL, TSR), /* 2.1.2 */
MP_CHMAP5(FL, FR, FC, TSL, TSR), /* 3.0.2 */
MP_CHMAP6(FL, FR, FC, LFE, TSL, TSR), /* 3.1.2 */
MP_CHMAP4(FL, FR, BL, BR), /* quad */
MP_CHMAP4(FL, FR, SL, SR), /* quad (side) */
MP_CHMAP4(FL, FR, FC, BC), /* quad (center) */
MP_CHMAP5(FL, FR, FC, BL, BR), /* 5.0 */
MP_CHMAP6(FL, FR, FC, LFE, BL, BR), /* 5.1 */
MP_CHMAP6(FL, FR, FC, LFE, SL, SR), /* 5.1 (side) */
MP_CHMAP7(FL, FR, FC, LFE, BL, BR, BC), /* 6.1 */
MP_CHMAP8(FL, FR, FC, LFE, BL, BR, SL, SR), /* 7.1 */
MP_CHMAP8(FL, FR, FC, LFE, BL, BR, TSL, TSR), /* 5.1.2 */
MP_CHMAP10(FL, FR, FC, LFE, BL, BR, TFL, TFR, TBL, TBR), /* 5.1.4 */
MP_CHMAP10(FL, FR, FC, LFE, BL, BR, SL, SR, TSL, TSR), /* 7.1.2 */
MP_CHMAP12(FL, FR, FC, LFE, BL, BR, SL, SR, TFL, TFR, TBL, TBR), /* 7.1.4 */
MP_CHMAP14(FL, FR, FC, LFE, BL, BR, SL, SR, TFL, TFR, TBL, TBR, WL, WR), /* 9.1.4 */
MP_CHMAP16(FL, FR, FC, LFE, BL, BR, SL, SR, TFL, TFR, TBL, TBR, TSL, TSR, WL, WR) /* 9.1.6 */
};
static const aaudio_channel_mask_t aaudio_masks[] = {
AAUDIO_CHANNEL_INVALID,
AAUDIO_CHANNEL_MONO,
AAUDIO_CHANNEL_STEREO,
AAUDIO_CHANNEL_2POINT1,
AAUDIO_CHANNEL_TRI,
AAUDIO_CHANNEL_TRI_BACK,
AAUDIO_CHANNEL_3POINT1,
AAUDIO_CHANNEL_2POINT0POINT2,
AAUDIO_CHANNEL_2POINT1POINT2,
AAUDIO_CHANNEL_3POINT0POINT2,
AAUDIO_CHANNEL_3POINT1POINT2,
AAUDIO_CHANNEL_QUAD,
AAUDIO_CHANNEL_QUAD_SIDE,
AAUDIO_CHANNEL_SURROUND,
AAUDIO_CHANNEL_PENTA,
AAUDIO_CHANNEL_5POINT1,
AAUDIO_CHANNEL_5POINT1_SIDE,
AAUDIO_CHANNEL_6POINT1,
AAUDIO_CHANNEL_7POINT1,
AAUDIO_CHANNEL_5POINT1POINT2,
AAUDIO_CHANNEL_5POINT1POINT4,
AAUDIO_CHANNEL_7POINT1POINT2,
AAUDIO_CHANNEL_7POINT1POINT4,
AAUDIO_CHANNEL_9POINT1POINT4,
AAUDIO_CHANNEL_9POINT1POINT6
};
static_assert(MP_ARRAY_SIZE(aaudio_chmaps) == MP_ARRAY_SIZE(aaudio_masks),
"`aaudio_masks` and `aaudio_chmaps` MUST have the same number of entries.");
/*
* The values corresponds to indexes of `aaudio_chmaps`
*
* Different devices may support different number of max channels
* depending on what they set `FCC_LIMIT` to
* See https://cs.android.com/android/platform/superproject/+/android-latest-release:system/media/audio/include/system/audio.h;l=234
*/
static const uint8_t aaudio_max_chnums[] = {
MP_ARRAY_SIZE(aaudio_chmaps),
22, /* FCC_12 */
19, /* FCC_8 */
2, /* FCC_2 */
1 /* FCC_1 */
};
static bool load_lib_functions(struct ao *ao)
{
struct priv *p = ao->priv;
p->device_api = android_get_device_api_level();
p->lib_handle = dlopen("libaaudio.so", RTLD_NOW | RTLD_GLOBAL);
if (!p->lib_handle)
return false;
for (int i = 0; i < MP_ARRAY_SIZE(lib_functions); i++) {
if (p->device_api < lib_functions[i].api_level)
break;
for (int j = 0; j < lib_functions[i].length; j++) {
const char *sym = lib_functions[i].functions[j].symbol;
void *fun = dlsym(p->lib_handle, sym);
if (!fun)
fun = dlsym(RTLD_DEFAULT, sym);
if (!fun) {
MP_WARN(ao, "Could not resolve symbol %s\n", sym);
return false;
}
*(void **)((uint8_t *)p + lib_functions[i].functions[j].offset) = fun;
}
}
return true;
}
static void error_callback(AAudioStream *stream, void *context, aaudio_result_t error)
{
struct ao *ao = context;
struct priv *p = ao->priv;
MP_ERR(ao, "%s, trying to reload...\n", p->AAudio_convertResultToText(error));
ao_request_reload(ao);
}
static aaudio_data_callback_result_t data_callback(AAudioStream *stream, void *context,
void *data, int32_t nframes)
{
struct ao *ao = context;
struct priv *p = ao->priv;
aaudio_result_t result;
int64_t presented, present_time;
int64_t written = p->AAudioStream_getFramesWritten(stream);
if ((result = p->AAudioStream_getTimestamp(stream, CLOCK_MONOTONIC, &presented, &present_time)) < 0) {
MP_TRACE(ao, "AAudioStream_getTimestamp() returned %s\n",
p->AAudio_convertResultToText(result));
presented = p->presented;
} else {
p->presented = presented;
}
int64_t end_time = mp_time_ns();
end_time += MP_TIME_S_TO_NS(nframes) / ao->samplerate;
end_time += MP_TIME_S_TO_NS(written - (presented + p->discarded)) / ao->samplerate;
ao_read_data(ao, &data, nframes, end_time, NULL, true, true);
return AAUDIO_CALLBACK_RESULT_CONTINUE;
}
static void uninit(struct ao *ao)
{
struct priv *p = ao->priv;
if (p->stream) {
p->AAudioStream_close(p->stream);
p->stream = NULL;
}
if (p->lib_handle) {
dlclose(p->lib_handle);
p->lib_handle = NULL;
}
}
static int init(struct ao *ao)
{
if (!load_lib_functions(ao))
return -1;
struct priv *p = ao->priv;
aaudio_result_t result;
AAudioStreamBuilder *builder;
if ((result = p->AAudio_createStreamBuilder(&builder)) < 0) {
MP_ERR(ao, "AAudio_createStreamBuilder() returned %s\n",
p->AAudio_convertResultToText(result));
return -1;
}
aaudio_format_t format;
if (p->device_api >= 34 && af_fmt_is_spdif(ao->format)) {
format = AAUDIO_FORMAT_IEC61937;
} else if (af_fmt_is_float(ao->format)) {
ao->format = AF_FORMAT_FLOAT;
format = AAUDIO_FORMAT_PCM_FLOAT;
} else if (af_fmt_is_int(ao->format)) {
if (af_fmt_to_bytes(ao->format) > 2 && p->device_api >= 31) {
ao->format = AF_FORMAT_S32;
format = AAUDIO_FORMAT_PCM_I32;
} else {
ao->format = AF_FORMAT_S16;
format = AAUDIO_FORMAT_PCM_I16;
}
} else {
ao->format = AF_FORMAT_S16;
format = AAUDIO_FORMAT_PCM_I16;
}
p->AAudioStreamBuilder_setDeviceId(builder, p->device_id);
p->AAudioStreamBuilder_setDirection(builder, AAUDIO_DIRECTION_OUTPUT);
p->AAudioStreamBuilder_setSharingMode(builder,
(ao->init_flags & AO_INIT_EXCLUSIVE)
? AAUDIO_SHARING_MODE_EXCLUSIVE
: AAUDIO_SHARING_MODE_SHARED);
p->AAudioStreamBuilder_setFormat(builder, format);
p->AAudioStreamBuilder_setSampleRate(builder, ao->samplerate);
p->AAudioStreamBuilder_setErrorCallback(builder, error_callback, ao);
p->AAudioStreamBuilder_setBufferCapacityInFrames(builder,
p->buffer_capacity);
p->AAudioStreamBuilder_setPerformanceMode(builder, p->performance_mode);
p->AAudioStreamBuilder_setDataCallback(builder, data_callback, ao);
if (p->device_api >= 28) {
if (ao->set_media_role)
p->AAudioStreamBuilder_setContentType(builder,
(ao->init_flags &
AO_INIT_MEDIA_ROLE_MUSIC)
? AAUDIO_CONTENT_TYPE_MUSIC
: AAUDIO_CONTENT_TYPE_MOVIE);
p->AAudioStreamBuilder_setUsage(builder, AAUDIO_USAGE_MEDIA);
p->AAudioStreamBuilder_setSessionId(builder, p->session_id);
}
if (p->device_api >= 32) {
uint8_t i = 0;
struct mp_chmap channels = ao->channels;
do {
struct mp_chmap_sel sel = {0, .tmp = p};
aaudio_channel_mask_t channel_mask = AAUDIO_CHANNEL_INVALID;
for (int j = 1; j < aaudio_max_chnums[i]; j++)
mp_chmap_sel_add_map(&sel, &aaudio_chmaps[j]);
if (!ao_chmap_sel_adjust(ao, &sel, &channels)) {
MP_ERR(ao, "Failed to find channel map\n");
goto err;
}
for (uint8_t j = 0; j < aaudio_max_chnums[i]; j++) {
if (mp_chmap_equals(&aaudio_chmaps[j], &channels)) {
channel_mask = aaudio_masks[j];
break;
}
}
assert(channel_mask != AAUDIO_CHANNEL_INVALID);
p->AAudioStreamBuilder_setChannelMask(builder, channel_mask);
result = p->AAudioStreamBuilder_openStream(builder, &p->stream);
if (result != AAUDIO_ERROR_OUT_OF_RANGE) {
break;
}
} while (i++ < MP_ARRAY_SIZE(aaudio_max_chnums));
ao->channels = channels;
} else {
result = p->AAudioStreamBuilder_openStream(builder, &p->stream);
}
if (result < 0) {
MP_ERR(ao, "AAudioStreamBuilder_openStream() returned %s\n",
p->AAudio_convertResultToText(result));
goto err;
}
if (p->device_api < 32) {
int32_t channel_count = p->AAudioStream_getChannelCount(p->stream);
if (channel_count >= MP_ARRAY_SIZE(aaudio_default_chmaps) ||
(ao->channels = aaudio_default_chmaps[channel_count]).num == 0) {
MP_ERR(ao, "Unknown layout for channel count: %" PRId32 "\n",
channel_count);
goto err;
}
}
ao->device_buffer = p->AAudioStream_getBufferCapacityInFrames(p->stream);
p->AAudioStreamBuilder_delete(builder);
return 1;
err:
p->AAudioStreamBuilder_delete(builder);
return -1;
}
static void start(struct ao *ao)
{
struct priv *p = ao->priv;
aaudio_result_t result;
p->discarded = p->AAudioStream_getFramesWritten(p->stream) - p->presented;
if ((result = p->AAudioStream_requestStart(p->stream)) < 0) {
MP_ERR(ao, "AAudioStream_requestStart() returned %s\n",
p->AAudio_convertResultToText(result));
return ao_request_reload(ao);
}
}
static bool set_pause(struct ao *ao, bool paused)
{
struct priv *p = ao->priv;
aaudio_result_t result = paused
? p->AAudioStream_requestPause(p->stream)
: p->AAudioStream_requestStart(p->stream);
if (result < 0) {
MP_ERR(ao, "AAudioStream_request%s() returned %s\n",
paused ? "Pause" : "Start",
p->AAudio_convertResultToText(result));
ao_request_reload(ao);
return false;
}
return true;
}
static void reset(struct ao *ao)
{
struct priv *p = ao->priv;
aaudio_result_t result;
aaudio_stream_state_t state = p->AAudioStream_getState(p->stream);
switch (state) {
case AAUDIO_STREAM_STATE_STARTING:
case AAUDIO_STREAM_STATE_STOPPING:
case AAUDIO_STREAM_STATE_PAUSING:
case AAUDIO_STREAM_STATE_FLUSHING:
if ((result = p->AAudioStream_waitForStateChange(p->stream,
state, &state, INT64_MAX)) < 0) {
MP_ERR(ao, "AAudioStream_waitForStateChange() returned %s\n",
p->AAudio_convertResultToText(result));
return ao_request_reload(ao);
}
}
if (state != AAUDIO_STREAM_STATE_PAUSED) {
if ((result = p->AAudioStream_requestPause(p->stream)) < 0) {
MP_ERR(ao, "AAudioStream_requestPause() %s\n",
p->AAudio_convertResultToText(result));
return ao_request_reload(ao);
}
if ((result = p->AAudioStream_waitForStateChange(p->stream,
AAUDIO_STREAM_STATE_PAUSING, &state, INT64_MAX)) < 0) {
MP_ERR(ao, "AAudioStream_waitForStateChange() returned %s\n",
p->AAudio_convertResultToText(result));
return ao_request_reload(ao);
}
}
if ((result = p->AAudioStream_requestFlush(p->stream)) < 0) {
MP_ERR(ao, "AAudioStream_requestFlush() returned %s\n",
p->AAudio_convertResultToText(result));
return ao_request_reload(ao);
}
}
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_aaudio = {
.description = "AAudio audio output",
.name = "aaudio",
.init = init,
.uninit = uninit,
.start = start,
.reset = reset,
.set_pause = set_pause,
.priv_size = sizeof(struct priv),
.priv_defaults = &(const struct priv) {
.device_id = AAUDIO_UNSPECIFIED,
.session_id = AAUDIO_SESSION_ID_NONE,
.buffer_capacity = AAUDIO_UNSPECIFIED,
.performance_mode = AAUDIO_PERFORMANCE_MODE_NONE,
.presented = 0,
.discarded = 0,
.stream = NULL,
.lib_handle = NULL
},
.options_prefix = "aaudio",
.options =
(const struct m_option[]){
{"device-id", OPT_CHOICE(device_id,
{"auto", AAUDIO_UNSPECIFIED}),
M_RANGE(INT32_MIN, INT32_MAX)},
{"session-id", OPT_CHOICE(session_id,
{"none", AAUDIO_SESSION_ID_NONE}),
M_RANGE(INT32_MIN, INT32_MAX)},
{"buffer-capacity", OPT_CHOICE(buffer_capacity,
{"auto", AAUDIO_UNSPECIFIED}),
M_RANGE(1, INT32_MAX)},
{"performance-mode", OPT_CHOICE(performance_mode,
{"none", AAUDIO_PERFORMANCE_MODE_NONE},
{"low-latency", AAUDIO_PERFORMANCE_MODE_LOW_LATENCY},
{"power-saving", AAUDIO_PERFORMANCE_MODE_POWER_SAVING})},
{0}},
};
+2 -1
View File
@@ -39,6 +39,7 @@
#include "options/m_option.h"
#include "common/msg.h"
#include "osdep/endian.h"
#include "osdep/timer.h"
#include <alsa/asoundlib.h>
@@ -972,7 +973,7 @@ static bool recover_and_get_state(struct ao *ao, struct mp_pcm_state *state)
if (err == -EAGAIN) {
// Cargo-cult from decades ago, with a cargo cult timeout.
MP_INFO(ao, "PCM resume EAGAIN - retrying.\n");
sleep(1);
mp_sleep_ns(MP_TIME_S_TO_NS(1));
continue;
}
if (err == -ENOSYS) {
+6 -4
View File
@@ -304,10 +304,12 @@ static int AudioTrack_New(struct ao *ao)
MP_JNI_EXCEPTION_LOG(ao);
tmp = MP_JNI_CALL_OBJECT(attr_builder, AudioAttributesBuilder.setUsage, AudioAttributes.USAGE_MEDIA);
MP_JNI_LOCAL_FREEP(&tmp);
jint content_type = (ao->init_flags & AO_INIT_MEDIA_ROLE_MUSIC) ?
AudioAttributes.CONTENT_TYPE_MUSIC : AudioAttributes.CONTENT_TYPE_MOVIE;
tmp = MP_JNI_CALL_OBJECT(attr_builder, AudioAttributesBuilder.setContentType, content_type);
MP_JNI_LOCAL_FREEP(&tmp);
if (ao->set_media_role) {
jint content_type = (ao->init_flags & AO_INIT_MEDIA_ROLE_MUSIC) ?
AudioAttributes.CONTENT_TYPE_MUSIC : AudioAttributes.CONTENT_TYPE_MOVIE;
tmp = MP_JNI_CALL_OBJECT(attr_builder, AudioAttributesBuilder.setContentType, content_type);
MP_JNI_LOCAL_FREEP(&tmp);
}
jobject attr = MP_JNI_CALL_OBJECT(attr_builder, AudioAttributesBuilder.build);
MP_JNI_LOCAL_FREEP(&attr_builder);
+1 -1
View File
@@ -83,7 +83,7 @@ static void feed(struct ao *ao)
ao_stop_streaming(ao);
}
if (real_sample_count == 0) {
return;
goto finish;
}
if ((err = CMBlockBufferCreateWithMemoryBlock(
-1
View File
@@ -275,7 +275,6 @@ static void init_physical_format(struct ao *ao)
coreaudio_error:
talloc_free(tmp);
return;
}
static bool init_audiounit(struct ao *ao, AudioStreamBasicDescription asbd, AudioChannelLayout *layout, size_t layout_size)
+2 -12
View File
@@ -93,16 +93,6 @@ static void select_format(struct ao *ao, const AVCodec *codec)
}
}
static void on_ready(void *ptr)
{
struct ao *ao = ptr;
struct priv *ac = ao->priv;
ac->worst_time_base = encoder_get_mux_timebase_unlocked(ac->enc);
ao_add_events(ao, AO_EVENT_INITIAL_UNBLOCK);
}
// open & setup audio device
static int init(struct ao *ao)
{
@@ -147,9 +137,10 @@ static int init(struct ao *ao)
encoder->sample_fmt = af_to_avformat(ao->format);
encoder->bits_per_raw_sample = ac->sample_size * 8;
if (!encoder_init_codec_and_muxer(ac->enc, on_ready, ao))
if (!encoder_init_codec_and_muxer(ac->enc))
goto fail;
ac->worst_time_base = encoder_get_mux_timebase_unlocked(ac->enc);
ac->pcmhack = 0;
if (encoder->frame_size <= 1)
ac->pcmhack = av_get_bits_per_sample(encoder->codec_id) / 8;
@@ -328,7 +319,6 @@ const struct ao_driver audio_out_lavc = {
.encode = true,
.description = "audio encoding using libavcodec",
.name = "lavc",
.initially_blocked = true,
.write_frames = true,
.priv_size = sizeof(struct priv),
.init = init,
+8 -5
View File
@@ -147,10 +147,10 @@ static enum spa_audio_channel mp_speaker_id_to_spa(struct ao *ao, enum mp_speake
case MP_SPEAKER_ID_TBR: return SPA_AUDIO_CHANNEL_TRR;
case MP_SPEAKER_ID_DL: return SPA_AUDIO_CHANNEL_FL;
case MP_SPEAKER_ID_DR: return SPA_AUDIO_CHANNEL_FR;
case MP_SPEAKER_ID_WL: return SPA_AUDIO_CHANNEL_FL;
case MP_SPEAKER_ID_WR: return SPA_AUDIO_CHANNEL_FR;
case MP_SPEAKER_ID_WL: return SPA_AUDIO_CHANNEL_FLW;
case MP_SPEAKER_ID_WR: return SPA_AUDIO_CHANNEL_FRW;
case MP_SPEAKER_ID_SDL: return SPA_AUDIO_CHANNEL_SL;
case MP_SPEAKER_ID_SDR: return SPA_AUDIO_CHANNEL_SL;
case MP_SPEAKER_ID_SDR: return SPA_AUDIO_CHANNEL_SR;
case MP_SPEAKER_ID_LFE2: return SPA_AUDIO_CHANNEL_LFE2;
case MP_SPEAKER_ID_TSL: return SPA_AUDIO_CHANNEL_TSL;
case MP_SPEAKER_ID_TSR: return SPA_AUDIO_CHANNEL_TSR;
@@ -577,7 +577,6 @@ static int init(struct ao *ao)
struct pw_properties *props = pw_properties_new(
PW_KEY_MEDIA_TYPE, "Audio",
PW_KEY_MEDIA_CATEGORY, "Playback",
PW_KEY_MEDIA_ROLE, ao->init_flags & AO_INIT_MEDIA_ROLE_MUSIC ? "Music" : "Movie",
PW_KEY_NODE_NAME, ao->client_name,
PW_KEY_NODE_DESCRIPTION, ao->client_name,
PW_KEY_APP_NAME, ao->client_name,
@@ -588,6 +587,10 @@ static int init(struct ao *ao)
NULL
);
if (ao->set_media_role)
pw_properties_set(props, PW_KEY_MEDIA_ROLE,
ao->init_flags & AO_INIT_MEDIA_ROLE_MUSIC ? "Music" : "Movie");
if (pipewire_init_boilerplate(ao) < 0)
goto error_props;
@@ -884,7 +887,7 @@ static void hotplug_uninit(struct ao *ao)
static void list_devs(struct ao *ao, struct ao_device_list *list)
{
ao_device_list_add(list, ao, &(struct ao_device_desc){});
ao_device_list_add(list, ao, &(struct ao_device_desc){0});
if (for_each_sink(ao, add_device_to_list, list) < 0)
MP_WARN(ao, "Could not list devices, list may be incomplete\n");
+5
View File
@@ -405,6 +405,11 @@ static int init(struct ao *ao)
}
(void)pa_proplist_sets(proplist, PA_PROP_MEDIA_ICON_NAME, ao->client_name);
if (ao->set_media_role)
(void)pa_proplist_sets(proplist, PA_PROP_MEDIA_ROLE,
ao->init_flags & AO_INIT_MEDIA_ROLE_MUSIC
? "music" : "video");
if (!(format = pa_format_info_new()))
goto unlock_and_fail;
+1 -2
View File
@@ -568,7 +568,7 @@ static bool find_formats(struct ao *ao)
struct wasapi_sample_fmt alt_formats[MP_ARRAY_SIZE(wasapi_formats)];
wasapi_get_best_sample_formats(ao->format, alt_formats);
struct wasapi_sample_fmt wasapi_format =
{AF_FORMAT_S16, 16, 16, &KSDATAFORMAT_SUBTYPE_PCM};;
{AF_FORMAT_S16, 16, 16, &KSDATAFORMAT_SUBTYPE_PCM};
if (alt_formats[0].mp_format)
wasapi_format = alt_formats[0];
@@ -643,7 +643,6 @@ exit_label:
SAFE_RELEASE(state->pSessionControl);
MP_WARN(state, "Error setting audio session name: %s\n",
mp_HRESULT_to_str(hr));
return;
}
static void init_volume_control(struct wasapi_state *state)
+1 -16
View File
@@ -68,8 +68,6 @@ struct buffer_state {
// and is considered as a temporary solution;
// DO NOT USE IT IN OTHER PLACES.
bool initial_unblocked;
// "Push" AOs only (AOs with driver->write).
bool recover_pause; // non-hw_paused: needs to recover delay
struct mp_pcm_state prepause_state;
@@ -713,9 +711,7 @@ static MP_THREAD_VOID ao_thread(void *arg)
while (1) {
mp_mutex_lock(&p->lock);
bool retry = false;
if (!ao->driver->initially_blocked || p->initial_unblocked)
retry = ao_play_data(ao);
bool retry = ao_play_data(ao);
// Wait until the device wants us to write more data to it.
// Fallback to guessing.
@@ -744,14 +740,3 @@ static MP_THREAD_VOID ao_thread(void *arg)
}
MP_THREAD_RETURN();
}
void ao_unblock(struct ao *ao)
{
if (ao->driver->write) {
struct buffer_state *p = ao->buffer_state;
mp_mutex_lock(&p->lock);
p->initial_unblocked = true;
mp_mutex_unlock(&p->lock);
ao_wakeup(ao);
}
}
+3 -4
View File
@@ -55,6 +55,9 @@ struct ao {
// Application name to report to the audio API.
char *client_name;
// Whether mpv should set the media role to the audio server
bool set_media_role;
// Used during init: if init fails, redirect to this ao
char *redirect;
@@ -131,10 +134,6 @@ struct ao_driver {
const char *name;
// Description shown with --ao=help.
const char *description;
// This requires waiting for a AO_EVENT_INITIAL_UNBLOCK event before the
// first write() call is done. Encode mode uses this, and push mode
// respects it automatically (don't use with pull mode).
bool initially_blocked;
// If true, write units of entire frames. The write() call is modified to
// use data==mp_aframe. Useful for encoding AO only.
bool write_frames;
+1 -1
View File
@@ -3,4 +3,4 @@ common_args="--werror \
-Dtests=true \
"
export CFLAGS="$CFLAGS -Wno-error=deprecated -Wno-error=deprecated-declarations -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"
export CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3"
-1
View File
@@ -4,7 +4,6 @@ set -e
. ./ci/build-common.sh
# clone exactly the oldest libplacebo we want to support
rm -rf subprojects
mkdir -p subprojects
git clone https://code.videolan.org/videolan/libplacebo.git \
--recurse-submodules --shallow-submodules \
+2 -1
View File
@@ -18,7 +18,8 @@ meson setup build $common_args \
-Dobjc_args="-Wno-error=deprecated -Wno-error=deprecated-declarations" \
-D{gl,iconv,lcms2,lua,jpeg,plain-gl,zlib}=enabled \
-D{cocoa,coreaudio,gl-cocoa,videotoolbox-gl,videotoolbox-pl}=enabled \
-D{swift-build,macos-cocoa-cb,macos-media-player,macos-touchbar,vulkan}=enabled
-D{swift-build,macos-cocoa-cb,macos-media-player,macos-touchbar,vulkan}=enabled \
-Dswift-flags="${SWIFT_FLAGS}"
meson compile -C build -j4
meson install -C build
+19 -8
View File
@@ -38,10 +38,11 @@ fam=x86_64
cat >"$prefix_dir/crossfile" <<EOF
[built-in options]
buildtype = 'release'
wrap_mode = 'nofallback'
wrap_mode = 'nodownload'
[binaries]
c = ['ccache', '${CC}']
cpp = ['ccache', '${CXX}']
rust = ['rustc', '--target', '${RUST_TARGET}']
ar = '${AR}'
strip = '${TARGET}-strip'
pkgconfig = 'pkg-config'
@@ -114,7 +115,7 @@ function build_if_missing {
_iconv () {
local ver=1.18
gettar "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ver}.tar.gz"
gettar "https://ftpmirror.gnu.org/gnu/libiconv/libiconv-${ver}.tar.gz"
builddir libiconv-${ver}
../configure --host=$TARGET $commonflags
makeplusinstall
@@ -144,6 +145,16 @@ _dav1d () {
}
_dav1d_mark=lib/libdav1d.dll.a
_lcms2 () {
[ -d lcms2 ] || $gitclone https://github.com/mm2/Little-CMS.git lcms2
builddir lcms2
meson setup .. --cross-file "$prefix_dir/crossfile" \
-Dtests=disabled -D{utils,versionedlibs}=false
makeplusinstall
popd
}
_lcms2_mark=lib/liblcms2.dll.a
_ffmpeg () {
[ -d ffmpeg ] || $gitclone https://github.com/FFmpeg/FFmpeg.git ffmpeg
builddir ffmpeg
@@ -214,14 +225,14 @@ _libplacebo () {
[ -d libplacebo ] || $gitclone https://code.videolan.org/videolan/libplacebo.git
builddir libplacebo
meson setup .. --cross-file "$prefix_dir/crossfile" \
-Ddemos=false -D{opengl,d3d11}=enabled
-Ddemos=false -D{opengl,d3d11,lcms}=enabled
makeplusinstall
popd
}
_libplacebo_mark=lib/libplacebo.dll.a
_freetype () {
local ver=2.13.3
local ver=2.14.1
gettar "https://download.savannah.gnu.org/releases/freetype/freetype-${ver}.tar.xz"
builddir freetype-${ver}
meson setup .. --cross-file "$prefix_dir/crossfile"
@@ -242,7 +253,7 @@ _fribidi () {
_fribidi_mark=lib/libfribidi.dll.a
_harfbuzz () {
local ver=10.2.0
local ver=12.2.0
gettar "https://github.com/harfbuzz/harfbuzz/releases/download/${ver}/harfbuzz-${ver}.tar.xz"
builddir harfbuzz-${ver}
meson setup .. --cross-file "$prefix_dir/crossfile" \
@@ -275,7 +286,7 @@ _luajit () {
}
_luajit_mark=lib/libluajit-5.1.a
for x in iconv zlib shaderc spirv-cross nv-headers dav1d; do
for x in iconv zlib shaderc spirv-cross nv-headers dav1d lcms2; do
build_if_missing $x
done
if [[ "$TARGET" != "i686-"* ]]; then
@@ -308,7 +319,7 @@ meson compile -C $build
if [ "$2" = pack ]; then
mkdir -p artifact/tmp
echo "Copying:"
cp -pv $build/mpv.com $build/mpv.exe artifact/
cp -pv $build/mpv.com $build/mpv.exe etc/mpv-*.bat artifact/
# copy everything we can get our hands on
cp -p "$prefix_dir/bin/"*.dll artifact/tmp/
shopt -s nullglob
@@ -320,7 +331,7 @@ if [ "$2" = pack ]; then
dlls=(
libgcc_*.dll lib{ssp,stdc++,winpthread}-[0-9]*.dll # compiler runtime
av*.dll sw*.dll postproc-[0-9]*.dll lib{ass,freetype,fribidi,harfbuzz,iconv,placebo}-[0-9]*.dll
lib{shaderc_shared,spirv-cross-c-shared,dav1d}.dll zlib1.dll
lib{shaderc_shared,spirv-cross-c-shared,dav1d,lcms2}.dll zlib1.dll
)
if [[ -f vulkan-1.dll ]]; then
dlls+=(vulkan-1.dll)
+4
View File
@@ -12,6 +12,10 @@ args=(
-Db_sanitize=address,undefined
)
[[ "$SYS" == "clangarm64" ]] && args+=(
-Dpdf-build=disabled
)
meson setup build $common_args "${args[@]}"
meson compile -C build
./build/mpv.com -v --no-config
-18
View File
@@ -3,24 +3,6 @@ set -e
. ./ci/build-common.sh
# FFmpeg on openBSD (4.4.4) is too old; use a subproject
rm -rf subprojects
mkdir -p subprojects
cat <<EOF > subprojects/ffmpeg.wrap
[wrap-git]
url = https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git
revision = meson-7.1
depth = 1
[provide]
libavcodec = libavcodec_dep
libavdevice = libavdevice_dep
libavfilter = libavfilter_dep
libavformat = libavformat_dep
libavutil = libavutil_dep
libswresample = libswresample_dep
libswscale = libswscale_dep
EOF
meson setup build $common_args \
-Dffmpeg:vulkan=auto \
-Dffmpeg:werror=false \
+1 -1
View File
@@ -4,7 +4,7 @@ set -e
. ./ci/build-common.sh
meson setup build $common_args $@ \
-Db_sanitize=address,undefined \
-Db_sanitize=$([ "$CC" = "gcc" ] && echo none || echo address,undefined) \
-Dcdda=enabled \
-Ddvbin=enabled \
-Ddvdnav=enabled \
+42 -14
View File
@@ -54,12 +54,9 @@ shaderc_proj = cmake.subproject('shaderc_cmake', options: opts)
shaderc_dep = declare_dependency(dependencies: [
shaderc_proj.dependency('shaderc'),
shaderc_proj.dependency('shaderc_util'),
shaderc_proj.dependency('SPIRV'),
shaderc_proj.dependency('SPIRV-Tools-static'),
shaderc_proj.dependency('SPIRV-Tools-opt'),
shaderc_proj.dependency('glslang'),
shaderc_proj.dependency('GenericCodeGen'),
shaderc_proj.dependency('MachineIndependent'),
])
meson.override_dependency('shaderc', shaderc_dep)
"@
@@ -123,25 +120,48 @@ opts = cmake.subproject_options()
opts.add_cmake_defines({
'CMAKE_MSVC_RUNTIME_LIBRARY': 'MultiThreaded',
'BUILD_SHARED_LIBS': 'OFF',
'BUILD_TESTING': 'OFF',
})
libjxl_proj = cmake.subproject('libjxl-cmake', options: opts)
libjxl_dep = libjxl_proj.dependency('jxl')
libjxl_dep = declare_dependency(dependencies: [
libjxl_proj.dependency('jxl'),
libjxl_proj.dependency('jxl_base'),
libjxl_proj.dependency('jxl_cms'),
libjxl_proj.dependency('hwy'),
libjxl_proj.dependency('brotlicommon'),
libjxl_proj.dependency('brotlidec'),
libjxl_proj.dependency('brotlienc'),
])
meson.override_dependency('libjxl', libjxl_dep)
libjxl_threads_dep = libjxl_proj.dependency('jxl_threads')
meson.override_dependency('libjxl_threads', libjxl_threads_dep)
"@
if (-not (Test-Path "$subprojects/aom")) {
New-Item -Path "$subprojects/aom" -ItemType Directory | Out-Null
}
Set-Content -Path "$subprojects/aom/meson.build" -Value @"
project('aom', 'cpp', version: '3.13.1')
cmake = import('cmake')
opts = cmake.subproject_options()
opts.add_cmake_defines({
'CMAKE_MSVC_RUNTIME_LIBRARY': 'MultiThreaded',
'BUILD_SHARED_LIBS': 'OFF',
'BUILD_TESTING': 'OFF',
})
aom_proj = cmake.subproject('aom-cmake', options: opts)
aom_dep = aom_proj.dependency('aom')
meson.override_dependency('aom', aom_dep)
"@
$projects = @(
@{
Path = "$subprojects/ffmpeg.wrap"
URL = "https://gitlab.freedesktop.org/gstreamer/meson-ports/ffmpeg.git"
Revision = "meson-7.1"
Revision = "meson-8.0"
Provides = @(
"libavcodec = libavcodec_dep",
"libavdevice = libavdevice_dep",
"libavfilter = libavfilter_dep",
"libavformat = libavformat_dep",
"libavutil = libavutil_dep",
"libswresample = libswresample_dep",
"libswscale = libswscale_dep"
"dependency_names = libavcodec, libavdevice, libavfilter, libavformat, libavutil, libswresample, libswscale"
"program_names = ffmpeg"
)
},
@{
@@ -178,6 +198,11 @@ $projects = @(
Path = "$subprojects/libjxl-cmake.wrap"
URL = "https://github.com/libjxl/libjxl"
Revision = "main"
},
@{
Path = "$subprojects/aom-cmake.wrap"
URL = "https://aomedia.googlesource.com/aom"
Revision = "main"
}
)
@@ -207,21 +232,23 @@ meson setup build `
-Dgpl=true `
-Dffmpeg:gpl=enabled `
-Dffmpeg:tests=enabled `
-Dffmpeg:programs=disabled `
-Dffmpeg:programs=enabled `
-Dffmpeg:sdl2=disabled `
-Dffmpeg:vulkan=auto `
-Dffmpeg:libdav1d=enabled `
-Dffmpeg:libjxl=enabled `
-Dffmpeg:libaom=enabled `
-Dlcms2:fastfloat=true `
-Dlcms2:jpeg=disabled `
-Dlcms2:tiff=disabled `
-Dlibass:test=enabled `
-Dlibjpeg-turbo:tests=disabled `
-Dlibusb:tests=false `
-Dlibusb:examples=false `
-Dlibplacebo:demos=false `
-Dlibplacebo:lcms=enabled `
-Dlibplacebo:shaderc=enabled `
-Dlibplacebo:tests=true `
-Dlibplacebo:tests=false `
-Dlibplacebo:vulkan=enabled `
-Dlibplacebo:d3d11=enabled `
-Dxxhash:inline-all=true `
@@ -239,4 +266,5 @@ meson setup build `
-Dx11=disabled
ninja -C build mpv.exe mpv.com libmpv.a
cp ./build/subprojects/vulkan-loader/vulkan.dll ./build/vulkan-1.dll
cp ./etc/mpv-*.bat ./build
./build/mpv.com -v --no-config
+16
View File
@@ -0,0 +1,16 @@
param(
[string]$arch,
[string]$version = "4.0.2"
)
if ($arch -eq "x64") {
$arch = "x86_64"
}
$cmake_fullname = "cmake-$version-windows-$arch"
$cmake_url = "https://github.com/Kitware/CMake/releases/download/v$version/$cmake_fullname.zip"
Invoke-WebRequest $cmake_url -OutFile .\$cmake_fullname.zip
Expand-Archive -Path .\$cmake_fullname.zip -DestinationPath .\ -Force
Rename-Item -Path .\$cmake_fullname -NewName cmake
+1 -2
View File
@@ -5,7 +5,6 @@ import re
import subprocess
import sys
from collections.abc import Callable
from typing import Optional
def call(cmd) -> str:
@@ -22,7 +21,7 @@ def lint_rule(description: str):
lint_rules[func.__name__] = (func, description)
return f
def get_commit_range() -> Optional[str]:
def get_commit_range() -> str | None:
if len(sys.argv) > 1:
return sys.argv[1]
# https://github.com/actions/runner/issues/342#issuecomment-590670059
+1 -1
View File
@@ -340,7 +340,7 @@ static void resolve_positional_arg(void *avobj, char **name)
char *end = NULL;
int pos = strtol(*name + 1, &end, 10);
if (!end || *end)
if (!end || *end || pos < 0)
return;
const AVOption *opt = NULL;
+11 -2
View File
@@ -91,6 +91,15 @@ enum video_sync {
VS_NONE,
};
enum track_flags {
// starts at 4, for cmd_track_add backwards compatibility
TRACK_HEARING_IMPAIRED = 1 << 2,
TRACK_VISUAL_IMPAIRED = 1 << 3,
TRACK_ATTACHED_PICTURE = 1 << 4,
TRACK_FORCED = 1 << 5,
TRACK_DEFAULT = 1 << 6,
};
#define VS_IS_DISP(x) ((x) == VS_DISP_RESAMPLE || \
(x) == VS_DISP_RESAMPLE_VDROP || \
(x) == VS_DISP_RESAMPLE_NONE || \
@@ -133,7 +142,7 @@ uint32_t mp_round_next_power_of_2(uint32_t v);
int mp_lcm(int x, int y);
int mp_snprintf_cat(char *str, size_t size, const char *format, ...)
PRINTF_ATTRIBUTE(3, 4);
MP_PRINTF_ATTRIBUTE(3, 4);
struct bstr;
@@ -156,7 +165,7 @@ char *mp_tag_str_buf(char *buf, size_t buf_size, uint32_t tag);
#define mp_tprintf(SIZE, format, ...) \
mp_tprintf_buf((char[SIZE]){0}, (SIZE), (format), __VA_ARGS__)
char *mp_tprintf_buf(char *buf, size_t buf_size, const char *format, ...)
PRINTF_ATTRIBUTE(3, 4);
MP_PRINTF_ATTRIBUTE(3, 4);
char **mp_dup_str_array(void *tctx, char **s);
+3 -17
View File
@@ -70,8 +70,6 @@ struct mux_stream {
enum AVMediaType codec_type;
AVRational encoder_timebase; // packet timestamps from encoder
AVStream *st;
void (*on_ready)(void *ctx); // when finishing muxer init
void *on_ready_ctx;
};
#define OPT_BASE_STRUCT struct encode_opts
@@ -277,13 +275,6 @@ static void maybe_init_muxer(struct encode_lavc_context *ctx)
p->header_written = true;
for (int n = 0; n < p->num_streams; n++) {
struct mux_stream *s = p->streams[n];
if (s->on_ready)
s->on_ready(s->on_ready_ctx);
}
return;
failed:
@@ -342,9 +333,7 @@ done:
// Can be called only once per stream. info is copied by callee as needed.
static void encode_lavc_add_stream(struct encoder_context *enc,
struct encode_lavc_context *ctx,
struct encoder_stream_info *info,
void (*on_ready)(void *ctx),
void *on_ready_ctx)
struct encoder_stream_info *info)
{
struct encode_priv *p = ctx->priv;
@@ -377,8 +366,6 @@ static void encode_lavc_add_stream(struct encoder_context *enc,
if (avcodec_parameters_copy(dst->st->codecpar, info->codecpar) < 0)
MP_HANDLE_OOM(NULL);
dst->on_ready = on_ready;
dst->on_ready_ctx = on_ready_ctx;
enc->mux_stream = dst;
maybe_init_muxer(ctx);
@@ -839,8 +826,7 @@ static void encoder_2pass_prepare(struct encoder_context *p)
talloc_free(filename);
}
bool encoder_init_codec_and_muxer(struct encoder_context *p,
void (*on_ready)(void *ctx), void *ctx)
bool encoder_init_codec_and_muxer(struct encoder_context *p)
{
mp_assert(!avcodec_is_open(p->encoder));
@@ -896,7 +882,7 @@ bool encoder_init_codec_and_muxer(struct encoder_context *p,
p->pkt = av_packet_alloc();
MP_HANDLE_OOM(p->pkt);
encode_lavc_add_stream(p, p->encode_lavc_ctx, &p->info, on_ready, ctx);
encode_lavc_add_stream(p, p->encode_lavc_ctx, &p->info);
if (!p->mux_stream)
goto fail;
+2 -8
View File
@@ -97,18 +97,12 @@ struct encoder_context *encoder_context_alloc(struct encode_lavc_context *ctx,
// After setting your codec parameters on p->encoder, you call this to "open"
// the encoder. This also initializes p->mux_stream. Returns false on failure.
// on_ready is called as soon as the muxer has been initialized. Then you are
// allowed to write packets with encoder_encode().
// Warning: the on_ready callback is called asynchronously, so you need to
// make sure to properly synchronize everything.
bool encoder_init_codec_and_muxer(struct encoder_context *p,
void (*on_ready)(void *ctx), void *ctx);
bool encoder_init_codec_and_muxer(struct encoder_context *p);
// Encode the frame and write the packet. frame is ref'ed as need.
bool encoder_encode(struct encoder_context *p, AVFrame *frame);
// Return muxer timebase (only available after on_ready() has been called).
// Caller needs to acquire encode_lavc_context.lock (or call it from on_ready).
// Return muxer timebase (only available if p->mux_stream is initialized).
AVRational encoder_get_mux_timebase_unlocked(struct encoder_context *p);
void encoder_update_log(struct mpv_global *global);
+5 -3
View File
@@ -25,7 +25,9 @@
#include "osdep/compiler.h"
#define TERM_MSG_0 "\xFC"
// Escape code for TERM_MSG codes. PU2 (U+0092) followed by 't'.
#define TERM_MSG_ESCAPE "\xC2\x92" "t"
#define TERM_MSG_0 TERM_MSG_ESCAPE "0"
struct mp_log;
@@ -52,9 +54,9 @@ struct mp_log *mp_log_new(void *talloc_ctx, struct mp_log *parent,
const char *name);
void mp_msg(struct mp_log *log, int lev, const char *format, ...)
PRINTF_ATTRIBUTE(3, 4);
MP_PRINTF_ATTRIBUTE(3, 4);
void mp_msg_va(struct mp_log *log, int lev, const char *format, va_list va)
PRINTF_ATTRIBUTE(3, 0);
MP_PRINTF_ATTRIBUTE(3, 0);
int mp_msg_level(struct mp_log *log);
+3 -2
View File
@@ -170,9 +170,10 @@ void playlist_shuffle(struct playlist *pl)
{
for (int n = 0; n < pl->num_entries; n++)
pl->entries[n]->original_index = n;
mp_rand_state s = mp_rand_seed(0);
for (int n = 0; n < pl->num_entries - 1; n++) {
size_t j = (size_t)((pl->num_entries - n) * mp_rand_next_double());
MPSWAP(struct playlist_entry *, pl->entries[n], pl->entries[n + j]);
size_t j = mp_rand_in_range32(&s, n, pl->num_entries);
MPSWAP(struct playlist_entry *, pl->entries[n], pl->entries[j]);
}
playlist_update_indexes(pl, 0, -1);
}
+2
View File
@@ -116,6 +116,7 @@ struct demux_cache *demux_cache_create(struct mpv_global *global,
mp_mkdirp(cache_dir);
cache->filename = mp_path_join(cache, cache_dir, "mpv-cache-XXXXXX.dat");
cache->fd = mp_mkostemps(cache->filename, 4, O_CLOEXEC);
talloc_free(cache_dir);
if (cache->fd < 0) {
MP_ERR(cache, "Failed to create cache temporary file.\n");
goto fail;
@@ -216,6 +217,7 @@ int64_t demux_cache_write(struct demux_cache *cache, struct demux_packet *dp)
}
mp_assert(!dp->is_cached);
mp_assert(!dp->is_wrapped_avframe);
mp_assert(dp->len <= INT32_MAX);
mp_assert(dp->avpacket->flags >= 0 && dp->avpacket->flags <= INT32_MAX);
mp_assert(dp->avpacket->side_data_elems >= 0 &&
+3
View File
@@ -59,6 +59,7 @@ static const struct {
{ CUE_UNUSED, "REM" },
{ CUE_UNUSED, "SONGWRITER" },
{ CUE_UNUSED, "MESSAGE" },
{ CUE_UNUSED, "MCN" },
{ -1 },
};
@@ -258,6 +259,8 @@ struct cue_file *mp_parse_cue(struct bstr data)
int mp_check_embedded_cue(struct cue_file *f)
{
if (f->num_tracks == 0)
return -1;
char *fn0 = f->tracks[0].filename;
for (int n = 1; n < f->num_tracks; n++) {
char *fn = f->tracks[n].filename;
+16 -3
View File
@@ -2047,7 +2047,7 @@ static void add_packet_locked(struct sh_stream *stream, demux_packet_t *dp)
record_packet(in, dp);
if (in->cache && in->d_user->opts->disk_cache) {
if (in->cache && in->d_user->opts->disk_cache && !dp->is_wrapped_avframe) {
int64_t pos = demux_cache_write(in->cache, dp);
if (pos >= 0) {
demux_packet_unref_contents(dp);
@@ -2519,8 +2519,14 @@ static void update_opts(struct demuxer *demuxer)
// Make demuxing progress. Return whether progress was made.
static bool thread_work(struct demux_internal *in)
{
if (m_config_cache_update(in->d_user->opts_cache))
struct demux_opts *opts = in->d_user->opts;
size_t old_max_bytes = opts->max_bytes;
size_t old_max_bytes_bw = opts->max_bytes_bw;
if (m_config_cache_update(in->d_user->opts_cache)) {
update_opts(in->d_user);
if (opts->max_bytes + opts->max_bytes_bw < old_max_bytes + old_max_bytes_bw)
demux_packet_pool_clear(in->packet_pool);
}
if (in->tracks_switched) {
execute_trackswitch(in);
return true;
@@ -3188,7 +3194,7 @@ static void demux_init_cuesheet(struct demuxer *demuxer)
struct cue_file *f = mp_parse_cue(bstr0(cue));
if (f) {
if (mp_check_embedded_cue(f) < 0) {
MP_WARN(demuxer, "Embedded cue sheet references more than one file. "
MP_WARN(demuxer, "Embedded cue sheet references zero or multiple files. "
"Ignoring it.\n");
} else {
for (int n = 0; n < f->num_tracks; n++) {
@@ -3268,6 +3274,11 @@ static struct demuxer *open_given_type(struct mpv_global *global,
if (mp_cancel_test(sinfo->cancel))
return NULL;
if (params && params->depth > 10) {
mp_err(log, "Demuxer recursion depth exceeded.\n");
return NULL;
}
struct demuxer *demuxer = talloc_ptrtype(NULL, demuxer);
struct m_config_cache *opts_cache =
m_config_cache_alloc(demuxer, global, &demux_conf);
@@ -3291,6 +3302,7 @@ static struct demuxer *open_given_type(struct mpv_global *global,
.opts_cache = opts_cache,
.events = DEMUX_EVENT_ALL,
.duration = -1,
.depth = params ? params->depth : 0,
};
struct demux_internal *in = demuxer->in = talloc_ptrtype(demuxer, in);
@@ -3355,6 +3367,7 @@ static struct demuxer *open_given_type(struct mpv_global *global,
params2.timeline = tl;
params2.is_top_level = params && params->is_top_level;
params2.stream_record = params && params->stream_record;
params2.depth = params ? params->depth + 1 : 0;
sub =
open_given_type(global, log, &demuxer_desc_timeline,
NULL, sinfo, &params2, DEMUX_CHECK_FORCE);
+3
View File
@@ -200,6 +200,8 @@ typedef struct demux_attachment
struct demuxer_params {
bool is_top_level; // if true, it's not a sub-demuxer (enables cache etc.)
int depth; // depth of the demuxer tree, 0 for top-level, each
// nested demuxer increases depth by 1
char *force_format;
int matroska_num_wanted_uids;
struct matroska_segment_uid *matroska_wanted_uids;
@@ -238,6 +240,7 @@ typedef struct demuxer {
bool is_streaming; // implies a "slow" input, such as network or FUSE
int stream_origin; // any STREAM_ORIGIN_* (set from source stream)
bool access_references; // allow opening other files/URLs
int depth; // demuxer depth, 0 for top-level
struct demux_opts *opts;
struct m_config_cache *opts_cache;
+1
View File
@@ -62,6 +62,7 @@ static bool try_open(struct timeline *tl, char *filename)
struct demuxer_params p = {
.stream_flags = tl->stream_origin,
.depth = tl->demuxer ? tl->demuxer->depth + 1 : 0,
};
struct demuxer *d = demux_open_url(filename, &p, tl->cancel, tl->global);
+1
View File
@@ -320,6 +320,7 @@ static int d_open(demuxer_t *demuxer, enum demux_check check)
.force_format = "+lavf",
.external_stream = demuxer->stream,
.stream_flags = demuxer->stream_origin,
.depth = demuxer->depth + 1,
};
struct stream *cur = demuxer->stream;
+10
View File
@@ -320,11 +320,19 @@ static struct tl_root *parse_edl(bstr str, struct mp_log *log)
}
}
mp_assert(root->num_pars);
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
if (root->num_pars > 3)
goto error;
#endif
for (int n = 0; n < root->num_pars; n++) {
if (root->pars[n]->num_parts < 1) {
mp_err(log, "EDL specifies no segments.'\n");
goto error;
}
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
if (root->pars[n]->num_parts > 3)
goto error;
#endif
}
return root;
error:
@@ -344,6 +352,7 @@ static struct demuxer *open_source(struct timeline *root,
struct demuxer_params params = {
.init_fragment = tl->init_fragment,
.stream_flags = root->stream_origin,
.depth = root->demuxer->depth + 1,
};
struct demuxer *d = demux_open_url(filename, &params, root->cancel,
root->global);
@@ -435,6 +444,7 @@ static struct timeline_par *build_timeline(struct timeline *root,
struct demuxer_params params = {
.init_fragment = tl->init_fragment,
.stream_flags = root->stream_origin,
.depth = root->demuxer->depth + 1,
};
tl->track_layout = demux_open_url("memory://", &params, root->cancel,
root->global);
+13 -9
View File
@@ -94,7 +94,9 @@ const struct m_sub_options demux_lavf_conf = {
{"demuxer-lavf-probescore", OPT_INT(probescore),
M_RANGE(1, AVPROBE_SCORE_MAX)},
{"demuxer-lavf-hacks", OPT_BOOL(hacks)},
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
{"demuxer-lavf-o", OPT_KEYVALUELIST(avopts)},
#endif
{"sub-codepage", OPT_STRING(sub_cp)},
{"rtsp-transport", OPT_CHOICE(rtsp_transport,
{"lavf", 0},
@@ -203,9 +205,6 @@ static const struct format_hack format_hacks[] = {
// Useless non-sense, sometimes breaks MLP2 subreader.c fallback
BLACKLIST("tty"),
// Let's open files with extremely generic extensions (.bin) with a
// demuxer that doesn't have a probe function! NO.
BLACKLIST("bin"),
// Useless, does not work with custom streams.
BLACKLIST("image2"),
{0}
@@ -911,6 +910,7 @@ static int block_io_open(struct AVFormatContext *s, AVIOContext **pb,
const char *url, int flags, AVDictionary **options)
{
struct demuxer *demuxer = s->opaque;
mp_require(demuxer);
MP_ERR(demuxer, "Not opening '%s' due to --access-references=no.\n", url);
return AVERROR(EACCES);
}
@@ -919,6 +919,7 @@ static int nested_io_open(struct AVFormatContext *s, AVIOContext **pb,
const char *url, int flags, AVDictionary **options)
{
struct demuxer *demuxer = s->opaque;
mp_require(demuxer);
lavf_priv_t *priv = demuxer->priv;
if (options && priv->opts->propagate_opts) {
@@ -953,6 +954,7 @@ static int nested_io_open(struct AVFormatContext *s, AVIOContext **pb,
static int nested_io_close2(struct AVFormatContext *s, AVIOContext *pb)
{
struct demuxer *demuxer = s->opaque;
mp_require(demuxer);
lavf_priv_t *priv = demuxer->priv;
for (int n = 0; n < priv->num_nested; n++) {
@@ -1214,11 +1216,12 @@ static bool demux_lavf_read_packet(struct demuxer *demux,
{
lavf_priv_t *priv = demux->priv;
AVPacket *pkt = &(AVPacket){0};
AVPacket *pkt = av_packet_alloc();
MP_HANDLE_OOM(pkt);
int r = av_read_frame(priv->avfc, pkt);
update_read_stats(demux);
if (r < 0) {
av_packet_unref(pkt);
av_packet_free(&pkt);
if (r == AVERROR_EOF)
return false;
MP_WARN(demux, "error reading packet: %s.\n", av_err2str(r));
@@ -1240,19 +1243,19 @@ static bool demux_lavf_read_packet(struct demuxer *demux,
AVStream *st = priv->avfc->streams[pkt->stream_index];
if (!demux_stream_is_selected(stream)) {
av_packet_unref(pkt);
av_packet_free(&pkt);
return true; // don't signal EOF if skipping a packet
}
// Never send additional frames for streams that are a single frame.
if (stream->image && priv->format_hack.first_frame_only && pkt->pos != 0) {
av_packet_unref(pkt);
av_packet_free(&pkt);
return true;
}
struct demux_packet *dp = new_demux_packet_from_avpacket(demux->packet_pool, pkt);
if (!dp) {
av_packet_unref(pkt);
av_packet_free(&pkt);
return true;
}
@@ -1264,7 +1267,8 @@ static bool demux_lavf_read_packet(struct demuxer *demux,
dp->duration = pkt->duration * av_q2d(st->time_base);
dp->pos = pkt->pos;
dp->keyframe = pkt->flags & AV_PKT_FLAG_KEY;
av_packet_unref(pkt);
dp->is_wrapped_avframe = st->codecpar->codec_id == AV_CODEC_ID_WRAPPED_AVFRAME;
av_packet_free(&pkt);
if (priv->format_hack.clear_filepos)
dp->pos = -1;
+4 -2
View File
@@ -20,9 +20,10 @@
#include "common/common.h"
#include "common/playlist.h"
#include "misc/natural_sort.h"
#include "misc/path_utils.h"
#include "options/m_config.h"
#include "stream/stream.h"
#include "misc/natural_sort.h"
#include "demux.h"
#include "stream/stream_libarchive.h"
@@ -75,7 +76,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check)
struct playlist *pl = talloc_zero(demuxer, struct playlist);
demuxer->playlist = pl;
char *prefix = mp_url_escape(mpa, demuxer->stream->url, "~|");
char *prefix = mp_url_escape(NULL, mp_normalize_path(mpa, demuxer->stream->url), "~|%");
char **files = NULL;
int num_files = 0;
@@ -86,6 +87,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check)
mpa->entry_filename);
MP_TARRAY_APPEND(mpa, files, num_files, f);
}
talloc_free(prefix);
if (files)
qsort(files, num_files, sizeof(files[0]), cmp_filename);
+18 -4
View File
@@ -129,6 +129,8 @@ typedef struct mkv_track {
int default_track;
int forced_track;
int visual_impaired_track;
int hearing_impaired_track;
unsigned char *private_data;
unsigned int private_size;
@@ -746,7 +748,7 @@ static void parse_trackvideo(struct demuxer *demuxer, struct mkv_track *track,
MP_DBG(demuxer, "| + Colorspace: %#"PRIx32"\n", track->colorspace);
}
if (video->n_stereo_mode) {
const char *name = MP_STEREO3D_NAME(video->stereo_mode);
const char *name = MP_STEREO3D_NAME_DEF(video->stereo_mode, NULL);
if (name) {
track->stereo_mode = video->stereo_mode;
MP_DBG(demuxer, "| + StereoMode: %s\n", name);
@@ -952,6 +954,16 @@ static void parse_trackentry(struct demuxer *demuxer,
MP_DBG(demuxer, "| + Forced flag: %d\n", track->forced_track);
}
if (entry->n_flag_visual_impaired) {
track->visual_impaired_track = entry->flag_visual_impaired;
MP_DBG(demuxer, "| + Visual-Impaired flag: %d\n", track->visual_impaired_track);
}
if (entry->n_flag_hearing_impaired) {
track->hearing_impaired_track = entry->flag_hearing_impaired;
MP_DBG(demuxer, "| + Hearing-Impaired flag: %d\n", track->hearing_impaired_track);
}
if (entry->n_default_duration) {
track->default_duration = entry->default_duration / 1e9;
if (entry->default_duration == 0) {
@@ -1538,6 +1550,8 @@ static void init_track(demuxer_t *demuxer, mkv_track_t *track,
sh->title = track->name;
sh->default_track = track->default_track;
sh->forced_track = track->forced_track;
sh->visual_impaired_track = track->visual_impaired_track;
sh->hearing_impaired_track = track->hearing_impaired_track;
}
static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track);
@@ -2200,16 +2214,16 @@ static int demux_mkv_open_sub(demuxer_t *demuxer, mkv_track_t *track)
// [0x30..0x37] are component tags utilized for
// non-mobile captioning service ("profile A").
if (component_tag >= 0x30 && component_tag <= 0x37)
lav->profile = FF_PROFILE_ARIB_PROFILE_A;
lav->profile = AV_PROFILE_ARIB_PROFILE_A;
break;
case 0x0012:
// component tag 0x87 signifies a mobile/partial reception
// (1seg) captioning service ("profile C").
if (component_tag == 0x87)
lav->profile = FF_PROFILE_ARIB_PROFILE_C;
lav->profile = AV_PROFILE_ARIB_PROFILE_C;
break;
}
if (lav->profile == FF_PROFILE_UNKNOWN)
if (lav->profile == AV_PROFILE_UNKNOWN)
MP_WARN(demuxer, "ARIB caption profile %02x / %04x not supported.\n",
component_tag, data_component_id);
}
+1
View File
@@ -170,6 +170,7 @@ static bool check_file_seg(struct tl_ctx *ctx, char *filename, int segment)
.matroska_was_valid = &was_valid,
.disable_timeline = true,
.stream_flags = ctx->tl->stream_origin,
.depth = ctx->demuxer->depth + 1,
};
struct mp_cancel *cancel = ctx->tl->cancel;
if (mp_cancel_test(cancel))
+1
View File
@@ -30,6 +30,7 @@ static int open_mpv(struct demuxer *demuxer, enum demux_check check)
return -1;
demuxer->playlist = talloc_zero(demuxer, struct playlist);
mp_url_unescape_inplace(s->path);
playlist_append_file(demuxer->playlist, s->path);
playlist_set_stream_flags(demuxer->playlist, demuxer->stream_origin);
demuxer->fully_read = true;
+5 -2
View File
@@ -106,7 +106,7 @@ struct pl_parser {
int autocreate_playlist;
enum demux_check check_level;
struct stream *real_stream;
char *format;
const char *format;
char *codepage;
struct demux_playlist_opts *opts;
struct MPOpts *mp_opts;
@@ -277,6 +277,8 @@ ok:
title = bstrto0(NULL, btitle);
}
} else if (bstr_startswith0(line_dup, "#EXT-X-")) {
// Note that this is only used for user advice. Actual HLS demuxing
// must happen through demux_lavf.
p->format = "hls";
} else if (line_dup.len > 0 && !bstr_startswith0(line_dup, "#")) {
char *fn = bstrto0(NULL, line_dup);
@@ -700,7 +702,8 @@ static int open_file(struct demuxer *demuxer, enum demux_check check)
bstr proto = mp_split_proto(bstr0(demuxer->filename), NULL);
// Don't add base path to self-expanding protocols
if (bstrcasecmp0(proto, "memory") && bstrcasecmp0(proto, "lavf") &&
bstrcasecmp0(proto, "hex") && bstrcasecmp0(proto, "data"))
bstrcasecmp0(proto, "hex") && bstrcasecmp0(proto, "data") &&
bstrcasecmp0(proto, "fd"))
{
playlist_add_base_path(p->pl, mp_dirname(demuxer->filename));
}
+1
View File
@@ -218,6 +218,7 @@ static void reopen_lazy_segments(struct demuxer *demuxer,
.init_fragment = src->tl->init_fragment,
.skip_lavf_probing = src->tl->dash,
.stream_flags = demuxer->stream_origin,
.depth = demuxer->depth + 1,
};
src->current->d = demux_open_url(src->current->url, &params,
demuxer->cancel, demuxer->global);
+28
View File
@@ -22,6 +22,7 @@
#include <libavcodec/avcodec.h>
#include <libavutil/hdr_dynamic_metadata.h>
#include <libavutil/imgutils.h>
#include <libavutil/intreadwrite.h>
#include "common/av_common.h"
@@ -43,6 +44,7 @@ void demux_packet_unref_contents(struct demux_packet *dp)
av_packet_free(&dp->avpacket);
dp->buffer = NULL;
dp->len = 0;
dp->is_wrapped_avframe = false;
}
}
@@ -166,6 +168,7 @@ void demux_packet_copy_attribs(struct demux_packet *dst, struct demux_packet *sr
dst->dts = src->dts;
dst->duration = src->duration;
dst->pos = src->pos;
dst->is_wrapped_avframe = src->is_wrapped_avframe;
dst->segmented = src->segmented;
dst->start = src->start;
dst->end = src->end;
@@ -209,6 +212,31 @@ size_t demux_packet_estimate_total_size(struct demux_packet *dp)
if (dp->avpacket) {
mp_assert(!dp->is_cached);
size += ROUND_ALLOC(dp->len);
if (dp->is_wrapped_avframe) {
mp_require(dp->buffer);
const AVFrame *frame = (AVFrame *)dp->buffer;
if (frame->hw_frames_ctx) {
const AVHWFramesContext *hwctx = (AVHWFramesContext *)frame->hw_frames_ctx->data;
int r = av_image_get_buffer_size(hwctx->sw_format, hwctx->width, hwctx->height, 16);
mp_require(r >= 0);
size += ROUND_ALLOC(r);
}
for (int i = 0; i < MP_ARRAY_SIZE(frame->buf) && frame->buf[i]; ++i)
size += ROUND_ALLOC(frame->buf[i]->size);
size += ROUND_ALLOC(frame->nb_extended_buf * sizeof(frame->extended_buf[0]));
for (int i = 0; i < frame->nb_extended_buf; ++i) {
size += ROUND_ALLOC(sizeof(*frame->extended_buf[i]));
size += ROUND_ALLOC(frame->extended_buf[i]->size);
}
size += ROUND_ALLOC(frame->nb_side_data * sizeof(frame->side_data[0]));
for (int i = 0; i < frame->nb_side_data; ++i) {
size += ROUND_ALLOC(sizeof(*frame->side_data[i]));
size += ROUND_ALLOC(frame->side_data[i]->size);
}
}
size += ROUND_ALLOC(sizeof(AVPacket));
size += 8 * sizeof(void *); // ta overhead
size += ROUND_ALLOC(sizeof(AVBufferRef));
+3
View File
@@ -53,6 +53,9 @@ typedef struct demux_packet {
// If true, cached_data is valid, while buffer/len are not.
bool is_cached : 1;
// If true, this is a wrapped AVFrame
bool is_wrapped_avframe : 1;
// segmentation (ordered chapters, EDL)
bool segmented;
struct mp_codec_params *codec; // set to non-NULL iff segmented is set
+2
View File
@@ -85,6 +85,8 @@ osd-outline-size=0
osd-shadow-offset=4
script-opt=console-border_size=0
script-opt=console-corner_radius=0
script-opt=context_menu-padding_y=0
script-opt=context_menu-corner_radius=0
script-opt=stats-border_size=0
[sub-box]
+3 -4
View File
@@ -6,10 +6,9 @@
# encoding profile file #
#########################
#
# Note: by default, this file is installed to /etc/mpv/encoding-profiles.conf
# (or a different location, depending on --prefix). mpv will load it by
# default on program start. If ~/.mpv/encoding-profiles.conf exists, this file
# will be loaded instead.
# Note: This file contains predefined encoding-related profiles that were
# installed and loaded by default in old versions of mpv. Consider this a
# historical reference.
#
# Then, list all profiles by
# mpv --profile=help | grep enc-
+12
View File
@@ -0,0 +1,12 @@
@echo off
setlocal
"%~dp0/mpv" --register
if %errorlevel% neq 0 (
echo Registration failed. Make sure mpv is in the same folder as this script.
pause
exit /b %errorlevel%
)
pause
endlocal
+12
View File
@@ -0,0 +1,12 @@
@echo off
setlocal
"%~dp0/mpv" --unregister
if %errorlevel% neq 0 (
echo Deregistration failed. Make sure mpv is in the same folder as this script.
pause
exit /b %errorlevel%
)
pause
endlocal
+1 -1
View File
@@ -140,4 +140,4 @@
# The following profile can be enabled on the command line with: --profile=eye-cancer
#[eye-cancer]
#sharpen=5
#gamma=100
+121
View File
@@ -332,6 +332,127 @@ struct mp_filter *mp_autorotate_create(struct mp_filter *parent)
return f;
}
struct vflip_priv {
struct mp_subfilter sub;
int prev_vflip;
int prev_imgfmt;
int target_vflip;
};
static void vflip_process(struct mp_filter *f)
{
struct vflip_priv *p = f->priv;
if (!mp_subfilter_read(&p->sub))
return;
struct mp_frame frame = p->sub.frame;
if (mp_frame_is_signaling(frame)) {
mp_subfilter_continue(&p->sub);
return;
}
if (frame.type != MP_FRAME_VIDEO) {
MP_ERR(f, "video input required!\n");
return;
}
struct mp_image *img = frame.data;
if (img->params.vflip == p->prev_vflip &&
img->imgfmt == p->prev_imgfmt)
{
img->params.vflip = p->target_vflip;
mp_subfilter_continue(&p->sub);
return;
}
if (!mp_subfilter_drain_destroy(&p->sub))
return;
mp_assert(!p->sub.filter);
int vflip = p->prev_vflip = img->params.vflip;
p->target_vflip = vflip;
p->prev_imgfmt = img->imgfmt;
struct mp_stream_info *info = mp_filter_find_stream_info(f);
if (!vflip || (info && info->vflip)) {
mp_subfilter_continue(&p->sub);
return;
}
if (!mp_sws_supports_input(img->imgfmt)) {
MP_ERR(f, "Video vflip with this format not supported\n");
mp_subfilter_continue(&p->sub);
return;
}
char *args[] = {NULL};
p->sub.filter = mp_create_user_filter(f, MP_OUTPUT_CHAIN_VIDEO, "vflip", args);
if (p->sub.filter) {
MP_INFO(f, "Inserting vflip filter.\n");
p->target_vflip = 0;
} else {
MP_ERR(f, "could not create vflip filter\n");
}
mp_subfilter_continue(&p->sub);
}
static void vflip_reset(struct mp_filter *f)
{
struct vflip_priv *p = f->priv;
mp_subfilter_reset(&p->sub);
}
static void vflip_destroy(struct mp_filter *f)
{
struct vflip_priv *p = f->priv;
mp_subfilter_reset(&p->sub);
TA_FREEP(&p->sub.filter);
}
static bool vflip_command(struct mp_filter *f, struct mp_filter_command *cmd)
{
struct vflip_priv *p = f->priv;
if (cmd->type == MP_FILTER_COMMAND_IS_ACTIVE) {
cmd->is_active = !!p->sub.filter;
return true;
}
return false;
}
static const struct mp_filter_info vflip_filter = {
.name = "autovflip",
.priv_size = sizeof(struct vflip_priv),
.command = vflip_command,
.process = vflip_process,
.reset = vflip_reset,
.destroy = vflip_destroy,
};
struct mp_filter *mp_autovflip_create(struct mp_filter *parent)
{
struct mp_filter *f = mp_filter_create(parent, &vflip_filter);
if (!f)
return NULL;
struct vflip_priv *p = f->priv;
p->prev_vflip = -1;
p->sub.in = mp_filter_add_pin(f, MP_PIN_IN, "in");
p->sub.out = mp_filter_add_pin(f, MP_PIN_OUT, "out");
return f;
}
struct aspeed_priv {
struct mp_subfilter sub;
double cur_speed, cur_speed_drop;
+3
View File
@@ -6,6 +6,9 @@
// hardware decode mode and the deinterlace user option.
struct mp_filter *mp_deint_create(struct mp_filter *parent);
// Flip according to mp_image.vflip
struct mp_filter *mp_autovflip_create(struct mp_filter *parent);
// Rotate according to mp_image.rotate and VO capabilities.
struct mp_filter *mp_autorotate_create(struct mp_filter *parent);
+1
View File
@@ -121,6 +121,7 @@ const struct m_sub_options dec_wrapper_conf = {
.flags = UPDATE_VD,
.help = decoder_list_help},
{"audio-spdif", OPT_STRING(audio_spdif),
.flags = UPDATE_AD,
.help = decoder_list_help},
{"video-rotate", OPT_CHOICE(video_rotate, {"no", -1}),
.flags = UPDATE_IMGPAR, M_RANGE(0, 359)},
-1
View File
@@ -654,7 +654,6 @@ static void hwdownload_process(struct mp_filter *f)
passthrough:
mp_pin_in_write(f->ppins[1], frame);
return;
}
static const struct mp_filter_info hwdownload_filter = {
-1
View File
@@ -311,7 +311,6 @@ static void precreate_graph(struct lavfi *c, bool first_init)
error:
free_graph(c);
c->failed = true;
return;
}
// Ensure to send EOF to each input pad, so the graph can be drained properly.
Loaded 100 of 288 files, more files were not shown because too many files have changed in this diff. Show more