Compare commits

..
1011 Commits
Author SHA1 Message Date
Kacper Michajłow 182fa6ca49 player/discnav: allow window dragging on menu
lint / commit-msg (push) Has been cancelled
lint / swift (push) Has been cancelled
lint / lua (push) Has been cancelled
lint / ruff (push) Has been cancelled
lint / mypy (push) Has been cancelled
lint / editorconfig (push) Has been cancelled
lint / pre-commit (push) Has been cancelled
build / mingw (i686, wine32) (push) Has been cancelled
build / mingw (x86_64, wine64) (push) Has been cancelled
build / win32 (arm64, windows-11-arm, aarch64-pc-windows-msvc) (push) Has been cancelled
build / win32 (x64, windows-2025-vs2026, x86_64-pc-windows-msvc) (push) Has been cancelled
build / macos (arm, macos-14, Xcode_15.0) (push) Has been cancelled
build / macos (arm, macos-15) (push) Has been cancelled
build / macos (arm, macos-26) (push) Has been cancelled
build / macos (macos-15-intel) (push) Has been cancelled
build / macos (test, macos-26, -target arm64-apple-macosx10.15, 10.15) (push) Has been cancelled
build / linux (map[args:-Db_lto=true -Db_lto_mode=thin cc:clang cxx:clang++ ld:lld]) (push) Has been cancelled
build / linux (map[args:-Db_ndebug=true cc:gcc cxx:g++]) (push) Has been cancelled
build / linux-fuzz (push) Has been cancelled
build / linux-ffmpeg-6-1 (push) Has been cancelled
build / openbsd (push) Has been cancelled
build / freebsd (push) Has been cancelled
build / msys2 (pattern, windows-2025-vs2026, clang64) (push) Has been cancelled
build / msys2 (true, windows-2025-vs2026, clang64) (push) Has been cancelled
build / msys2 (uninitialized, windows-2025-vs2026, clang64) (push) Has been cancelled
build / msys2 (windows-11-arm, clangarm64) (push) Has been cancelled
build / msys2 (windows-2025-vs2026, mingw64) (push) Has been cancelled
build / msys2 (windows-2025-vs2026, ucrt64) (push) Has been cancelled
build / msys2 (zero, windows-2025-vs2026, clang64) (push) Has been cancelled
build / Publish git release (push) Has been cancelled
2026-08-26 18:04:17 +02:00
Kacper Michajłow c318236b88 player: drop the enhancement-layer pairing when the media has no EL 2026-08-26 01:47:41 +02:00
Kacper Michajłow e1cf77c0e9 stream_dvdnav: clamp number of buttons to array size
libdvdread doesn't sanitize this value, so we do for corrupted discs.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 93451ef64f demux_disc: mark streams the current program does not carry
The outer streams live for as long as the disc does, but each program
brings its own set. Playing a BD playlist without the Dolby Vision
enhancement layer left the outer EL stream selected with no slave
stream mapped to it.

Normally when there is no EL there is no track either, but since it was
exposed in PMT we still have the track, while VM may decide to unmap it.
This is bit of workaround, but harmless one.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 795cd15438 demux: let a demuxer mark a stream as absent
Media can stop providing a stream mid-playback, for example a disc
program that does not carry the Dolby Vision enhancement layer the
previous one had. Since mpv always try to keep at least 1 packet
buffered in all tracks, it can keep reading it till EOF.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 96b9d84b60 f_output_chain: restore the chain ends manual connections on relink
mp_pin_connect() clears manual_connection on the pins it links, so a
filter that stops being the first or the last one leaves the chain
unable to drive its own ends. Nothing has changed the ends at runtime
so far, so this went unnoticed.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 79186bd167 discnav: poll the disc VM while playback idles
The BD-J VM progresses only on reads. With playback at EOF or on a
held still nothing reads anymore, applet playlist switches never
surface and menus freeze, libbluray documents this polling requirement
for idle states. Drive one nav read per tick and keep the core awake.
The slave demuxer latches its EOF and stops touching the stream, so
the read path peeks the stream itself to run its event loop. Poll the
same way while paused in a menu, highlight redraws would otherwise
wait for the next core wakeup. dvdnav stills release on user input,
not reads, and the pump bypasses the cache limits, so no pumping
outside these states.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 6f6bedec72 demux_disc: reset the slave demuxer in place on BD time seeks
A seek repositions the disc under the live slave demuxer, and mpegts
spliced its buffered PES state together with data of the new position
into broken packets, an AU worth of decode errors per seek. mpegts
already flushes all per-PID packet state when it sees the avio
position jump, so restart the byte position counters on the seek and
resync the avio position to the stream in drop_buffers.
2026-08-26 01:47:41 +02:00
Kacper Michajłow a47452aac0 stream_bluray: treat unannounced repositions as jumps
BD-J applets seek their player and restart playlists without any event
reaching the read loop, menu loop points do this constantly. Compare
bd_tell against the end of the previous read and treat a mismatch as a
jump. Checking before the read keeps the new position's head out of
the old slave demuxer, the forward-only stream cannot re-read it. A
read delivered together with a jump event can already carry data of
the new position, the same check drops it.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 0c87e46c83 demux_disc: gate slave reopens on buffered stream data
While the disc is between positions the open only probes an EOF and
fails, and retrying at the read rate logged a warning every attempt.
Peek before opening, this pumps the stream's event loop and the peeked
bytes stay buffered for the probe.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 15750e1212 stream_bluray: drain queued events before holding a still
The release of a still can already sit in the event queue behind the
event that announced it. Holding at first sight would miss it and
freeze the menu until user input. STILL_TIME is re-emitted on every
read while the still holds and does not count as progress.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 16896f33c0 stream_dvdnav: fix seek positioning
Menu-domain seeks: menu PGCs sequence intro/transition segments and
the looping button segment as programs of one PGC, and the menu
subpicture is a one-shot packet at a cell start. dvdnav's time search
lands mid-cell (erratically so in menu VOBs, which often lack usable
time maps), skipping the subpicture and leaving the menu without
visible buttons until its next loop. Map menu seeks to program skips.

Title seeks: dvdnav_time_search() interpolates the target from cell
durations. On VBR content the landing can fall further short than the
seek step, so repeated relative seeks converge to a fixed point and
never advance. Use dvdnav_jump_to_sector_by_time(), which resolves
through the VTS time maps, with dvdnav_time_search() as the fallback for
titles without one. Accurate landings also let the hr-seek margin
shrink.
2026-08-26 01:47:41 +02:00
Kacper Michajłow dd18d1eabc stream_dvdnav: reset a stale selected button on menu changes
A menu change keeps the VM's selected-button register unless the link
command carried a button number or the new button set forces one via
fosl_btnn. Select the first button in that case.
2026-08-26 01:47:41 +02:00
Kacper Michajłow abbbffe0dd demux_disc: hold BD jump boundaries for the player's resync seek
The resync seek that follows a disc-initiated jump must not reposition
the VM. On BD the jump is handled out-of-band by reopening the slave
demuxer on the packet-read path, and the VM already sits at the jump
destination. Repositioning it with the (stale) seek target time would
hop to the wrong place. Adopting the discontinuity counter here would
leave the old slave demuxer parsing the new playlist's data with the
wrong codec context. Flush our side only, and keep the counter stale so
the read path still performs the reopen.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 4a110f39cf demux_disc: map timestamps with per-stream timeline generations
Discs restart the in-stream timestamps at cell/segment boundaries. The
single global base_dts/last_dts pair rebased on any |diff| >= 5s between
consecutive packets of any stream, which broke down in several ways:

- Backward resets smaller than the threshold (e.g. a 1.5s menu
  transition cell followed by the looping button cell) were not detected
  at all, producing non-monotonic playback timestamps.
- The global last_dts ping-ponged between streams that cross a boundary
  at different packet positions (interleave skew), rebasing on nearly
  every packet and spamming the log.
- Menu subpictures timestamped for the next cell were mapped with the
  previous cell's offset and displayed at the wrong time.

Map each segment as a timeline "generation" with its own raw->playback
offset instead. Boundaries are detected per stream, as a backward step
beyond muxing jitter or a forward gap that would stall playback (sparse
still-image streams exempt). The previous generation stays valid until
every stream has moved past the boundary, and the new generation is
placed so the triggering stream continues seamlessly.

DVD subpictures are muxed around cell boundaries and their raw
timestamps alone cannot tell whether they continue the current segment
or belong to the next one. Defer each by one a/v packet (or EOF) and
let the packet that follows settle which generation it belongs to.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 02ec593037 stream: auto-detect .iso DVD-Video, DVD-Audio and Blu-ray images
Passing a disc image directly (e.g. `mpv disc.iso`) previously fell
through to FFmpeg. Route it to the matching disc backend instead,
like the VIDEO_TS.IFO/AUDIO_TS.IFO/BDMV redirectors already do.
2026-08-26 01:47:41 +02:00
Kacper Michajłow fee9b14d46 demux_disc: handle slideshow DVD titles
Audio DVDs commonly author each song as a chapter whose video is a
single (or more) still frame, with only the audio really interleaved.
Detect this at runtime and mark the video still_image. The player then
treats it as sparse, and the starved stream stops forcing eager reads
that would scan through the source hunting for the next still.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 4109805d0c demux_disc: follow the disc's initial audio stream selection
The player's default track selection picks the first probed audio
track, but the substream the disc's current PGC actually plays is
decided by the DVD VM and may be a different one. On discs whose menu
domain plays LPCM while the mux also carries an (unreferenced) AC3
substream, mpv selected the AC3 track, which has no data. We have to
keep track of what VM wants to output and what LAVF expects.
2026-08-26 01:47:41 +02:00
Kacper Michajłow c855d13170 stream_dvdnav: resync disc-initiated jumps through the seek path
When the disc VM jumps (menu activation, end of title), the demuxer
and player have to flush and reinitialize exactly at the boundary.

Hold an EOF at the boundary until the demuxer acks it, and resync
the player with a regular seek, which already orders flush, decoder
reset and restart. d_seek recognizes the held boundary and releases
it instead of repositioning the VM.

Also log the VM domain in nav event messages.
2026-08-26 01:47:41 +02:00
Kacper Michajłow daaab42166 player: rejoin the restart for a video frame after a transient EOF
A sparse video stream can report a transient EOF during a restart. The
DVD-Audio still track is read lazily and its first frame may arrive a
moment after the video chain already drained. Treat a frame arriving
while the restart is in progress as the restart's first frame.
2026-08-26 01:47:41 +02:00
Kacper Michajłow b3e3d1774e player: fix timing of sparse still-image video streams
Sparse video with continuous audio broke playback timing in several
ways:

- The first frame after a seek/restart was always shown immediately.
  With sparse video the frame at the seek target may not exist, and the
  next still can lie minutes ahead. Showing it early displays the wrong
  image.
- hr-seeks dropped frames with PTS below the target. For sparse video
  the nearest preceding still is the correct frame to show.
- Frame scheduling used the incremental A/V delay accounting, which is
  unusable across the video-EOF gaps between stills. Schedule sparse
  frames directly against the audio clock instead.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 34c649b864 demux: allow demuxers to update still_image during demuxing
Whether a DVD title's video track consists of sparse still images (a
slideshow) is only observable from the packet timestamps after
streaming started, and demux_disc wants to flip sh->still_image
accordingly, so that the stream stops being read eagerly.
2026-08-26 01:47:41 +02:00
Kacper Michajłow a2448f3b81 stream_dvda: expose DVD-Audio still images as a cover-art video track
DVD-Audio discs carry an Audio Still Video Set (ASVS). An MPEG-2 still
images (cover art, booklet/lyric pages) that the disc associates with
tracks.

A new STREAM_CTRL_GET_STILL returns the still for a given playback time.
demux_disc exposes it as a selectable mpeg2video track and injects the
still as a keyframe at the track's playback time. It changes as playback
crosses track boundaries (and follows onset times when a disc encodes
them).

--dvda-page (with the new STREAM_CTRL_SET_STILL_PAGE) forces a specific
still page instead of the scheduled one. The still state is guarded by
a mutex, runtime page changes arrive from the player thread while the
demuxer thread extracts stills.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 263bea5261 demux: read sparse still-image streams lazily
still_image streams (AV_DISPOSITION_STILL_IMAGE) consist of sparse
frames that can be minutes apart. When such a stream was selected
alongside an eager audio/video stream, its empty packet queue forced
the demuxer to keep reading ahead, buffering the whole file trying to
chase min_secs of "video". Read them lazily when other eager streams
exist, so playback drives read-ahead instead.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 8c6680a868 osdep/w32_register: add a DVD-Audio AutoPlay handler
Register mpv for the PlayDVDAudioOnArrival event, like the existing
CD-Audio/DVD/Blu-ray handlers.
2026-08-26 01:47:41 +02:00
Kacper Michajłow be04215d3f stream_dvda: add DVD-Audio playback support
Add a dvda:// protocol backed by libdvdread. Audio title sets are
enumerated from the ATS IFOs. Each ATS title is exposed as an mpv
title/edition and its tracks as chapters.

Menus are not supported, they would need full VM implementation, and
libdvdnav currently doesn't support DVD-Audio.

Still images (ASVS) may be supported in the future.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 76c0c5de03 stream_dvdnav: lock event processing
The menu/highlight state is filled by event processing on the demuxer
thread and read by nav commands and controls on the player thread. Add
a mutex around it.
2026-08-26 01:47:41 +02:00
Kacper Michajłow bb19b0fc36 stream_bluray: remove BD_EVENT_POPUP and menu-event tracking
BD_EVENT_POPUP was tracked into has_popup, which never grew a
consumer. BD_EVENT_MENU's menu_event_active only fed the menu_active
condition, where it was subsumed by the visible-overlay check. Remove
all three.
2026-08-26 01:47:41 +02:00
Kacper Michajłow c9422ff88f stream: turn the highlight fields into mp_dvdnav_highlight
The highlight rectangle and palette were passed around as loose fields
in three places. Bundle them into a struct, pass the whole nav state to
the sd_lavc control.
2026-08-26 01:47:41 +02:00
Kacper Michajłow c7859fe5b6 sub/osd_state: rename external2 to image_overlay 2026-08-26 01:47:41 +02:00
Kacper Michajłow b17b4371f8 stream_bluray: route logs through mp_log
This is awkward, because libbluray has a single global log callback.
libmpv can spawn multiple players in a single process, and the
instance created last takes over the callback (the previous instance's
log stays alive until its stream closes, so a racing callback never
sees a dangling pointer). This mirrors how ffmpeg logging works.

The callback delivers only a string without severity, so everything is
printed as MSGL_DEBUG, with the libbluray debug mask derived from our
log level.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 15f8a74aa4 stream_dvdnav: route logs from libdvdnav through mp_log
Use dvdnav_open2() with a logger callback instead of letting libdvdnav
print to stderr. This bumps the libdvdnav requirement to 6.1.0. 6.1.0 is
from 2019, it's resonable to request it by now.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 7c13c58ffa stream_dvdnav: keep cached duration in native time base
Store the duration in 90 kHz ticks instead of converting back and
forth. This also fixes STREAM_CTRL_GET_CURRENT_TIME's failure check,
which previously compared the already-converted value against -1 and
could never trigger.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 61416bd8b5 stream_bluray: rename BD_TIME_TO_MP to BD_TIME_TO_S 2026-08-26 01:47:41 +02:00
Kacper Michajłow b48fb6c86c demux_lavf: seek avfc only on seekable streams in drop_buffers
Disc streams are only seekable through the higher-level stream
controls, a byte seek on the slave can only fail and log errors.
avformat_flush() below already resets the demuxer state.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 2c8d954d21 demux_disc: only add the menu edition for streams with menu support 2026-08-26 01:47:41 +02:00
Kacper Michajłow 8356c7f674 demux_disc: keep one-shot DVD menu subpictures deliverable
Keep DVD SPU streams always enabled at the slave level and retain the
last subpicture per substream. Re-deliver the retained copy when a sub
track is (re)selected and when the player resets playback state.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 47a53910a5 demux: parent chapter metadata to the chapter list
demux_disc replaces the chapter list at runtime. Parent each chapter's
tags to the list that contains them, so a replaced list keeps owning
its metadata instead of accumulating it on the demuxer.
2026-08-26 01:47:41 +02:00
Kacper Michajłow b0c4e8cab6 demux_disc: soft-reload the slave demuxer on DVD discontinuities
A full slave reopen makes libavformat re-probe the stream, which eats
packets around the jump (losing the one-shot menu SPU) and re-bases the
timestamps. DVD cannot change codecs across a jump, so flushing the
slave and refreshing duration/chapters/edition is enough. BD keeps the
full reopen because codecs can change across titles.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 582810ac1d stream_dvdnav: emit a one-shot EOF at source jump boundaries
Menu activations, HOP_CHANNEL and VTS changes jump the source position.
On this strictly forward stream the demuxer cannot tell where the old
content ends, so buffered pre-jump data would mix with post-jump data.
Return a single EOF at the boundary so the demuxer drains and resets
before any new content flows.
2026-08-26 01:47:41 +02:00
Kacper Michajłow dbe496e6be demux_lavf: clear sticky avio EOF in drop_buffers
A stream can report a one-shot EOF and then continue producing data
(disc-nav jump boundaries). Also clear a sticky read error, the
underlying source is being reused.
2026-08-26 01:47:41 +02:00
Kacper Michajłow af53a9dc4b stream_bluray: rework fill_buffer around bd_read_ext
Menu support added bd_read_ext for events but kept the old bd_read
path, leaving two read loops. Use bd_read_ext everywhere and handle
all events in one place.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 4084e7609f stream_bluray: add support for still frames
Track BD_EVENT_STILL/STILL_TIME. Hold playback on indefinite stills and
skip timed stills only. Activations on a held still bump the
discontinuity counter, the disc VM will jump.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 3897b3a579 stream_dvdnav: add support for still frames
DVDNAV_STILL_FRAME means the VM is holding a frame indefinitely (menu
pages, some logos) or for a timed duration. Report the indefinite case
via nav state so the player holds playback at EOF instead of ending
the file, and skip timed stills, which would otherwise stall playback.
2026-08-26 01:47:41 +02:00
Kacper Michajłow fbcced5bf0 stream_bluray: lock all controls that read cached disc state
We cache some state like title properties, in some cases during deinit
player thread may actually try to read it during demuxer thead read.
Just add a lock, it shouldn't be called frequently to cause too much
synchronization.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 5f19209953 stream_bluray: use 1-based angle, same as in DVD
Internally the angle stays 0-based (matching the libbluray API), only
the user-visible option/property values are 1-based. BD_EVENT_ANGLE
delivers a 1-based value and is converted on arrival.
2026-08-26 01:47:41 +02:00
Kacper Michajłow f0bc30aaf1 demux: adapt caching to interactive disc navigation
The disc VM advances when the stream is read, so in nav mode the cache
must not run ahead of what the user is seeing. Never read ahead (a
looping menu is endless). Never satisfy seeks from the cache either.

This applies to the whole disc session, not only while a menu is on
screen. The VM can jump at any time (BD-J timers, end of title), so
the cache must never run ahead of playback.

Activations still must be able to drive the VM while nothing is
consumed. demux_drive_nav() forces a single read for them.
2026-08-26 01:47:41 +02:00
Kacper Michajłow c625405ddc stream_bluray: add BD-J menu support
Adds support for the ARGB overlay callback from libbluray. libbluray
does not convert between its overlay formats, BD-J planes arrive as
ARGB while HDMV planes arrive RLE-encoded, so both callbacks have to
be supported.

When the Java VM is not available, fall back to non-menu playback.

Also bump libbluray requirement to 1.0.2, it was released in 2017.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 70174945a4 discnav: sync track selection state with VM
The disc VM selects audio and subpicture streams itself (menu SPU
highlights, title-authored stream changes on jumps). Follow the VM's
selection on every hop, and turn subtitles on/off with the disc's
sub_visible flag.

The sync only applies while the corresponding track selection is on
auto. An explicitly chosen track (--aid/--sid or runtime cycling) is
never overridden.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 4725c2e492 demux_disc: set partially_seekable to true
This suppresses refresh seeks (e.g. on track switches). A refresh seek
would reposition the disc VM, which breaks menus and can hop to a
different position entirely. Track switching relies on the always-on
readahead of the disc demuxer instead.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 216e26c871 player/command: add discnav command and bind default keys
User-facing entry point for in-disc menu navigation. The command
forwards an action (up/down/left/right/select/menu/title-menu/popup/
prev/mouse-move/mouse-click) to the current disc stream handler.

The new discnav input section allows binding controls that are only
active while a disc menu is on screen.

Setting the edition property on a disc jumps to the title through the
stream directly, so selecting the currently-playing edition can still
return to it from a menu.
2026-08-26 01:47:41 +02:00
Kacper Michajłow a5682eb2ad player/command: add disc-menu-active property 2026-08-26 01:47:41 +02:00
Kacper Michajłow 5713c30160 player/loadfile: react to runtime chapter/edition list updates
On DEMUX_EVENT_LISTS, re-copy the chapter list and notify the
chapter/edition properties, so a disc title change is reflected in
observed properties and the OSC.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 816eca1fef player/loadfile: auto-select default tracks added after initial open
play_current_file picks default tracks once, then leaves them alone.
That leaves later-surfacing streams without a default selection. This
applies to all demuxers with late-added streams, not only discs.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 652ca81af9 player: add disc-menu state holder and overlay support
The new player/discnav.c owns the player-side state for the in-disc
menu UI, shared between stream_bluray and stream_dvdnav. Once per
playloop iteration it pulls the stream's nav state and

- pushes the BD menu plane to the OSD (OSDTYPE_DISC_MENU) and the DVD
  highlight state to the dvd_subtitle decoders,
- resyncs playback when the disc VM jumped on its own, detected
  through the stream's discontinuity counter,
- mirrors the disc's current title into demuxer->edition,
- force-selects a dvd_subtitle track while a DVD menu is up, so the
  menu graphics decoded by sd_lavc reach the OSD, and
- enables the {discnav} input section while a menu is interactive.

The per-file state is reset on every new playlist entry.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 8d36904e05 sub/osd: add OSDTYPE_DISC_MENU
A dedicated OSD object for the disc menu overlay. It renders above the
subtitle tracks and below mpv's own OSD.
2026-08-26 01:47:41 +02:00
Kacper Michajłow e204c1cfd9 demux_disc: add a synthetic "Disc Menu" edition
Expose the disc menu in the edition list, after the titles, so it can
be reached like any title.
2026-08-26 01:47:41 +02:00
Kacper Michajłow af9a11a8e5 demux_disc: reopen slave demuxer on disc-nav hops
Playing a disc through the menu means crossing playlist boundaries at
runtime: menu -> title (and back), sub-menu -> sub-menu, title -> title.
Each new playlist can have a different stream count and/or a different
codec mix. The previous slave demuxer was probed once at open and never
refreshed, so after a hop the player either kept decoding stale streams
or saw nothing at all. Tear down and re-open the slave on every nav
discontinuity.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 3a8b6995e9 stream_bluray: implement HDMV menu navigation
Add HDMV menu support to stream_bluray, activated by opening with
"bd://menu/..." or the global --disc-menu option.

The IG overlay plane arrives through the libbluray YUV overlay
callback. Decode the palettized RLE into a BGRA plane (premultiplied
alpha) and hand it to the player via STREAM_CTRL_GET_NAV_OVERLAY.
STREAM_CTRL_NAV_CMD maps arrow/select/menu/popup/mouse actions onto
bd_user_input() and bd_mouse_select(). Events relevant to the menu
state (title, playlist, menu on/off) are tracked so
STREAM_CTRL_GET_NAV_STATE can report an active menu, and playlist
changes bump discontinuity_id so the player flushes stale packets.
2026-08-26 01:47:41 +02:00
Kacper Michajłow b17feb1f79 stream_dvdnav: implement DVD menu navigation
Drive libdvdnav's menu state through the new disc-nav protocol so the
player can show and interact with VMGM and VTSM menus.

STREAM_CTRL_NAV_CMD maps the nav actions onto libdvdnav.

STREAM_CTRL_GET_NAV_STATE reports whether a menu with buttons is on
screen, the highlight rectangle and palette of the focused button, and
the ids of the disc-selected audio/SPU streams.

Menu mode is entered by opening with dvd://menu or --disc-menu, which
starts at the disc's root menu instead of a title.
2026-08-26 01:47:41 +02:00
Kacper Michajłow fbd0e047b1 options: add disc-menu option 2026-08-26 01:47:41 +02:00
Kacper Michajłow e2b7a983fa stream: add disc-nav actions and states
Define three new stream controls so disc backends (libdvdnav, libbluray)
can expose their in-disc menu/highlight state to the player.

Not used yet, the next commits add the backends and the player side.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 5db1db2852 demux: allow updating duration, chapters and editions during playback
Disc demuxers switch titles and playlists at runtime, which changes the
duration and replaces the chapter/edition lists. Add
demux_set_duration() and demux_lists_changed() for demuxers to publish
such updates, and DEMUX_EVENT_LISTS for the player to react.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 3ba4f76096 demux_disc: drop "PTS discontinuity" logs to verbose
Discs restart timestamps on every title or menu transition, so these
are expected in normal operation, not a sign of broken input.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 8b583e9a0d sd_lavc: add support for DVD sub highlight
This is connected to standard DVD subs renderer, with additional state
passed for highlight color.
2026-08-26 01:47:41 +02:00
Kacper Michajłow fad4b3f321 stream_dvdnav: read VTS event payload from the right buffer
While here, drop the message to MP_VERBOSE and fix its wording.
"switched to title" is misleading because this is a VTS-change event,
not a title change.
2026-08-26 01:47:41 +02:00
Kacper Michajłow b573edaaa1 sub/osd: change osd_set_external2 into generic osd_set_bitmaps
Let the caller pick the OSD object instead of hardcoding EXTERNAL2, so
other bitmap overlay sources can reuse the same path. No functional
change, EXTERNAL2 is still the only user.
2026-08-26 01:47:41 +02:00
Kacper Michajłow fbca538bfe stream_dvdnav: remove unused mousex/mousey 2026-08-26 01:47:41 +02:00
Kacper Michajłow f73dd13376 demux_lavf: parent mp_codec_params members to it
The members were parented to the demuxer or sh_stream, while they really
commute better with mp_codec_params.
2026-08-26 01:47:41 +02:00
Kacper Michajłow 57b0a0a695 stream_dvdnav,demux_disc: clean up log messages 2026-08-26 01:47:41 +02:00
Kacper Michajłow 654e9382c0 command: add colorspace and luminance arguments to overlay-add
Add primaries, transfer, max_luma and video_colorspace arguments.
Allows tagging the colorspace of the overlay bitmap instead of assuming
sRGB. video_colorspace interprets the bitmap in the video's colorspace,
so it is tone mapped exactly like the video. max_luma overrides the
luminance peak of the bitmap. Currently only vo_gpu_next honors these
parameters. vo_gpu keeps its sRGB assumption regardless of the tag.

Fixes #10678
2026-08-23 18:09:02 +02:00
Kacper Michajłow 1c2ff7d56b vo_gpu_next: support per-part overlay colorspace
Split the parts into runs of consecutive parts that share a colorspace
and render each run as a separate overlay referencing the same texture.
2026-08-23 18:09:02 +02:00
Kacper Michajłow 66ff2efbc7 sub/sd_lavc: zero-initialize sub_bitmap entries 2026-08-23 18:09:02 +02:00
posi 345e783643 vo_gpu_next: use video colorspace for overlays only when requested
Bitmap subtitles muxed in media file are generally the same colorspace
as video. Generic overlays may not be.
2026-08-23 18:09:02 +02:00
Kacper Michajłow e89a491052 sub/packer: preserve video_color_space when packing to RGBA
The flag was lost when replacing the result with the packed image.
2026-08-23 18:09:02 +02:00
Kacper Michajłow 413153fd4e vo_gpu_next: split update_overlays into helper functions
No functional changes.
2026-08-23 18:09:02 +02:00
Kacper Michajłow 65d138fd57 vo_gpu_next: don't read libass.color for non-libass parts
The union member is only valid for SUBBITMAP_LIBASS. The resulting data
is only read for PL_OVERLAY_MONOCHROME, so there was no risk of using
garbage data, but we can make it explicit.
2026-08-23 18:09:02 +02:00
verygoodlee 9f9f8c4dd4 select.lua: fix some incorrect boolean values in the property menu
`false` value in the `value or mp.get_property_native(property)`
expression will trigger `mp.get_property_native`, but some
sub-properties cannot be accessed directly, the obtained value is nil.
2026-08-23 10:45:18 +02:00
Kacper Michajłow b955aa28f3 f_enhancement_pair: keep retained frames within the hw surface budget
Reduce the queue to 8 frames and reserve that many extra surfaces on
both the BL and EL decoders.
2026-08-22 21:00:11 +02:00
Kacper Michajłow 228f3109fd f_decoder_wrapper: add mp_decoder_wrapper_set_extra_hw_frames()
Player-side consumers can now retain decoded frames beyond what the
decoder and VO account for, e.g. the enhancement-layer pairing queue.
2026-08-22 21:00:11 +02:00
Kacper Michajłow 3b4caf0f8b f_enhancement_pair: don't emit BL-only frames before the EL warms up
The queue-full fallback could fire during startup (and after seeks),
before the enhancement-layer decoder produced its first frame.

Gate the fallback on the EL pipeline having delivered at least one
frame since the last reset. Until then a full queue only means the EL
decoder is still spinning up.
2026-08-22 21:00:11 +02:00
Kacper Michajłow 49418246f3 ci: port BSD jobs to new cross-platform-actions syntax
The run input is deprecated. Split the monolithic scripts into the same
step layout as the other jobs. Sync the sources once at VM start and
skip the per-step file synchronization, since everything runs inside the
VM anyway.

This will make reading logs easier.
2026-08-21 13:36:49 +02:00
Kate Markson a87a678573 osdep/subprocess-win: terminate environment block
Terminate the block of environment variables with NUL. Previously the block was left unterminated which could cause subprocess spawn failures depending on the array contents after the last item.
2026-08-21 12:45:11 +02:00
Kacper Michajłow e7191f2a65 demux_lavf: select initial edition only by the program's variant_bitrate
The per-stream variant_bitrate is not a reliable selection key. FFmpeg
attributes the whole variant's bandwidth to individual streams, and for
streams shared by multiple variants the value was bogus or missing
depending on the number of variants sharing the stream. The program
metadata always carries the exact HLS variant BANDWIDTH, so use it as
the only key and drop the per-stream fallback.

Note that with `--flatten-editions` tracks are selected by their own
tags, so they may still use bogus values.

For context, there is currently a bug in lavf where, depending on the
number of variants sharing a stream, the stream may or may not get
`variant_bitrate`. This will be fixed in a future FFmpeg release.
2026-08-17 19:57:13 +02:00
sharpchen b6d3434493 script_format_time: fix typo in comment 2026-08-17 19:52:11 +02:00
dependabot[bot] e034d612cf ci: bump cross-platform-actions/action from 1.3.0 to 1.4.0
Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 1.3.0 to 1.4.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v1.3.0...v1.4.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-version: 1.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-08-16 13:43:18 +02:00
Kacper Michajłow e167836802 demux/ebml: interpret zero-length elements as their default value
An EBML element is permitted to have a zero-length data payload. It's
then interpreted as the element's RFC declared default value, or zero.

Before this change all zero-length elements were initialized to empty or
rejected in case of uint.

Fixes: #18351
2026-08-14 23:24:50 +02:00
Kacper Michajłow 52bb166f30 TOOLS/matroska.py: use named attributes for optional element fields
Will be useful for next commit.
2026-08-14 23:24:50 +02:00
Philip Langdale 7b8915bc1d ra_pl: add x2bgr10/x2rgb10 special RA formats
x2bgr10/x2rgb10 are packed formats that do not automatically get mapped by the
existing ra_pl logic. They are more useful than other non-byte-aligned packed
formats because they show up when dealing with > 8bit RGB content, which is
more common in an HDR context.

In practice, x2bgr10 is probably the only one that's going to get used, but
I figured there's no harm in supporting both.
2026-08-13 21:03:11 +02:00
llyyr f4d13e1c2c wayland: handle null output in wl_surface.enter event
This is seemingly possible: https://wayland.freedesktop.org/docs/book/Message_XML.html#allow-nulltrue--false
2026-08-10 04:39:39 +00:00
llyyr 513d3407d4 wayland: wait for initial surface configure before attaching buffer 2026-08-09 04:09:06 +00:00
subotac dd5d17d328 osc.lua: ignore seek ranges without usable duration
seekRangesF() accepts a zero duration and produces NaN/Inf coordinates,
which assdraw cannot format. Ignore seek-range metadata when the native
duration property is unavailable or zero.

Fixes #18344
2026-08-07 22:41:57 +02:00
zhanghongyuan 21277b0ccf bash-completion: fix '=' for *-clr/*-help and --help=
The special-options regex decided which options are completed without
a trailing '=', but it only covered Print options and "not in config
files" flags. As a result, two groups of no-argument options still got
'=' appended:

  (1) *-clr / *-help sub-options (e.g. --af-clr, --vo-help) which are
      mpv list-type sub-options taking no argument.
  (2) --help/--h which is String-typed in --list-options but actually
      accepts a substring filter to narrow down the option listing.

Extend the regex to cover (1). For (2), keep '=' appended (it does take
an argument) and route completion through a new Help branch that mirrors
the zsh help-options state: complete bare option names (no "--"
prefix), excluding no-* negations and list-type sub-options
(-add/-append/-clr/-pre/-set/-remove/-toggle). Bare names are needed
because --help=<substring> matches within the option name body.
2026-08-05 20:01:49 -07:00
Kacper Michajłow 1d15686142 hwdec_d3d11egl: fix EGL_EXT_device_query availability check
After ANGLE commit 56663dbfa780 EGL_EXT_device_query is listed in the
client extension string instead of the display one. The display string
check always failed, silently disabling native d3d11va interop.

This fixes `hwdec` with `gpu-context=angle`.
2026-07-31 18:01:08 +02:00
Kacper Michajłow 55146ecd14 ci/cleanup_caches: prune setup-msys2 package caches
setup-msys2 saves the pacman package cache under a key ending in a hash
of its contents. So with each update it saves more caches, what's more
important it saves it per each PR ref. We don't want that. Keep only the
msys2 cache on main branch and only the latest one per each
configuration. If PR saves new one, it will be dropped, we prefer master
branch case that can be used by all PR, rather then per PR cache of
this. The few packages that will be refetched are ok.

This change is an atempt to keep our cache under 10GB limit, to avoid
evicting more important ccache caches.
2026-07-31 17:58:16 +02:00
Kacper Michajłow 612bf5b6e8 ci/cleanup_caches: rewrite the selection as a single jq program
The nested jq invocations were hard to extend and left no trace of what
they decided. Delete by id rather than by key, since a key is only
unique per ref, and log each deletion.

No change in which caches are selected.
2026-07-31 17:58:16 +02:00
Kacper Michajłow 22c09166d7 ci/cleanup_caches: group all cleanup runs together
A cleanup is not tied to the build that triggered it, it always operates
on the whole cache state. Just cancel them and let the newest one
finish.
2026-07-31 17:58:16 +02:00
sfan5 63ada87ec7 ci/mingw: add second download URL for iconv and freetype
It appears this time GNU broke their ftpmirror, while the primary one is working again.

download.savannah.gnu.org also seems to be having issues.
Never thought I'd see the day where sourceforge is more reliable.
2026-07-31 15:56:00 +02:00
Dudemanguy 56b6200986 build: use --output option for rst2man
Apparently, the separate destination argument was deprecated years ago
and will be removed soon*. Just switch to the "new" way of specifiying
the output. Fixes #18283.

https://sourceforge.net/p/docutils/feature-requests/36/#0709
2026-07-31 13:12:03 +00:00
Nathan Lucas 74356c0fc6 ad_spdif: only warn for required codec parameters
determine_codec_params() warns when it cannot determine a codec profile.
Some passthrough formats use fixed output parameters and do not require
the probed profile or sample rate making the warning misleading.

Warn only when a value used to configure the selected passthrough format
is missing: the profile for DTS-HD, or the sample rate for core DTS and
AC-3.

Signed-off-by: Nathan Lucas <nlucasgit@gmail.com>
2026-07-29 18:18:37 +02:00
Nathan Lucas 1388a45395 ad_spdif: recreate spdif muxer on reset
The spdif decoder uses avformat/spdifenc. Some spdifenc paths keep
muxer state across packets, such as partial TrueHD MAT frames. After a
seek, that state belongs to the old stream position and can cause the
next packet to be muxed with stale timing or buffering state.

On decoder reset, discard the current spdif muxer context. The next
usable input packet will recreate the muxer through the existing
initialization path.

Cache codec parameters from the initial probe so recreating the muxer
does not probe a partial packet after a seek or replace known values
with fallbacks.

A fresh TrueHD spdif muxer needs a TrueHD major sync before it can begin
muxing the stream. Startup or post-seek playback may begin on a TrueHD
access unit that does not have major sync, so drop TrueHD packets until
a major sync access unit is seen. This also gives the downstream decoder
a clean restart point after seeks. Warn periodically if no major sync
has been found.

Partially addresses: https://trac.ffmpeg.org/ticket/9569
Signed-off-by: Nathan Lucas <nlucasgit@gmail.com>
2026-07-29 18:18:37 +02:00
Kacper Michajłow 24c1cc52a3 vd_lavc: derive hwdec surface pool size from VO requirements
Change --hwdec-extra-frames default to auto, which sizes fixed hw frame
pools from the number of frames the VO declares to reference, instead of
a static guess. Fixes pool exhaustion with e.g. --interpolation and a
tscale filter with larger radius.

Fixes: #18205
2026-07-28 15:08:36 +02:00
Kacper Michajłow 7f72f64b7f vo: add number of referenced frames to queue params
VOs can hold more frames than the requested lookahead. vo_gpu_next's
pl_queue retains past frames for the interpolation mixing window. Let
VOs declare the total number of frames they may reference at the same
time, so fixed hwdec surface pools can be sized accordingly.
2026-07-28 15:08:36 +02:00
Kacper Michajłow 48e6c35c0e demux: interrupt blocking reads whose result would be discarded
Add demux_read_interrupted(), true when the demuxer is being canceled,
its thread is terminating, or a seek is queued. Poll it from
demux_lavf's AVIO interrupt callback so blocking network I/O (e.g. the
HLS demuxer waiting on a live playlist reload) doesn't stall queued
seeks or shutdown for multiple seconds. The aborted read's result is
discarded in all of these cases anyway.

In normal operation demuxer reads are fast enough to not notice the
issue. However, in the HLS/DASH demuxers, FFmpeg blocks read() calls
on the playlist reload timeout. This is expected, but can mean multiple
seconds of dummy wait before we can actually proceed. This change
significantly speeds up seeking in HLS playback when it hits a playlist
reload.
2026-07-26 18:15:18 +02:00
Philip Langdale 390ebe2eac hwdec_vulkan: propagate the queue creation flags to ffmpeg
Up until now, we have not bothered to propagate queue creation flags when
setting up the ffmpeg device context, but with libplacebo setting flags like
VK_DEVICE_QUEUE_CREATE_INTERNALLY_SYNCHRONIZED_BIT_KHR and newer nvidia drivers
actually supporting this feature, I've now managed to run into this. If the
flags aren't put into the context, ffmpeg code can end up calling
vkGetDeviceQueue2 with the wrong flags, and the driver will return a NULL
queue instead.

I suspect we got this far without hitting this because the only filter that
can currently end up calling vkGetDeviceQueue2 is vf_libplacebo and then only
with the new `inherit_device=1` where the device we set up _from_ libplacebo
goes back to libplacebo. The oroborus is complete.
2026-07-26 06:05:47 -07:00
Kacper Michajłow b27573a239 demux: fail probing when the stream cannot be rewound to the start
Each probe attempt assumes it reads from position 0. If the rewind
fails, the demuxer would silently misparse the stream from a wrong
position.

On non-seekable streams this may fail when the probe size > buffer size,
which would cause us to drop the buffered data and not allow to rewind
the stream. This can be improved in the future.
2026-07-26 12:59:51 +02:00
Kacper Michajłow 762c5999c2 stream_curl: only offer compression for full unbounded requests
The requested start/end is in file bytes, we cannot use compression in
this case.
2026-07-26 12:59:51 +02:00
Kacper Michajłow 5910e9c2ba stream_curl: validate that the server honored a requested start offset
Error out like lavf/http.c instead of serving bytes at wrong offsets when
the server ignores the range request.
2026-07-26 12:59:51 +02:00
Kacper Michajłow 8849c4963f stream_curl: fix racy read of request_start when setting initial pos
request_start is producer state, a fast transfer can complete and roll it
forward before curl_open gets to read it, mislabeling all stream offsets.
Store the requested offset separately and use it for the initial pos.

Fixes: 289723b41a
2026-07-26 12:59:51 +02:00
nanahi 5659a9a9c8 DOCS/man/options: clarify --playlist expansion behavior
It's not recursive except for directories.
2026-07-26 11:50:05 +02:00
nanahi f76519ebd8 DOCS/man/options: clarify how --shuffle option works
There are many misconceptions about how this option work.
Make it more clear.
2026-07-26 11:50:05 +02:00
nanahi 05d45f4955 DOCS/man: mention when options are marked as file-local 2026-07-26 11:49:30 +02:00
nanahi 42d50061f6 DOCS/man/input: use connect terminology for file-local options
The file-local-options property sets options that are reset when file
change occurs. This is different from per-file options which are set with
--{ commandline arguments and options parameter of the loadfile command.
Per-file options use file-local option mechanism for setting options when
the file is loaded, but they are persistent and stay with the playlist
entries, unlike file-local-options set at runtime.

This corrects the on_load hook documentation about the effect of setting
file-local-options.
2026-07-26 11:49:30 +02:00
nanahi 731229bd2b options: add --playlist-inherit-options option
This allows controlling whether the files in a playlist inherit the
per-file options of the playlist file itself. For playlists created
by --autocreate-playlist, --playlist-inherit-options=current allows
inheriting only for the item the playlist is created from.
2026-07-26 11:49:16 +02:00
nanahi 19215efe61 player/loadfile: inherit file-local options when resolving playlist file
Currently, if a playlist file is played and replaced by its contents,
the per-file options of the playlist file are ignored.

This commit makes these options inherited for its contents so they work
as expected.
2026-07-26 11:49:16 +02:00
nanahi 97db44f89f common/playlist: add playlist_set_params function
Helper function to set file local options for all entries. Will be used
in the next commit.
2026-07-26 11:49:16 +02:00
llyyr 8c67647b50 wayland: don't leak wl_fixes on uninit
I fixed this locally but forgot to push it before the original commit
got merged, oh well

Fixes: 6f6c29b0b4
2026-07-24 12:53:05 +00:00
diniamo 0fb136f685 input/ipc-win: allow Windows handles for --input-ipc-client
Previously, you could only provide a CRT FD, which works great for the
most part, but when using CreateProcess on Windows, it requires the use
of the reserved fields of STARTUPINFO to inherit the FD to a child mpv
process. This becomes a problem for example if you use Go's os/exec API,
which does not expose a way to set those reserved fields. Exposing a way
to allow passing handles directly fixes the mentioned scenario, and
makes --input-ipc-client more flexible at no cost.
2026-07-23 22:06:04 +02:00
llyyr 6f6c29b0b4 wayland: use wl_fixes.ack_global_remove on global_remove
Notifies the compositor that the removed global will not be bound, so
the compositor can destroy it.

Ref: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/533
2026-07-23 12:29:49 +00:00
Guido Cella 1c4adc9819 console.lua: limit how many completions are printed to the terminal
This prevents mpv from freezing e.g. when completing very large
directories.
2026-07-23 13:04:55 +02:00
Kacper Michajłow 11a9054b1d player/lua: pre-allocate tables of known size 2026-07-23 12:16:59 +02:00
Kacper Michajłow 7ff087a6b0 options/m_property: avoid repacking list nodes if we can just steal it
Removes one redundant deep-copy. For example this makes playlist with
300_000 elements conversion to node from 800 ms to 470 ms. Not a big
improvement, but still it's free to do.
2026-07-23 12:16:59 +02:00
Kacper Michajłow e61d819bf6 console.lua: add coroutine to filter selectable items asynchronously
Make the filtering and user input render asynchronously, such that there
is no latency penalty for user typing.

A single keystroke with hundreds of thousands of selectable items blocks
the script for significant time. Especially filtering by single letter
which would produce a lot of matches. This could be fixed by delaying
filtering by the time user "stops" typing, but this adds artificial
delay on top of the filtering delay itself. Instead we start the
filtering always, but have a deadline of 5 ms, at which point the
coroutine is paused and script is allowed to process user events again.
If user typed or closed the dialog, we simply abort the filtering and
start new one. Instead of waiting for full filtering to finish when the
result is already stale.

The first slice runs synchronously, so anything but huge item lists is
still filtered within the keypress handler exactly as before.

Fixes: #18268
2026-07-23 12:16:59 +02:00
Kacper Michajłow 893ffae982 console.lua: speed up filtering of selectable items
Store just the indices of the matching items in matches. The text is
looked up in selectable_items, and the positions to highlight are
computed in get_matches_to_print() only for the rendered matches, using
the query that produced the current matches. This reduces useless work
of computing highlight positions when only handful of items can be
displayed at the time on screen in practice.

Sort matches without lua comparator, this significantly speeds up
sorting of big lists, where C->Lua round-trip was problematic.

Overall it's 10x-20x times faster in my testcase.
2026-07-23 12:16:59 +02:00
Kacper Michajłow 0583bb892e fzy.lua: use lookup table for precompute_bonus
Replace those conditions with precomputed lookup. It's not huge win, but
it's free, so we can do it.

JIT:
* score() x 44875 matches: 35 -> 25 ms
* filter_range 'p': 50 -> 25 ms
* filter_range 'pf': 61 -> 37 ms

interpreter:
* score() x 44875 matches: 295 -> 254 ms
* filter_range 'p': 412 -> 284 ms
* filter_range 'pf': 531 -> 388 ms

The lookup is dense, to avoid hash tables, which makes things slower,
but in fact the tables are reused, so it's low on memory.
2026-07-23 12:16:59 +02:00
Kacper Michajłow 181090e70d fzy.lua: add filter_range() for interactive filtering of large lists
Add fzy.filter_range() which computes only scores, appends to
caller-provided arrays instead of allocating tables per match, takes
an inclusive range so callers can process a large list in slices while
handling pending input in between, and accepts optional pre-lowercased
haystacks so repeated calls don't allocate a lowercase copy of the whole
list each time.
2026-07-23 12:16:59 +02:00
Kacper Michajłow e2eaf31ce2 fzy.lua: optimize main compute() a little
There could be a lot more done if we target luajit only. Or if we port
this to C. But for now let's keep it this way. It's 2-3x faster than
before, and the issue is mostly only on very big inputs, which are not
that common in practice.

Previously computing scores allocated two matrices of lua tables per
call. With hundreds of thousands of items this made fuzzy matching in
console.lua GC-bound.

When only the score is needed, keep two reused rolling matrix rows,
making repeated scoring allocation-free. positions() still keeps all
rows since tracing back the matched positions requires them.

fzy.filter() of 300000 items drops from 1013 ms to 356 ms (on my setup)
for a worst-case single-character needle, and a standalone score() call
no longer allocates at all.
2026-07-23 12:16:59 +02:00
Kacper Michajłow e4abaaa26b fzy.lua: do byte comparision instead string ones
This are char comparisions, but in lua they are expressed as full string
compare. Compare as bytes instead, this is significantly faster,
especially with luajit compiled code.
2026-07-23 12:16:59 +02:00
Kacper Michajłow 23d39a6048 vo_wlshm: fix leak on in flight buffer on unint 2026-07-23 10:17:00 +02:00
Kacper Michajłow 11e6a50025 vo/context_wayland: fix memory leaks on failed init 2026-07-23 10:17:00 +02:00
Kacper Michajłow 15de3e6193 vo/opengl/context: fix memory leaks on failed init 2026-07-23 10:17:00 +02:00
idontwannagoo 8ab3f8b66d options: add secondary-sub-scale
This allows scaling secondary subtitles independently from primary subtitles. The option defaults to 1 like --sub-scale and follows the other secondary-sub-* options by not inheriting from the primary subtitle setting.

Fixes #14989.
2026-07-22 19:32:01 +00:00
llyyr 25451bcc11 player/command: don't refresh sub stream on UPDATE_SUB option updates
Back when reselect_demux_stream call was added in this path in 700f72f,
sub_redecode_cached_packets only retained the last two packets. The
subtitle decoder cache was changed in 0a4b098 to retain the whole packet
sequence. Therefore sub_redecode_cached_packets by itself can rebuild
the new decoder state entirely from packets held in memory, and we no
longer need the demuxer to refresh the track.

This fixes expensive track refresh for network streams, where changing
some sub-* options during runtime of network streams would cause the
cache to be dropped
2026-07-22 20:51:55 +02:00
Dudemanguy 94335ab87a ci/build-mingw64: remove --enable-libshaderc flag
This was removed upstream.

https://code.ffmpeg.org/FFmpeg/FFmpeg/commit/92f2e6374dfbe9bf1c8e4d879f8810deafff3710
2026-07-14 19:13:03 +00:00
dengbo e5486b96d7 ao_pipewire: treat init timeout as failure instead of success
When wait_for_init_done times out, init_state remains INIT_STATE_NONE.
The original check only handled INIT_STATE_ERROR, allowing init() to
return 0 (success) even though the stream was never properly initialized.
This could lead to an infinite reload loop when the partially initialized
stream later enters an error state.

Fix by checking for INIT_STATE_SUCCESS instead of INIT_STATE_ERROR,
so that any state other than SUCCESS (including NONE due to timeout)
is correctly treated as a failure.
2026-07-10 00:22:51 +02:00
Kacper Michajłow 115b87b521 demux_mkv: init ff-index for backward compatibility
lavf basically always provide tracks in order as they appear, so this
will match it. There is no hard guarantee, but this is documented.

`ff-index` is now optional, but both demux_mkv and demux_lavf set it, so
it should cover most cases where it's used. In all other cases it would
be wrong anyway.
2026-07-09 05:04:11 +02:00
Kacper Michajłow 5b087dfb18 demux: remove falsification of ff-index
The `ff-index` is just a index of in the track order as seen by lavf.
However, there are many cases where tracks are not related to lavf, when
it's not used or there are virtual tracks addded like DOVI EL track or
merged image tile grid. Don't conjure `ff-index` out of nothing.

Some scripts may be confused when this index does not much ffmpeg. Even
though it has always stated in docs.

Fixes #18244
2026-07-09 05:04:11 +02:00
Kacper Michajłow e517fd6043 player/command: make track-list/N/ff-index optional
The `ff-index` is just a index of in the track order, it doesn't carry
much meaning and may be wrong or unavailable when other than lavf
demuxer is used. Additionally some tracks may be virtual like DOVI EL
track or merged image tile grid. In which case those track are not
related to lavf at all.

No deprecation period. It was never guaranteed to match FFmpeg anyway,
so anyone who has a hard dependency on this property should reconsider.
It's not really possible to provide backward compatibility given the
ambiguity of this index. It's better to make it unavailable than making
mismatch. For user it's clear when it's not available, but not possible
to know when it's wrong.
2026-07-09 05:04:11 +02:00
Kacper Michajłow 68387ea859 video/vdpau: throttle reinit in all cases
If `is_preempted` flag is set during init we need to try again, but if
we do it too fast, we never let the init to finish and constantly gets
the flag re-set.

Fix this by throttling the same as error path. It's not perfect, because
we rely on init timing, but was confirmed working and this restores the
previous status quo.

Fixes: d9f27bd0f1
Fixes: #18161
2026-07-08 21:02:26 +02:00
Kacper Michajłow cc763d17dc osc.lua: fix duration when it becomes available
After recent changes OSC become defunct when duration is updated during
playback.

Fixes: 02491a3949
2026-07-08 20:43:09 +02:00
Kacper Michajłow cef62fbc39 player/command: reset playback state of edition changes
When changing MPEG-TS program (edition) it may have completelly
different time base and duration, on live, non-seekable streams we would
just hang trying to resync to revious PTS, which is not valid. Reset the
state on edition change.
2026-07-08 20:42:25 +02:00
Kacper Michajłow 7f93b06797 demux_lavf: sort AVProgram array by id
AVProgram array contains programs in order as they were discovered by
lavf. For MPEG-TS depending on the point where we start demuxing it is
effectivelly random. Sort by the id, so we have consistent order of our
editions, regardless of probing.
2026-07-08 20:42:25 +02:00
Kacper Michajłow 02baec9701 demux_lavf: change demuxer-lavf-{probesize,buffersize} to OPT_BYTE_SIZE
It's way easier to type 10M instead of typing all those zeros.

Our C API uses int64_t for properties and string for setting options, so
it's safe to bump this option type.
2026-07-08 20:42:25 +02:00
Kacper Michajłow ab34ec35d2 vo_gpu_next: use pl_color_transfer_is_hdr consistently
pl_color_space_is_hdr checks also luminance, but we don't do that in
other places, and unlikely that we want it.
2026-07-08 20:20:07 +02:00
Kacper Michajłow 4c220ffd95 vo_gpu_next: disable auto reference white on onlder libplacebo version
To avoid forcing by default values that may be problematic in some
cases, especially with ICC profiles.
2026-07-07 00:00:05 +02:00
Kacper Michajłow 6a0ef86e00 vo_gpu_next: make subtitles / osd also follow system reference white 2026-07-07 00:00:05 +02:00
Kacper Michajłow ba92eb63c4 vo_gpu_next: ignore reference white for screenshots 2026-07-07 00:00:05 +02:00
llyyr 8e88661257 video/out/hwdec_cuda: use mp_msg for ffnvcodec logging
ffnvcodec falls back to fprintf(stderr) unless FFNV_LOG_FUNC and
FFNV_DEBUG_LOG_FUNC are defined by the user
(https://github.com/FFmpeg/nv-codec-headers/blob/master/include/ffnvcodec/dynlink_loader.h#L80-L84).
Define these callbacks so CUDA loader messages go through mpv's normal
logging instead.
2026-07-06 18:26:36 +02:00
der richter 28a7932599 osxbundle: fix vulkan loader search path check
the old check stopped at the first occurrence of a vulkan loader path.
though it's possible different vulkan loaders are installed in different
paths, leading to not found vulkan loaders.

to prevent this, also check if the needed vulkan loader is actually
installed to that path.

specific case is when installing MoltenVK and KosmicKrisp at the same
time. the former is installed in the homebrew prefix under etc/ the
latter under share/. the latter wasn't found previous, since the former
was found first.
2026-07-06 18:25:28 +02:00
der richter ed9c05d06e osxbundle: fix a wrong vulkan search path
the paths in the array are meant to be base paths to the vulkan path.
remove vulkan from it so it won't end up as /usr/share/vulkan/vulkan.
2026-07-06 18:25:28 +02:00
nanahi 9281bccfdf osdep/compiler: don't use __has_builtin for __builtin_mul_overflow
The feature test macro is nonstandard and not available on older GCC
version, which causes build failure despite the compiler does support
__builtin_mul_overflow.

Since there are no fallback when __builtin_mul_overflow is not
available, there is no need to check, so simply remove it.
If __builtin_mul_overflow is not supported compilation will still fail
just like currently.
2026-07-06 18:25:12 +02:00
llyyr c8c7d91a8e ci/freebsd: bump freebsd version to 15.1 2026-07-06 13:17:01 +02:00
Kacper Michajłow 7bf2d9cee6 vo/opengl/context_drm_egl: init fd to -1
Instead of using zero initialized value. Otherwise an early init failure
calls close(0), a descriptor we don't own, breaking whatever else
happens to hold it.

This is bit defensive, but I want to init those just after allocation,
so we don't have to trace whether they are initalized correctly or not.
2026-07-06 13:02:16 +02:00
Kacper Michajłow 318e4e21fb vo/drm_common: init fd to -1
Instead of using zero initialized value. Otherwise an early init failure
calls close(0), a descriptor we don't own, breaking whatever else
happens to hold it.

Also add missing check before close() call.
2026-07-06 13:02:16 +02:00
Kacper Michajłow f6df7dfd8b vo/vulkan/context_display: init fd to -1
Instead of using zero initialized value. Otherwise an early init failure
calls close(0), a descriptor we don't own, breaking whatever else
happens to hold it.

This is bit defensive, but I want to init those just after allocation,
so we don't have to trace whether they are initalized correctly or not.
2026-07-06 13:02:16 +02:00
Dudemanguy 33111f3212 DOCS/man/vo: remove mentions of 'experimental' for vo_dmabuf_wayland
It's fair to say that it's generally a mature and well-working VO at
this point.
2026-07-03 14:00:15 +00:00
Dudemanguy 7a94ec5719 vo_libmpv: use the VO_CAP of the renderer backend instead of the VO
The software renderer backend is not capable of using any of the VO
capabilities set globally by vo_libmpv. This can lead to assertion
errors when trying to render a video with 90 degree rotation metadata.
Instead use the ctx->renderer->driver_caps value so the source frame
doesn't have its params rotated when it's not desired.
2026-07-03 13:59:58 +00:00
Mohammad AlSaleh 7aa8580cab options: store audio/sub delay in doubles instead of floats
An `--audio-file` could be sourced from a stream. A stream could be
 using timestamps that match unix time in their segments. In that
 case, setting `audio-delay` will lead to a big unexpected A/V desync
 due to the limited precision of floats.

 This commit changes `--audio-delay` (and --sub-delay while at it) to be
 stored in `double` instead of `float`.

 `audio_delay` was already up-casted to `double` wherever it was
 evaluated. Same for `sub-delay`, except its own value was getting
 adjusted based on `double` values in one place (bad!):

 player/command.c:6297

    mpctx->opts->subs_shared->sub_delay[track_ind] -= a[0] - refpts;

 A showcase:

    mkfifo /tmp/mpv
    date=$(date +'%s')

 Before:

    mpv --input-ipc-server=/tmp/mpv -
    echo 'print-text '"${date}" | socat - /tmp/mpv # 1782890841
    echo 'set audio-delay '"${date}" | socat - /tmp/mpv
    echo 'set sub-delay '"${date}" | socat - /tmp/mpv
    echo 'print-text ${=audio-delay}' | socat - /tmp/mpv # 1782890880.000000
    echo 'print-text ${=sub-delay}' | socat - /tmp/mpv # 1782890880.000000

 After:

    mpv --input-ipc-server=/tmp/mpv -
    echo 'print-text '"${date}" | socat - /tmp/mpv # 1782890841
    echo 'set audio-delay '"${date}" | socat - /tmp/mpv
    echo 'set sub-delay '"${date}" | socat - /tmp/mpv
    echo 'print-text ${=audio-delay}' | socat - /tmp/mpv # 1782890841.000000
    echo 'print-text ${=sub-delay}' | socat - /tmp/mpv # 1782890841.000000

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2026-07-02 17:38:51 +00:00
Kacper Michajłow c02751a0bf vo: prefer dmabuf_wayland over other fallback VOs 2026-07-02 17:38:28 +00:00
Mohammad AlSaleh dc8101574d audio/filter: implement lavfi-tempo leveraging lavfi's atempo/ascale
Implement `lavfi-tempo` audio filter, which uses `atempo` or `ascale`
 form libavfilter for setting the tempo.

 Users (myself included) seem to be always looking for alternative tempo
 scalers to try, and this provides a faster implementation (or two), and
 may prove useful beyond performance/speed.

 `atempo` is picked as a default, and as a fall-back if `ascale` is not
 available.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2026-07-02 17:38:07 +00:00
Emmanuel Gil Peyrot 0279c0f07d path-unix: only accept absolute paths
The XDG Base Directory specification says “All paths set in these
environment variables must be absolute. If an implementation encounters
a relative path in any of these variables it should consider the path
invalid and ignore it.”
2026-07-02 17:36:50 +00:00
Thomas Weißschuh c22cac669e stream_env: add new stream to read from environment variables 2026-07-02 17:36:31 +00:00
Thomas Weißschuh 6d64f2867c stream_memory: split out bstr logic
This logic can then be reused by other streams that work on static data.
2026-07-02 17:36:31 +00:00
Thomas Weißschuh 1c467ad4f9 stream: drop unneeded include fcntl.h 2026-07-02 17:36:31 +00:00
Nicolas F a3d4b59197 command: plug another slop faucet
In the 2020s, now known as "the twilight years of modern
civilization", Silicon Valley's two most morbidly obese failsons
finally found their niche: a product that lets complete imbeciles
pretend to be software developers. This was, at least for a
while, a smash hit. Hordes of claudecucked vibechuds began
spamming free software projects with bogus "security bugs" and
associated even worse fixes, both of which they did not know how
to reason about, and definitely did not care to learn how to
reason about. The entire exercise, after all, was to get one's
name into the list of contributors, to get ahead in a highly
competitive job market of economies with equally torturous
education systems.

To the disturbingly moist-looking tech oligarchs recording
Goldman Sachs jerk-off instructons on their podcasts, this was a
profound shift in software development. Now, they no longer had
to pay 6 figures to some idiot who doesn't know how to program so
chooses React, and instead they can pay 6 figures to some
application that doesn't know how to program so chooses React.

For everyone else, it just added to the torment that is life in a
modern globalised service economy, where the fruits of their
labour are siphoned off and directed towards building ever
grander and more opulent paedophile island resorts.

But back to the code. Someone submitted a slop issue about how
there's UB if you run an input command with bogus parameters.
This is hardly a bug, since the commands are trusted, so the fix
is "don't do dumb shit". However, contextless vibechuddies saw
this as an opportunity to fire up their deeply subsidized
planet-burners and shit out some code they had no idea about what
it did.

LLMs, failing to have any real reasoning, tried twice, and failed
twice, to find the real """fix""" here. #18144 decided that
another condition needed to be added to the logical OR, whereas
the subsequent #18211 instead wanted to do an explicit cast to
size_t for no fucking reason. Funnily enough, the unsignedness of
size_t doesn't cause any problems here, because of the earlier
check to make sure `w` is positive.

Both of them missed that if `foo < bar * 4` overflows `bar`, you
can just check for `foo / 4 < bar`, which is an efficient
division as 4 is a power of 2, and the integer division here does
not lead to any problems because the check is a range check.

Do that, just to stop these stupid fucking PRs from popping up,
and deny these dumb shitheads the satisfaction of getting their
name into the contributor stats.

Closes #18128.
2026-07-02 00:30:18 +02:00
Kacper Michajłow 99b4c12ccc demux_mkv: map hvcE into side-data 2026-07-01 04:46:42 +02:00
Kacper Michajłow abfc3b21c8 mp_image: don't use deprecated pl_avdovi_metadata_supported
It's always true now.
2026-07-01 04:46:42 +02:00
Kacper Michajłow 8930fdb132 vo: bump size of pass desc string
To avoid truncated description.
2026-07-01 04:46:42 +02:00
Kacper Michajłow f53e8f3fed demux_mkv: group EL+BL dovi tracks 2026-07-01 04:46:42 +02:00
Kacper Michajłow 103aee7261 demux_disc: mirror lavf demuxer stream groups to parent
This joins Dolby Vision EL track with base one. libbluray current (as of
1.4.1) doesn't even expose this info, it will be available in next
version, but it is less code to ask lavf for this info in fact.
2026-07-01 04:46:42 +02:00
Kacper Michajłow 6b4a205c99 demux_lavf: handle AV_STREAM_GROUP_PARAMS_DOLBY_VISION 2026-07-01 04:46:42 +02:00
Kacper Michajłow 95f8f18d13 demux_mkv: add support for splitting EL track from in-band 2026-07-01 04:46:42 +02:00
Kacper Michajłow 116c8ecf3c demux_lavf: add support for splitting EL track from in-band 2026-07-01 04:46:42 +02:00
Kacper Michajłow 998c20af67 demux/dovi_split: add helper to split interleaved HEVC with BL and EL 2026-07-01 04:46:42 +02:00
Kacper Michajłow 6f724890e0 vo_gpu_next: upload/map EL frame 2026-07-01 04:46:42 +02:00
Kacper Michajłow 29c693c039 vo_gpu_next: parametrize frame upload/map
This is refactor only.
2026-07-01 04:46:42 +02:00
Kacper Michajłow 5058e6e737 f_output_chain: pair BL+EL and output as single frame 2026-07-01 04:46:42 +02:00
Kacper Michajłow 5330cae57e f_enhancement_pair: add filter to match frames of separate video tracks 2026-07-01 04:46:42 +02:00
Kacper Michajłow 81037dae3a mp_image: add no_dovi / no_enhancement_layer params 2026-07-01 04:46:42 +02:00
Kacper Michajłow 0480011ac4 vf_format: add vf=format=enhancement-layer option 2026-07-01 04:46:42 +02:00
Kacper Michajłow 6c4480cbfd mp_image: add enhancement_layer child image 2026-07-01 04:46:42 +02:00
Kacper Michajłow 314e80f2ec loadfile: reselect dependent tracks only when selected by user 2026-07-01 04:46:42 +02:00
Kacper Michajłow 25606307ff demux: propagate track selection only from base track
Don't try to select dependent track as main and feedback to base track.
To avoid situations where tracks are deselected only to select the same
group again.
2026-07-01 04:46:42 +02:00
Kacper Michajłow bc5684c2cf video/img_format: make mp_imgfmt_desc_get_num_comps input param const 2026-07-01 04:46:42 +02:00
sfan5 3f1b23abd0 stream_curl: fix libavformat version checks
Unfortunately ffmpeg missed the backport of <https://code.ffmpeg.org/FFmpeg/FFmpeg/commit/1a7e802c8f970e76807f08c3d3fb3513ae5a4882>,
so custom IO is still segfaulting on the older versions.
2026-06-29 14:58:15 +02:00
Kacper Michajłow 5abce15f1c vf_d3d11vpp: enable NVIDIA RTX Video only for SDR input
This filter only converts SDR to HDR, so disable it if we have already
HDR on input. Note that it also seems to be disabled if HDR is disabled
in Windows, but we don't check that, because filters are not related to
display. Use conditional profile to enable this filter when needed, this
commit is only small convenience change.

Fixes: #17800
2026-06-28 17:22:20 +02:00
Kacper Michajłow 4dbc235dba select.lua: add property_set getter 2026-06-28 16:36:32 +02:00
yangli 523aea99ad {select,console}.lua: release memory of menu items after menu closing
select.lua: `properties` is a large table containing 10k+ elements,
currently it's a global variable, which makes its memory cannot be
reclaimed by the GC after menu closing, so let's simply change it
to a local variable.

console.lua: `selectable_items` has the same issue, however, it cannot
be changed to a local variable because it is used by too many functions,
but at least we can reset it to nil when closing console.
2026-06-28 16:35:54 +02:00
dependabot[bot] 42149e9eac ci: bump cross-platform-actions/action from 1.2.0 to 1.3.0
Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 1.2.0 to 1.3.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v1.2.0...v1.3.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-version: 1.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-28 15:57:06 +02:00
dependabot[bot] 508d25590d ci: bump actions/cache from 5 to 6
Bumps [actions/cache](https://github.com/actions/cache) from 5 to 6.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-28 15:56:36 +02:00
Kacper Michajłow 62f1494661 vo_gpu_next: follow reference white system setting
This is mostly useful for SDR mode where previously we would output 203
nits, which on Windows is considered HDR, because reference white is
fixed at 80 nits in SDR mode. Which in turn causes additional
tone-mapping when using scRGB output.

Note that for SDR transfers this doesn't change the luminance, but
instead causes more aggressive tone-mapping, might not be fully
expected. But maybe we should follow system setting for better of for
worse.

Fixes: https://github.com/mpv-player/mpv/issues/17850
Not fully, because when ICC profile is embeded in content, libplacebo
will override our luminance, this will be fixed separately.
2026-06-27 23:15:26 +02:00
Kacper Michajłow a01e391851 vulkan/context_win: implement target_ref_luma 2026-06-27 23:15:26 +02:00
Kacper Michajłow be8d1eb3d6 vo/gpu/context: add preferred_ref_luma function 2026-06-27 23:15:26 +02:00
Kacper Michajłow a8a1cdbbbb d3d11/context: implement target_ref_luma 2026-06-27 23:15:26 +02:00
Kacper Michajłow 069a6f004e vo/gpu/context: add target_ref_luma function 2026-06-27 23:15:26 +02:00
Kacper Michajłow 5d15a41b0f vo/win32/d3d11_helpers: add mp_dxgi_sdr_white_level_from_hwnd() 2026-06-27 23:15:26 +02:00
Kacper Michajłow 245652c34c vo/win32/displayconfig: add mp_w32_displayconfig_get_sdr_white_level 2026-06-27 23:15:26 +02:00
Kacper Michajłow fe4eaf7c9d stream_curl: add support for Icecast metadata 2026-06-27 21:47:41 +02:00
Kacper Michajłow 5c97ee2a48 stream_lavf: use common Icecast metadata parser 2026-06-27 21:47:41 +02:00
Kacper Michajłow aa845b965a stream/network: add Icecast metadata parser 2026-06-27 21:47:41 +02:00
Guido Cella 8395d89069 vo_gpu{,_next}: use mp_basename_bstr() 2026-06-27 21:43:18 +02:00
Guido Cella 9dbf5d681d misc/path_utils: rename bstr_strip_ext() to mp_strip_ext() 2026-06-27 21:43:18 +02:00
Guido Cella 089c172dff misc/path_utils: rename bstr_get_ext() to mp_get_ext() 2026-06-27 21:43:18 +02:00
Guido Cella 4fa3c38983 misc/path_utils: remove mp_splitext()
It is no longer used.
2026-06-27 21:43:18 +02:00
Guido Cella 1a09154988 various: replace mp_splitext() with bstr_get_ext()
This will allow removing mp_splitext().
2026-06-27 21:43:18 +02:00
Guido Cella 9ffc0cd861 misc/path_utils: remove mp_strip_ext()
It is no longer used.
2026-06-27 21:43:18 +02:00
Guido Cella df3b76b018 various: replace mp_strip_ext() with bstr_strip_ext()
This will allow removing mp_strip_ext().
2026-06-27 21:43:18 +02:00
Guido Cella 2057e34f45 misc/path_utils: make bstr_strip_ext() and bstr_get_ext() accurate
Move bstr_strip_ext() and bstr_get_ext() to path_utils.c making them use
split_ext(), which is better than the previous bstr.c implementation
because it doesn't consider . in the dirname or at the start of
basenames.
2026-06-27 21:43:18 +02:00
Guido Cella 381e7eb155 misc/path_utils: add split_ext()
This will be used by bstr_get_ext() and bstr_strip_ext() without
allocating memory.
2026-06-27 21:43:18 +02:00
Guido Cella 4eaef66f4c bstr: don't make bstr_splice() add to NULL
If str.start is NULL, don't error on FreeBSD + ASan with "applying zero
offset to null pointer" in bstr_splice().

This will avoid an error in split_ext() in the language test with NULL
as argument.
2026-06-27 21:43:18 +02:00
Guido Cella 29c26b5bc5 misc/path_utils: add mp_basename_bstr()
This will be used by bstr_get_ext() and bstr_split_ext() without
allocating memory.
2026-06-27 21:43:18 +02:00
Guido Cella 9bfdb3d67f vo_gpu{,_next}: use bstr_strip_ext()
Because it is simpler than mp_splitext(), and will allow removing
mp_splitext().
2026-06-27 21:43:18 +02:00
llyyr d8c82c3b16 ao_pipewire: convert pw_time.queued from bytes to frames
pw_time.queued is reported in bytes, while the code here expects it in
nframes.

Note that this doesn't matter at all, because pw_time.queued is always 0
for us since we use it as a pull-based AO. This would be a latent bug if
we ever switched to push model.
2026-06-27 21:06:47 +02:00
Kacper Michajłow 1cf081e66c select.lua: register not yet evaluated properties to item
In case when during parse and initial item creation there is only single
property evaluated, in case like `prop1 or prop2`. Only `prop1` is
evaluated and added to observe that will make item dirty. However, when
item is dirty, we may need to evaluate the rest of the expression,
especially important to add it to observe, so we mark it dirty next
time.

Fixes: #18153
2026-06-27 20:57:24 +02:00
Kacper Michajłow 80865a7d1f f_swresample: guard invalid memory access also in NDEBUG
Mostly to make GCC happy and fix array-bounds warning.
2026-06-27 20:39:35 +02:00
Kacper Michajłow a40319a514 osdep/compiler: make MP_ASSERT_UNREACHABLE no return
On some platforms assert is continuable, we don't want that, so abort()
just after.
2026-06-27 20:39:35 +02:00
Kacper Michajłow fb6c700ecb meson: try vapoursynth-script first
Older versions ship separate `vapoursynth-script.pc` and
`vapoursynth.pc`, we want to use `script` one. Try it first, if not
available use `vapoursynth`, which is the only one new version ships.
2026-06-27 19:16:30 +02:00
Kacper Michajłow ccfe4871db test/avio_crypto: add test for stream decryption 2026-06-27 19:04:03 +02:00
Kacper Michajłow 449944e25f demux/avio_crypto: add AES decryption
This mirrors `crypto+` protocol from ffmpeg, which is used in HLS
demuxer. Unfortunatelly ffmpeg doesn't use custom io_open in their
crypto.c, so we spin our own decryption.
2026-06-27 19:04:03 +02:00
Kacper Michajłow fc26cd23c0 msg: strip raw C1 controls and skip valid UTF-8 in sanitize
Fixes: #17957
2026-06-27 18:55:17 +02:00
arch1t3cht 7da362dfb5 demux_mkv: support demuxing native VC-1 streams
Match lavf's logic for how to parse the extradata.
2026-06-27 18:12:09 +02:00
verygoodlee 6b623e29cd select.lua: make property list more in line with the desc in the manual
1. the index of array-type properties is 0-based. ( e.g. `playlist/N` )
2. boolean values should be formatted as yes/no instead of true/false.
2026-06-27 18:11:48 +02:00
Nicolas F 669f431cf0 demux_edl: fix signed integer overflow in HLS bitrate
Use the new MP_SATURATE_MUL to prevent hls_bitrate from overflowing when
being multiplied by 8.

Fixes: #18120
2026-06-27 18:10:47 +02:00
Nicolas F f5a894de87 common/common: add saturating multiply macro
Add a new function-like macro MP_SATURATE_MUL. It multiplies a * b and
stores it in pointer "result", but sets "result" to its type's maximum
value if it overflows. Evaluates to true if it saturated, otherwise
false.
2026-06-27 18:10:47 +02:00
Nicolas F 8c6ad1b002 osdep/compiler: add MP_CKD_MUL
Add a new MP_CKD_MUL macro which does a multiplication with overflow
checking, backed by either the C23 ckd_mul standard function, or the
GCC/Clang __builtin_mul_overflow otherwise.
2026-06-27 18:10:47 +02:00
Kacper Michajłow ae99e39239 demux_mkv: remove redundant size checks
After previous commit, those sizes are checked in parser.
2026-06-27 18:09:12 +02:00
Kacper Michajłow 0251783b95 TOOLS/matroska.py: add size constraint for fixed size binary data
Those are fixed size per RFC and read as such in demux_mkv.c, fixes OOB
access in some cases that were missing the checks there.
2026-06-27 18:09:12 +02:00
Kacper Michajłow 23b9e96e9b demux/ebml: fix error path on data reject
If we don't read the data it shouldn't set the element as present.
2026-06-27 18:09:12 +02:00
Guido Cella 351291d583 menu.conf: compare aspect overrides more strictly
Fixes #18152.
2026-06-27 18:04:48 +02:00
Kacper Michajłow 0d68a842a0 hwdec_d3d11va: support 4:4:4 and high bit depth zero-copy formats
Replace the static format whitelist with a device-probed table and add
4:4:4 (VUYX/XV30/XV36/XV48) and 4:2:0 12/16-bit (P012/P016) surfaces to
both the zero-copy and copy mapper paths. The packed YUV formats can't be
decomposed by ra_get_imgfmt_desc(), so they are viewed as a single RGBA
texture and the swizzle is recovered from the imgfmt descriptor, which
only works with --vo=gpu-next.
2026-06-27 18:04:15 +02:00
Kacper Michajłow 2a49cc01d6 video/d3d: exclude VP9 on known broken Intel drivers 2026-06-27 18:03:54 +02:00
Kacper Michajłow 1d8cb602ac video/d3d: exclude HEVC on known crashing Intel drivers
The list of failing drivers was taken from a popular browser, which has
a lot of telemetry to determine which versions are not working.

Fixes: #18173
2026-06-27 18:03:54 +02:00
Kacper Michajłow 07c8c16bef vd_lavc: allow disabling codec hwdec per-device 2026-06-27 18:03:54 +02:00
Kacper Michajłow 70894ae039 ytdl_hook: defer loading until the formats become available
yt-dlp can provide time at which formats become available
`available_at`. Sleep until the requested time.

Fixes: #18192
2026-06-27 01:10:41 +02:00
Kacper Michajłow c75b8d2cca stream_curl: strip parameters from content type
It should only be assigned mime-type itself. I'm sure I had this change
locally, but probably lost it during rebase somewhere.

Fixes: #18187
2026-06-26 06:48:16 +02:00
Kacper Michajłow 289723b41a stream_curl: fix initial stream pos when offset is used
This is to match lavf/http.c behaviour and allow proper seeking.
2026-06-26 06:48:16 +02:00
Kacper Michajłow c4207644ba stream_curl: require libcurl 7.88.0
To avoid those awkward definitions. Initially much lower version was
required, but after changes it landed at 7.87.0, so we might as well
bump it one up.
2026-06-26 06:47:50 +02:00
sfan5 2339eb7276 stream_curl: extend version checks that enable curl by default
...to include older ffmpeg patch relases where the nested IO cleanup bug is fixed
2026-06-23 11:03:09 +02:00
Misaki Kasumi 2bd9c3229f osdep: fix MP_NO_ASAN definition 2026-06-22 03:52:21 +02:00
Guido Cella 1bcc17a7be select.lua: fix selecting the default subtitle line
Fixes 53796ca2ea.
2026-06-21 20:34:00 +02:00
dependabot[bot] dde8d8c4a0 ci: bump actions/checkout from 6 to 7
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-21 12:36:13 +02:00
Kacper Michajłow efe8644a93 github/workflows/docs: update package index to fix install failures
When index is outdated some files may not exist, when we try to install
them.
2026-06-20 23:30:14 +02:00
Kacper Michajłow 2d5dfb343a ytdl_hook: use native http-proxy option instead of lavf option
Fixes: #18042
2026-06-18 05:27:17 +02:00
Kacper Michajłow f8150c78d5 demux_mkv: don't apply AVI b-frame delay compensation to VfW tracks
crazy_video_pts_stuff() shifts video PTS back by the codec delay to undo
libavcodec returning frames paired with a later packet's DTS. This is
only correct for genuine AVI, where DTS are decode-order frame indices.

VfW-muxed Matroska looks similar but its block timestamps are real DTS,
already offset by the reorder delay, so the libavcodec shift cancels the
offset and no compensation is needed. Applying it anyway pushed video
one frame ahead of audio (e.g. VC-1, whose Advanced Profile always
reports has_b_frames=1).

Split the `avi_dts` flag. Deep DTS routing for VfW mkv via a new
`block_dts`, and reserve avi_dts for genuine AVI only.

Note that demux_lavf for Matroska was already not affected, because
`avi_dts` wouldn't be set for those.

Fixes #18089
2026-06-17 23:55:51 +02:00
Guido Cella 02491a3949 osc.lua: don't reinit on duration changes
It can be avoided by extracting just the code to update the seekbar and
its chapter markers. This avoids log spam and is more efficient for DVD
and Blu-ray menus which continously update duration and have chapter
markers.

The livemarkers option is removed since updating the chapter markers is
no longer expensive like reiniting.
2026-06-17 13:39:10 +00:00
Guido Cella 715d2b7cf2 DOCS/man/commands: rename COMMANDS to CONSOLE COMMANDS
Avoid confusing it with command interface.
2026-06-17 13:38:57 +00:00
llyyr 3159500884 f_auto_filters: destroy deint filter immediately on format change
When the image format changes (e.g. switching hwdec), immediately
destroy the existing deinterlace filter instead of draining it. Draining
feeds new frames through the old filter, which can cause issues. (e.g.
bwdif_vulkan receiving vaapi frames).

This fixes userdeint filter failure when switching from hwdec=vulkan to
hwdec=vaapi while the filter is applied via --deinterlace=auto/yes
2026-06-17 13:37:57 +00:00
llyyr 4acaa77de5 af_scaletempo: avoid memcpy with disabled overlap
Overlap can be disabled with overlap=0 or very small stride values which
cause calculated overlap size to truncate down to 0.

Fixes: https://github.com/mpv-player/mpv/issues/18107
2026-06-17 13:37:34 +00:00
llyyr 9d828d5e55 vulkan/context: guard for null --vulkan-device param
Fixes: https://github.com/mpv-player/mpv/issues/18106
2026-06-17 13:37:34 +00:00
Dudemanguy 306546f35f bitmap_packer: drop fprintf logging
Ideally we would properly log this with mp_log but the plumbing for that
was deemed too ugly and not really worth it for just this one mysterious
edge case. So instead, drop the fprintf business since we really
shouldn't be doing that.
2026-06-17 13:36:44 +00:00
Dudemanguy 7bc56a77a9 bitmap_packer: return -1 instead of aborting on invalid bitmap size
All current callers of this already handle the -1 case like an error, so
instead of killing everything just return -1.
2026-06-17 13:36:44 +00:00
Misaki Kasumi 688b2738c6 subprocess-posix: skip macro guard in reset_signals_child 2026-06-17 10:47:16 +02:00
Misaki Kasumi 49b06cc337 subprocess-posix: fix uninitialized stacks in fork path 2026-06-17 10:47:16 +02:00
Misaki Kasumi 6b48326ccf subprocess-posix: avoid using mmap 2026-06-17 10:47:16 +02:00
Misaki Kasumi d849fd60d0 subprocess-posix: use rfork_thread on FreeBSD 2026-06-17 10:47:16 +02:00
Misaki Kasumi de1c73a44b subprocess-posix: handle detach inside spawn_process 2026-06-17 10:47:16 +02:00
Misaki Kasumi 5fb6a76ddf subprocess-posix: use clone when available 2026-06-17 10:47:16 +02:00
Pavel 53796ca2ea select.lua: add keep-open argument to select bindings
Adds an optional keep-open argument to all select.lua script bindings
that prevents the menu from closing after a selection.

Menus that display selection state (tracks, audio device) or a current
position indicator (playlist, chapter, edition, subtitle line) are
wrapped in a recursive function so the list is rebuilt after each
selection and the indicators remain accurate. default_item is passed to
preserve the cursor position on the last selected item.

The history confirmation dialog reopens the history menu when No is
selected, and closes when Yes is selected as there is nothing to show
anymore.
2026-06-17 00:30:39 +02:00
dependabot[bot] f88bcd25c7 ci: bump cross-platform-actions/action from 1.1.0 to 1.2.0
Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v1.1.0...v1.2.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-version: 1.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-16 16:20:38 +00:00
Wang Yu 9baeefe635 player: fix cover-art-files overriding embedded video tracks
When comparing external cover art images with embedded video tracks,
the external-vs-internal preference should not apply. Without this
check, --cover-art-files causes video files to be treated as audio
by selecting the external image over the embedded video stream.

Only apply the external track preference when both tracks have the
same image type (both images or both non-images).

Fixes #12219
2026-06-16 16:17:48 +00:00
Guido Cella cab6fbe222 context_menu.lua: don't open disabled submenus on hover
A menu item can have a non-empty submenu but still be disabled. This is
the case for mkvs with a single edition. Don't open the submenu on hover
in that case.
2026-06-16 13:02:52 +02:00
verygoodlee 89da9deafe console.lua: do not allow typing newlines when searching for menu items
newline makes no sense in such case, as there're no line breaks in the
selectable items. and it also causes a bug where the cursor may move
outside the background box.
2026-06-16 13:02:11 +02:00
arch1t3cht 65a1852ba3 input.conf: bind right click to context menu 2026-06-15 07:20:37 +02:00
Mikael Magnusson 662d41093c demux_timeline: fix Twitch VOD timestamps being offset by ~60 seconds 2026-06-14 20:14:42 +02:00
llyyr 7d245fd100 video/gpu/lcms: remove stray pointer from video profile handle
cmsHPROFILE is already a pointer type
2026-06-12 19:15:18 +02:00
llyyr bda1dcaa78 video/gpu/lcms,vo_gpu_next: avoid returning bool from pointer functions 2026-06-12 19:15:18 +02:00
llyyr 3d4893a893 test/language: replace accidental octal literal
Surrounding code uses decimal 0, not octal 0, so probably a typo
2026-06-12 19:15:18 +02:00
Kacper Michajłow 304426c390 video/vf_amf: fix use-after-free on AMF_INPUT_FULL 2026-06-09 11:52:29 +02:00
Kacper Michajłow fb5345809d sub/sd_ass: fix animated state indexing for reordered packets 2026-06-09 11:52:29 +02:00
Kacper Michajłow c1c047f8d6 stream/lavf: check child_next return value before dereference 2026-06-09 11:52:29 +02:00
Kacper Michajłow 894c350f83 stream/dvb: initialize parsing buffers for VDR-style configs 2026-06-09 11:52:29 +02:00
Kacper Michajłow 1ad719ff19 osdep/subprocess-posix: restore signal mask on detached fork failure 2026-06-09 11:52:29 +02:00
Kacper Michajłow f232963c61 input/ipc-win: fix uninitialized handle and missing client NULL check 2026-06-09 11:52:29 +02:00
Kacper Michajłow a7d0ebaf76 input: remove unused mp_input_src_feed_cmd_text() 2026-06-09 11:52:29 +02:00
Kacper Michajłow dddafe8b60 filters/f_lavfi: compare height in is_vformat_ok 2026-06-09 11:52:29 +02:00
Kacper Michajłow 5e4b06d977 demux/disc: avoid timestamp shift on unknown duration 2026-06-09 11:52:29 +02:00
Kacper Michajłow 5dfdd39997 demux/packet: fix OOB read in ITU-T T.35 UK parsing 2026-06-09 11:52:29 +02:00
nanahi 6444c05059 filters/frame: use correct check for mp_frame_set_pts
Not effect for current handlers.

Fixes: [Bug] frame.c: Wrong handler check in mp_frame_set_pts
(get_pts instead of set_pts)
2026-06-08 01:26:23 +02:00
nanahi e7f5d8f9c8 filters/filter: fix dropping request logging
Fixes: 76276c9210
2026-06-08 01:26:23 +02:00
nanahi c42393a280 video/filter/vf_amf: fix profile option
Fixes: [Bug] vf_amf.c: Profile always forced to FRC_PROFILE_HIGH
2026-06-08 01:26:23 +02:00
nanahi c9cf510d6a video/filter/vf_format: fix changing gamma check
Fixes: 76276c9210
2026-06-08 01:26:23 +02:00
nanahi 6a5e514509 input/sdl_gamepad: move controller null check to front
No need to call SDL_GameControllerGetJoystick if controller is NULL.
2026-06-08 01:26:23 +02:00
nanahi a24227d7ad stream/stream_bluray: fix chapter range check
Fixes: 62786c0c91
2026-06-08 01:26:23 +02:00
nanahi f29fcafb81 video/filter/vf_gpu_vulkan: parent opts to ctx
And only free explicitly on success. On failure it will be freed by
parent.

Fixes: [Bug] vf_gpu_vulkan: Use-after-free of ctx_opts
2026-06-08 01:26:23 +02:00
nanahi 579a62c2ba video/filter/vf_gpu_vulkan: remove redundant frees
ractx and vk are parented to ctx. No need to free manually.
2026-06-08 01:26:23 +02:00
arch1t3cht 47f81c8d7e lcms: avoid NaN when building BT.1886 transfer curves
After
https://github.com/mm2/Little-CMS/commit/bb60a46e9c50e9d3d18cf6dd81869240e4ebe618
cmsDetectBlackPoint can output nonzero X and Z values, which can end up
slightly negative due to rounding errors.
Bound the resulting src_black values by 0 below to ensure that raising
them to the power of 1 / gamma does not result in NaN, which would
result in a broken video profile.

Fixes #17439.
2026-06-08 00:56:44 +02:00
Hubert Głuchowski 43b14a4c9f sub/sd_sbr: make margin changes trigger redraw
This fixes panning not updating the subtitle overlay.
2026-06-07 16:06:37 +02:00
Hubert Głuchowski 71ebd08406 sub/packer: correctly offset instance bitmap pointer in pack_subrandr
The software scaling code expects this pointer to already be offset
by `src_x` and `src_y` but this function copied a pointer only
offset by the image offset, forgetting about instance offset.
2026-06-05 22:16:45 +02:00
Hubert Głuchowski 85fe21d290 sub/sd_sbr: fix zooming
Previously both the padding and clip rect calculations didn't take into
account zoom (negative margins) which resulted in more or less broken
behavior depending on if `sub-use-margins` was set or not.

This fixes those to properly handle negative margins which:
- Makes us calculate a tighter clip rect if `!sub-use-margins`.
- Unbreaks layout zoomed in and `sub-use-margins`.
2026-06-05 21:37:18 +02:00
Kacper Michajłow f88f423829 meson: consider only 'v0.*' tags when computing the version
This allow creating other tags on the repository and don't interfere
with version string generated.
2026-06-05 07:21:58 +02:00
Amyspark 1ad1322335 ci/win32: enable building without Git Bash shell
Replace `cp` in the subrandr wrap with an inline Python script.
2026-06-05 04:03:04 +02:00
Amyspark 0fc000b10b meson: properly escape backslashes when setting CONFIGURATION macro
This fixes compiling when using Windows-style paths in the Meson
configuration line, e.g.

> '-Dc_args=-IC:\mpv\subprojects\amf-headers'
2026-06-05 04:03:04 +02:00
Kacper Michajłow 4013a3c9b6 ci/build.yml: add publish job for git prerelease 2026-06-04 19:44:44 +02:00
nanahi 1d82932cce various: use fopen wrapper for cloexec handling 2026-06-04 04:58:16 +02:00
nanahi 1f150567ac osdep/io: fix fdopen mode flag
In both C11 standard and Microsoft documentation, '+' must be placed
immediately after mode, so placing 'b' between them is incorrect.
2026-06-04 04:58:16 +02:00
nanahi f1a42eff01 osdep/io: use mp_fopen on all platforms
Currently, all fopen uses in mpv do not set cloexec flag, resulting
in fd leak whenever mpv creates a process.

This makes mpv use mp_fopen on all platforms, and always set O_CLOEXEC
on the opened fd. This is required because the "e" flag for fopen is
nonstandard and UB in C11, and unsupported on macOS.

This had been done similarly in other projects. e.g.
https://gitlab.com/graphviz/graphviz/-/merge_requests/3797
2026-06-04 04:58:16 +02:00
NRK 6d5c8591eb osc: reevaluate mouse state after leaving never
currently mouse processing only happens on mouse movement which
causes cases where going from never -> auto does not show the
osc even though the cursor might be in proximity.

move mouse processing code to a function and refresh it when
leaving visibility never to avoid such issues.

Fixes: https://github.com/mpv-player/mpv/pull/17954#discussion_r3286015305
2026-06-04 00:18:55 +02:00
NRK 048c5ec351 osc: fix thumbnails clearing on visibility change
currently hide_bar() bypasses set_visible when visibility was
changed to `never`, this can leave the thumbnail hanging.

instead of scattering disable_thumbnail() calls around, just
call set_visible(false) instead.

Fixes: 9ce79bcaa
2026-06-04 00:18:47 +02:00
NRK 31ee4f99e5 osc: only clear thumbnails when hiding
this currently disables thumbnail even on set_visible(true)
calls which was causing flickering due when scrubbing through
the timeline. only disable thumbnail when hiding the osc.

Fixes: 9ce79bcaa
2026-06-04 00:18:47 +02:00
arch1t3cht 20ec48b717 menu.conf: make quit-watch-later item name more user-friendly
The name "Quit watch later" is hard to understand for users that don't
already know about the quit-watch-later command.

For what it's worth, this does also have some downsides:

1. It makes the context menu even wider, since "Quit watch later" was
   already the longest option.
2. The meaning of the "Open > Watch later" option may now be slightly
   less obvious to users. But this option does not work by default
   anyway, so the user will need to read the manual either way before
   using this option.

But these are fairly minor issues.
2026-06-04 00:16:54 +02:00
verygoodlee 3d709c731c console.lua: take position indicator into account when calculating width
sometimes the position indicator takes up a large portion of the input area, leaving almost no space for input.
2026-06-04 00:16:23 +02:00
Kacper Michajłow bdbeecbc11 demux_lavf: select non-empty edition by default
Some files, that are stripped from programs without edition program
table expose all old programs, that are not usable. Try to select the
one that actually has tracks.

Fixes: https://github.com/mpv-player/mpv/issues/18053#issuecomment-4607524402
2026-06-03 18:56:23 +02:00
Kacper Michajłow 7ae4846c17 player/misc: rate limit taskbar progress update rate
Rate-limit progress-only updates. The win32 backend forwards these to
the shell (explorer.exe), we don't want to spam it too much to avoid
performance issues, when stealing cpu time from the shell thread. In
normal playback, this doesn't update at all, but in live streams the
duration can change, even on every frame.

Fixes: #18053
2026-06-03 18:56:05 +02:00
Kacper Michajłow 448de741f9 DOCS/compile-windows.md: update guide to mention missing pieces 2026-06-03 05:06:14 +02:00
Kacper Michajłow 02273e9d9e ci: fix comment workflow permissions
We are commenting on pull requests.
2026-06-02 12:05:07 +02:00
Kacper Michajłow ad119d9dc9 stream_curl: expose redirect location to lavf
Some demuxers like DASH and HLS, query the location through the
"location" av option, this is how http.c in lavf exposes it. Respect
this interface and expose effective url.

Fixes: https://github.com/mpv-player/mpv/pull/18044
2026-06-02 08:36:21 +02:00
Kacper Michajłow 18d38d4f3e demux: don't mark mid-stream cache ranges as BOF
queue->is_bof is set optimistically after a seek to start, assuming
demuxing began at the start of the file. That is wrong for streams
opened mid-content, which can happen in unfinished event HLS playlists,
which starts at live-edge, but the seekable range in the past is still
valid.

For full support this also require change in lavf [1] to fix the overall
duration of the stream and seeking.

[1] https://code.ffmpeg.org/FFmpeg/FFmpeg/commit/6d98a9a2e8757d6eb616501ade06877389a31597

Fixes: #11990
2026-06-02 08:35:31 +02:00
Kacper Michajłow 1c29507822 ci/msys2: workaround crashing whisper.cpp after unload
When FFmpeg is built with whisper.cpp, the libmpv-lifetime test fails
with `GGML_ASSERT(prev != ggml_uncaught_exception)`. Avoid this by
disabling the problematic backtrace code.
2026-06-02 02:11:07 +02:00
Kacper Michajłow f5d4d9b029 swresample: pass input layout in mpv's order via custom channel order
Drop the swr_set_channel_mapping() + transpose_order() + reorder_in[]
plumbing. Instead, build the swr input channel layout directly from the
mpv chmap as AV_CHANNEL_ORDER_CUSTOM, so the labels in the layout already
match the positions of the channels in the input data.

For all unknown map, we return all UNSPEC, so the swr expands to default
layout for this channel number.
2026-06-01 16:53:48 +02:00
Kacper Michajłow 43a2d9ac0d swresample: remove dead fudge_layout_conversion
Since 9ef614d6a3 this helper has been a no-op. fudge_layout_conversion()
returned the modified uint64_t channel-layout bitmask, but the new
AVChannelLayout path builds out_layout from the unfudged out_lavc and
feeds that to swr.

Even when it was wired up, libswresample handles the BL/BR <-> SL/SR
mapping if needed. SDL/SDR is not currently handled, but I would rather
patch the swr/rematrix.c for those too, instead of having custom glue
here.

Note that SDL/SDR are not that common in-practice.
2026-06-01 16:53:48 +02:00
Kacper Michajłow f239c2dd76 demux_lavf: migrate to AVStreamGroupLayeredVideo 2026-06-01 12:28:16 +02:00
Chainik 44a9b03f24 vf_vapoursynth: improve backward compatibility
The previous commit to dynamically load VapourSynth R74 would fail to work
for VapourSynth R73 and before on Linux due to load mode RTLD_LOCAL. To
make it work on all VapourSynth version, switch to use RTLD_GLOBAL mode.
2026-05-31 18:16:18 +02:00
Chainik 3650c67b6d Revert "vf_vapoursynth: improve backward compatibility"
This reverts commit 8aabba933b.
2026-05-31 18:16:18 +02:00
Ricardo Fonseca 74271a7d80 sub/sd_ass: subtitle timing rounding errors
Use floor(pts * 1000 + 1e-6) instead of llrint() for all timestamp
conversions to avoid floating-point precision errors causing early
subtitle presentation on boundry frames.

Fixes: #17453
Signed-off-by: Ricardo Fonseca <ricardofonseca94321@tecnico.ulisboa.pt>
2026-05-31 03:29:50 +02:00
Kacper Michajłow 13a3e3ad0e stream_curl: log user friendly message when TLS verification fails 2026-05-28 20:14:35 +02:00
Kacper Michajłow ee3d72ce02 options: enable tls-verify by default
We shouldn't default to no verification in current year. User can
opt-out if needed.

Keep it disable for builds without libcurl when libavformat is older
than 63.0.100. This is done to match ffmpeg's timeline for enabling
tls_verify by default in lavf, also to ensure we the default verify
locations will be loaded on such version.
2026-05-28 20:14:35 +02:00
Kacper Michajłow ca89a744c9 stream_curl: tell libcurl to use the native CA store
This is independent of other CA certificate locations set at run time or
build time. Those locations are searched in addition to the native CA
store.
2026-05-28 20:14:35 +02:00
llyyr cce65c722c wayland: map ICtCp coefficients to BT.2100 HLG as well
H.273 defines a single ICtCp matrix coefficients for both BT.2100 PQ and
HLG.
2026-05-27 15:21:19 +02:00
Philip Langdale d05814ceef hwdec_vulkan: fix partial failure edge cases in error paths
This is another file where the slopbot identified a problem, but I was
surprised to see it fix it in a poor way and also miss an adjacement
problem.

`mapper_map` calls `mapper_unmap` with the intention of using it to clean
up partial failure after some planes are wrapped and released while others
are not. But the current code would actually segfault in that situation.

There are two fixes required:

* Ensure `p->vkf` is set by `mapper_map` early so that its available to
  `mapper_unmap` in the error path
* Don't call `vkfc->unlock_frame` in the `mapper_map` error path, as
  this will be called by `mapper_unmap`

Fixes #17977
2026-05-26 18:22:04 -07:00
Philip Langdale 89b95243ef hwdec_cuda: fix partial failure edge cases in error paths
The slopbot spam did find valid issues in the error paths in this code, and as
part of verifying them, I have additional fixes.

* ensure that the return value -1 from `cuda_init()` if `ext_init()` fails
* zero alloc the `ext_vk` and `ext_gl` structs so that we have a known initial
  state
* explicitly initialise the `sem_handle.fd` to -1 to ensure we don't
  accidentally close stdin in the error path. But also don't do this on
  windows as an invalid Handle is 0.
* Don't do a double `cuCtxPopCurrent()` in the `ext_gl` init failure path

Fixes #17976, #17988, #17989
2026-05-26 18:22:04 -07:00
Kacper Michajłow 427e4bf25d stream_curl: support offset/end_offset passed in AVDictionary
lavf's http demuxer exposes initial/final byte offsets as AVOptions.
Some demuxers, like lavf/hls.c assume it is always available, even for
custom IO. We need to use those values for correct demuxing.

Fixes: https://github.com/mpv-player/mpv/pull/17879#issuecomment-4468476976
2026-05-26 19:32:02 +02:00
dependabot[bot] 1ac687d791 ci: bump cross-platform-actions/action from 1.0.0 to 1.1.0
Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-version: 1.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-24 15:59:02 +02:00
llyyr 9e06c3248a ao_pipewire: avoid passing NULL to mp_msg 2026-05-22 17:51:57 +00:00
llyyr 1a78f9fa8e ao_pipewire: avoid deadlock when starting thread loop
loop_start starts a thread which immediately acquires the thread loop
lock. Locking the loop before loop_start can therefore deadlock the
newly created thread during initialization.

Locking the thread loop before loop_start was always incorrect, but
Pipewire commit fb49e0795c28* made the issue visible by switching
pw_thread_loop_lock to the underlying SPA loop lock.

To fix this, we just avoid starting the loop until after we're connected
to the server.

* https://github.com/PipeWire/pipewire/commit/fb49e0795c28c892116b03369785ba86c27c968d
2026-05-22 17:51:57 +00:00
Kacper Michajłow db73857997 ytdl_hook.lua: map ass/srt subtitles 2026-05-21 21:47:45 +02:00
llyyr d521821573 demux_cue: fix audio file lookup inside subdirectory
The FILE field in a CUE sheet may contain a relative path with
subdirectories. It's not clear if this usecase is intended to be
supported, as none of the usual CD/DVD ripping tool generates this type
of FILE field in the CUE sheet. The specification is old and abandoned,
so this will likely never be clarified and it doesn't cost much to
support it so might as well...
2026-05-20 23:22:18 +02:00
Guido Cella 6eaf35866c command: add support for printing sub-lines
show-text ${sub-lines} can be used to print subtitle lines around the
current one and have them hide automatically.
2026-05-20 23:21:49 +02:00
NRK 59c91def55 osc: add back hover-sec in draw-preview
this was initially part of draw-preview but was later moved to a
separate property because it was deemed useful outside of just
thumbnail preview. however this causes bugs when a thumbnailer
observes draw-request and the draw rectangle doesn't change (e.g
due to getting clamped around the border).

add back hover-sec which makes the draw-request more self
contained and removes this footgun.

Fixes: https://github.com/mpv-player/mpv/pull/17518#discussion_r3256017469
2026-05-20 23:17:17 +02:00
Guido Cella 3d111fbf1e demux_libarchive: apply --directory-filter-types to files in archives
Fixes #17931.
2026-05-20 23:15:44 +02:00
Mikael Magnusson 7d603534de msg: don't allow any escapes in --term-title
Unlike --term-playing-msg, the --term-title string is printed in an
escape sequence already. If we print other escapes during this sequence,
it will abort the sequence and dump the rest of the title string as a
visible string to the user, and possibly beep as well, since the title
string can end with a bel character.

Also updates the manpage to remove a comment about win32, since
terminal-win.c does handle OSC title sequences, calling SetConsoleTitleW.
2026-05-20 10:56:08 +02:00
Mikael Magnusson 5f5839aadb video/out/x11_common: set the source indication to 1 in vo_x11_minimize
This was the only call that didn't do this.
2026-05-20 10:55:59 +02:00
Mikael Magnusson c0ef68904d video/out/x11_common: add --focus-on support in X11
Note that when the video params don't change, the check in
player/video.c does not call vo_reconfig2 and the _NET_ACTIVE_WINDOW
message is not sent. As far as I can tell, the same limitation is true
for the macOS implementation, but I can't test that.
2026-05-20 10:55:59 +02:00
Lynne 4c72a03546 video/decode: enable APV hwdec by default
Today, FFmpeg got an APV decoder written in Vulkan compute shaders.
2026-05-20 10:55:48 +02:00
sfan5 1fe37856cb ci: fix comment workflow permissions 2026-05-19 18:54:30 +02:00
Lynne 98c3ae4add vulkan/context: don't activate descriptor buffers after ffmpeg 8.1 2026-05-19 17:35:08 +02:00
Lynne 873a1e8a24 vulkan/context: activate runtime array indexing and non-uniform accesses
We use them everywhere in Vulkan in FFmpeg now.
2026-05-19 17:35:08 +02:00
llyyr a16b333eef meson: bump libcurl minimum version to 7.87.0
CURL_WRITEFUNC_ERROR is only avaialble from 7.87 onwards
2026-05-19 15:55:13 +02:00
sfan5 8fc1a10a44 ci: fix necessary permissions for cleanup_caches and comment
This undoes de5edca29c,
because I failed to read the documentation.
2026-05-18 21:13:09 +02:00
sfan5 de5edca29c ci: clarify that cleanup_caches and comment don't use token permissions 2026-05-18 20:53:29 +02:00
Clinton Phillips 35ae76daad docs/comments: fix more doubled-word typos
Follow-up to #17926, addressing the four additional instances flagged
by @garoto:

- DOCS/man/options.rst: "output size size is limited" -> "output size is limited"
- DOCS/man/input.rst: "Called after after a file" -> "Called after a file"
- video/out/gpu/video.c: "target target that needs to be written" -> "target that needs to be written"
- video/out/x11_common.c: "enable DPMS only we we disabled it before" -> "enable DPMS only if we disabled it before"
  (this one wasn't a pure duplicate — the first "we" was a typo for "if"; the comment now matches the conditional on the line above)
2026-05-18 16:47:14 +02:00
Kacper Michajłow 059bc7025b stream_curl: disable by default on libavformat < 62.15.101 2026-05-16 18:20:42 +02:00
Kacper Michajłow 724b76fe0a stream_curl: add --curl-enabled option 2026-05-16 18:20:42 +02:00
Kacper Michajłow f7e0fd8f0e meson: add curl to summary 2026-05-16 18:20:42 +02:00
Kacper Michajłow 9a9c890e23 stream_curl: use for ftp/ftps
It's significantly more stable than Lavf. Fixes seeking out of cached
ranges. Additionally correctly marks demuxer_is_network for ftp too.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 4dc772c429 stream: don't drop data on stream_read_more
At the initial file open, the buffer may be populated with more data,
than later requested by decoder, but don't drop this data. This fixes
initial open to perform multiple reads of the area, especially for
images that are likelly fully read for probbing already.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 0ae2214a7a ytdl_hook.lua: use the new curl-max-request-size option if needed
This is for stream_curl.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 332764d909 stream_curl: build protocol list based on libcurl state
Allow only subset of supported protocols by libcurl.
2026-05-16 18:20:42 +02:00
Kacper Michajłow b14d8f5ee1 demux_lavf: route nested HTTP opens through the curl backend
Hook AVFormatContext.io_open so HLS/DASH segment fetches and other
nested FFmpeg I/O go through stream_http when libcurl is available.
This lets segments inherit the connection reuse, HTTP/2 multiplexing,
mid-stream resume and conditional compression of the top-level stream.

Falls back to FFmpeg's default I/O for non-HTTP URLs and when the curl
backend is not built in.
2026-05-16 18:20:42 +02:00
Kacper Michajłow f658223abb stream_curl: allow reading cookies not only from a local file 2026-05-16 18:20:42 +02:00
Kacper Michajłow c6833a9307 stream_curl: add libcurl-based stream backend
Introduces stream_http, an internal libcurl-driven backend for http://
and https:// URLs. Runs all transfers on a dedicated curl multi thread
with a producer-side ring buffer, and exposes HTTP/2 multiplexing,
QUIC/HTTP/3 (when libcurl supports it), HSTS and TCP keep-alive.

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

Build is gated on the new 'libcurl' meson option (auto). When disabled
or unavailable, mpv silently falls back to FFmpeg's HTTP implementation.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 5936572e1e ci/build-win32.ps1: disable libpsl tests build 2026-05-16 18:20:42 +02:00
sfan5 ea12f8efc8 ci/mingw: add libcurl 2026-05-16 18:20:42 +02:00
Kacper Michajłow f90dfd033f ci: install curl 2026-05-16 18:20:42 +02:00
Kacper Michajłow cdd3f1197f stream: split shared network options into their own sub-options
Will be useful for future commits
2026-05-16 18:20:42 +02:00
Kacper Michajłow 96ade17428 options: fix stream_lavf options struct name 2026-05-16 18:20:42 +02:00
Kacper Michajłow 6017d1fd1c ytdl_hook.lua: write cookies via cookies-file instead of stream-lavf-o
stream-lavf-o[cookies] only feeds the lavf stream backend. Instead of
side-loading it, use core `--cookies-file` option.
2026-05-16 18:20:42 +02:00
Kacper Michajłow 893313e5af stream/cookies: allow reading cookies not only from a local file 2026-05-16 18:20:42 +02:00
Clinton Phillips 779378c248 docs/comments: fix doubled-word typos
Pure typo fixes in user-facing manpages, interface changelog, and
source comments. No behavior change.

- DOCS/man/encode.rst: "copying of the the comment" -> "copying of the comment"
- DOCS/man/options.rst: "visible takes the the menu bar" -> "takes the menu bar"
- DOCS/interface-changes.rst: "rename the the lua-settings/" -> "rename the lua-settings/"
- video/out/present_sync.c: "requires that that caller" -> "requires that the caller"
- player/lua.c: "try to get by by filtering" -> "try to get by filtering"
2026-05-16 05:26:02 +02:00
Kacper Michajłow 4498c0ff81 ci/build-win32.ps1: bump ffmpeg to 8.1 branch 2026-05-15 00:40:17 +02:00
llyyr f4d059b1d9 vd_lavc: disallow hwdec for grouped streams
44a2c33939 tried to do this in a cute way by unsetting the hwdev to
be used for hwdec, but this doesn't prevent -copy variants from being
probed. Instead explicitly disallow it for grouped streams
2026-05-13 22:24:07 +02:00
sfan5 7b70999b62 ci/mingw: cache tar downloads 2026-05-13 20:45:41 +02:00
llyyr 914114a2cf wayland: fix typo 2026-05-13 15:28:29 +00:00
llyyr 02b4f8ca69 wayland: remove stray spaces before function call parenthesis 2026-05-13 15:28:29 +00:00
llyyr 90f63675ce wayland: return bool values for bool type create_input function
Also invert the return value to better match the rest of the file, and
adjust callers accordingly.
2026-05-13 15:28:29 +00:00
llyyr bef4dc37db wayland: convert create_xdg_surface to bool
create_xdg_surface returns success/failure, so use bool instead of int
for its return type. Also invert the return values to better match the
style of the rest of the file, also adjust callers accordingly.
2026-05-13 15:28:29 +00:00
llyyr ff2d112132 wayland: convert create_viewports to bool
create_viewports returns success/failure, so use bool instead of int for
its return type. Also invert the return values to better match the style
of the rest of the file, also adjust callers accordingly.
2026-05-13 15:28:29 +00:00
llyyr e92538b1db wayland: convert spawn_cursor to bool
spawn_cursor returns success/failure, so use bool instead of int for its
return type. Also invert the return values to better match the style of
the rest of the file, also adjust callers accordingly.
2026-05-13 15:28:29 +00:00
llyyr d28bc02393 wayland: convert check_for_resize to bool
Only returns if a resize edge was found
2026-05-13 15:28:29 +00:00
llyyr ae811ddbbb wayland: log current preferred scale, not older stale one 2026-05-13 15:28:29 +00:00
llyyr 6c34c07b36 wayland: null-check before munmap call
munmap(NULL, 0) returns a failure, also this follows project style
2026-05-13 15:28:29 +00:00
llyyr db4506be45 wayland: fix resize edge boundary checks
The `>` checks exclude a pixel, which is asymmetric with the `<` checks.
Use `>=` for the right and bottom resize edge checks, to not skip a
pixel.
2026-05-13 15:28:29 +00:00
llyyr 3a5e05720e wayland: fix condition for tablet tool cursor shape device destroy 2026-05-13 15:28:29 +00:00
llyyr 0be060ed76 wayland: fix mapping for PAL/NTSC primaries
525 lines is NTSC, 625 lines is PAL. Previously we had them reversed.
2026-05-13 15:28:29 +00:00
Kacper Michajłow 37f4edffaf f_output_chain: don't lose EOF frame on filter failures 2026-05-13 15:44:03 +02:00
Guido Cella 631cdd3622 select.lua: preserve empty subtitle lines
Fixes e9fbf49466.
2026-05-13 15:43:38 +02:00
llyyrandGuido Cella 44a2c33939 f_decoder_wrapper: disable non-copy hardware decoding for stream groups
This allows playing tile grid images without manually disabling hardware
decoding. There is no other type of stream group known to support
hardware decoding so far.

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2026-05-13 14:55:48 +02:00
Guido Cella aa57714b63 video: merge the tiles of grid heif and avif images
Fixes #13585.
Fixes #14982.
Fixes #16486.
2026-05-13 14:55:48 +02:00
Kacper Michajłow c3f8acc10f f_decoder_wrapper: add support for N -> 1 stream merging
This allows to spin N decoder of dependent streams, and merge them in
single output using a filter. Currently only lavfi is supported, and
should be set as a string in the stream group definition.

In the future more advance merging can be implemented in place of lavfi,
but the grouping of the streams should be similar.

This will be useful for tile merging or LCEVC style enchantment support.
May even be useful for DV EL, but this is often not a separate track.
2026-05-13 14:02:10 +02:00
Kacper Michajłow 8c76342a52 demux: select all tracks represented by the stream group 2026-05-13 14:02:10 +02:00
Kacper Michajłow 1095d85b51 demux/stheader: add sh_stream_group representing stream group 2026-05-13 14:02:10 +02:00
Kacper Michajłow cdf77d9274 vo_gpu_next: always cache frames in paused state and never interpolate 2026-05-13 11:22:09 +02:00
Kacper Michajłow 0c4ad9adf6 vo_gpu_next: respect interpolation-preserve option for cache flush
Flush cache only if interpolation-preserve is off, or in paused state to
get immediate update.

Fixes unnecessary cache flushes when parameters of external hooks are
updated rapidly.
2026-05-13 11:22:09 +02:00
nanahi 21351a0580 options/m_property: only get m_option info when needed
Micro optimization.
2026-05-12 21:39:34 +02:00
nanahi f98b114d58 options/m_property: use mp_require for log
log cannot be null on write path which is true for multiply and switch.
2026-05-12 21:39:34 +02:00
nanahi ae23198144 options/m_property: simplify m_property_multiply/m_property_switch
M_PROPERTY_GET_CONSTRICTED_TYPE is already acquired, just pass m_option
directly.
2026-05-12 21:39:34 +02:00
nanahi 6320792f1b options/m_property: try to get constricted type in m_property_do
When setting properties via M_PROPERTY_SET_NODE, the property value
is limited by static declared range. However, some properties like
volume handle dynamic M_PROPERTY_GET_CONSTRICTED_TYPE requests and
return runtime determined limits. M_PROPERTY_SET_NODE in this case
does not respect that limit, and allows setting to a value out of
range.

Fix this by always trying to use M_PROPERTY_GET_CONSTRICTED_TYPE
first so that the dynamic limits will be used.
2026-05-12 21:39:34 +02:00
nanahi 27ec68fbd8 options/m_property: add log null check to m_property_multiply
Similar to m_property_switch, cannot be null for write paths.
2026-05-12 21:39:34 +02:00
nanahi 13550bd31d options/m_property: extract m_property_switch to a function
Similar to m_property_multiply.
2026-05-12 21:39:34 +02:00
Kacper Michajłow c411c6ea68 f_decoder_wrapper: output EOF when decoder is unavailable
When decoder is not available or failed to initialize, just signal EOF
and allow player to close, instead of spinning waiting for frame that
will never arrive.
2026-05-12 14:13:05 +02:00
Kacper Michajłow 6bdacac991 player/loadfile: fix stack-overflow on EDL metadata track
demux_edl allocates metadata track with type set to STREAM_TYPE_COUNT,
when counting track types this was not accounted for. Make room for this
"special" type of track. Add asserts while at it, just in case.

Note that other similar uses are gated behind track->selected, and
metadata track will never be marked as one.

This is not exploitable, as it was overriding only one integer value past
the allocated array, so worse thing that could happen is that we
misbehave during track selection or crash.

Side note, OSS-Fuzz was fuzzing this for few years now, and couldn't dig
into this specific case. I've validated that our fuzzer is in fact
reproducing this issue when provided the testcase, which I belive was a
basis for this report.

Fixes: GHSA-qpf4-42gw-f286

This vulnerability was discovered by Claude, Anthropic's AI assistant,
with OSS-Fuzz fuzzing and triaged by Ada Logics manually in
collaboration with Anthropic Research.
2026-05-12 13:09:22 +02:00
Guido Cella 7732c305a5 osc.lua: hide 0 duration
Restore the behavior before 3183ea99.
2026-05-12 00:06:35 +02:00
Guido Cella 8674222927 input.conf: make rotate keybindings repeatable
Needed because --video-rotate is OPT_CHOICE.
2026-05-10 20:46:31 +02:00
Hubert Głuchowski bba7c53a29 sub/sd_sbr: implement get_lines 2026-05-10 00:39:41 +02:00
Hubert Głuchowski a0ff557459 sub/sd_sbr: implement get_text 2026-05-10 00:39:41 +02:00
sfan5 003c5433f6 ci/mingw: switch to zlib-ng
gotta go fast
2026-05-10 00:02:19 +02:00
sfan5 373cfc6924 ci/mingw: refactor tar downloading 2026-05-10 00:02:19 +02:00
nanahi 7b057f66fa DOCS/man/mpv: add usage hint alternative for pseudo-gui profile
This has been deprecated for 9 years since
9eef41dec1.
With the previous commit, this can be replaced by conditional autoprofiles.
Add usage hint to the documentation.
2026-05-09 15:01:09 +02:00
nanahi ed2e55b941 options: make player-operation-mode readable as a property
Make it readable as a property so that scripts and conditional
autoprofiles can customize behavior depending if player is
launched as pseudo gui mode.
2026-05-09 15:01:09 +02:00
llyyr 4414547d62 wayland: use lrint for keepaspect window sizing
Avoid biasing sizes upwards
2026-05-09 14:50:17 +02:00
llyyr 1a1288184a wayland: force redraw on every configure when in toplevel resize state
This fixes stalled/slow resize when there's only an image being
displayed or no output at all. When there's a video playing, the video
implicitly causes a redraw but we need to redraw ourselves when there's
no video.

Fixes: https://github.com/mpv-player/mpv/issues/16744
2026-05-09 14:50:17 +02:00
sfan5 24fbc99701 ci/mingw: some small cleanups and updates
Note: zlib 1.3.2 breaks with -Werror=undef, so we don't update it.
<https://github.com/madler/zlib/issues/1169>
2026-05-09 12:07:53 +02:00
Guido Cella e9fbf49466 select.lua: split multi-line subtitles
Before 77ed8fef88 texts with multiple lines were split to multiple
items, after it only shows the text before any newline.

Split lines again.
2026-05-09 09:56:13 +02:00
Kacper Michajłow e0eb42c303 demux: add --demuxer-hysteresis-bytes
Fixes: https://github.com/mpv-player/mpv/discussions/17888#discussioncomment-16852506
2026-05-08 17:27:13 +02:00
Kacper Michajłow 09900a0ff0 demux/packet_pool: incrementally free old packets on pop
Until now the pool only released its packets on shutdown or when the
cache size was reduced at runtime, so it kept growing across a session.
The amount of packets would be indirectly bound by demuxer cache size,
else the packets are reused. Still over long playback or switching
files, this may give impression of elevated memory usage, or even memory
leak. This was particularly visible with cache-on-disk, where users
reasonably expect RAM usage to stay low.

Pop now keeps the first POOL_HOT_RESERVE packets at the head of the
freelist for fast reuse, and frees up to POOL_GC_BATCH packets from
beyond that on each call. Bulk pushes (e.g. cache reset on file end)
remain no-work policy. The pool drains across subsequent allocations
rather than stalling on a single huge free. Self-balancing without any
size tracking.

This drains the pool in steady state. Note that on file switch we
effectively reuse only ~N / POOL_GC_BATCH packets from the old cache,
because each pop reuses just one packet while freeing up to
POOL_GC_BATCH. That's fine, both free and alloc calls are throttled to
the same per-pop rate, so allocator pressure stays bounded even though
not all packets get reused.
2026-05-08 14:43:36 +02:00
Kacper Michajłow 2c8f449f1e ci/build-win32.ps1: update shaderc patch 2026-05-08 12:06:25 +02:00
Kacper Michajłow 4d944b2fad ytdl_hook.lua: remove track selection hack
This breaks HLS bitrate selection, as it uses track metadata in place of
HLS bitrate, which are most of the time different things.
2026-05-07 18:59:08 +02:00
Kacper Michajłow 8c26c0c1e9 TOOLS/matroska.py: plumb some type hints to make new mypy happy
We don't use strict mode still, so only few are typed.
2026-05-07 14:29:04 +02:00
Kacper Michajłow cfd818bcae ra_gl: fix memory leak 2026-05-05 20:17:24 +02:00
Kacper Michajłow 333857403f test/libmpv_common: wait for all clients and player to be destroyed
mpv_destroy() only detaches the client, while leaving the player alone.
Since this is exit cleanup, we should just wait and quit whole player.
2026-05-03 20:26:40 +02:00
llyyr 948c86d24c player/lua: fix autofree ctx leak on exit() call
Fixes LSAN leak when tests call fail() and exit(1) is called. We have
mpv_destroy set for atexit but data.ctx was null parented, so it had no
parent to be freed by. Parent it to script_ctx instead so it gets
cleaned up by mpv_destroy.

LSAN output:

Direct leak of 400 byte(s) in 5 object(s) allocated from:
    #\0 0x7f4c6c52c01f in malloc (/lib64/libasan.so.8+0x12c01f) (BuildId: db0aa5bf57ed53a5869a3a2cc49051292ceb6390)
    #\1 0x7f4c6b276388 in ta_alloc_size ../ta/ta.c:139
    #\2 0x7f4c6b2bf01f in script_autofree_trampoline ../player/lua.c:1310
    #\3 0x7f4c69373b15  (/lib64/libluajit-5.1.so.2+0xbb15) (BuildId: 182622c63dea3dd74173bbd5a810051a76bcf4d9)
2026-05-03 17:25:17 +02:00
Ivan Shapovalov ce71cd8aeb mp_image: refine check for supported Dolby Vision metadata
Improve the Dolby Vision metadata check to accept RPUs that indicate EL
usage (profiles 4 and 7) if the original bitstream and metadata are
MEL-only, instead of hardcoding a check for disable_residual_flag.

This needs libplacebo commit a4783f89 ("util/libav: do not bail on
MEL-only RPUs w/EL"), or libplacebo API version 359.
2026-05-03 11:49:47 +02:00
Kacper Michajłow 7c25b3e47c vo_gpu_next: fix upload synchronization
And make them actually async when copied from host ptr. The issue was
when we used DR buf upload, which is always async, it was not
synchronized in anyway.

Fixes: #13811
2026-05-03 08:47:34 +02:00
llyyr d8be86067c ao_pulse: fix subscribe_cb using wrong bitmask for event type
PA_SUBSCRIPTION_MASK_SINK is a pa_subscription_mask constant used when
registering with pa_context_subscribe(), not a
pa_subscription_event_type mask. Masking the event type with it would
never match PA_SUBSCRIPTION_EVENT_NEW or PA_SUBSCRIPTION_EVENT_REMOVE,
causing hotplug events to be silently dropped.

Fixes: e01750020d
2026-05-03 06:44:37 +02:00
nanahi 5e847889b3 osdep/win32/smtc: fix client handle leak 2026-05-01 13:42:57 +02:00
nanahi 0ec3015339 player/external_files: remove handling related to update sub exts
This is only used to update the list for player internal sub ext matching.
Since this handling now lives in the dnd client, it can be removed from
core, which also eliminates a global variable.
2026-05-01 13:42:57 +02:00
nanahi 675fb1229b input/dnd: move --drag-and-drop handling to dnd client
This unifies --drag-and-drop handling to a single place. All platforms
currently only support normal drop (mapped to "replace") and shift click
drop (mapped to "append").
2026-05-01 13:42:57 +02:00
nanahi 81611b4a4e input/dnd: move built-in drag and drop handling to mpv client
This moves the drag and drop handling to an internal mpv client,
removing the hardcoded handling from core.
2026-05-01 13:42:57 +02:00
nanahi 87ccb6022c command: add dropped-file property
This adds dropped-file property which contains a list of dropped files
and the type of the drop. This allows clients to implement custom drag
and drop handling.
2026-05-01 13:42:57 +02:00
nanahi e12ab84571 input: add --input-builtin-drag-and-drop option
This allows disabling the built-in drag and drop handler, while still
allowing VO to announce dropped files.
2026-05-01 13:42:57 +02:00
nanahi 544a56a148 input: rename notify_touch_update to notify_event_update
Will also be used to notify dnd updates.
2026-05-01 13:42:57 +02:00
nanahi 41fb7f9eb2 command: use string list helper for option-info 2026-05-01 13:42:57 +02:00
nanahi 777401d7de options/m_property: add SUB_PROP_STRING_LIST
Helper used in next commits.
2026-05-01 13:42:57 +02:00
nanahi 5e0932e785 input: rename mp_event_drop_files to mp_input_drop_files
Move it to input.c. Will be used in next commit.
2026-05-01 13:42:57 +02:00
Kacper Michajłow cdbe01c3db demux_lavf: add support for stream groups
Currently none of them are fully supported, but at least mark dependent
tracks as such.
2026-05-01 11:44:26 +02:00
Kacper Michajłow c0c7584342 etc/builtin.conf: change gui mode to idle=yes
It is more expected from GUI application to stay open, even after
playback. Additionally this gives user a chance to inspect possible load
failures, while previously mpv would disappear.
2026-05-01 11:42:04 +02:00
Kacper Michajłow dc59f3b399 test/libmpv_test_track_selection: add test for program mappings 2026-05-01 11:41:31 +02:00
Kacper Michajłow bf1a14e541 test/libmpv_common: print property in checks 2026-05-01 11:41:31 +02:00
Kacper Michajłow f5857d3b87 demux_lavf: support multiple program mappings per stream
Each stream can belong to multiple programs, we have to support that.
Previously track could belong only to single program.
2026-05-01 11:41:31 +02:00
Kacper Michajłow 28ce461a84 options/m_option: add m_option_type_prop_array
Add adaptor for arrays of properties, this is not used as real option,
as those are always string list. But as a connector struct for creating
typed node arrays, in (sub)_properties.
2026-05-01 11:41:31 +02:00
Kacper Michajłow eedadc24ae player/command: hide dependent tracks
They are unusable on thier own, and shouldn't be selected by the user.
Those tracks are ment to be used internally.
2026-05-01 10:42:00 +02:00
Kacper Michajłow 0c067f140e test/libmpv_test_track_selection: add test for --flatten-editions 2026-05-01 10:42:00 +02:00
Kacper Michajłow b4a7ea306e demux_{lavf,timeline}: add --flatten-editions
Lavf exposes programs/renditions as a flat track list tagged with
program_id. We respect this metadata and group tracks into their
respective programs, as tracks from different programs may be completely
unrelated to each other.

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

Fixes: https://github.com/mpv-player/mpv/issues/17836#issuecomment-4345930205
2026-05-01 10:42:00 +02:00
Kacper Michajłow 44ceaa6498 vo_gpu_next: only flush cache on render options update
No need to reset input queue too.
2026-05-01 10:41:41 +02:00
Kacper Michajłow 8d04be2b85 mp_image: force stride to be multiple of bpp
Vulkan require all sizes in texels, so we have to make our image
multiple of them.

Fixes: #17743
2026-05-01 10:41:28 +02:00
Kacper Michajłow 8aef2c9162 demux_lavf: map comment to stream title
Lavf HLS demmuxer put rendition names into `comment`, this is basically
a title in our usage.
2026-05-01 06:09:27 +02:00
Kacper Michajłow ec03ef7e97 demux_lavf: remove track flags duplication from title
Those flags are already exposed, and users can format it as they wont.
Don't produce some dummy titles.
2026-05-01 06:09:27 +02:00
llyyr a44478d79f vulkan/context: avoid printing incorrect error on vulkan-device fail
M_OPT_INVALID says "option parameter could not be parsed" which is
incorrect for some failures this parser might encounter. Instead print
something that might be useful for the user to debug.

Vulkan instance might fail to create if there's no vulkan drivers that
mpv can see, or devices might fail to enumerate for whatever reason
2026-05-01 06:09:00 +02:00
Kacper Michajłow 48bd97b5bb stream_dvdnav: don't leak times in STREAM_CTRL_GET_CHAPTER_TIME 2026-05-01 05:01:37 +02:00
Kacper Michajłow 4182a1df43 stream_dvdnav: use named definition for return val 2026-05-01 05:01:37 +02:00
Kacper Michajłow 118dda68c1 stream_dvdnav: fix STREAM_CTRL_SET_ANGLE return value
It was flipped and returned ok on error.
2026-05-01 05:01:37 +02:00
Richasy 986dd6387d ao_wasapi: fix retry budget on DEVICE_INVALIDATED
The retry path in wasapi_thread_init() used MP_TIME_US_TO_NS, giving a
total budget of ~15 us before MP_FATAL killed the audio thread. The
resulting log line "Retrying in 1000 ns" makes the unit confusion
obvious.

In practice AUDCLNT_E_DEVICE_INVALIDATED is most often hit right after
the system resumes from sleep, or when the default endpoint changes,
where the audio endpoint typically needs hundreds of milliseconds to
come back. The current budget never covers that window, so the first
playback after wake-up permanently fell back to "no audio" until the
user manually restarted playback.

Switch the retry schedule to milliseconds: start at 1 ms (~one Windows
timer tick, effectively an immediate yield), multiply by 10 each
iteration, and cap at 1 s -- i.e. 1/10/100/1000 ms, 4 retries, ~1.1 s
total. Use MP_TIME_NS_TO_MS for the warning so the unit in the log
matches reality.
2026-05-01 05:01:00 +02:00
Kacper Michajłow 2f58ee36ce demux/packet: refactor demux_packet_add_blockadditional
Make it more extensible for future additions.
2026-05-01 00:38:04 +02:00
Kacper Michajłow 696190d25b demux/packet: add support for LCEVC ITU-T35 payloads 2026-05-01 00:38:04 +02:00
Dudemanguy b1d23bba5e vo_gpu_next: don't spam render queue underrun logs on frame->still
If we are redrawing on a still image (e.g. ass events), then the pl
queue will hit the PL_QUEUE_MORE case which is fine but there's no need
to spam the log here. The information may be useful for when an actual
video is being played, but when a frame is still (e.g. paused or only a
single image) it's just noise.

Fixes #17840.
2026-04-30 15:01:34 +00:00
Kacper Michajłow 5ebe9581d5 demux_{lavf,timeline}: consider audio only HLS when selecting edition
Fixes: #17836
2026-04-29 19:23:42 +02:00
Guido Cella 0a0c63d3e9 ytdl_hook.lua: convert metadata values to string
Fixes https://github.com/mpv-player/mpv/pull/17805#issuecomment-4340090625
2026-04-29 11:32:19 +02:00
kamperemu 8cc65c838e osc.lua: add box width option for box and slimbox layouts
osc.lua: add slimbox width option and preserve width values for box slimbox

docs: update default box and slimbox width values in OSC configuration

docs: add `boxwidth` and `slimboxwidth` script options to osc
2026-04-29 07:22:14 +02:00
Kacper Michajłow 3e3936eee4 player/loadfile: filter tracks without edition when there are matches
When the current edition supplies its own track of a given type
(e.g. yt-dlp muxed editions ship their audio paired with the video),
shared program_id == -1 tracks of that type are filtered out of
both the track list and auto-selection. Editions that don't ship
their own track (DASH video-only editions sharing the audio pool)
continue to see the program-agnostic tracks.
2026-04-29 03:45:05 +02:00
Kacper Michajłow 4730c9179a player/loadfile: remove preferred_program from track selection
It's no longer needed, tracks from different editions are not listed
togheter anymore.
2026-04-29 03:45:05 +02:00
Kacper Michajłow 91b6d8fdd1 demux: enrich edition titles with codec/resolution/bitrate info
Extract the codec descriptor out of mp_format_track_metadata into a
shared demux_append_codec_desc() helper, and use it from a new
demux_compose_edition_title() composer that both demux_timeline.c and
demux_lavf.c call when building editions. Codec block is only added
when the program has exactly one stream of that kind, and fields
already present in the prefix (e.g. WxH from yt-dlp's format label)
are skipped to avoid duplication.
2026-04-29 03:45:05 +02:00
Dudemanguy a42b1b9103 wayland: only update toplevel state values if we have a valid state
We have this annoying situation here during the initial window
configuration where sometimes we have to update certain values and other
times they need to be ignored. 45324ce682
made sure to parse the toplevel state before we checked the initial
compositor values which is correct. But it's not enough because mpv can
have its own initial state (e.g. --fullscreen) and by moving it here it
would get overwritten in the toplevel state check and thus ignored. So
to have our cake and eat it too, we need to only update the internal
state values if we know mpv is in a valid state in the first place. So
either we've set the initial geometry already or the compositor has
given us some specific initial state to work with. Fixes #17819.
2026-04-27 14:39:05 +00:00
Guido Cella 05b327c723 osc.lua: use the cached chapter_list instead or retrieving chapters 2026-04-26 08:56:24 +02:00
Guido Cella ae3189567b select.lua: add select-secondary-subtitle-line
Requested in https://github.com/mpv-player/mpv/pull/17730#issuecomment-4321224996
2026-04-26 08:55:42 +02:00
Kacper Michajłow ed99433277 TOOLS/dylib_unhell.py: simplify the otool output processing
There is no need to pipe things through shell and grep/awk, python is
perfectly fine word processor. This makes it simpler to reason what is
extracted and from where and also makes the script faster as we spawn
only single process directly, not shell with multiple children.
2026-04-26 01:19:27 +02:00
Guido Cella 3183ea9980 osc.lua: always observe duration
Currently the duration observer is toggled in multiple places to not
call request_init unecessarily. It is much simpler to always observe it
and call request_init conditionally in the callback. This also allows
reusing the cached value throughout the OSC.

Note that dividing by 0 is not an error in Lua so there is no need to
check for both 0 and nil.
2026-04-26 00:20:33 +02:00
Guido Cella 9ce79bcaa0 osc.lua: hide thumbnails when setting visibility to never
And also when using script-message osc-hide.
2026-04-25 20:03:10 +02:00
Guido Cella 47a8a47b31 osc.lua: don't write to user-data on every render
Only update hover-sec when there is a big enough change to not spam the
log with -v.
2026-04-25 20:03:10 +02:00
Guido Cella 77ed8fef88 select.lua: use sub-lines instead of forking to ffmpeg
This:

- Removes the dependency of ffmpeg in PATH - useful on Windows, macOS
  (?), Flatpak.
- Will support subrandr.
- Avoids redownloading network subtitles.
- Avoids slow demuxing of large mkvs.
- But no longer returns future lines of embedded subtitles.
- No longer returns embedded lines of regions you seeked beyond without
  playing them.
- Changing sub track drops cached subtitles.
2026-04-25 19:58:52 +02:00
Hubert Głuchowski a0a0a7e4cf sub/dec_sub: de-duplicate overlapping sub lines 2026-04-25 19:58:52 +02:00
Guido Cella 5f02e1b8a2 sub: add sub-lines property
Return all subtitle lines in memory with text, start and end.

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

Closes #12810.
2026-04-25 19:58:52 +02:00
Kacper Michajłow c662594f05 Revert "player/core: increase number of past_frames to 1000"
100 is enough and avoids mistimed frames to affect long term stats. It
would be good to improve vsync estimation accuracy, but increasing
averaging size alone is not the best solution.

This reverts commit 4e44fe024c.
2026-04-25 08:32:29 +02:00
Kacper Michajłow 4e44fe024c player/core: increase number of past_frames to 1000
This helps with video fps estimation, for containers that doesn't
provide accurate timestamps.
2026-04-25 07:15:37 +02:00
Kacper Michajłow 68b1d10da5 player/video: rewrite display-sync audio drift compensation
The old code had several interacting problems that prevented A/V from
reaching a steady state.

When the A/V difference was large, it applied the maximum allowed
compensation in one step. That was fine for catching up, but the value
was never re-evaluated, so audio speed routinely overshot the target.
Once the difference crossed zero (or re-entered the acceptable range) it
would run a linear regression over recent av_diff samples and snap the
audio speed to the estimated drift. The fatal flaw was that those
samples already included the controller's own compensation: even when
the underlying drift was zero, the controller would "detect" the drift
it had just induced and try to cancel it. Between these rare, sparse
updates audio speed stayed frozen, so in practice the controller was
introducing drift more than it was fixing it. On high fps outputs,
where the vsync range is tight, this degenerated into a ping-pong:
overshoot, snap back, overshoot again, never settling.

The new code replaces the bang-bang direction controller and one-shot
regression with a proportional controller driven by a low-pass-filtered
av_diff. The LP filter (1 s time constant) rejects per-frame vsync
jitter so the compensation no longer chases noise. The target then
decays av_diff exponentially toward zero with a 10 s recovery time.
Adaptive slew caps per-frame motion to the desired correction magnitude,
so large excursions are absorbed quickly while near-equilibrium motion
stays below audibility. The result is a continuous, gentle control loop
that actually reaches steady state and does so without audible
audio-speed modulation.
2026-04-25 07:15:37 +02:00
Kacper Michajłow 382e3e74e8 player/command: add more precision to avsync pretty print
To better see close to zero values, instead of just clamping to 0.
2026-04-25 07:15:37 +02:00
Kacper Michajłow 99b9d9491d player/command: add more precision to av speed correction pretty print
Those values are often very small, but it's still good information to
have how they are changing.

This brings those values closes to old `%+.05f%%` that were used here.
2026-04-25 07:15:37 +02:00
Crend King 8aabba933b vf_vapoursynth: improve backward compatibility
The previous commit to dynamically load VapourSynth R74 would fail to work
for VapourSynth R73 and before on Linux due to load mode RTLD_LOCAL. To
make it work on all VapourSynth version, switch to use RTLD_GLOBAL mode.

Add library handle closing in drv_vss_uninit for completeness.
2026-04-25 07:14:56 +02:00
Andrew Rabert 45324ce682 wayland: parse toplevel states before geometry_configured check
Fix toplevel state being lost before geometry_configured is
configured. Previously, for a KWin rule that set fullscreen (apply
initially or forced) when a --geometry was also specified, mpv would
render at --geometry size even though the compositor was treating it as
fullscreen. This resulted in geometry-sized content anchored to the
top-right without a titlebar. This mismatch of what mpv thinks and what
actually is can also be seen similarly with a KWin rule that sets a
maximize state.

With this change, mpv starts in fullscreen _proper_ (ie --fullscreen).
Exiting fullscreen then results in a window size as specified by the
--geometry.

For the other states this handles, I'm honestly not sure as I wasn't
able to force them. It _should_ be fine based on what I see here and
_logically_ is correct as mpv's state should always match what the
compositor informs it to be.
2026-04-25 04:47:32 +00:00
Guido Cella e046cd0736 context_menu.lua: add background_alpha script-opt
Closes #17807.
2026-04-24 20:19:50 +02:00
Julian Orth 4c9262664c wayland: implement session management
If the compositor supports session management, the mpv window is always
added to a session. The user can manage multiple sessions by using
`--wayland-session=<human-readable-name>`. Human-readable names are
mapped to session ids via files under `~/.local/state/mpv/sessions`. The
file name is computed as a hash of XDG_CURRENT_DESKTOP and the
human-readable name.

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

Upon session restoration, the mpv window is restored by the compositor
according to its state from the previous session. What that entails is
compositor policy.
2026-04-24 15:36:44 +00:00
Guido Cella 98a6960a3d ytdl_hook.lua: remove outdated comment 2026-04-23 22:06:47 +02:00
Guido Cella b3c46456c5 ytdl_hook.lua: set metadata with use_manifests=yes
With use_manifests=yes EDL is not used so metadata never gets set
through the tags mechanism. Thankfully the metadata property was
recently made writable so use that instead.

The existing metadata variable is inlined to fix linting.

Fixes https://github.com/mpv-player/mpv/pull/17761#issuecomment-4306070651
2026-04-23 22:06:47 +02:00
Kacper Michajłow 9b3565c980 msg: don't filter PU{1,2} we use them internally
Fixes: #17801
Fixes: d4ae20b7a3
2026-04-23 17:13:42 +02:00
Crend King 75b2ccfeb1 vf_vapoursynth: update for VapourSynth R74
VapourSynth R74 changed two things relevant to mpv build process:

1) VSScript no longer has static library to link to, and only support runtime loading.
This is reflected on the new VSScript example in VapourSynth SDK.
2) The VSScript library name is changed from libvapoursynth-script to libvsscript for Linux
and MacOS.

The new VSScript initialization code is modified from their SDK example to utilize
mpv's mechanisms. Build dependency is also updated accordingly.
2026-04-23 01:38:48 +02:00
Aly Smith f5939d0b93 ci: ensure winget is available on windows-11-arm
per actions/partner-runner-images#95, manually install and repair winget module in windows-11-arm runner to ensure it is available for following dependency step
2026-04-22 04:15:29 +02:00
alydev d40a29190d demux_playlist: add support for 'strm' playlist
The .strm format consists of a URI or local path as the sole contents
of a text file, this is parsed by software like Emby or Jellyfin to
treat remote streams or paths as if they are in the local filesystem.
This commit adds .strm to mpv's internal list of playlist file formats,
and points it to the handler for .m3u files as they should be
compatible. .strm doesn't need all the features of .m3u/.m3u8, but the
features do not cause issues with the relatively barebones playlist
format of .strm.
2026-04-22 03:23:50 +02:00
Kacper Michajłow 174bcec30e w32_common: support initial --fs and --window-maximized
Don't set maximized window state if we are entering fullscreen too, this
makes restoring later consistent.
2026-04-22 01:56:59 +02:00
Kacper Michajłow 9d526fc138 w32_common: keep client size on window state changes
Not all resizes should reset client size size.

Fixes: #17695
2026-04-22 01:56:59 +02:00
Hubert Głuchowski 7ec11ad67a misc/codepoint_width: handle partially ill-formed UTF-8
Previously the function just bailed on invalid input, this instead makes
it count how many replacement characters would be shown by a terminal
complying with the Unicode specification's recommendation here:
https://www.unicode.org/versions/Unicode17.0.0/core-spec/chapter-3/#G66453

Fixes https://github.com/mpv-player/mpv/pull/17773#issuecomment-4277538534
2026-04-22 00:06:59 +02:00
Guido Cella 35b851e38a DOCS/man/options: remove all_formats=yes warning
Dunno what wm4 was referring to here but all_formats=yes works just fine
and quickly for changing track at runtime. The only issue I see is that
it drops the video cache if you change audio track.
2026-04-21 22:50:12 +02:00
Guido Cella 6b524c4f0e ytdl_hook.lua: default to all_formats=yes
93fe7a5526 fixed the only problem with all_formats=yes, so make it the
default to allow changing tracks of ytdl_hook URLs at runtime without
re-invoking yt-dlp.

Closes #16872.
2026-04-21 22:50:12 +02:00
nanahi 531fe5a43e osc.lua: make window control buttons action customizable
Use bind_mouse_buttons helper. This makes it possible to bind custom
actions, such as right click X button to quit with watch later.
2026-04-21 18:19:18 +02:00
nanahi d9e8e0bdf6 osc.lua: add option to configure skip_forward/backward buttons
This adds _down_command support to bind_mouse_buttons so it can be
used to bind button down actions like mbtn_left_down, and let forward
and backward buttons use bind_mouse_buttons. This makes mouse button
down actions customizable.
2026-04-21 18:19:18 +02:00
nanahi b3e6506d10 osc.lua: fix frame stepping with skip_backward/forward buttons
The event responder must have up, down, or press suffix, but
940ab99055 removed it for frame stepping
function, making it unusable. Fix this by using the down suffix.

Fixes: 940ab99055
2026-04-21 18:19:18 +02:00
Hubert Głuchowski ac3b6044d0 console.lua: use terminal_display_width when picking longest menu item
Previously this function would just count bytes which was very easily
broken by incantations like `Ő̶̧͍̹͔̮̮̦͌̈̌̂́̊͜K͖̮̼̯͖͆͋̓̀̕` which take up 52 bytes while being just
2 normal width characters visually.

`terminal_display_width` correctly counts `Ő̶̧͍̹͔̮̮̦͌̈̌̂́̊͜K͖̮̼̯͖͆͋̓̀̕` as 2 visual characters.

Note: GitHub strips all these in their web UI but there are many Unicode
combining characters after each letter of the `OK`s above that produce
a "cursed" text effect.

Fixes #17772
2026-04-21 18:17:22 +02:00
Hubert Głuchowski c202be1efe player/{lua,javascript}: add mp.utils.terminal_display_width function 2026-04-21 18:17:22 +02:00
Kacper Michajłow 6ab49ac5d7 w32_common: clear window_minimized flag on minimize->maximize
It doesn't send RESTORE in this case, so the state got confused.

Fixes: #17678
2026-04-21 05:51:58 +02:00
Kacper Michajłow e7d3fe8668 vf_d3d11vpp: fix print index value 2026-04-21 05:08:49 +02:00
Guido Cella 5921fe50bb osc.lua: use the cached chapter-list for chapter markers
When 0197729949 added state.chapter_list this call was not updated to
use the cached value, but there is no reason not to use it, especially
now that more cached properties are used.
2026-04-20 21:57:05 +02:00
Guido Cella fb8c933d4d osc.lua: cache observed properties
For properties that were already being observed but still retrieved over
and over, cache their values using the new observe_cached().

osd-dimensions observer said that if cached we may have to worry about
property ordering but it seems to work fine. It is nice to cache it
because it was the property retrieved the most frequently, in 5
different places.
2026-04-20 21:53:57 +02:00
rabbit d4ae20b7a3 msg: sanitize term title and block C1 controls and DEL
Expose the terminal output sanitizer as mp_msg_sanitize() and use it in
term_osd_update_title() to sanitize the property-expanded term-title
string before it reaches mp_msg_set_term_title(). Without this, a
crafted media tag can break out of the OSC-0 sequence via embedded BEL
or ESC bytes when --term-title includes property expansions like
${media-title}.

Extend the sanitizer to cover two gaps:

- UTF-8 encoded C1 controls (U+0080-U+009F, bytes C2 80..C2 9F). xterm
  in UTF-8 mode interprets these codepoints as C1 control functions
  (U+009B as CSI, U+009D as OSC, U+009C as ST), allowing escape
  sequence injection without any ESC or BEL bytes.

- DEL (0x7F), which was not previously filtered.
2026-04-20 21:53:33 +02:00
Kacper Michajłow 4d0666670a vo_gpu_next: don't dither scRGB
scRGB is basically intermediary format, but we don't really know what
would be the real target. And since we send floating-point buffer, we
can just expect the downstream will handle dithering and quantization at
some point.
2026-04-20 21:52:52 +02:00
NRK 7d1a598bdd vo_gpu: support parameters in RPN expressions 2026-04-20 21:52:06 +02:00
NRK d17e32fcfc DOCS/man/options: add missing RPN operators
equal and mod are also supported but were missing in the docs.
2026-04-20 21:52:06 +02:00
Kacper Michajłow 7eb1ef2fe0 video/out/filter_kernels: mark kernel-compatible windows as resizable
Mark every filter window whose libplacebo counterpart is resizable as
resizable in mpv too.

This allows --tscale-radius to be used. Prior to this, vo=gpu
silently ignored the radius override while vo=gpu-next honored it,
producing different output for the same options.
2026-04-20 21:51:34 +02:00
Kacper Michajłow 3f1589cf4c video/out/filter_kernels: fall back to nearest tap when sum is zero
When the effective filter bound (radius * blur) is smaller than the
smallest tap distance, mp_compute_weights produces all-zero weights and
the subsequent normalization divides by zero, producing NaN weights that
render as black. This can happen for resizable filters where the user
picks a radius below 0.5.

Detect sum == 0 and fall back to nearest-neighbor on the closest tap.
2026-04-20 21:51:34 +02:00
Kacper Michajłow 1be21a3186 demux_timeline: prefer editions with default video track
When the EDL marks a video track with flags=default, select the edition
whose video stream carries that flag.
2026-04-20 03:04:25 +02:00
llyyr ac852ab9df demux/packet: fix version check for SMPTE 2094-50 metadata
This enum was added in lavc 62.30.100 in https://github.com/ffmpeg/ffmpeg/commit/7faa6ee2aa01
The doc/APIchanges version listed in that commit is incorrect, it's
actually lavc 62 not lavc 60.

Fixes build failure with ffmpeg between
https://github.com/ffmpeg/ffmpeg/commit/6ba6db4f195c and https://github.com/ffmpeg/ffmpeg/commit/7faa6ee2aa01

Fixes: 76df24f40c ("demux/packet: add support for SMPTE 2094-50 metadata")
2026-04-19 16:11:38 +02:00
Guido Cella 06f4ce75aa defaults.lua: remove mp.use_suspend dead code
This does nothing since f30c5d09f4 (10 years ago).
2026-04-18 23:28:57 +02:00
nanahi 25e9a0c740 player/command: remove inaccurate comment in cmd_mouse 2026-04-18 21:13:46 +02:00
nanahi bceb1eeaf4 Revert "player/command: don't send mouse move event on mouse leave request"
There is no reason to do this, since VOs do report mouse position when
outside of window in some cases.

This reverts commit 3ff7b04790.
2026-04-18 21:13:46 +02:00
nanahi 891273055f DOCS/man/input: fix mouse-pos/hover documentation
The comment about video backends not updating pointer position is only
true if no mouse button is being pressed. If mouse button is pressed on
mpv window and then moves out of window region without releasing the
button, some platforms (win32, Wayland, X11) "capture" the pointer and
still report the coordinates, while some other platforms (SDL) do not.

The value of mouse-pos/hover also differs between platforms in this case.
The value is true on win32 and Wayland, but false on X11.

Fix documentation to address them.
2026-04-18 21:13:46 +02:00
llyyr 8665237a07 wayland: use av_gcd instead of implementing our own gcd function
Adds mp_gcd wrapper for av_gcd and uses it instead.
2026-04-18 17:55:26 +02:00
Guido Cella 8f66c0982f command: log menu-data changes at trace level instead of verbose
Avoid spamming the log.
2026-04-18 17:45:03 +02:00
Guido Cella 0b2c08ba8d osc.lua: show the first selected audio track id with --lavfi-complex
Similar to current-tracks, when the selected audio track is combined
with another one or with an ffmpeg filter, show the first selected track
id instead of "-".

This was requested by a user on IRC.

Also avoid fetching aid and sid on each render.
2026-04-18 17:41:54 +02:00
Kacper Michajłow 76df24f40c demux/packet: add support for SMPTE 2094-50 metadata 2026-04-18 05:38:40 +02:00
Mike Will d0df98f701 command: allow metadata to be set manually 2026-04-18 05:37:38 +02:00
Dudemanguy 4377cce737 wayland: always override surface local coordinates on reconfig
Previous commit fixes the issue when doing state changes but I never
actually tested just normal reconfigs (i.e. advancing a file in a
playlist). Override it in this case too. Fixes #17755.
2026-04-17 21:59:47 +00:00
NRK 09d075f475 osc: define and add support for "preview" api
this adds a "standard" api for ui scripts and thumbnailers to
communicate with each other, based on the simple thumbfast api
[0].

the api works as follows:

* To issue a thumbnail draw command, the UI script will set the
  property `user-data/osc/draw-preview`.
* To clear the thumbnail, the UI script will set the previously
  mentioned property to `nil`.

a more ideal api would make it so that the thumbnailer script
only generates the thumbnail and doesn't need to draw at all.
but such api is vastly more complex [4] and would require a lot
more work and maintenance on mpv's side.

this is a decent enough api that allows arbitrary thumbnailers
and ui scripts to communicate between each other and work
together, while being simple enough that it can be supported
without too much maintenance.

this change has been tested with work with thumbfast [1]. and
for demonstration that this api can be useful outside of osc, it
has also been tested to work on mfpbar's thumbnailer branch [2].

the code to determine thumbnail x,y is based on the osc fork
inside of thumbfast [3].

[0]: https://github.com/po5/thumbfast?tab=readme-ov-file#for-ui-developers-how-to-add-thumbfast-support-to-your-script
[1]: https://github.com/po5/thumbfast/pull/173
[2]: https://codeberg.org/NRK/mpv-toolbox/src/branch/thumbnailer/mfpbar
[3]: https://github.com/po5/thumbfast/tree/vanilla-osc
[4]: https://github.com/mpv-player/mpv/discussions/17654
2026-04-17 20:36:48 +02:00
Guido Cella 8da99f778f osc.lua: set no_video correctly
Fixes f4197a5ce0.
2026-04-17 20:28:42 +02:00
Guido Cella f4197a5ce0 osc.lua: merge the current-tracks/video observer into track-list's
Reuse the new track-list observer callback to check whether there is a
video track.
2026-04-17 20:19:28 +02:00
Kacper Michajłow 6788174641 video/out: use predefined pl_color_space_srgb 2026-04-17 20:16:50 +02:00
Guido Cella 15e5af0868 osc.lua: add observe_cached() helper
This removes code repetition and will make caching more properties
easier.

Some state fields are renamed to have the same name as the property.
2026-04-17 20:05:46 +02:00
NRK c415c662d3 vo_gpu/utils: add gpu_get_auto_param()
deduplicates some code between vo_gpu and vo_gpu_next
2026-04-17 20:03:22 +02:00
NRK 3e0729eb06 vo_gpu: add support for ENUM parameters 2026-04-17 20:03:22 +02:00
NRK a0b6233318 vo_gpu: add support for DEFINE parameters 2026-04-17 20:03:22 +02:00
NRK 0d655fe665 vo_gpu: initial support for tunable parameters
does not support everything supported by gpu-next/libplacebo,
only a subset that was needed to run some user shaders.
2026-04-17 20:03:22 +02:00
NRK 91ceffce42 shader_cache: add gl_sc_uniform_{f,i}_bstr()
this enables callers that already have bstr names to avoid
unnecessary string conversions.
2026-04-17 20:03:22 +02:00
NRK c1a21bb8d9 vo_gpu: skip invalid component overwrite
can occur when a user shader sets a hook texture with more
components than supported. e.g overwriting LUMA with 3
component.

this does create a massive log spam when triggered, but that
seems consistent with the existing resize/realign error case.

Closes: https://github.com/mpv-player/mpv/issues/9863
2026-04-17 20:02:09 +02:00
NRK 1bf50fc71c user_shaders: reject nonsense COMPONENTS values
negative values in specific causes out of bound accesses.
2026-04-17 20:02:09 +02:00
Guido Cella 021b5ccf23 ytdl_hook.lua: set the title in metadata
93fe7a5526 made global_tags work with all_formats=yes, so do like
suggested in 8ea7aa5471 and set the title via tags.

This makes available in ${metadata/title}, even if you set
--force-media-title separately.

--force-media-title is also set when self_redirecting_url is true, but
tags seem not to be set in this case and I don't know where to find such
videos to test. It was originally added to close #5313, but the URL
linked there no longer loads.
2026-04-17 19:56:06 +02:00
Guido Cella aec426a4d8 context_menu.lua: set user-data/mpv/context-menu/open
Closes #17428.
2026-04-17 19:46:12 +02:00
emberfade 179d832738 DOCS/man/vf: fix parameter separator in EBNF 2026-04-17 19:45:48 +02:00
nanahi 57490dd3a6 vo_gpu_next: add image-subs-hdr-peak=video-dynamic/video-static
Subtitles in general have constant brightness, but currently
--image-subs-hdr-peak=video uses detected peak value which is not synced
with scene and undesirable.

Add new modes that allow using static peak metadata or per-scene metadata.
2026-04-17 19:44:15 +02:00
nanahi 7f81e1ec8c vo_gpu_next: fix image subtitle hdr peak
704afb8968 assumed that HDR image
subtitles target SDR white. However, this is incorrect according to
UHD BD spec version 3.2:

> CLUTs of Presentation Graphics streams and Interactive Graphics streams
> are prepared by content author according to dynamic range property of
> the Primary video stream.
> If a Primary video stream is HDR, the Graphics streams have CLUTs
> expressed in BT.2020 color space primaries and ST2084 EOTF.
> If a Primary video stream is SDR, the Graphics streams have CLUTs
> expressed in BT.709 color space primaries and BT.1886 EOTF.

This means that PGS subtitles always have the same colorspace and HDR
dynamic range as the video, so the target peak should also be the same.

This is also supported by the BD-J spec (which displays PGS graphics):

> However the BD-ROM player does not support color space conversion nor
> dynamic range conversion of Java graphics and Background plane when
> mixing with video plane.

The Graphics model spec further states:

> The composited image on the graphics plane is transformed to full color
> and transparency by the CLUT module and then overlaid on the video
> image.

These sentences indicate that BD-ROM players simply overlay the decoded
graphics onto the video without any kind of conversion.

Change the default of image-subs-hdr-peak to 1000 to fix this.
This accommodates most HDR videos with a peak brightness of 1000 nits
and some bad HDR videos with 10000 nits peak brightness due to reencoding
and mixed with unmodified subtitles.
If there are compatibility issues, the option can be manually
set to sdr or video.

Fixes: 704afb8968
2026-04-17 19:44:15 +02:00
bennyyip 74d3c80640 select.lua: add confirmation on "Clear history" 2026-04-17 19:30:27 +02:00
Guido Cella f4dcd295cf demux_edl: support global_tags with delay_open
The delay_open mechanism used by
--script-opt=ytdl_hook-all_formats=yes breaks setting metadata with
global_tags because tl->track_layout is NULL. See adcf51dccd cbb8f534b0
8ea7aa5471.

Fix this by applying tags to the EDL timeline in this case.

Tags must still be applied to tl->track_layout when available for them
to work with local EDL files.
2026-04-17 19:24:47 +02:00
Patricia Bucataru cc8f3bf9fa gpu/utils: fix null pointer arithmetic UB in mp_log_source
strchr() can return NULL when no newline is found. Computing end + 1
before the null check on end is undefined behaviour per C11 6.5.6.
Move the next assignment inside the else branch to avoid the UB.
2026-04-17 19:11:58 +02:00
Guido Cella e0f54adf08 menu.conf: add OSC layout selection
Make this feature discoverable.
2026-04-17 18:34:24 +02:00
Guido Cella e6a338a98a options.lua: stop searching in lua-settings
This has been deprecated for 8 years, since 9eadc068fa, with a visible
warning. Removing it has the benefit of not spamming every log file with
lua-settings searches.
2026-04-17 18:33:35 +02:00
Guido Cella 18f83bc43e osc.lua: make buttons clickable from the horizontal edges
Since changing the width and alignment of buttons shrinks them or messes
up the layout, manually override the hitbox of buttons at the edges.

Fixes #9791.
2026-04-17 18:33:11 +02:00
Kacper Michajłow 7ba2e1d713 osc.lua: reduce floatingalpha a little
Alpha blending is done in gamma light of the target, when the overlay is
drawn. Depending on VO and target format, the alpha value can act quite
differently.

Lower it a little to avoid excessive transparency in some cases. This
should be fixed or workaround in better way, but for now just adjust the
value.
2026-04-17 18:32:29 +02:00
Kacper Michajłow 1068d4adb1 ytdl_hook.lua: tag variants with program_id 2026-04-17 18:30:43 +02:00
Kacper Michajłow cc9610b850 demux_timeline: add support for programs 2026-04-17 18:30:43 +02:00
Kacper Michajłow 6c165fe46e demux_lavf: add support for programs
This adds proper support for MPEG-TS programs and HLS variants. Now
program selection is exposed as editions and tracks are grouped under
such edition. If there are external tracks added, they are available in
all editions.
2026-04-17 18:30:43 +02:00
Kacper Michajłow 8010ea49c9 osc.lua: fix track indexing
track-list/N is not required to match aid/vid. They are encoded as
track-list/N/id.

This fixes changes in 1a558bf5c2 where it
was asumed that track id is the same in track-list, which is not true,
in general sense.
2026-04-17 18:30:43 +02:00
Kacper Michajłow 85bdf63a48 player/command: simplify and fix new-line handling
Remove dead code, make it work also when there is not tracks.
2026-04-17 18:30:43 +02:00
nanahi 1fea31f00c player/external_files: do not log for 0 priority files
They are not considered potential external files.
2026-04-17 04:09:23 +02:00
nanahi f5931117f0 player/external_files: fix --cover-art-whitelist priority
Since cb56c2f888, the priority of
--cover-art-auto and --cover-art-whitelist is unclear. Depending on the
number of elements in --cover-art-whitelist, the priority of
--cover-art-whitelist files can be lower, equal, or higher than
--cover-art-auto matches, creating unpredictable behavior.

Fix this by making --cover-art-whitelist priority always between "fuzzy"
and "all" priority. test_cover_filename now uses bstr_find_in_list0 to
return a negative priority value depending on the position in list.
The "all" priority is set to INT_MIN. Modify filter_subidx to use 0
priority as removal marker, since all files in the external files list
already have non-zero priority.
2026-04-17 04:09:23 +02:00
nanahi d711657833 options/m_option: use bstr_find_in_list0
Removes redundant find_list_bstr function.
2026-04-17 04:09:23 +02:00
nanahi 3d568495fc misc/bstr: move str_in_list to this file
Rename it to bstr_in_list0 and implement it in bstr_find_in_list0.
2026-04-17 04:09:23 +02:00
nanahi ac8d69e6fc misc/bstr: add bstr_find_in_list0 function
This will be used to unify several find in list handlings.
2026-04-17 04:09:23 +02:00
nanahi b20a33287b player/main: don't use atoi
Prevents UB if the value cannot be represented.
2026-04-17 04:09:23 +02:00
nanahi da2739f44f various: don't check if endptr is null for strto[udll]
These functions always set endptr to non-null so there is no need to
check.
2026-04-17 04:09:23 +02:00
nanahi 6260e7236c player/scripting: use strcasecmp for comparing script files
The documentation says that the scripts are loaded in alphabetical order,
which indicates that the case is not sensitive. Use strcasecmp to satisfy
this requirement.
2026-04-17 04:09:23 +02:00
nanahi 2b62f7c861 player/external_files: use natural sort for comparing filenames
Similar to the method used elsewhere in mpv.
2026-04-17 04:09:23 +02:00
nanahi 6b3cb12dac player/external_files: rename subtitle references to external file
These functions are used to load all external files, not only
subtitles.
2026-04-17 04:09:23 +02:00
Kacper Michajłow 17d12f83ad osdep/io: expand relative path only if it contains directory separator
For anything else, respact default load library search logic.
2026-04-17 03:56:13 +02:00
Kacper Michajłow c3231fa1ee osdep/io: use static string for dlopen errors
The dynamic allocation of this strings is completelly pointless. It adds
complexity with mp_exec_once to init aexit() to free the string, which
was leaked anyway, because the structure is thread_local and atexit only
data from the main thread was freed.

Remove all this, and just use static buffer.
2026-04-17 03:56:13 +02:00
Kacper Michajłow c865008e65 mpv-osd-symbols: center fluent icons only vertically
Makes it nicer for speaker icon to not move around on different volume
levels. Also remove scaling, it was not needed.

This required to rewrite the exclamation mark drawing code, made it look
similar to old icon now.
2026-04-16 19:03:47 +02:00
nanahi a9e1ce9c0d DOCS/man/options: fix description for testing with all hwdec methods
The comment is not longer true since auto now means auto-safe.
Change to auto-unsafe which is the setting to use to test all methods.
2026-04-16 17:18:42 +02:00
Kacper Michajłow d20d108d94 vd_lavc: remove Vulkan hwdec from auto-safe selection
It's unstable and unfortunately the situation is not getting better
over time as there are constantly new regressions introduced, which
makes it unsafe for auto selection.

It is also twice as slow as d3d11va on Windows AMD.

See also:
https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21692
https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/21704
https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22342
https://github.com/mpv-player/mpv/issues/16782
https://github.com/mpv-player/mpv/issues/17085
https://github.com/mpv-player/mpv/issues/17175
https://github.com/mpv-player/mpv/issues/17370
https://github.com/mpv-player/mpv/issues/17517
https://github.com/mpv-player/mpv/issues/17593
https://github.com/mpv-player/mpv/issues/17688

Those are only issues from recent months, many of which are not fixed.
2026-04-15 19:13:23 +02:00
Thomas Lange 7ac022c834 mpv.metainfo.xml: Update screenshot URL
The previous URL causes a "404 - Not Found" error meanwhile.
2026-04-15 15:19:50 +00:00
dependabot[bot] da4789c2dd ci: bump cross-platform-actions/action from 0.32.0 to 1.0.0
Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 0.32.0 to 1.0.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v0.32.0...v1.0.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-version: 1.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-12 14:57:28 +02:00
NRK 062f4bf047 player: fix leak on client-message send failure
when there's a flood of events causing the event queue to
overflow, the duplicated client-message payload gets dropped
without being released. free it on failure too.

discovered while trying to trigger #10110.
2026-04-11 19:27:44 +02:00
Dudemanguy 3e3048a5aa wayland: override surface local when setting geometry or window scale
If the window is fullscreen or maximized and the user sets some geometry
or window scale, we should apply it when the state transitions back to
windowed mode. This was being missed and the surface local coordinates
were being used.
2026-04-10 14:00:50 +00:00
Dudemanguy fd2215eef4 wayland: override surface local coordinates on reconfigures
We don't want to be using the coordinates from the compositor in this
case since it can't know that the new surface has a totally different
aspect ratio. Also remove the early return so that the state is always
updated regardless if it's determined we need to resize or not.

Fixes #17710.
2026-04-10 14:00:50 +00:00
Kacper Michajłow 75939c2116 wayland_common: use only supported primaries when inferring from raw 2026-04-09 21:21:46 +02:00
Guido Cella ec4d50fd91 context_menu.lua: enable runtime script-opt updates
Fixes #17726.
2026-04-09 13:40:37 +02:00
Guido Cella 266cb79f38 osc.lua: make all the height of bar lines clickable
There is an area between the 2 lines of bottombar and topbar that is not
clickable, e.g. between the menu and play_pause icons. Make it all
clickable so it's easier to click buttons.

This also allows clicking from the bottom in slimbottombar and from the
top in topbottombar.
2026-04-08 20:32:48 +02:00
Guido Cella c9d2f17a98 osc.lua: allow clicking window controls from the top
Window controls are not clickable from the very top of the window, they
have a margin to the top that makes them harder to click. Make them
clickable also from the very top to make them easier to activate.

The close button with the default windowcontrols_alignment=right
specifically is already clickable from the rightmost part of the window.

Partial fix of #9791 (other buttons also need to be updated).
2026-04-08 20:32:48 +02:00
NRK 1bfa18107c DOCS/man/input: add note on env case-sensitivity 2026-04-08 20:24:07 +02:00
NRK aef3793e92 osdep/io: make getenv case insensitive on windows
env vars are case insensitive on windows so getenv should
compare them as such.

Fixes: https://github.com/mpv-player/mpv/pull/17577#issuecomment-4167125610
2026-04-08 20:24:07 +02:00
NRK e2180e581e demux_playlist: only autocreate on regular file
trying to autocreate playlist when the file is a fifo breaks
playback. the bug report is a special case of `/dev/fd/*` but
even for named fifos, opening and closing them can cause the
other end to stop writing.

Closes: https://github.com/mpv-player/mpv/issues/17682
2026-04-06 18:50:28 +02:00
nanahi 7ace42f505 ytdl_hook.lua: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi 1839da1d07 select.lua: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi 3b86e32c2b defaults.lua: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi 095d858a19 defaults.js: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi b0f9279824 TOOLS/lua/command-test.lua: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi dbd31fd9d3 DOCS/man: use _name key for mp.command_native 2026-04-06 18:33:20 +02:00
nanahi 80582efca5 input/cmd: use _name for command name in mpv_command_node
Some commands have named arguments named "name", which conflict with
the "name" entry used to specify command name in mpv_command_node, so
they cannot be used with mpv_command_node.

These commands include:
set, del, change-list, add, cycle, multiply, enable-section,
disable-section, define-section, script-binding, keybind, keypress,
keydown, keyup, apply-profile.

This makes mpv_command_node accept command name as key "_name", so
"name" can be used to specify command arguments. For compatibility,
if "_name" entry does not exist, then "name" is used as fallback.
2026-04-06 18:33:20 +02:00
nanahi b7377ede18 DOCS/man/options: document @ syntax for --input-ipc-server 2026-04-06 18:31:27 +02:00
nanahi b11ae04f37 input/ipc-unix: don't delete file for abstract sockets
If --input-ipc-server path name starts with "@", then "@" is replaced
with a null character, which represents the abstract socket namespace
on Linux. Because abstract sockets have no file system presence, it
should not delete the file with the same name starting with "@".
2026-04-06 18:31:27 +02:00
nanahi c2d9905598 DOCS/man/options: add note about %tX behavior change 2026-04-06 18:30:10 +02:00
nanahi edf6016ecf player/screenshot: support %s date format on all platforms
Previous commit left the common %s format extension unresolved.
This implements the format in a platform independent way so it can be
used on all platforms, including on Windows where strftime does not
support %s.
2026-04-06 18:30:10 +02:00
nanahi 87d359eabf player/screenshot: validate strftime format string
The format specifier is controlled by the user that can be arbitrary
character. Using invalid specifier in strftime is UB. Fix this by only
accepting the specifiers recognized in C11.

Partial compatibility is provided for extension formats k, l, P by
translating them to the closest standard alternative.
2026-04-06 18:30:10 +02:00
nanahi dfef53f94b player/screenshot: fix null dereference when failing to get time
localtime can fail and return NULL, which causes NULL dereference
for strftime.
2026-04-06 18:30:10 +02:00
nanahi e0fe1a45d2 command: fix race in reading pad_buttons_pressed
mp_input_get_tablet_pos stores the address to an array that is protected
by lock, and the content is accessed without acquiring lock.

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

Fixes: 0fbf20f057
2026-04-06 18:28:04 +02:00
nanahi b67a5b4cd8 input: fix out of bound read/write in pad_buttons_pressed
When buttons > MP_MAX_TABLET_PAD_BUTTONS and the value is stored in
ictx->tablet_pad_buttons, the next mp_input_set_tablet_pad_focus call
will cause out of bound write, and mp_property_tablet_pos will cause
out of bound read.

Fix this by limiting ictx->tablet_pad_buttons range.

Fixes: 0fbf20f057
2026-04-06 18:28:04 +02:00
NRK 9251f871b6 options: preparse --shuffle
needed in order to correctly handle --directory-mode=auto

Fixes: https://github.com/mpv-player/mpv/issues/17601
2026-04-06 18:27:27 +02:00
nanahi cf957b4f2a player/command: use m_property_read_sub_validate when suitable
Avoids wasting resources on trivial requests.
2026-04-06 18:26:34 +02:00
nanahi 629205280c player/command: rename to mp_property_list_editions
Use mp prefix like everything else.
2026-04-06 18:26:34 +02:00
nanahi 7f28b8818a player/command: use m_property_read_sub for mouse-pos
Allows reading using sub property syntax.
2026-04-06 18:26:34 +02:00
Kacper Michajłow 9e60ae0fee SECURITY.md: add security policy 2026-04-06 18:24:48 +02:00
Guido Cella b8df71a411 commands.lua: use the new choices field in command-list
Use the choices field added by ae2384bce0 for command arguments instead
of hardcoding them.
2026-04-06 18:24:30 +02:00
NRK 702abfd587 vo_gpu: use actual (not logical) texture dimension
pass_upload_image currently stores the logical dimensions, which
in case of vulkan decoding may not match the physical one (e.g
1088 for 1080p). this mismatch results in glitches when using
polar scalers.

fix this by using the actual texture dimensions for hwdec plane
sizes.

Fixes: https://github.com/mpv-player/mpv/issues/14944
2026-04-06 18:23:54 +02:00
nanahi 9bf9bb50de options/m_option: fix valid format in geometry option help message
/WS format is accepted.
2026-04-06 18:23:25 +02:00
nanahi 94d06bc727 options/m_option: allow /WS geometry parameter usable without XYWH
This allows specifying workspace while using autofit for window size
or leave it as default instead of mandatory geometry in pixels.
2026-04-06 18:23:25 +02:00
nanahi befe1e73a2 video/out/x11_common: fix BadAtom error when getting atom name
When XdndEnter advertises format without using XdndTypeList, some of
the atoms in the 3 fixed items may be None, which causes error in
XGetAtomName. Fix this by not resolving name when atom is None.

Fixes the following error message when dragging file on mpv window:
X11 error: BadAtom (invalid Atom parameter)
2026-04-04 21:36:07 +02:00
Mia Herkt 428edff9c1 Meson: add appropriate install_tag to each target
See https://mesonbuild.com/Installing.html#installation-tags

tl;dr it allows choosing what to install and also provides some
extra metadata for tools operate on Meson projects via its
introspection feature.
2026-04-03 18:45:52 +02:00
Mia Herkt c1f30c9b63 Meson: specify license files
This allows using --licensedir. Meson then also generates and
installs a machine-readable manifest file at that location, which
would include the licenses of subprojects if we had any.
2026-04-03 18:21:19 +02:00
Kacper Michajłow c41ee4b95f vo_gpu_next: remove swdec from upload frame pass description
Users are confused about `-copy` hwdec, which is effectively sw upload,
but let's remove this suffix.

Fixes: https://github.com/mpv-player/mpv/pull/17684#issuecomment-4170637631
2026-04-03 02:02:40 +02:00
Kacper Michajłow 0c883fbe03 w32_common: update DWM corners state in when toggling fullscreen
Fixes: #17653
2026-04-03 00:07:29 +02:00
Guido Cella c961c96afb lua: remove the deprecated error field from end-file
This has been deprecated for 6 years so remove the compatibility code.

This basically reverts 37f441d61b.
2026-04-01 22:10:08 +00:00
Guido Cella 70b8b22c8b command: remove the deprecated time-start property
This has been deprecated for 11 years since 70df1608d6 so remove it. All
it does is return 0.
2026-04-01 22:09:25 +00:00
nanahi 4e6196e1a6 player/command: fix update-clipboard text-primary
It mistakenly updates text instead.
2026-04-02 00:05:27 +02:00
Guido Cella ea40f07d2d DOCS/interface-changes: add newline at end of file 2026-04-01 16:47:26 +02:00
zenodity ae2384bce0 player/command: add default-value/choices arg fields to command-list
Add optional 'default-value' and 'choices' fields where appropriate
for command arguments in the 'command-list' property. Update
documentation to reflect the command-list schema change.

DOCS/interface-changes/command-list: add changes
2026-04-01 16:08:26 +02:00
Kacper Michajłow bed0f49729 osc.lua: show window controls in idle 2026-04-01 16:07:27 +02:00
Kacper Michajłow 39302caae4 osc.lua: use window title for window controls from mpv core 2026-04-01 16:07:27 +02:00
Kacper Michajłow 40db14f85b vo_gpu_next: add few cpu timers 2026-04-01 15:20:11 +02:00
Kacper Michajłow 7757064bdd vo_gpu_next: add sw upload time to stats
Also fix lingering hw map stats.
2026-04-01 15:20:11 +02:00
NRK d79c4ad1e3 player/command: add env property
mainly so that env vars can be accessed from within config files.
2026-03-31 18:44:10 +00:00
NRK 5f45db9d70 DOCS/man/input: document dummy properties
these properties cannot be used directly and require a
sub-property. document this explicitly.
2026-03-31 18:44:10 +00:00
llyyr 552d8fa91e vo_drm: use drmModeDestroyDumbBuffer instead of using the ioctl directly 2026-03-31 18:22:54 +00:00
llyyr 8b2e3bf786 vo_drm: use drmModeMapDumbBuffer instead of using the ioctl directly 2026-03-31 18:22:54 +00:00
llyyr 5bb30a6f6c vo_drm: use drmModeCreateDumbBuffer instead of using the ioctl directly
Also remove `fb->handle = 0` assignment because the framebuffer struct
is already zero initialized.
2026-03-31 18:22:54 +00:00
llyyr 64c4309697 drm_prime: use GEM_CLOSE wrapper instead of using ioctl directly 2026-03-31 18:22:54 +00:00
llyyr 4bed99f6a5 meson: bump minimum libdrm version to 2.4.114
We'll use the dumb buffer helpers added in 2.4.114 and GEM_CLOSE wrapper
added in 2.4.108. This is available on Ubuntu 24.04 and Debian 12.
2026-03-31 18:22:54 +00:00
llyyr c8e3a2ec52 drm_common: change type of framebuffer.size from uint32_t to uint64_t
Matches the defintion in kernel headers.
2026-03-31 18:22:54 +00:00
Guido Cella 9465b30a40 DOCS: remove behavior changes before version 0.38
These are ancient and not useful anymore.

The version notices are kept under:
overlay-add: handled by #17520
end-file's file_error: the notice should be removed when updating error
field like suggested there
time-start: this should just be removed
~/.mpv/: needed to understand why this is used
--aid: needed to understand the following paragraphs
2026-03-30 15:09:38 +00:00
Dudemanguy 2e83b3b61c wayland: don't always use surface local coordinates in toplevel config
Since 1301fdb2ec we try to directly use
surface local coordinates however it is valid for compositors to send us
0s in either the width or height. In that case, it means mpv should
choose its geometry so we should calculate out our own coordinates.
Previously this was incidentally handled, but we should be more explicit
here and set the bool.
2026-03-30 01:01:43 +00:00
llyyr adff00c8aa wayland: don't use surface local coordinates if we haven't received them
vo_wayland_handle_scale may be called from reconfig, even before we get
the first toplevel_configure. In this case, don't use the surface local
coordinates because they will be initialized as 0.
2026-03-30 01:01:43 +00:00
llyyr de118fdb70 m_option: don't allow m_geometry_apply to make a coordinate 0
Same reasoning as the previous commit.
2026-03-30 00:53:18 +00:00
Dudemanguy 9214b44a68 video/out/win_state: don't allow apply_autofit to return 0
There's no way this coordinate can ever work so don't force callers to
waste time checking for it, so just MPMAX at 1. Fixes a crash in certain
cases if you do --autofit=1x1.
2026-03-30 00:53:18 +00:00
Dudemanguy 90985bb826 vo: officially deprecate vo_vaapi
Using vo_vaapi has already been heavily discouraged for years since
years since 5c313f1f59. More importantly,
it's just fundamentally broken on most hardware, serves no real purpose,
and well we shouldn't just ship broken stuff. vo_vaapi largely only ever
worked correctly on some intel hardware. The VO relies on certain API
calls that other vendors never implemented so things like the OSD and
subtitles are just never going to work. This largely has no reason to
exist either. If you're looking for efficient playback, you can use
vo_gpu/vo_gpu_next in dumb mode with vaapi decoding. You can also use
vo_dmabuf_wayland with vaapi as well to avoid even more GPU to CPU
copies and theoretically be even more efficient.
2026-03-30 00:34:31 +00:00
llyyr e9a1f82345 wayland: scale edge pixel threshold by scaling factor 2026-03-30 00:32:51 +00:00
llyyr b824aec50f wayland: document that wayland-edge-pixels-touch only affects CSD 2026-03-30 00:32:51 +00:00
llyyr 51ef7c5960 wayland: use wayland-edge-pixels-pointer for tablet input resize zone
Tablet input is more similar to mouse input than it is to touch input,
so it makes sens to use wayland-edge-pixels-pointer instead. Also
document that it's used for tablet input, previously this was completely
undocumented.
2026-03-30 00:32:51 +00:00
Martin Tournoij 86b30afea0 DOCS/man/options: clarify --directory-filter-types docs
Using "mpv --directory-filter-types= dir" as an "empty" value doesn't
work, because that will create a list where the first value is an empty
string, so get_directory_filter() returns AUTO_NONE instead of AUTO_ANY.

You need to use --directory-filter-types-clr instead, to create a proper
empty list.

I suppose this is kind of obvious in hindsight, but it took me quite
some time and digging through the mpv source to figure this out –
initially I assumed it must be a bug of some sort.

So clarify what "empty list" means.
2026-03-30 00:13:03 +00:00
nanahi e45f86225f demux_playlist: don't get config group again when checking shuffle
The shuffle option is already available as p->mp_opts->shuffle since
44a3a3293f.
There is no reason to get the config group again and free it.
2026-03-30 00:07:45 +00:00
llyyr ef531e19c3 vulkan/context: remove pl_swapchain_resize in set_color
ref: https://code.videolan.org/videolan/libplacebo/-/merge_requests/811
2026-03-29 18:00:48 +02:00
Kacper Michajłow 4f9f1ffaf3 meson: build mpv.com with -Os
LLVM even in freestanding build required memset/memcpy/memmove to be
implemented. We don't use them directly but the calls are generated from
the code, which are later optimized away. Since this suppose to be small
utility application, we can always optimize it.

Fixes: #17664
2026-03-28 23:22:09 +01:00
Dudemanguy 2ad46a3c3c vo_dmabuf_wayland: place video surface on the top
For rounding reasons, we should have the surface with the video on the
top. Rounding subsurfaces is tricky business that we don't need to get
into.
2026-03-27 22:20:34 +00:00
Dudemanguy 1301fdb2ec wayland: directly use surface local coords for viewport when possible
Previously, we calculated out the value for simplicity but there can be
a mismatch due to round where what we calculate as the viewport
width/height is not what surface local coordinates the compositor gave
us. Note that we don't always want to use these values directly (e.g.
whenever we set our own geometry), so some notion of overriding has to
be added.
2026-03-27 22:20:34 +00:00
llyyr 251a2b6f49 wayland: alphabetize static function definition
Also fix some inconsistent indenting while at it
2026-03-27 16:40:41 +00:00
llyyr 63d0beb67c wayland: use designated initializers for protocol listeners
Replace order-dependent struct initialization of Wayland listener
structs with designated initializers.

Besides making it harder to make ordering mistakes while adding or
changing code, also makes it easier to grep for specific events because
our callback functions aren't necessarily named the same as the event
names (e.g. global_remove = registry_handle_remove).
2026-03-27 16:40:41 +00:00
llyyr 4d16b0938d wayland: fix typo in log message 2026-03-27 16:40:41 +00:00
llyyr 065146c9b8 wayland: wrap color mgmt functions in ifdefs instead of their bodies 2026-03-27 16:40:41 +00:00
llyyr 38cf424134 wayland: remove set_img_desc goto from set_color_management
A bit easier to understand perhaps
2026-03-27 16:40:41 +00:00
llyyr 96de78f914 wayland: validate metadata before set_luminance
It's still invalid for max_lum to be less than or equal to min_lum, so
do the check before set_luminances call. Also rename the function
because it does more than just check if it's valid, it also sanitizes
some invalid values.

Also changes the TRC_LINEAR case a bit, because min_luma == 0 isn't
exactly invalid, only min_luma >= max_luma is invalid which is covered
by the sanitize function
2026-03-27 16:40:41 +00:00
llyyr 3cf31bf7a4 wayland: reduce branching when printing log for unsupported prim/tf
Also move scRGB comment inside ifdef
2026-03-27 16:40:41 +00:00
llyyr 56832b2bdb wayland: reduce branching in color-management info_done 2026-03-27 16:40:41 +00:00
Guido Cella 1a545faf28 menu.conf: don't check Hardware decoding with no video track 2026-03-25 13:44:44 +01:00
Kacper Michajłow 793ab6dcb0 options: target-gamut now accepts custom CIE xy primaries
Fixes: #17633
2026-03-25 02:01:03 +01:00
Kacper Michajłow eda0e0b093 w32_common: latch force position until it is actually applied
In case we are in fullscreen, we might not apply it right away.
2026-03-25 01:42:12 +01:00
nanahi ae6728a7c0 misc/io_utils: allow mp_save_to_file writing empty files 2026-03-25 01:41:05 +01:00
Kacper Michajłow ef7bced028 osc.lua: make title wider in floating layout
We don't put anything else on title line, so we don't need reserved
space as with other layouts.
2026-03-24 19:24:49 +01:00
Kacper Michajłow f42480d0cc w32_common: fix Windows 10 workaround for initial window pos
Restores hack from 3d4170b81b to work
again.

Fixes: 7466a9f9f3
2026-03-24 00:50:08 +01:00
Kacper Michajłow e757931859 af_scaletempo: limit options to resonable range
This fixes multiple overflows when passing huge values. Which causes
either invalid memory accesses when memory allocations are wrong size or
huge allocations leading to OOM.

Reported by: Trail of Bits
2026-03-23 23:34:20 +01:00
Kacper Michajłow ed534eb7f5 vo_gpu_next: add stereo osd support
Duplicate OSD/Subtitles for left and right eye.

Fixes: #12462
2026-03-23 23:16:32 +01:00
Kacper Michajłow 7466a9f9f3 video/out/win_state: don't move window when force-window-position=no
When force-window-position=no place window on requested position only on
init (when VO requests `force_pos`), except that keep existing
position on auto resizes.

This applies to both user provided geometry and default center
position.

Fixes: #17588
2026-03-23 15:05:01 +01:00
Kacper Michajłow 5df1681c48 vo_gpu_next: add timer for hwdec frame mapping
With `--d3d11va-zero-copy=no` (default), we do the GPU-GPU copy of the
frame, add this time to the stats.
2026-03-23 15:04:11 +01:00
nanahi 514c8097a9 player/configfiles: use mp_hash_to_bstr 2026-03-23 15:03:38 +01:00
nanahi 1bd29b0ba2 video/out/gpu/lcms: use mp_hash_to_bstr 2026-03-23 15:03:38 +01:00
nanahi b48058e6cb video/out/gpu/shader_cache: use mp_hash_to_bstr 2026-03-23 15:03:38 +01:00
nanahi 58ee11c58a misc/hash: add mp_hash_to_bstr function
This util function uses the generic libavutil hash API to hash any data
with the specified algorithm to a bstr. It deduplicates multiple hash
routines used in mpv.
2026-03-23 15:03:38 +01:00
nanahi 6245d7e92c video/out/opengl/utils: remove redundant imports 2026-03-23 15:03:38 +01:00
Kacper Michajłow 7ec8a7e9b1 vd_lavc: ensure decoder state is valid after reinit
This fixes dynamic hwdec switching, which would often fails, because
hw decoder were feed data without context, which caused decoding errors,
which in turn disabled hwdec.

command.c does queue_seek() after decoder reinit, but it may already be
too late, by the time seek to keyframe finishes.

Fix this, by just discarding the data until we have safe point to start
decoding again. Limit this only for hwdec to avoid formats that may not
have ffmpeg parser and not give us keyframe information and limit to 96
frames, just as safety to not lock the player, but this shouldn't happen
in practice.

This should also fix cases, when media file is cut in a way that would
cause decoding errors at the start.

Fixes: #17484
2026-03-23 13:29:59 +01:00
Kacper Michajłow 9339a68dfb demux_lavf: mark packets with keyframe for wrapped avframes too 2026-03-23 13:29:59 +01:00
llyyr 89febe90c2 wayland: move last_zero_copy to fback_pool 2026-03-23 00:31:35 +01:00
low-batt 75681e5019 mac/window: fix white lines around screen with non-native fullscreen
in macOS 11 Apple changed AppKit to disallow use of the fullscreen
window style by custom full screen implementations, reserving this style
for their own implementation. mpv's custom implementation had to
workaround this by manually applying changes to the window to match the
fullscreen window style.

in macOS 26 Apple made changes to enhance visual depth. This
included making a window's shadow more pronounced. This revealed
the workaround was missing code to remove the window's shadow when in
full screen mode. This was especially visible when the macOS appearance
was set to dark and a dark video was played with --native-fs=no. The
window's shadow under macOS 26 was visible as a very thin white outline
around the screen.

this fix will enhance the workaround in the macOS custom full screen
implementation to toggle NSWindow.hasShadow when entering and exiting
full screen mode under macOS 11+.

Fixes: #17586
2026-03-22 23:27:16 +01:00
Kacper Michajłow c798884163 w32_common: respect C{X,Y}MIN system metrics
Fixes: #8440
2026-03-21 23:31:15 +01:00
Kacper Michajłow a380190a41 w32_common: fix handling of WM_SIZING
Fixes some corner cases when resizing window with keep aspect ratio
enabled. Limit correctly window to working area, also after adjusting
aspect ratio to avoid unexpected resizes and window not staying in
position. Use integer math to have consistent rounding, to avoid window
"drifting".

Fixes: #8728
2026-03-21 23:31:15 +01:00
Kacper Michajłow 6c9105380c w32_common: set max window track size 2026-03-21 23:31:15 +01:00
llyyr 9021c3263a clipboard-{x11,wayland}: replace static const with enum
Fixes gcc build with certain build options
2026-03-21 23:27:04 +01:00
nanahi edc8534d0b misc/io_utils: rename cache
The function is used for various purposes so rename cache to something
generic.
2026-03-21 20:14:09 +01:00
nanahi 8b2ab60ae3 video/out/gpu/shader_cache: use mp_save_to_file 2026-03-21 20:14:09 +01:00
nanahi 20b24a0dbd video/out/gpu/lcms: use mp_save_to_file 2026-03-21 20:14:09 +01:00
nanahi 26fbea0205 player/configfiles: check error before copying mtime
Similar to what is mp_write_watch_later_conf is already doing.
2026-03-21 20:14:09 +01:00
nanahi f5cad5c065 player/configfiles: use mp_save_to_file 2026-03-21 20:14:09 +01:00
nanahi 3a8a908641 menu.conf: use update-clipboard command
This command is now required when the default has no clipboard monitoring.
2026-03-21 16:05:36 +01:00
nanahi 59d7315fe2 console.lua: use update-clipboard command
This command is now required when the default has no clipboard monitoring.
2026-03-21 16:05:36 +01:00
nanahi bf054a8357 input.conf: use update-clipboard command
This command is now required when the default has no clipboard monitoring.
2026-03-21 16:05:36 +01:00
nanahi bc4f5ce2ba clipboard-wayland: notify clipboard updates to update-data waiters 2026-03-21 16:05:36 +01:00
nanahi 7d41ceef05 clipboard-wayland: support update_data 2026-03-21 16:05:36 +01:00
nanahi 8611b4c11e clipboard-wayland: disable automatic content fetching 2026-03-21 16:05:36 +01:00
nanahi 613b7f2a77 clipboard-x11: notify clipboard updates to update-data waiters 2026-03-21 16:05:36 +01:00
nanahi 527500b68a clipboard-x11: support update_data 2026-03-21 16:05:36 +01:00
nanahi dd9f7949a2 clipboard-x11: disable automatic content fetching when not monitoring 2026-03-21 16:05:36 +01:00
nanahi f7f7cf18f3 command: add update-clipboard command
This uses the update_data request for clipboard backends that require it.
When clipboard monitoring is disabled, the backends will no longer
fetch data when it detects data change, and will now only do that when
receiving the update_data request.

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

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

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

For backends that do not support update_data, this command does nothing.
2026-03-21 16:05:36 +01:00
nanahi 49b2cf66d6 clipboard: make clipboard_ctx persistent
There is no reason to create and destroy this storage. They can be
zeroed instead when destroyed. This simplifies some logic and prepares
for the next commit.
2026-03-21 16:05:36 +01:00
Dudemanguy e84ac3760c Revert "osc.lua: fix window controls showing in fullscreen"
Decoupling fullscreen behavior from the generalized border logic
increases the complexity and also inherently changes the behavior in a
way that is not neccesarily desirable. People in IRC notably were
confused about the window controls not being shown in fullscreen because
of this change. We could default the option to yes, but then there will
likely be people confused as to why they suddenly now have the controls
when it wasn't there previously. The best way to avoid all this is just
undo it. If someone wants special fullscreen behavior with
windowcontrols, this can be done with auto profiles already. There's not
much utility in having a separate option.

This reverts commit 3b66428152.
2026-03-20 14:44:03 +00:00
llyyr 7b1ee864b8 input: only allocate key name if we've printing trace level messages 2026-03-19 20:45:55 +01:00
llyyr 520faac68d input: fix leaking tablet tool key name 2026-03-19 20:45:55 +01:00
llyyr 5f9e1bc7bd wayland: guess best containing primary from raw primaries 2026-03-17 10:49:09 +01:00
llyyr 5a45669663 vo_gpu_next: move get_best_prim_container to csputils
Used in next commit
2026-03-17 10:49:09 +01:00
Kacper Michajłow 3d4170b81b w32_common: force DWMWA_EXTENDED_FRAME_BOUNDS to work on init
DWMWA_EXTENDED_FRAME_BOUNDS is not available before window is shown, so
show it off-screen to get correct values.

Fixes: https://github.com/mpv-player/mpv/pull/16127#issuecomment-4063603866
2026-03-17 10:13:34 +01:00
Kacper Michajłow 53f7c6e9dd w32_common: add missing title bar height calc back
I've lost this piece of code when doing rebases or testing. This is
needed to correctly calc maximized window size.
2026-03-17 10:13:34 +01:00
llyyr b51131dff9 ci/freebsd: bump to FreeBSD 15.0 2026-03-15 18:40:09 +01:00
llyyr a71da301b0 ci/{freebsd,openbsd,linux-old}: clone the latest supported libplacebo 2026-03-15 18:40:09 +01:00
llyyr 022fbd16b9 meson: bump min libplacebo version to v7.360.1
This version contains critical fixes to swapchain selection, correct
mapping of sRGB TRC as well as fix for gpu hangs on anv. Bump the
minimum version because the mpv experience with previous version
shouldn't be endorsed or be considered acceptable by upstream.
2026-03-15 18:40:09 +01:00
Kacper Michajłow d12f2ce19c hwdec_vulkan: guard deprecated AVVulkanDeviceContext.lock/unlock_queue
libavutil deprecated AVVulkanDeviceContext.lock/unlock_queue without
replacement [1]. This prevents us from using queue locking, as those
callback will be removed in lavu. Set those callbacks as long as they
are still present, they will be noop in libplacebo with
`VK_KHR_internally_synchronized_queues`.

It's unclear what will happen to devices that do not support
`VK_KHR_internally_synchronized_queues` when the lock/unlock_queue
callbacks are removed.

[1] https://code.ffmpeg.org/FFmpeg/FFmpeg/commit/c102e89448a06d9920920923a4008fee3db4ea37
2026-03-15 17:45:49 +01:00
llyyr 3945a41872 wayland: fix alpha mode mapping for color-representation
Fixes: ed8954e8cf ("wayland: add support for wp-color-representation-v1")
2026-03-15 17:43:27 +01:00
Rudi Heitbaum 8ace278cbe various: fix Wdiscarded-qualifiers warnings
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
2026-03-15 14:49:00 +01:00
llyyr afef9126ce wayland: don't try to do anything on data_device.motion
The keyword here is "try". mpv attempts to accept data offer on motion,
by using the time as the serial... which doesn't do anything. We already
accept data offers on data_device.enter so this doesn't do anything even
if we used the right serial.

Fixes: 68f9ee7e0b
2026-03-14 15:10:59 +00:00
nanahi a7283a8e89 DOCS/man/mpv: use admonition for slice protocol examples 2026-03-14 16:06:51 +01:00
nanahi 2b2bb95181 DOCS/man/mpv: document archive protocol
This protocol is useful for opening a specified file in an archive
instead of opening the archive as a playlist.
2026-03-14 16:06:51 +01:00
llyyr e96c8ed650 video/vaapi: mark nvidia-vaapi-driver as emulated driver
This should match the vendor string[1] provided in that project, and mpv
will skip using this driver on Nvidia. nvidia-vaapi-driver segfaults
when trying to decode 4:4:4 videos, and there's no reason for Nvidia
users to use this layer in mpv anyway. Use nvdev or vulkan instead.

1: https://github.com/elFarto/nvidia-vaapi-driver/blob/c4e1788b6d554f29adec31f3f8aa984c143c54c1/src/vabackend.c#L2331-L2335
2026-03-14 12:55:40 +01:00
Kacper Michajłow 44f06c6dd0 osc.lua: fix typo
oops...

Fixes: 6bf5a6ca7c
2026-03-13 20:12:53 +01:00
Kacper Michajłow 88e741a019 osc.lua: use fluent icons by default for floating layout
Floating layout is more rounded comparet to square bar layout, so fluent
icons are better match here.
2026-03-13 19:16:47 +01:00
Kacper Michajłow 6bf5a6ca7c osc.lua: add floating layout 2026-03-13 19:16:47 +01:00
Kacper Michajłow 8bf384fe6d osc.lua: add osc-icon_style option 2026-03-13 19:14:39 +01:00
Kacper Michajłow 1d7d6c2719 mpv-osd-symbols: add some Fluent UI System Icons to mpv font
This uses Fluent UI System Icons [1] as a source for icons. The glyps
are generated using `TOOLS/gen-fluent-glyphs.py` script, which downloads
Icon and convert for our mpv font to use. Glyphs are vendored in our
repository to avoid external dependency.

Script could be extended to add more icons/variants easily, currently
only filled version are imported.

[1] https://github.com/microsoft/fluentui-system-icons
2026-03-13 19:14:39 +01:00
Kacper Michajłow fbdaddf968 w32_common: refactor window resizing
Fixes lots of issues with current window resizing and window style
modifications.
2026-03-13 15:13:31 +01:00
Kacper Michajłow df4736df26 win32: remove SC_RESTORE handling
It doesn't seem to be neeeded anymore.
2026-03-13 15:13:31 +01:00
Kacper Michajłow 6be1e3f2b9 win32: don't override fs user option
We don't support other ways of fullscreening.

Fixes: #16119
2026-03-13 15:13:31 +01:00
Kacper Michajłow c804e55dbe win32: change resize window event logs to trace 2026-03-13 15:13:31 +01:00
Kacper Michajłow a34ecb5284 video/out/win_state: allow internal size constraint for window_geometry
Will be useful to limit the size directly based on platform requirement.
2026-03-13 15:13:31 +01:00
Kacper Michajłow 8142c831f0 video/out/win_state: pass opts as argument
Options may be at different state when caller is using it's own cached
copy. This makes opts consistent in usage.
2026-03-13 15:13:31 +01:00
Kacper Michajłow 27b0979b6b osc.lua: set sub_margins to no
Subtitles are complex subsystem, let's leave the choice to move them
with margin on user.
2026-03-13 15:10:21 +01:00
Kacper Michajłow 0f37c2abef osc.lua: use dedicated options to control SUB/OSD offset
There is concern that with certain user options or script the value of
`{sub,osd}-margin-y` value may be persisted or overwrite user option
when it's changed while OSD is visible and offset is applied.

Fix this by using dedicated option.
2026-03-13 15:10:21 +01:00
dependabot[bot] 3a09e793b9 ci: bump actions/cache from 4 to 5
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 17:20:00 +01:00
dependabot[bot] d58b7e03b2 ci: bump actions/upload-artifact from 5 to 7
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 17:19:40 +01:00
dependabot[bot] e74ef802c5 ci: bump cross-platform-actions/action from 0.30.0 to 0.32.0
Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 0.30.0 to 0.32.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v0.30.0...v0.32.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-version: 0.32.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-03-12 17:18:59 +01:00
Kacper Michajłow d83931aa61 ci: add dependabot to update actions for us 2026-03-12 16:08:15 +01:00
NRK 3cd66d2fd7 command: avoid crashing the player with mmap
mmap in inherently crashy due to the file changing underneath
and requires esoteric SIGBUS handling [0] to use properly.

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

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

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

[0]: https://www.sublimetext.com/blog/articles/use-mmap-with-care
2026-03-12 15:58:53 +01:00
NRK 1aee4637f2 osdep/io: add mp_dup_cloexec()
will be used in the next commit
2026-03-12 15:58:53 +01:00
NRK 7e9fa0dee4 osdep/io: remove redundant errno setting
according to the docs _get_osfhandle() sets errno to EBADF upon
failure already:
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/get-osfhandle?view=msvc-170
2026-03-12 15:58:53 +01:00
NRK a2ddcdf67b osdep/io: fix error check
_get_osfhandle returns INVALID_HANDLE_VALUE on failure, not 0.
2026-03-12 15:58:53 +01:00
Guido Cella ad9374d03e osc.lua: move {audio,sub}_track_count into state 2026-03-12 15:58:21 +01:00
Guido Cella 6da164452a osc.lua: update track state only when track-list changes
There is no need to retrieve track-list on every osc_init().

Also remove the outdated comment.
2026-03-12 15:58:21 +01:00
Sam 11440741cb osc.lua: remove pause_state() 2026-03-12 10:50:11 +01:00
Kacper Michajłow 79bf5d2684 osc.lua: increase deadzoneszie to 0.75
This allows to retain deadzone in the middle of the screen when both top
and bottom bars are enabled. We also doesn't have to show bars that
early before moving mouse down.
2026-03-12 00:02:41 +01:00
Kacper Michajłow 3b66428152 osc.lua: fix window controls showing in fullscreen
If `no-border` or `no-title-bar` was used, window controls would enable
also in fullscreen, this was inconsistent, as window decorations are not
visible ragardless of those options in fullscreen mode.
2026-03-12 00:02:17 +01:00
Guido Cella 44dec05a29 osc.lua: don't retrieve display-fps at startup
There is no advantage since is it never available at startup, so speed
up the startup by not retrieving it.
2026-03-11 14:58:09 +01:00
Kacper Michajłow 24500c5e27 f_decoder_wrapper: fix decoder name/desc allocation parent
Those strings has to be owned by mp_codec_params, not decoder wrapper
priv.

Our assumption is that we set those strings here once on decoder init
and they will not be changes during the life time of the
mp_codec_params, hence why we need to make sure they are not deallocated
too soon, in case they happen to be in use.

Fixes, use after free in some cases, when tracks are deselected.
2026-03-11 00:20:22 +01:00
Kacper Michajłow 7b2feb9429 osc.lua: add osd-margin option
Fixes: #17539
2026-03-10 19:45:03 +01:00
Kacper Michajłow e1e6eb8b6e osc.lua: add sub-margin option 2026-03-10 19:45:03 +01:00
Kacper Michajłow aa8966a50f osc.lua: add dynamic_margins option 2026-03-10 19:45:03 +01:00
Kacper Michajłow d4625c7db6 osc.lua: fix always visibility 2026-03-10 19:45:03 +01:00
Kacper Michajłow 32a690b8bd DOCS/man/osc: fix boxvideo description 2026-03-10 19:45:03 +01:00
Kacper Michajłow 85f9e6f274 vf_d3d11vpp: allow more future/past frames
Apparently some video processors request 15-20 future frames.

Fixes: https://github.com/mpv-player/mpv/pull/17413#issuecomment-4032784635
2026-03-10 18:30:10 +01:00
Kacper Michajłow 88ac54b95d osc.lua: hide osc or wc when leaving its area
Those zones use input sections, but in OSC we allow them to overlap. So,
we might switch to the other section, after which point we won't get
mouse_leave event that would hide the bar for the other section.

This makes hidding/showing WC and OSC more consistent.
2026-03-10 08:56:23 +01:00
Kacper Michajłow 3ff7b04790 player/command: don't send mouse move event on mouse leave request 2026-03-10 08:56:23 +01:00
nanahi 1f430f8ce3 osc.lua: always wipe osc when idle
Prevents osc lingering when entering idle.
2026-03-10 08:31:15 +01:00
sfan5 07c3ff3725 command: reject negative offset for overlay-add 2026-03-09 15:43:32 +01:00
Kacper Michajłow cbecfb4046 wayland_common: add scRGB support 2026-03-09 12:00:33 +01:00
nanahi 19b2215142 include/mpv/client: remove mpv_suspend() reference
Removed in mpv 0.35.0.
2026-03-09 10:34:51 +01:00
Kacper Michajłow 14508544ea wayland_common: keep unaltered hint params for changed check
This avoids trying to set params on every frames, if they were modified
by the set color itself.
2026-03-09 10:18:30 +01:00
Kacper Michajłow be2336fcb3 wayland_common: warn on not supported color representation 2026-03-09 10:18:30 +01:00
Kacper Michajłow 040eb5b656 vo_dmabuf_wayland: add BT.2100 mapping 2026-03-09 10:18:30 +01:00
Kacper Michajłow 218be8d93a vo_dmabuf_wayland: use color parameters prepared in reconfig
Those has Dolby Vision metadata stripped and have all parameters
correctly guessed.
2026-03-09 10:18:30 +01:00
Kacper Michajłow 63f3d1731a video/out/opengl/context_wayland: export preferred colorspace 2026-03-09 10:18:30 +01:00
Kacper Michajłow 012d9baa22 vo_wlshm: use image params after conversion 2026-03-09 10:18:30 +01:00
Julian OrthandKacper Michajłow 96e64b0e70 wayland_common: scale preferred luminances
Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2026-03-09 10:18:30 +01:00
Kacper Michajłow 66dcb2ba7b wayland_common: set luminances
This fixes --target-trc=linear output and makes our output luminance
ranges more explicit.
2026-03-09 10:18:30 +01:00
Kacper Michajłow fe9f917d8e vo_gpu_next: set color directly using Wayland protocol
Wayland color managment is not really flexible to be usable with Vulkan
color spaces, so set it directly.
2026-03-09 10:18:30 +01:00
Kacper Michajłow 2417d17c81 wayland_common: only bind color surface when actually used
This is required, because other modules like Vulkan may need to use it,
and only single color surface is allowed in Wayland.
2026-03-09 10:18:30 +01:00
Kacper Michajłow 4a815734e3 player/playloop: clear demux packet pool on idle
Packet pool is useful to avoid work and additional allocations when
switching files, going to idle should free the pool as those packets may
not be used for some time.

Fixes: #17525
2026-03-09 08:54:53 +01:00
zenodity 147c951a17 DOCS/man/input: add tablet-pos node map schema 2026-03-08 18:02:01 +01:00
nanahi 9bb5a0b705 osc.lua: add audioonlyscreen script option
Allows rendering mpv logo when there is no video, instead of
black screen. osc is still available at the same time for playback
control.
2026-03-08 13:07:37 +01:00
nanahi 937e67e7b1 DOCS/man/input: fix typo 2026-03-08 13:07:37 +01:00
nanahi 276710318f osc.lua: make logo centered 2026-03-08 13:07:37 +01:00
nanahi 107b5bee0a osc.lua: render logo and osc on separate layers
Allows rendering logo and osc at the same time to be used by the next
commit.
2026-03-08 13:07:37 +01:00
nanahi e3f6e5d8ed auto_profiles.lua: evaluate conditional profiles on on_loaded hook
This allows conditional profiles to evaluate on the properties only
available in on_loaded stage before the media is shown to the user.
2026-03-08 13:07:05 +01:00
nanahi ba30c8c175 player/loadfile: add on_loaded hook
Currently, there is no hook which happens when the playback actually
starts. The on_preloaded hook is insufficient for many cases, as many
track information are unavailable at that stage. This makes it impossible
to act on certain track metadata before the media is shown to the user,
so the user will see the media before action for a brief moment before the
properties are notified and options are changed.

This adds the on_loaded hook which allows the mentioned information
available.
2026-03-08 13:07:05 +01:00
Kacper Michajłow 396bf65ec5 select.lua: fix crash on user_profiles sort
The list is filtered, so we need to not use index of the input.

Fixes: Lua error: attempt to compare string with nil
2026-03-08 11:50:08 +01:00
CogentRedTester 429fdcf21d mp.input: allow clients to override console.lua script-opts
This commit allows a table of script-opt overrides to be passed to
`mp.input.get()` and `mp.input.select()`, which console.lua will use
instead of the its own.

To minimise required changes, metatables are used to allow console.lua
to seamlessly fall back on the original script-opts if the client does
not provide an override.
To prevent exceptions, the incoming opts must be of the same type.
2026-03-07 12:31:50 +01:00
Kacper Michajłow a205e95efb ci/win32: change from choco to winget
Chocolatey is unstable recently, let's try winget.
2026-03-07 12:30:51 +01:00
Kacper Michajłow 289bcb9e13 Revert "ci/win32: downgrade meson to 1.9.2"
This reverts commit 95c7599c41.
2026-03-07 12:30:51 +01:00
Kacper Michajłow debfdf9402 ci/win32: pre-generate SPIRV-Tools build-version.in
Work around meson's cmake module not supporting OBJECT_DEPENDS [1],
which broke the build after SPIRV-Tools removed the explicit
spirv-tools-build-version target [2].

[1] https://github.com/mesonbuild/meson/issues/9062
[2] https://github.com/KhronosGroup/SPIRV-Tools/commit/54ad621f6e3fa758c1b80981489fcf0b62d2b752
2026-03-07 12:30:51 +01:00
Kacper Michajłow 9548ec5531 osc.lua: avoid use of goto
For Lua 5.1 compatibility.
2026-03-07 07:28:13 +01:00
Kacper Michajłow f9190e57f9 vo_gpu_next: add scRGB support
Fixes: #17076
2026-03-06 16:17:58 +01:00
Kacper Michajłow 74e8cee80d vo_gpu_next: always clip hdr.prim to container primaries
It may happen that .hdr.prim is set from display properties and exceeds
.primaries. This would make gamut mapping work incorrectly.
2026-03-06 16:17:58 +01:00
llyyr 3b55bc9795 wayland: dispatch queue until image_description_pending flag is cleared
wl_display_roundtrip performs one roundtrip one the queue, but there's
no guarantee that the callback will be invoked within that roundtrip.

Instead of hoping one roundtrip is enough, dispatch the queue until the
pending flag is cleared explicitly.
2026-03-05 19:16:30 +01:00
nanahi 10ed4716a7 etc/restore-old-bindings.conf: add changed bindings
Changed in: 7bfa2cfd3d,
8da6e8ad55
2026-03-05 19:14:55 +01:00
Kacper Michajłow 45019b21bf osc.lua: clean areas autohide
Fixes some corner cases with showing/hiding zones.
2026-03-05 16:34:22 +01:00
Kacper Michajłow eda3b89278 osc.lua: make top/bottom bar show independently on mouse proximity
Controlled by `windowcontrols_independent` opt.
2026-03-05 12:44:11 +01:00
Guido Cella a9ac97a5b0 DOCS/man/lua: remove REPL reference
It is a leftover of the original repl.lua name. Follow up to 9551de6385.
2026-03-04 14:11:16 +01:00
WhitePeter c401ef9c3b screenshot: use mp_strip_ext for %F
Reuse existing functionality, see previous commit introducing above
function.
2026-03-03 03:06:39 +01:00
WhitePeterandGuido Cella 648fc933b1 misc/path_utils: new mp_strip_ext shorthand
There are at least two users of this functionality, the filename/no-ext
property and the screenshot template %F specifier. The latter uses a
buggy private version. So split out what the former does, so it can be
reused.

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2026-03-03 03:06:39 +01:00
WhitePeterandGuido Cella 5dba9c52c0 misc/path_utils: fix mp_splitext bugs
The detection for leading dots was in the wrong place, in case path was
not already a basename. Fixed by acting on basename. Also all leading
dots are now getting skipped, otherwise the root of `path/to/...ext`
could end up as `path/to/..` which in the wrong place/context would mean
directory traversal.

Additionally, since we act on the basename there is no longer a need to
test for trailing path separators. The previous check also did not
account for Windows paths with \ separators.

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2026-03-03 03:06:39 +01:00
WhitePeter 9ecbf5c878 screenshot: remove redundant mkdirp call
There is no reason to create the screenshot dir separately, because the
final path starts with it. So defer creating directories to the last
possible moment with all the information necessary.
2026-03-03 03:06:39 +01:00
WhitePeterandGuido Cella d2877a1cdb screenshot: fix %f with trailing slashes
URLs can end with trailing slashes (/) which in turn results in GNU
basename[1] returning the empty string, i.e. when the filename property
is queried. Instead use the whole path for everything that ends with /.
Subsequent path sanitation takes care of translating invalid path
component chars.

Issue reproduction steps:
```
mpv \
    --screenshot-dir=$HOME/mpv-shots \
    --screenshot-template='%f/%P' \
    https://example.org/video/
```
This would result in %f expanding to '' and thus render
screenshot-template an absolute path which, for some reason, would in
turn take precedence of screenshot-dir and hence result in a
non-writeable path, i.e. `/timestamp.ext`.

With this new approach the resulting path looks like this:
`/home/user/mpv-shots/http:__example.org_video_/timestamp.ext`

[1] https://github.com/mpv-player/mpv/pull/14635#issuecomment-2269456187

Co-authored-by: Guido Cella <guido@guidocella.xyz>
2026-03-03 03:06:39 +01:00
llyyr 35443a74cb vo,vo_dmabuf_wayland: remove vo_wait_on_vo
Not needed after previous commit
2026-03-03 03:01:41 +01:00
llyyr 8012dc88f7 wayland: do a roundtrip to wait for image description creation
Also switch to a different event queue to ensure there are no other
events in the queue.
2026-03-03 03:01:41 +01:00
Kacper Michajłow c55bdc3282 video/out/gpu: signal correctly if set_color is supported
set_color conceptually is a swapchain command, but in Wayland it's
implemented in ra_ctx, so we have one jump of indirection. Having
`set_color` defined for context_vulkan doesn't mean that all ra contexts
support it. Add a bool to mitigate this.

This could be structured differently, but should be fine.

Fixes: #17487
2026-03-02 02:04:36 +01:00
Guido Cella af9c81fa1e DOCS/man/options: don't recommend --sub-justify=left
It is unclear why this should be recommended. If it were recommended it
would be the default. The consensus is that centered justification looks
better.
2026-03-01 08:24:39 +01:00
Guido Cella 05fac7f21e DOCS/man/lua: document remaining input.select() fields
Document more shared fields with input.get().

I originally omitted them because they didn't seem useful for
input.select(), but now opened can be used to override keybindings, and
default_text = "'" can be used to default to exact search (which I do
for history in my build).

closed, default_text and cursor_position may be used to remember the
last input line for the next call.
2026-02-28 22:41:26 +01:00
nanahi fc7f6e0208 osc.lua: fix mouse position init
get_virt_mouse_pos() can return dummy -1, -1 in some cases, for example
when mouse is not considered "in" the area. render() is called
immediately and sets the initial mouse position to -1, -1 when the first
tick happens.

When starting player and mouse is already on the window but not moved,
then move the mouse, the mouse_move handler thinks that the mouse moved
from -1, -1 to the current position, triggering showing even when the
amount moved is less than osc-minmousemove.

Fix this by not letting render() init mouse position if the position is
dummy -1.
2026-02-28 22:39:24 +01:00
Kacper Michajłow 3511e467e7 vo_gpu_next: use typed variable for alpha 2026-02-28 13:32:19 +01:00
Kacper Michajłow 2e8520311c vo_gpu_next: fix rgb range in Wayland hint
Fixes: 9d2da2567c
Fixes: #17479
2026-02-28 13:32:19 +01:00
Dudemanguy bcfc754f03 wayland: invert image_description_processed boolean
Depending on the state being true before advancing through frames works
but it's error prone and leads to various edge cases you have to account
for (e.g. like 339ac9b305). It's better
invert it so that setting color management is the special case that sets
the boolean to true to stall the playloop. The logic can then be
simplified, and the vo_wayland_handle_color call is moved up to be
directly after we create the buffer.
2026-02-28 10:50:38 +01:00
Dudemanguy f864f9a14a wayland: use set_color for vo_wayland_handle_color
Move this out of swap_buffers. This makes it more consistent with what
vo_dmabuf_wayland does.
2026-02-28 10:50:38 +01:00
Dudemanguy baad29c1f4 context_drm_egl: use set_color for handling colorspaces
With this ordering, we ensure that the colorspace is set before the
first atomic commit.
2026-02-28 10:50:38 +01:00
Dudemanguy 9d2da2567c video/out/gpu: add set_color ra_swapchain_fns
Anything related color management gets complex and there is a lot of
platform-specific code that gets called in relation to this. Currently,
this stuff gets called in various places in the render loop which mostly
works but it's prone to "off by 1 frame" errors and also isn't clean.
Introduce this helper to hopefully unify all this kind of stuff under
one umbrella. For integration with vo_gpu_next, this needs to be called
before flip_page and we should stop abusing target_params for this
purpose. The next couple of commits will implement this in two places.
2026-02-28 10:50:38 +01:00
Dudemanguy 2268297ac4 context_drm_egl: use target_csp to signal HDR
For the drm context, we can use the target_csp so vo_gpu_next knows what
colorspace to output to. We just need to be sure the monitor is able to
display bt2020. For now, all we detect on the EDID side is either pq or
hlg so ensure at least one of those works before we send back something
to vo_gpu_next to use for target_csp.
2026-02-28 10:50:38 +01:00
Dudemanguy 7dd06a6c0b video/out/gpu: remove pass_colorspace ra_ctx_fns
This was originally added way back when specifically for drm so it can
play  nice with libplacebo for HDR. This is pretty ugly though and a bit
hacky. There's a better way to integrate this with target_csp. So drop
the pass_colorspace stuff in this commit and we'll change the
implementation in the next commit.
2026-02-28 10:50:38 +01:00
Nicolas F f28cea85c1 ytdl_hook.lua: use the new request_size AVOption when needed
Some sites throttle requests, but throttling can be avoided with many
small range requests. yt-dlp implements a "http_chunk_size" key in its
-J output to inform us of the ideal size.

https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21703 has just been merged,
which allows use the http_chunk_size to greatly speed up how fast
YouTube videos get loaded into the cache by mpv.

Should the FFmpeg that mpv is built against lack the request_size
AVOption, then this will silently not do anything new, so no version
checks are needed.

Specifying multiple_requests=1 like suggested in
https://github.com/mpv-player/mpv/issues/8655#issuecomment-3872689494
does not seem necessary.

Fixes #8655.
Supersedes #15612.

Co-authored-by: Nicolas F <ovdev@fratti.ch>
2026-02-27 20:18:55 +01:00
Kacper Michajłow e54cee1b23 player/command: apply expand-properties modifier also for string lists 2026-02-27 20:18:42 +01:00
Guido Cella 850677c157 input.lua: don't shadow the global type() function
For consistency, also rename type to event in defaults.js.
2026-02-27 18:12:52 +01:00
CogentRedTester a96bbf5c17 mp.input: sanitise client inputs
This commit should remove any unexpected behaviour or crashes
that
may be caused by users passing unexpected values to mp.input functions.

String and numerical options are now explicitly converted to strings and
numbers. Values which should be tables are set to empty tables, and
warning messages are printed to inform the user.
2026-02-27 09:51:14 +01:00
CogentRedTester 4d26c4e42c console.lua: guard against invalid arguments to script-messages
All but one of these guards should never be tripped
if people are using the mp.input
module. However, it could happen if non-lua/js clients were to use the
JSON API directly.

Currently, without these guards, calling these script messages with
incorrect arguments will almost certainly crash `console.lua`, hence
preventing any client from requesting input.

An error message has also been added for each guard to provide some
feedback as to why the arguments were invalid.
2026-02-27 09:51:14 +01:00
Guido Cella 3ec435dbee menu.conf: add a Reload menu item 2026-02-27 09:24:53 +01:00
Guido Cella 06259d1a0b input.conf: bind Ctrl+r to reload the current file
Because how to do this has been asked more than 10 times in #mpv, bind
it by default.
2026-02-27 09:24:53 +01:00
Guido Cella 3b555c349c command: let playlist-play-index current preserve file-local-options
If you set file-local-options/foo at runtime and run playlist-play-index
current or playlist-play-index $current_pos, file-local-options/foo is
reset. Add a flag to make it preserve file-local-options.

The advantage of this change is that it allows binding Ctrl+r set
file-local-options/start ${=time-pos}; playlist-play-index current yes
to reload the current file while preserving all options, independently
of --no-config, --watch-later-options or --reset-on-next-file, and
without writing watch later files to disk. It also preserves
file-local-options set on the CLI unlike loadfile.
2026-02-27 09:21:14 +01:00
CogentRedTester 149e6dc55b commands.lua: return empty completions on early returns
The new async completion handling code expects an empty list of
completions to be returned if no completions should be shown.
2026-02-27 05:29:06 +01:00
NRK d54bad5636 screenshot: percent decode filename if it's a URI
any uri that's fed to mpv should be percent encoded already
(ffmpeg will sometimes do it for you, but it's heuristic is not
foolproof [1]).

but there's no reason for us to leak uri quirks into screenshot
filename, and it's generally not what users want either. so do
the obvious thing and percent decode the filename if it's a uri.

[1]: https://github.com/mpv-player/mpv/issues/17450#issuecomment-3953135707
Fixes: https://github.com/mpv-player/mpv/issues/17450
2026-02-25 17:36:37 +02:00
NRK 41463d6ac8 DOCS/man/mpv: document that URLs should be percent-encoded
most of the time not doing so will still work since ffmpeg has
some heuristics in place to detect if the url is percent encoded
already or not. but these heuristics are not foolproof and so
document this quirk explicitly.
2026-02-25 17:33:03 +02:00
Avi Halachmi (:avih) 92ed2d2ef0 github/issue_template: clarify "latest mpv version"
At the issue templates "tested with the latest version" checkbox, make
that a link to the latest version, revise the text slightly, and add
"or newer".

At the linux issue template, also note that if the distro does not
provide the latest version, then the issue should be reported to them.
2026-02-25 00:28:18 +01:00
CogentRedTester 4bb048c227 console.lua: prevent outdated completions from being selected
This commit flags when console.lua is waiting for completions, and
disables the completion cycle key until up-to-date completions are
received.

While this is happening, completions are not printed when in terminal
output mode. In normal OSD mode, the completions are still printed, but
at reduced opacity. This is to avoid distracting and ugly flickering
from completions being rapidly erased and redrawn.

The completion results are only dimmed after a short (sub-second) delay.
This is to avoid distracting flickers from the opacity
rapidly changing for clients that return completions almost immediately,
e.g., commands.lua.
2026-02-24 20:19:24 +01:00
CogentRedTester 9902e84e20 DOCS/interface-changes: change how mp.input completions are returned 2026-02-24 20:19:24 +01:00
CogentRedTester 5a1700a456 mp.input: avoid displaying outdated completions from the same client
Previously, completion responses from the same client would be displayed
even if the user had since changed the input, as long as a newer
complete event had already been sent. This meant that, if clients took a
sufficiently long time to return completions, then
console.lua would display completions for previous versions of the line
which were no longer valid.

This commit has the client send back the version of the line their
completions apply to, ensuring that `console.lua` displays the
correct completions.
2026-02-24 20:19:24 +01:00
CogentRedTester c568e1539f commands.lua: use new mp.input complete method
Updates to use the new response function passed to
`complete` events to send completions back to `console.lua`. This is to
pre-empt the old return value method being deprecated.
2026-02-24 20:19:24 +01:00
CogentRedTester c72f2add25 mp.input: allow async completions
Previously, it was impossible to generate a list of completions for an
`input.get()` request asynchronously, as the values had to be returned
by the callback function.

This commit provides a way to send completions asynchronously by passing
a second argument to the complete callback; a function which can be
passed the return values to respond to the complete event.
2026-02-24 20:19:24 +01:00
CogentRedTester cf481faa72 DOCS/man/lua: update recommended use of the mp.input opened event
Now cites overriding keybinds as the most notable use of the `opened`
event.
2026-02-24 20:12:57 +01:00
CogentRedTester ae965e7a7e console.lua: remove undocumented dont_bind_up_down option
This undocumented option was used by `stats.lua` to prevent the page
scroll keys from being overridden by `console.lua`. The previous commits
have removed the need for this hack, so it is now safe to remove.
2026-02-24 20:12:57 +01:00
CogentRedTester de0f2f943d stats.lua: correctly override mp.input keybinds
This commit uses the opened event to ensure that the page scroll keys
(`UP`/`DOWN` by default) override the mp.input bindings,
without overriding any other mp.input keys.

This is much safer than the previous method, which required an
undocumented option to be passed to `mp.input`, and was hardcoded to the
default scroll keys.
2026-02-24 20:12:57 +01:00
CogentRedTester 0af0c137bb console.lua: flush keybinds before sending mp.input opened events
This commit uses the undocumented `mp.flush_keybindings()` method
to ensure that all `console.lua` keybinds are set before
sending the `opened` event to `mp.input` clients.

Previously, the keybinds would only be flushed when `console.lua` went
idle. As the `opened` event is sent before this happens, clients
processing the event may end up flushing their own keybinds before this
happens. This makes it unreliable to use the `opened` event to override
keybinds set by `console.lua`; for example, adding different
behaviour to `input.select` when using `Shift+Enter` instead of `Enter`.

This commit allows the `opened` callback to be used to safely override
`console.lua` keybinds.

.luacheckrc: move flush_keybindings to globals
2026-02-24 20:12:57 +01:00
llyyr e09a1d12f2 m_option: also clamp OPT_FLOAT values for float_set
This incorrectly used clamp_double function after 0e7f9c39dc when it
should've always used clamp_float instead. Use clamp_float instead

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

Fixes: 0e7f9c3
Fixes: #17436
2026-02-24 19:41:53 +01:00
nanahi 3eb8f9a1de demux_lavf: get codec info from AVCodecParameters
This allows displaying codec info for all tracks without selecting the
track.
2026-02-24 19:36:33 +01:00
nanahi 4e2f3ce4b9 command: add track-list/N/demux-duration property 2026-02-24 19:36:33 +01:00
nanahi ccdb098fb4 stats.lua: add track_info_selected_only script option
Allow displaying info for all tracks rather than only selected tracks.
2026-02-24 19:36:33 +01:00
nanahi e6bd564723 demux_lavf: also make demux-bitrate available for video
Make it available as a property and on stats page 5.
2026-02-24 19:36:33 +01:00
nanahi b62e34d975 stats.lua: display file duration on page 5 2026-02-24 19:36:33 +01:00
nanahi 9ce6da09e6 stats.lua: add format entry to page 5 2026-02-24 19:36:33 +01:00
nanahi c3f11f8b7e stats.lua: rename format to codec on page 5
To be consistent with page 1 usage, where format refers to sample format
and not codec.
2026-02-24 19:36:33 +01:00
zenodity 4620834e36 DOCS/man/input: add/update MPV_FORMAT_NODE map and array pseudo structs 2026-02-23 20:06:02 +01:00
Guido Cella ee9a219600 console.lua: deduplicate code between get-input and handle_cursor_move 2026-02-23 17:40:11 +01:00
zenodity f439c7f62c m_option: fix x:y mode format when printing geometry
Previously, x:y mode geometry strings were incorrectly printed
using the WxH+x+y format.
2026-02-22 22:31:40 +01:00
Kacper Michajłow 250d6056c3 ci/win32: update runners to windows-2025-vs2026 2026-02-21 01:36:35 +01:00
Kacper Michajłow 5159300ba3 ci/win32: use vswhere to find Visual Studio 2026-02-21 01:36:35 +01:00
Simon Bruder 534b2d2ea6 {demux,player}: expose original and commentary track flags
Those flags were added to the Matroska specification together with the
already implemented hearing-impaired and visual-impaired flags.

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

Ref: https://github.com/ietf-wg-cellar/matroska-specification/pull/447
Ref: https://www.rfc-editor.org/rfc/rfc9559#name-original-flag
Ref: https://www.rfc-editor.org/rfc/rfc9559#name-commentary-flag
2026-02-20 20:31:04 +01:00
Kacper Michajłow f7ad4a5f8f vf_d3d11vpp: set output format for NVIDIA RTX Video HDR
It outputs RGB tone mapped image, set params accordingly.

Fixes: #17265
2026-02-19 19:18:56 +01:00
Kacper Michajłow 43f00135ea vf_d3d11vpp: add dots to logs 2026-02-19 19:18:56 +01:00
Kacper Michajłow 568522e69e vf_d3d11vpp: use ID3D11VideoContext1 interface for setting color space
This allows to use DXGI enums for color spaces, which supports PQ
transfers and so on. Old D3D11_VIDEO_PROCESSOR_COLOR_SPACE is limited
and doesn't support HDR formats.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 825ba4167e hwdec_d3d11va: add support for RGB formats
This will be useful for mapping RGB output from d3d11vpp tone mapping.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 2aba5a7167 ra_d3d11: allow mapping rgba10_a2 format
This is needed for ra_get_imgfmt_desc() which otherwise would not allow
rgba10_a2 format, because it doesn't have all components with the same
size. However it's nativelly supported by d3d11, so we add it to special
formats, same as opengl does.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 18330cb1ed video/img_format: add repack test for new formats 2026-02-19 19:18:56 +01:00
Kacper Michajłow 54976fe147 video/img_format: add IMGFMT definitions for x2bgr10 and rgba16f
Will be useful for mapping hardware frames. We could add more formats
here, but those should be enough to allow RGB processing.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 71bc92a080 video/img_format: move IMGFMT_X2RGB10 from custom range 2026-02-19 19:18:56 +01:00
Kacper Michajłow 7b015a9846 video/img_format: remove custom rgb30 definition
It's supported in ffmpeg since 4.4, no need to keep custom code for it.
2026-02-19 19:18:56 +01:00
Kacper Michajłow 2b4b345a3a video/img_format: rename IMGFMT_RGB30 to IMGFMT_X2RGB10
It's supported in ffmpeg, so let's have naming parity.
2026-02-19 19:18:56 +01:00
Kacper Michajłow af47c1d43b vo_drm: don't define custom IMGFMT values
We should never make such mappings that are not covered by
img_formats.h.
2026-02-19 14:20:56 +01:00
Kacper Michajłow e9a3bf2ad1 vo_drm: use always little endian formats
DRM formats are little endian, unless the format is ORed with
DRM_FORMAT_BIG_ENDIAN.
2026-02-19 14:20:56 +01:00
Kacper Michajłow 73ae34e2d0 vo_drm: fix xbgr2101010 format mapping
Fixes: 6b452788c4
2026-02-19 14:20:56 +01:00
Kacper Michajłow c2c081f49a vf_d3d11vpp: use half-rate for IVTC mode
The optimal way would be to use custom rate based on telecine cadence,
but it's not supported by any driver in practice. So instead, allow
driver to field match and output with duplicated frames, which can be
removed using decimate filter.

Note that in practice all GPU vendors uses single video processor for
all deinterlacing, so IVTC will be done even if mode is not explicitly
selected. At least the field matching part, because correct rate output
is not supported. The main difference is that when selecting more we
output at video frame rate, not field rate.
2026-02-18 18:13:18 +01:00
Kacper Michajłow f571fd73a1 vf_d3d11vpp: print supported custom rates 2026-02-18 18:13:18 +01:00
Kacper Michajłow 2141fa88b3 vf_d3d11vpp: fix deinterlacing
There were multiple issues in API usage, not setting correct
OutputIndex, lying about frame field parity to make it work without
OutputIndex. Not passing reference frames which forced BOB mode always.

Fix all issues and allow forcing BLEND/BOB mode by not passing frames.
Blend mode also sets half rate output. Half rate could be separate
option too, but there is not much gain from it except for debugging
really.

Fixes: #15197
2026-02-18 18:13:18 +01:00
Kacper Michajłow 47ed5785e4 video/filter/refqueue: add mp_refqueue_output_fields 2026-02-18 18:13:18 +01:00
Kacper Michajłow db2352f69a vf_d3d11vpp: update mode selection logging 2026-02-18 18:13:18 +01:00
Kacper Michajłow 626f1344c8 vf_d3d11vpp: rename ivctc to ivtc
This was a typo. Although this changes the user option name, this
filter, especially this option, is so niche that I fix it without a
deprecation period.
2026-02-18 18:13:18 +01:00
Guido Cella aa82213726 select.lua: don't set an empty prompt
Not needed since 44816ef8ff.
2026-02-15 16:36:28 +01:00
Guido Cella 102e693f49 select.lua: sort the track submenu
track-list doesn't necessarily return tracks sorted by type so we need
to sort them ourselves.
2026-02-14 01:07:27 +01:00
llyyr 1a160f9767 Revert "ci/tumbleweed: disable sanitizers for GCC build"
This reverts commit 5b0cfe8849.

Shouldn't be needed after previous commit
2026-02-14 00:43:52 +01:00
llyyr a7523a4afd demux_mf: satisfy gcc ubsan so it doesn't produce bogus warnings
Since we call bstr0 on the string anyway, might as well use it for
printing which implicitly includes a null check that gcc can see so it
doesn't produce the warning as seen in the next commit anymore
2026-02-14 00:43:52 +01:00
Dudemanguy 76a5eba991 player: don't mangle current playlist entry before initialization
Scripts and things using the client API can load up playlists in a
specific order and choose what file to start playing on by using the
loadfile or loadlist commands with the play argument. However if
starting from idle mode, it is possible to send these commands before
all scripts finish initializing. mpv's core then does a prepare_playlist
call on its own for startup which will nuke the current playlist entry
set by the API user and lead to an unexpected item being played. Fix
this by not unconditionally setting pl->current to NULL allow callers to
optionally always overwrite it by getting the first item in the playlist
(e.g. if it's called after startup anywhere else in the code). Other
options like --playlist-start or --shuffle are allowed to win if they
happen to be set.
2026-02-12 04:42:32 +00:00
Dudemanguy 3847a8157f wayland: handle all outputs disappearing without segfaulting
If you switch TTYs while mpv is playing, wlroots compositors will remove
all outputs from the registry. This segfaults when you switch back since
we try to access cleared memory. Rework this so wl->current_output is
given null when appropriate and properly guarded. You still need at
least one output to initially place the surface, but in general they can
all disappear during runtime and it should work. Change the log to
verbose because that becomes just noise in this case (switching TTYs).
The surface entrance event happens later and should get all the proper
parameters.
2026-02-10 00:46:55 +00:00
llyyr f0f9322c57 vo_dmabuf_wayland: only wait for image description if we have a buffer
Waiting for color management from the compositor doesn't make sense in
other cases and this breaks --force-window since the playloop doesn't
advance. Fixes #17391.
2026-02-10 00:35:28 +00:00
Dudemanguy d5bc61596d vo: clear request_redraw in render_frame only if video is playing
27a78276eb almost got it but it should be
an and condition not an or. When we unlock VO to draw the core, the OSD
can update after we flip the page and the player can also pause itself
in that time. That means that we will clear the redraw request but due
to the OSD update it actually needs to draw again. Because the player
paused itself in that time frame, this redraw gets lost and you have the
mismatch. The simplest way to avoid that case is to only clear the
redraw_request while mpv is playing. The paused case will always get
handled later in do_redraw so it does not get missed. The slight
downside is that it's technically possible to do a redundant redraw
(e.g. what if you pause before draw_frame), but this theoretical
inefficiency is deemed not really relevant or important enough to add
more confusing code to avoid. Fixes #17288.
2026-02-09 14:43:46 +00:00
Kacper Michajłow 4fd2600c65 d3d11: support --d3d11-output-format fully for gpu-next 2026-02-08 22:14:18 +01:00
Kacper Michajłow c9c039b7f1 d3d11: set pl_d3d11_swapchain_params.alpha_bits if alpha is needed 2026-02-08 22:14:18 +01:00
llyyr 67886c97dd vulkan: set pl_vulkan_swapchain_params.alpha_bits if alpha needed
We can try to calculate specific amount of bit required in the future,
and also populate color_bits field but for now this should suffice.

Ref: https://code.videolan.org/videolan/libplacebo/-/merge_requests/767
2026-02-08 18:52:56 +01:00
sfan5 60dd40d007 test/img_format: remove dead code 2026-02-08 11:51:26 +01:00
sfan5 e01165d3db test/repack: test draw_bmp at some uneven sizes
intended to discover bugs like f3c1dcf7a1
2026-02-08 11:51:26 +01:00
sfan5 272404533e test: add reference files for ffmpeg 8 2026-02-08 11:51:26 +01:00
Guido Cella 1f686769cd mp.input: deprecate log_error()
This was a mistake. It's too situational and it's not worth complicating
the API and every mp.input client with it. It made some sense before I
implemented input.select() because you could use input.get() to input a
choice and validate it, but in general for input.get() clients it's
better to show an error with input.set_log() instead of adding new lines
to the log everytime. This is what e.g.
https://framagit.org/Midgard/mpv-subber/-/blob/master/subber.lua does.

So this is only marginally useful for REPL scripts that keep adding
lines to the log, and the only such scripts are commands.lua and my
lua-repl.lua. commands.lua never used it and I already removed it from
lua-repl.lua. Cloning all scripts in the wiki reveals that **nobody** is
using log_error(), confirming that it is safe to deprecate.
2026-02-08 11:51:17 +01:00
sfan5 b6512e1f8d wayland_common: improve probing behavior and logging
Any errors when opening the display are now logged.
The WAYLAND_DISPLAY check now also logs and applies only when probing.
This means explicitly setting a wayland `--gpu-context` will always
try to open the display instead of "helpfully" refusing (in some cases).

see also: f6f1721101
2026-02-08 01:56:01 +01:00
Steve Williams 9ccd8899ff sub/draw_bmp: limit memset to available width in last slice
extends f3c1dcf7a1 for all lines not just
the last. This avoid unnecessary write every line and fixes a buffer
overflow for small enough images (for example 78x64).
2026-02-06 11:01:59 +01:00
Kacper Michajłow 97867450ba osdep/w32_register: fix EstimatedSize
Move PathCchRemoveFileSpec after actually getting the file size. It must
have been swapped at some point by accident.

Also use correct unit for the size.

Fixes: #17375
2026-02-05 23:23:38 +01:00
Steve Williams 339ac9b305 wayland: set image_description_processed when not using color mgmnt
otherwise wl->image_description_processed will always be false and
the window will not show.
Follows 468d34c9bd.
2026-02-05 16:07:15 +00:00
verygoodlee 70c893988a select.lua: quote and escape string arguments in menu item commands
try to define a `[foo \ "bar"]` profile in mpv.conf, the command
to apply it in context-menu is `apply-profile foo \ "bar"`,
which is obviously incorrect, the correct command should be
`apply-profile "foo \\ \"bar\""`.

for string arguments that may contain spaces or some special
characters, we need to quote and escape them in JSON-style,
fortunately, `utils.format_json` can do this very well.
2026-02-05 16:14:48 +01:00
Guido Cella ea82915ba7 menu.conf: change duplicate hints
Deduplicate:
Op&en and &Editions/Titles
&Quit and &Quit watch later
2026-02-03 21:05:38 +01:00
llyyr db22a4528f vo: reset wait_on_vo if render_frame is called without current_frame
Fixes a deadlock when switching vo before a frame is displayed (e.g.
with auto profiles) where we'd end up in a state where wait_on_vo is set
to true for the first frame and then draw_frame is never called again so
its value never changes even once dmabuf-wayland is ready to advance
frame

Fixes: 468d34c9bd ("vo: allow VOs to request waiting before advancing frames")
2026-02-02 01:04:16 +00:00
verygoodlee 40d2947fa3 DOCS/man/lua: fix the arg of callback function for "mp.register_event" 2026-01-31 16:56:13 +01:00
Guido Cella d6eeff690d select.lua: handle empty lines at the end of the file
Prevent a crash in this case due to lines[i + 1] being nil.
2026-01-31 14:26:04 +01:00
Guido Cella a0f593202a select.lua: handle carriage returns in menu.conf
Fixes https://github.com/mpv-player/mpv/pull/16816#issuecomment-3804029038
2026-01-31 14:26:04 +01:00
Guido Cella 2cef09820d context_menu.lua: apply disabled_color to separators
As per Samillion's suggestion, reduce the contrast between separators
and the background to match other context menus. Using the already
defined disabled_color works for this and seems to be what GTK and Qt
do at a glance.
2026-01-31 13:20:05 +01:00
Dudemanguy ee843f4db7 player/command: fix repeatable frame stepping with the seek argument
730062b510 fixed the problem with mouse
buttons but unfortunately we forgot to include repeated commands in the
condition. This effectively made any variant of "frame-step X seek"
unrepeatable even though it was supposed to be. So just allow those in
add_step_frame too.

Fixes #17348.
2026-01-31 01:20:14 +00:00
Guido Cella 01cb6433c0 select.lua: always observe --osd-playlist-entry
The playlist submenu does not update in this edge case:

- Have a playlist-count > 99 on the first vo-configured. This makes
  playlist() return before observing --osd-playlist-entry.
- Remove playlist entries until the count is < 100
- Change --osd-playlist-entry
- Show the playlist submenu before changing the playlist
2026-01-30 10:53:19 +01:00
verygoodlee c5c8e8a39a console.lua: allow scrolling up the log until only one line remains
Currently, if some log lines have very long text that actually
renders across multiple lines, even if you scroll to the top,
the topmost content will be pushed out of the screen by these
lines and will never be visible.

In STATS page 2/4/5/0, you can scroll down until there is one
line left on the screen, we can keep the scrolling behavior of
the log consistent with it.
2026-01-30 10:53:07 +01:00
Kacper Michajłow 54da0ba070 demux/packet_pool: unref packet early if we can do it without penalty 2026-01-28 18:40:19 +01:00
Kacper Michajłow a1ea4f3aec demux/packet_pool: always return default packet state from pop
This is not functional change, as pop() is only used in packet_create()
which already cleared the packet, but it's better to make it explcit.
2026-01-28 18:40:19 +01:00
Kacper Michajłow 3b17ab5d3b demux/packet: add demux_packet_unref helper 2026-01-28 18:40:19 +01:00
Guido Cella d79172ac3e select.lua: update the playlist submenu after playlist-move
Observing playlist-pos and playlist-count is not enough to update it
after playlist-move, but we can observe any playlist property with type
none to get notified of every MP_EVENT_CHANGE_PLAYLIST, even if the
property has not changed.

This is similar to the
mp.observe_property("vsync-jitter", "none", recorder) hack used by
stats.lua to replicate the deprecated tick event.

Fixes https://github.com/mpv-player/mpv/pull/16816#discussion_r2727498518
2026-01-28 15:21:38 +01:00
Guido Cella d1743b641b menu.conf: change duplicate hints
Deduplicate:
&Properties and Copy &path
C&enter and D&einterlace
&Speed and &Shuffle
2026-01-26 11:47:16 +01:00
Guido Cella eadba4469f menu.conf: add open-chat to the context menu 2026-01-26 11:11:38 +01:00
Guido Cella d7f0efb67b context_menu.lua: make ESC close only submenus when they are open
Fixes https://github.com/mpv-player/mpv/pull/17316#issuecomment-3798278219
2026-01-26 10:50:50 +01:00
Guido Cella 70d3dc58e8 context_menu.lua: activate key hints with caps lock
Fixes https://github.com/mpv-player/mpv/pull/17316#issuecomment-3797615909
2026-01-26 10:32:05 +01:00
Guido Cella 7bfa2cfd3d input.conf: add context menu bindings
Rebind MENU to show the context menu. Shift+F10 is also bound because it
is a standard context menu binding.

MENU is not added to restore-old-bindings.conf because it is uncommon.
2026-01-25 20:56:42 +01:00
Guido Cella f4b37b6455 select.lua: populate the context menu
Make select.lua parse menu.conf on the first vo-configured and fill
menu-data with the properties referenced in menu.conf change. This is
disabled in the libmpv profile.

This is done from select.lua to reuse functions to format the data and
retrieve key bindings.

There is also a script-binding that opens the correct context menu
depending on --load-context-menu.

While the context menu is scrollable, for the playlist it is better to
start from around the current entry rather than from the beginning, and
since menu-data has no way to specify where to start, when there are
more than 25 items playlist items this adds … entries that open the
scrollable console menu when clicked.

input-bindings is parsed to show the shortcuts bound to commands. Since
it is not observable, it just uses the bindings from the first time the
context menu is opened.

Multimedia and numpad keys are also not shown to reduce clutter.

The old Context Menu section of the docs is merged in the more detailed
context_menu.rst to not repeat the same information.
2026-01-25 20:56:42 +01:00
Guido Cella 8f2d69e1cc select.lua: skip key bindings of forced input sections
Avoid showing forced key bindings by modal scripts that temporarily
overwrite keybindings, like console and stats. These have section
input_forced_$scriptName. Unfortunately this skips all keybindings added
with mp.add_forced_key_binding even if you may want to show them.

Also skip the OSC sections "input" and "window-controls"; these sections
are not called input_forced_osc because the OSC uses
mp.enable_key_bindings() directly instead of mp.add_key_binding().

This mainly benefits the shortcuts in the context menu that the next
commit will add, but is also useful select/select-binding.
2026-01-25 20:56:42 +01:00
Guido Cella df7ac1d931 command: add the default-menu property
This property contains the builtin etc/menu.conf, and will be used by
select.lua. It is undocumented because it is for internal usage.
2026-01-25 20:56:42 +01:00
Guido Cella 19adc2d509 menu.conf: add this file
Add a default context menu definition in etc/menu.conf. It will be used
to populate the context menu.

The format is meant to be easily readable with just tabs as separators
and submenus denoted by indentation. It avoids complicating the builtin
input.conf like similar scripts do.

By not defining the shortcut keys in the builtin input.conf, menu
entries won't be associated to wrong shortcuts when the user's
input.conf changes key bindings without redefining the menu. Note that
external scripts don't have this issue.

I used 3+ spaces as separators at first but then realized that since we
have Windows users tabs will look better in editors with proportional
fonts like notepad, though it still won't be perfectly aligned depending
on the font. But I am still not sure what is better.

On a curious note, etc/menu.conf already existed in the past as mplayer
used to have a menu. git log -p etc/menu.conf will show commits from
2002 to 2011.
2026-01-25 20:56:42 +01:00
Guido Cella 7e38052138 input.conf: format some commands more consistently
The formatting of input.conf commands is totally inconsistent. At least
for the commands that will be used in the context menu, make it
consistent. The next commit will define the context menu commands, and
the keys bound to these commands will be shown in the menu only when
they match exactly, so this avoids copy pasting commands with
inconsistent formatting just to make them match.
2026-01-25 20:56:42 +01:00
Kacper Michajłow 6136c01f95 win32/menu: add mnemonic v for mpv sub-menu
`m` is taken by `Move`, use `v` as it's closer to alt+space than `p`.
2026-01-25 15:39:20 +01:00
Guido Cella e99a9168c1 context_menu.lua: implement key hints
When a character in an item's title is preceded by &, underline it and
activate the item when pressing the character.

Cycling between multiple items with the same hint is not supported.

&& escapes & so it works like the Windows context menu.

Hints after &&&, or greater odd numbers of &, are not supported since
Lua patterns don't support {n,m} quantifiers.
2026-01-25 05:21:49 +01:00
Kacper Michajłow dc5145c01d win32/menu: resolve system menu identity crisis
Don't reset system menu state, when menu data is empty, just disable the
items as needed. Fixes erratic behavior of system menu.

Fixes: 861908c70f
Fixes: #17290
2026-01-24 15:55:07 +01:00
Kacper Michajłow 3c09473327 Revert "ci/win32: manually install cmake to fix cpu detection issue"
No longer needed, upstream images has been fixed already.

This reverts commit e612f419f3.
2026-01-24 15:29:17 +01:00
Kacper Michajłow b5abb065a2 wayland_common: remove pl_color_space_infer
Common layer should alter target params anymore, it's on specific VO to
set correct params. Also this should be noop anyway, after
dmabuf_wayland fix in previous commits.
2026-01-24 14:08:08 +01:00
Kacper Michajłow 43824e793b mp_image: call pl_color_space_infer in guess_csp
This will do a little bit more than only setting max_luma. Also will
fallback to bt.709/bt.1886, but that's fine. We would do it anyway
later.

If params goes through guess_csp, they shouldn't have "unknown" fields
anymore.
2026-01-24 14:08:08 +01:00
Kacper Michajłow 9dd598def8 vo_dmabuf_wayland: ensure target params consistency 2026-01-24 14:08:08 +01:00
Filip Hejsek ed83c7c51e select.lua: add dvb_subtitle to the list of image subtitle codecs 2026-01-24 14:07:37 +01:00
Kacper Michajłow 9c6a3c06ec vo_kitty: add missing sequence end on unint
Fixes: #16299
2026-01-24 09:09:44 +01:00
Filip Hejsek 5d6f31f0a8 DOCS/man/options: fix typos and grammar errors 2026-01-24 08:02:28 +01:00
Steve Williams 16d9e12f37 wayland: add identity-rgb format mappings in color-representation 2026-01-24 08:00:07 +01:00
Filip Hejsek 7298ce13b0 test/samples: use mpeg2 codec for video samples
In CI, ffmpeg chooses vp9 by default, which cannot be muxed into mpegts.
2026-01-24 07:54:46 +01:00
Filip Hejsek c2882c3d81 player/loadfile: never autoselect tracks with wrong PID
Currently, we prefer selecting a track that matches the video program
ID, but can fall back on a track with a different program ID when there
is no such track or when no such track matches subs-fallback criteria.

Change this to instead select no track when only tracks with wrong PID
are available. Program ID will now act as a filter, not as a preference,
and only files with either matching or unset PID will be considered for
autoselect.

Also, ignore the program ID of external tracks, as it doesn't make much
sense to compare PIDs from different files.
2026-01-24 07:54:46 +01:00
Filip Hejsek 3e12e6fcff test/libmpv_test_track_selection: add a program ID matching test 2026-01-24 07:54:46 +01:00
Filip Hejsek bdbe40765a test/libmpv_test_track_selection: add a more complex locale test
The purpose of this test is mostly to verify that matching the OS
language is not wrongly prioritized over other things (like the forced
flag, matching the audio language, etc).
2026-01-24 07:54:46 +01:00
Filip Hejsek 79e87fa62d test/libmpv_test_track_selection: add a locale test with forced tracks
This is a copy of the existing locale test, but with forced flag added
to all tracks. The forced flag should not affect language selection in
this case.
2026-01-24 07:54:46 +01:00
Filip Hejsek 8aca078f09 test/libmpv_test_track_selection: add additional multilang test case
The new test case exercises --subs-fallback-forced=always and verifies
that default+forced is preferred over forced.
2026-01-24 07:54:46 +01:00
Filip Hejsek 6bae2c0f53 player/loadfile: simplify how external tracks are excluded
When autoload-files=no, external files are never selected. Simplify the
logic by excluding them up front instead of removing them afterwards.

This doesn't change the outcome of track selection, apart from edge
cases that are already broken because compare_track is not transitive.
2026-01-24 07:54:46 +01:00
Filip Hejsek a6cb319611 player/loadfile: simplify track selection logic
This fixes the problem that a subtitle track that normally wouldn't be
selected if it were the only track available could end up being selected
after a different candidate track was selected first.
2026-01-24 07:54:46 +01:00
Filip Hejsek 82dce233bc player/loadfile: clean up track comparison logic
This brings compare_track closer to implementing a consistent linear
order and fixes many broken edge cases.
2026-01-24 07:54:46 +01:00
Filip Hejsek 8d5fcade02 player/loadfile: remove forced param from compare_track
Use track->forced_select instead. The value would be assigned there
anyway after the track is selected and the field is not used for any
other purpose.
2026-01-24 07:54:46 +01:00
Dudemanguy 731450f883 opengl/context: remove unneeded ra_swapchain_fns redirection
We don't allow backends to override this anymore since
5ae0e0ff9a so we can just set it directly
in ra_swapchain.
2026-01-23 17:04:04 +00:00
Dudemanguy f74adc4243 opengl/context: require swap_buffers param for FenceSync
Commits 8854c74271 and
5ae0e0ff9a eliminated the external
swapchain API that the render backend (vo_libmpv) was previously using.
However, it was missed that this was being used to skip the
gl->FenceSync calls and that logic change was not properly accounted
for. This meant that vo_libmpv would leak fences since
ra_gl_ctx_swap_buffers is never called to clean them up.

Fix this by making sure the ra_ctx_params have swap_buffers defined
before calling gl->FenceSync. All platforms are required to implement
this anyway with the exception of vo_libmpv since it's a funny special
case. Fixes #17217.
2026-01-23 17:04:04 +00:00
Guido Cella dd50a4748e DOCS/man/commands: update an example
Use the new script name instead of relying on the backwards
compatibility script message.
2026-01-23 12:21:11 +01:00
Guido CellaandCogentRedTester cc1e654286 DOCS/man/lua: suggest keep_open for nested mp.input calls
Before 17551b2d43 keep_open was needed to make nested mp.input calls.
Even after that change it is still better to pass it to not show the
console quickly closing and reopening to the user, so recommend it.

Co-authored-by: CogentRedTester <cogent.redtester@outlook.com>
2026-01-23 10:15:04 +01:00
Kacper Michajłow 32a164cc01 DOCS/man/mpv: reference low-latency profile in network example
It makes more sense in this context, than `fast` profile.
2026-01-23 05:18:14 +01:00
Kacper Michajłow 11b2004b91 vo_gpu{,_next}: fix overriding scaling parameters for inherited kernels
If `{d,c}scale` is not specified the scaling kernel is inherited from
`scale`. This made all `{c,d}scale-*` options not work, as they were
silently ignored.

This commits inherits scale options, only if `{c,d}scale` options were
not adjusted in the config.
2026-01-23 05:18:14 +01:00
der richter df51d5500e ci/mac: install ffmpeg-full with homebrew when available
homebrew slimmed down their ffmpeg formula and stripping it off some
essential functionality.
https://github.com/Homebrew/homebrew-core/pull/261303

use ffmpeg-full instead. this is keg only formula and not automatically
symlinked system wide. make sure ffmpeg is not installed in parallel and
install ffmpeg-full system wide.
2026-01-22 09:43:45 +01:00
Kacper Michajłow 6e54aa328d builtin.conf: enable antiringing in high quality profile
General consensus is that ortho scalers antiring while fast is not that
good, let's use it in high-quality profile only.
2026-01-22 00:10:48 +01:00
Guido Cella 7858e1fdaf command: remember the language when reloading tracks
In 5871ba8f3e I took the language from the filename when reloading
tracks noting "that backing up t->lang and restoring it if nt->lang is
NULL would work incorrectly when lang is in the stream and it is removed
before reloading", but actually external tracks don't have language in
the stream, it is set in the container, and reload commands only affect
external tracks. So just back up the language before reloading and then
restore the old language.

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

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

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

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

If a language is explicitly passed to sub-add and related commands, that
takes priority.
2026-01-22 00:10:02 +01:00
Guido Cella 1da08fa332 DOCS/man/options: document that --script is not limited to Lua 2026-01-22 00:08:53 +01:00
CogentRedTester 2aa727bc3d mp.input: send buffer ids with logs to avoid race conditions
This commit modifies the log methods in mp.input to always send the id
of the latest `input.get()` request with log entries.

Previously, the log methods applied to whichever input request happened
to be open when the log message was received. Even when scripts used
these methods correctly, there was the risk of sending a log to the
wrong log buffer if the active input request changed while the log
message was in transit; a race condition.

Now the id of the latest `input.get()` request is sent alongside the log
messages, preventing data races between scripts while also preventing
those logs from being discarded.
2026-01-22 00:04:35 +01:00
CogentRedTester 3ed9b798bb mp.input: avoid rare race condition when supplying completions
It was previously possible for completion messages to be received by a
new input request, if one was created while the message was in transit.

Since it is trivial to avoid this by passing the script name and
existing handle_id value, we may as well do so and guarantee that there
will not be any data races.
2026-01-22 00:04:35 +01:00
CogentRedTester 5d469e6bf5 mp.input: remove race conditions when calling input.terminate()
This commit ensures that `input.terminate()` can only close input
requests made by the same script, and prevents any in-transit events
for old input requests from being processed.

Previously, there was no way to guarantee that the input request being
terminated was the one intended; the asynchronous nature of the API
meant that it was always possible (though unlikely) that another client
may have activated its own input request while the termination request
was in transit.
This commit removes the race condition between different scripts calling
`input.terminate()` by sending the script name alongside the termination
message.

In addition, when a script overwrites one of its own input requests,
there may be incoming events still in transit. Some of these events may
have a decent chance of calling `input.terminate()` if they are
processed (e.g., `submit`). This commit avoids this issue by only
processing `closed` requests once a new `input.get()` request is made.
2026-01-22 00:04:35 +01:00
CogentRedTester 17551b2d43 mp.input: use unique event handlers for input.get requests
This makes changes to mp.input and console.lua so that every input.get
request uses a unique script-message to handle input events.

Previously, making new input.get requests shortly after the termination
of a previous request made by the same script could cause a race
condition where the input handler was closed but the new request
was still being drawn in the UI. This was caused by the `closed` event
for the previous request being received only after the new request was
registered, hence closing the event handler for the new request instead.

In addition, this commit makes the behaviour of calling input.get while
another request is active more consistent. When a new request is
received it overwrites the in-progress request, sending a `closed`
event. However, previously, the `closed` event could not be sent if both
requests came from the same script, as the new request would have
overwritten the event handler. Now, the `closed` event is called
regardless of where the new request comes from.
2026-01-22 00:04:35 +01:00
Dudemanguy 49b6d80e87 player/loadfile: possibly do a reset of sd_ass when turning on video
It's a pretty niche case, but if you start a file with no video with
animated ass subtitles and then turned on the video later, the subtitles
would not actually be rendered animated. This because the subtitles were
already decoded, and we do not do a check for animations expect in the
specific case of an image being played back on the video since the check
can be quite expensive. To fix this edge case, we just need to reset the
ass before doing the track switch in the case where we go from no video
to a track that's an image. SD_CTRL_RESET_SOFT is added as a a sub_ctrl
to accomplish this. Fixes #17268.
2026-01-21 15:18:08 +00:00
Dudemanguy fdb996adbc sd_ass: clear num_packets_animated on every reset
This should be done otherwise it could technically increment forever if
you constant reset.
2026-01-21 15:18:08 +00:00
Mohammad AlSaleh 313beaf241 player: make effective image_display_duration playback_speed aware
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2026-01-21 11:40:20 +01:00
Guido Cella 833e2f254e select.lua: link to mpv's IRC channel in the menu
Add a menu entry that opens mpv's IRC channel so users can quickly ask
support questions.
2026-01-21 11:27:07 +01:00
llyyr 491802918e f_auto_filters: rework --deinterlace=auto option
Before this commit, deinterlace=auto and deinterlace=yes had the same
exact behavior for d3d11 and vaapi, the only difference being that
`auto` would create/destroy the deinterlacing filter on every frame that
changed the deinterlace flag and with `yes`, we left that the
responsibility to determine whether to deinterlace or not to d3d11vpp
and vavpp and the filters were always inserted.

Inserting and removing filters on every frame the interlaced flag changes
is expensive and it will be more efficient to let the deinterlacing
filters handle this distinction instead.

With this change, `yes` works as it should: the filter is inserted
always and deinterlacing is forced regardless of the frame flag. `auto`
will insert the deinterlacing filter only when mpv sees the first
interlaced frame, and the filter will only deinterlace the frames marked
as interlaced. Note that perfect detection of interlaced frames is not
possible, and in such cases the user has to set `yes` manually.

One downside of this change is that we don't know if the filter is
actually deinterlacing or not, we can only guess that if the filter is
inserted and the frame is interlaced then it should be deinterlacing.
It's possible for it to fail for whatever reason, and it's also possible
future changes to ffmpeg (since bwdif implementation lives in ffmpeg),
might make the logic more complicated than this check. However, for now
this is good enough.
2026-01-21 08:40:50 +01:00
Kacper Michajłow f4db102a2e osdep/language-win: remove use of GetSystemPreferredUILanguages
The system preferred language is the language used during Windows
install. It doesn't have much purpose except that it is the backend
language for core Windows internals. All user facing dialogs and text
should follow the user preferred language, as this is what the user
selected and uses on daily basis.

It makes no sense to include system language in track selection.
2026-01-21 04:39:54 +01:00
Eugene Noble 868b9aa3ca DOCS/man/libmpv: fix typo 2026-01-21 03:54:27 +01:00
nanahi d6e7fb0597 options/options: add several audio extentions
mp1 - MPEG-1 Audio Layer I
mp2 - MPEG-1 Audio Layer II
mpc - Musepack
tak - Tom's lossless Audio Kompressor
tta - The True Audio
2026-01-20 07:49:17 +01:00
nanahi be5ed3bfd1 vo: wake up core when VO requests redraw
a74a324b98 returned responsibility of video
redraw back to playloop. The playloop is only run if something wakes up
the core.

However, the logic for VO requested redraw only wakes up the core when
in->want_redraw is false, which is only resetted by vo_redraw, called
from the core. This creates a situation where it can never wake up the
core, so redrawing never happens even when VO requests it.

efc44d05ff caused the issue to surface
because it also throttles VO requested redraws, and in some cases results
in the above behavior.

Fix this by always waking up core when the VO requests redraw.
2026-01-20 07:28:55 +01:00
llyyr b7e8fe949d wayland: move info_done variable to vo_wayland
vo_wayland_preferred_description_info is destroyed after info_done, so
obviously we can't store it here. This causes a use-after-free.
Embarrassing mistake

Fixes: 7a7d871d0a
2026-01-18 16:11:37 +00:00
Kacper Michajłow 5f6d5b3b7e ci/msys2: add build with -ftrivial-auto-var-init
Just to catch uninitialized variables early. Build all three                                                                                          unint/zero/pattern to compare the results between them and we don't                                                                                   accidentally depend on implicit initialization in tests.
2026-01-18 12:59:16 +01:00
Kacper Michajłow 5fbd1caee2 ci/msys2: build also clang64 without ASAN
To cross compare results on basic build.
2026-01-18 12:59:16 +01:00
Kacper Michajłow 1db89a546a Revert "ci/build-msys2.sh: disable pdf-build for clangarm64"
This reverts commit 25aa402f1d.
2026-01-18 12:59:16 +01:00
Kacper Michajłow a339fe58b5 osdep/language-win: fix use of GetUserPreferredUILanguages()
Commit baf2fd2f28 fixed this for 2nd call
to GetSystemPreferredUILanguages(), but apparently regressed the 1st
call, duh.

To retrieve the size both buffer has to be NULL and size 0.

Memory has a lot of zeros, because it has been working quite
consistently on CI.
2026-01-18 11:09:00 +01:00
Dudemanguy 468d34c9bd vo: allow VOs to request waiting before advancing frames
This is essentially for vo_dmabuf_wayland, but there is a race condition
during initialization where we should wait on an event from the
compositor to set the appropriate description for the image (namely for
color management) before flipping the page. Previously, there was an
off-by-one frame difference which resulted in the initial frame not
being appropriately color managed. Fix this by telling the core render
loop that it is not ready for the next frame. This keeps the frame queue
from advancing and allows the backend to process events appropriately
until it signals that it is ready.
2026-01-17 04:58:17 +00:00
Simonas Kazlauskas 1af136bceb ao_pipewire: remove the node.always-process attribute
With `node.always-process` mpv will force pipewire to continuously keep
driving the source node, even when paused, which causes a relatively
significant increase in power consumption due to frequent CPU wakeups.

I have tested mpv with this option disabled, both for music and video,
pausing and seeking around in various ways and could not notice any
problems with this option disabled. And with it disabled pipewire
properly becomes idle a couple seconds after video/audio is paused.

Pipewire documentation suggests that this option is largely useful for
JACK clients, which `mpv` isn't. Using GitHub-wide search it seems like
the other two notable uses of this property are really just SDL and
OpenAL. All other applications I use work well without this property
being set as well.

Note that this change does not affect the output devices differently as
far as I can tell. Both with and without `always-process` pipewire will
suspend the output device after some idle time and in case
`always-process` is enabled, it will redirect `mpv` to `Dummy-Driver`
instead.
2026-01-17 04:55:01 +00:00
fkroener 00774f5b85 DOCS/man/options: fix typo (double "for") 2026-01-16 00:49:36 +01:00
Hubert Głuchowski fa44f67b0b sub/sd_sbr: pass track language to sbr_load_text
The language hint is required for *correct* handling of RTL in srv3 so
provide the best-effort guess from the subtitle track.

Without this hint some RTL paragraphs are going to be wrongly assumed
LTR and reorder incorrectly. Additionally, subrandr may soon start
treating srv3 segments as `inline-block`s which means guessing is not
going to be possible anymore (at least as part of unicode bidi algorithm).
2026-01-16 00:48:55 +01:00
llyyr 7a7d871d0a wayland: move image description info to separate queue
Helps with presentation when compositor tries to ddos applications, for
example when moving the brightness slider on Kwin.
2026-01-15 17:03:18 +00:00
Hubert Głuchowski 2007f5543c sub/sd_sbr: use instanced rendering to avoid blending in software
The instanced API allows a lot of work to be offloaded to the GPU and
makes software rasterization tolerable performance-wise in most cases.

This is similar to sd_ass but there are some substantial differences:
- It uses a BGRA atlas to allow drawing bitmap emoji.
- De-duplicates images internally to significantly reduce atlas size by
  reusing the same atlas image for different instances.
- Exploits bilinear interpolation to further reduce atlas size of some
  primitives. For example this allows reducing background boxes to one
  very stretched pixel.

Bumps subrandr requirement to `v1.1` since this API is not present in
earlier versions.
2026-01-14 01:56:18 +01:00
Hubert Głuchowski 0babb5778b sub/ass_mp: split out packer into a separate file 2026-01-14 01:56:18 +01:00
Dudemanguy 7ce58f7a07 DOCS/contribute.md: address the AI menace
It's the future and well contributions of this nature aren't going to
disappear. Might as well address it in the contribute.md hope that maybe
a would-be vibe coder out there does a slightly better job before
sending anything our way.
2026-01-13 17:00:17 +01:00
Guido Cella bbcd68f8ed demux_playlist: expand tilde placeholders in playlist files
This allows playing something like an m3u containing ~/foo.mp4 or
~~/foo.mp4.

URLs like memory://#EXTM3U\n~/foo.mp4 also work.
2026-01-12 15:10:37 +00:00
Guido Cella 8bbcdec992 Revert "{osc,select}.lua: show playlist entries with trailing /"
This reverts commit ee05804bfa. Only the
select.lua part since osc.lua list formatting was removed.

Since playlist/N/filename is now normalized, it is never going to have
trailing slashes so there is no need to strip them.
2026-01-12 15:10:37 +00:00
Guido Cella fc86b96a8a various: don't normalize playlist filenames again
Since the previous commit normalized playlist filenames when they are
stored, the code normalizing them can be simplified back to how it was
before implementing normalization.
2026-01-12 15:10:37 +00:00
Guido Cella dfb4164097 common/playlist: store normalized playlist filenames
This normalizes the playlist/N/filename sub-property, making it
consistent with path. As a consequence playlist-path and stream-path are
also normalized.

This will allow simplifying the code by not normalizing playlist
filenames in several places, similar to 23b57e9f7f for tracks.
2026-01-12 15:10:37 +00:00
Guido Cella 616149744a misc/path_utils: ensure mp_normalize_path never returns NULL
If the current working directory or the realpath could not be retrieved,
return the path as it was passed to mp_normalize_path() to avoid
guarding the return value. This is also makes it consistent with what
the Windows code was doing.
2026-01-12 15:10:37 +00:00
Guido Cella 2871471f31 demux_playlist: add base paths when adding playlist entries
Currently entries in playlist files like m3u are first added to the
playlist, and then if they were relative paths the playlist file's
dirname is prepended to them.

Change it to directly add entries with the correct path. This will be
needed to normalize playlist entries as soon as they are added, else
normalization would prepend the working directory to entries with
relative paths.

demux_cue, demux_edl and demux_mkv_timeline don't need to be modified to
work with the next commit.
2026-01-12 15:10:37 +00:00
llyyr 363341afea vo: don't set request_redraw on redraw path
We need to acquire in->lock first before setting this flag, but if we
take this path then request_redraw is true already. So fix the data race
by just not re-setting the value.

This fixes data race detected with checking in->request_redraw value in
vo_redraw detected with TSAN
2026-01-12 09:15:45 +01:00
Brad Barden 39d7bbe2bf video/out/drm_common: fix uninitialized var
Add a missing variable initialization. The variable is only conditionally set
later. Then there is a check for a NULL if no CTA block was found, but the
value is instead uninitialized memory. There would then be a segfault when the
pointer is de-referenced.
2026-01-11 18:30:03 -06:00
der richter beddaec5ab mac/view: make our view aware of possible transparent rendering
the default value of isOpaque is false and it was always assumed that
underlaying content needs to be rendered and blended in some way.

make it dependent on the layer's isOpaque property, which theoretically
could increase render performance.
2026-01-11 13:48:58 +01:00
der richter ce694c1eba mac/common: add support for transparent rendering
this adds support for possible transparent rendering by setting the
window and layer background to transparent.

NOTE: atm only possible with libplacebo master.
2026-01-11 13:48:58 +01:00
der richter 9aebe4cb01 mac/vulkan: force proper opaque state on metal layer
MoltenVK sets this to false even when no transparent content is
rendered. this prevents direct-to-display rendering from working.
2026-01-11 13:48:58 +01:00
Kacper Michajłow 9483d6e12f ci: cancel pr jobs after new push
github.head_ref is only defined for pull_request event, so only those
will be grouped, the rest will fallback to unique run_id, so we neither
cancel them or serialize.
2026-01-10 02:48:15 +01:00
Dudemanguy 11c020f526 player/command: refactor loadfile and loadlist commands to use flags
We should have done this ages ago. These commands essentially consist of
a combination of a load action and whether or not playback should be
started. The old `-play` aliases are kept for backwards compatibility.
2026-01-10 01:00:58 +00:00
Kacper Michajłow 3d980d8ecc w32_common: release all input when entering context menu 2026-01-09 20:16:23 +01:00
Kacper Michajłow 2b50cecf86 w32_common: defer context menu update to WM_INITMENU
This avoids issues when menu-data property is updated while context menu
is open.
2026-01-09 20:15:48 +01:00
llyyr 9229d52e75 vo_gpu_next: undo dither-depth=auto meaning 8bpc for SDR when undetected
This commit effectively reverts f914947dda

We don't need this hack anymore
2026-01-09 20:05:37 +01:00
llyyr 81687dbf27 video/out/vulkan/context_wayland: implement color_depth
In f914947dda we implemented a hack to
force 8bpc dithering for SDR playback, because at the time nothing in
the pipeline was doing dithering. mpv would pick 16bpc swapchain, dither
down to 16bpc, then it'd be presented to the user's display as-is and
result in banding. There is no way to detect the real on-the-wire bpc,
so we told users to configure dither-depth manually.

However, it seems most compositors that do color management now handle
10-16bpc input just fine without any banding, so instead implement
color_depth to effectively set dither-depth=auto for compositors that
support expose color_manager and keep the 8bpc hard default for others.

Fixes: https://github.com/mpv-player/mpv/issues/17222
2026-01-09 20:05:37 +01:00
Guido Cella 85bf9f4ff4 console.lua: only clip items between UTF-8 characters
Since with the new horizontal scrolling the end of lines can be visible,
ensure not to clip lines in the middle of UTF-8 characters to not show
mojibake, also adding … to show when items are clipped.

Also replace the existing use of ⋯  with …
2026-01-07 01:09:00 +01:00
Guido Cella a385c0635b console.lua: implement horizontal scroll
Bind Shift+LEFT, Shift+RIGHT, Shift+WHEEL_DOWN, Shift+WHEEL_UP,
WHEEL_LEFT, WHEEL_RIGHT to scroll the menu horizontally.

This lets you see long items that get clipped, like long history entries
and key bindings.
2026-01-07 01:09:00 +01:00
Guido Cella 86466b5745 console.lua: bind Shift+UP and DOWN to scroll the log
We don't know how many log lines wrap, so scrolling the log with page up
and down with wrapped lines would skip lines, and those are also already
bound to history navigation.

This therefore only implements scrolling of one item at a time. While
not perfect because when the item is wrapped it scrolls multiple lines,
it is usable.

The number of log lines kept in memory is increased from 100 to 10000.

Closes https://github.com/mpv-player/mpv/discussions/14718.
2026-01-07 01:08:00 +01:00
verygoodlee 3315ef8f32 console.lua: avoid empty lines at the bottom after resizing window
with `scale_with_window=no` script option, `first_match_to_print`
increases when shrinking the window and no longer decreases when
expanding the window, causing empty lines at the bottom of menu
and a chain reaction of the script crashing due to the mouse wheel
scrolling up.

this commit trys to decrease `first_match_to_print` when its value
is abnormal.

Closes #16682
2026-01-07 01:01:39 +01:00
nanahi 39e5d29879 player/playloop: handle force window in playloop
813c112329 moved force window to option
callback. This happens before the loading of the file has finished
(which is supposed to trigger handle_force_window) so it is too early to
handle certain cases, such as loading of album art failed and therefore
window will never be created because there is no video track.

Adding force window check in playloop to make sure window is always
initialized after file loading is complete.

Fixes: 813c112329
2026-01-07 01:01:11 +01:00
Kacper Michajłow e75a174743 ci/win32: add subrandr
Wrap subrandr build process into meson custom target.

Meson's custom target allow only file output (without path component),
so additionall copy step is added to get the library. Dummy stamp file
is used to connect custom target to dependency, the file is actually not
created, so target will be called each time, but it's fine, because
cargo will resolve it's own dependencies this way and build if needed.

This is glued only for static lib, this is what we need for our CI
script.
2026-01-06 13:58:11 +01:00
Kacper Michajłow 273f1db49e player/loadfile: indent file metadata if it is multiline
And sanitize a bit.
2026-01-06 13:57:21 +01:00
Kacper Michajłow 6c160f1aa8 common/msg: allow only SGR sequence in terminal output
Sanitize the remaining control codes to mitigate malicious files or
scripts that could manipulate the terminal in unintended ways, such as
clearing the screen or changing the terminal title. While the
surface-level impact may seem minimal, control codes can be a vector for
exploiting vulnerabilities in the terminal emulator itself. This can
occur without user interaction, since file tags are displayed by default
in mpv.

Reported by: zefr0x
2026-01-06 13:57:21 +01:00
der richter c63fe8ab95 ci/mac: remove unneeded FFMPEG_SYSROOT pkg-config path
this seems to be a remnant of the very old travis build.
see 56d31ae190
2026-01-06 11:37:14 +01:00
der richter aa0f4e32ba ci/mac: add homebrew libarchive pkg-config path to PKG_CONFIG_PATH
libarchive can't be linked globally because macOS already has an old
outdated version installed.
2026-01-06 11:37:14 +01:00
der richter 5bee8f0f7f ci/mac: add missing libraries for consistency with other platforms
add libbluray, libarchive, libcaca, libcdio-paranoia, libdvdnav,
rubberband and zimg to macOS builds for consistency with other platforms
and detection tests.
2026-01-06 11:37:14 +01:00
der richter b38d22efa8 github/issue_template: add IDs to textarea fields for URL queries
adding IDs to the fields makes them pre-fillable with a URL query.

adds the possibility to procedural generate links to pre-fill specific
data. for example, mpv/library version or platform version data.

possible application, menu entries or CLI output to submit bug reports.
2026-01-06 11:34:16 +01:00
llyyr 0035bb7cbd path-unix: check fopen value, and also call fclose 2026-01-04 21:50:04 +01:00
nanahi a3350e2fbb command: add libplacebo-version property
Similar to other core library dependencies.
2026-01-02 20:04:32 +01:00
Kacper Michajłow 72efbfd009 version.h.in: bump copyright year 2026-01-01 13:26:59 +01:00
Kacper Michajłow f57c5ca422 ci/win32: upload pdb separately
The job id is now in the artifact filename, so we can identify the
matching pdb file.
2025-12-31 02:04:15 +01:00
Kacper Michajłow afa090317b ci: make artifact names more descriptive
Add git hash, job id and avoid double zipping.
2025-12-31 02:04:15 +01:00
Guido Cella 5cc1094ad6 console.lua: remove selected_color and selected_back_color
42660a8c23 renamed selected_color and selected_back_color to
focused_color and focused_back_color. The new names have been in a
release so remove the backwards compatibility check.
2025-12-30 17:03:48 +01:00
m154k1 468e2a8475 vulkan/context: add driver name to --vulkan-device=help
Some platforms (like macOS) may have multiple Vulkan drivers installed,
so the device list can contain devices with the same name.
Adding driver name to the list of devices can help with identification.
2025-12-29 11:24:36 +01:00
Attila Fidan 4ecf7293f5 playloop: unset last_chapter_flag when queueing non-chapter seeks
This fixes a race condition where if a non-chapter seek is queued
immediately after a chapter seek is queued, the chapter property may
become unavailable until a new file is loaded.

If multiple seeks are queued within the same playloop iteration, only
the last seek is executed. Because the chapter seek is never executed,
last_chapter_flag remains set and last_chapter_seek becomes -2, which
causes get_current_chapter to return -2, which makes the chapter
property unavailable.

Unset this (and also last_chapter_seek) immediately rather than
wait for seek execution, like chapter seeks set these immediately.

Fixes: 233f1e46f6 ("playloop: make chapter property more accurate when seeking chapters")
2025-12-28 11:04:47 +01:00
nanahi 4bbf014f09 sub/draw_bmp: fix rgba alpha blending
Wrong formula was used due to copypasting draw_ass_rgba code.

Fixes: c1a961ad78
2025-12-28 11:02:17 +01:00
nanahi a58dd8ac41 video/out/opengl/context_wayland: cleanup vo when egl fails to init
When the "new" API for OpenGL VO backends was created 10 years ago in
df97c30e0e, it was expected that any
"driver" that fails to init to clean up themselves (the "old" API always
called mpgl_uninit() to clean up on failure).

However, when switching Wayland to the "new" API, this was forgotten.
Wayland VO will never be cleaned up when EGL init fails.

With commit a310a65d35, this issue was
exposed when a leftover Wayland context pointer, which results from a
successful Wayland context init but with failed EGL init, triggers an
assertion in the X11 context init code, which expects the pointer to be
NULL.

Fix this by uninit Wayland context when EGL init fails.

Fixes: bd87598af9
2025-12-27 19:53:29 +01:00
Guido Cella d15f34b24e select.lua: preserve empty LRC lines
Subtitle extraction preserves empty lines in LRC subtitles because they
are useful for separating verses and choruses. 036fae317c changed their
sub codec from subrip to text, so update select.lua accordingly.
2025-12-27 15:42:16 +01:00
Guido Cella 52f2c670d5 console.lua: don't error if compute_bounds doesn't return dimensions
compute_bounds doesn't return any field if the rectangle is empty: its
docs say "If set to true, attempt to determine bounds and write them to
the command's result value as x0, x1, y0, y1 rectangle (default:
false). If the rectangle is empty, not known, or somehow degenerate, it
is not set.". So shrinking mpv as much as possible with a menu open
caused a crash.

This doesn't happen on Xorg because of these lines in video/out/x11_common.c:

// Set minimum height/width to 4 to avoid off-by-one errors.
hint->flags |= PMinSize;
hint->min_width = hint->min_height = 4;

nor on macOS because of

minSize = NSSize(width: 160, height: 90)

in video/out/mac/window.swift.

But this is needed on Wayland and Windows.

Fixes #16682 along with the diff posted there.
2025-12-27 15:41:44 +01:00
llyyr c66204b69b screenshot: correctly detect hardware frame
This only ever worked by accident and relied on broken behavior that was
fixed by 9b1d47ece1
2025-12-27 15:41:24 +01:00
Kacper Michajłow c0d989c839 sub/sd_sbr: check runtime version 2025-12-24 19:01:40 +01:00
Kacper Michajłow 5c80b876db ci/msys2: enable subrandr on clang64
Implib issue has been fixed upstream.

See: https://github.com/afishhh/subrandr/commit/d26a1536bd15fb2c3dbf7866b855fe674a7363bb
2025-12-24 13:38:38 +01:00
Hubert Głuchowski 75bb651945 sub/sd_sbr: respect sub-use-margins 2025-12-24 07:00:07 +01:00
Kacper Michajłow 6dff941c71 ci/{win32,mingw64,msys2}: add amf-headers 2025-12-23 07:06:34 +01:00
Kacper Michajłow cb1b6a54f2 video/filter/vf_amf: add AMD Frame Rate Conversion filter
D3D11 only for now. Documentation says that only D3D11 and D3D12 is
supported, but it looks like Vulkan is possible too. But I realized this
after implementing this version. Vulan may be added later.

Fixes: #16613
2025-12-23 07:06:34 +01:00
Kacper Michajłow e72807e7a0 mp_image_pool: set D3D11 BindFlags for all hw frame pools
It's always needed, not only in d3d11vpp.
2025-12-23 07:06:34 +01:00
Hubert Głuchowski 2ed355f51f demux/demux_sbr: re-emit packet after seek 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 8ad5066e43 sub/sd_sbr: mark subtitle packets as animated 2025-12-23 07:01:29 +01:00
Hubert Głuchowski b6d7f4e793 sub/sd_sbr: add logging callback 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 111233dbf2 ci: build with subrandr on Linux 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 454573bc08 ci: build with subrandr on mingw64 and msys2 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 4921c61bff sub/sd_sbr: log errors from subrandr functions 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 2b78ac44a9 demux/demux_sbr: allow configuring probe size 2025-12-23 07:01:29 +01:00
Hubert Głuchowski 557e592511 ytdl_hook: recognize srv3 subtitle format if subrandr is present
This allows YouTube videos played directly from a URL to make use of
subrandr's SRV3 support if it is allowed by an overriden `sub-format`.
2025-12-23 07:01:29 +01:00
Hubert Głuchowski a330318592 player/command: add subrandr-version property
Allows script to detect the presence of subrandr at runtime, useful for
determining whether this mpv instance can play SRV3 subtitles.
2025-12-23 07:01:29 +01:00
Hubert Głuchowski bb97882c9a sub: add subrandr renderer support
subrandr is a subtitle rendering library which aims to render
SRV3 (YouTube) subtitles and WebVTT subtitles accurately.

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

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

It's not perfect of course and there's still many things it doesn't do
or does wrong but those are things that can be incrementally improved
outside of mpv.
2025-12-23 07:01:29 +01:00
der richter 3effff1c43 DOCS/man/options: update macOS requirements and remove unsupported
our minimum requirement is macOS 10.15. we can remove the mentions of
older versions and their different behaviour or feature inclusions.
2025-12-23 06:58:40 +01:00
Dudemanguy 7369b336df wayland: accept version 7 of xdg-shell
Maybe we could use the constrained states that version 7 adds, but for
now just allow binding to version 7.
2025-12-23 06:58:03 +01:00
Dudemanguy ad740caab0 wayland: accept version 2 of wl_shm
No difference for us.
2025-12-23 06:58:03 +01:00
Dudemanguy 0c44abbd67 wayland: accept version 5 of linux-dmabuf
It makes no difference for us so no reason not to accept it.
2025-12-23 06:58:03 +01:00
Dudemanguy b7ad86f120 wayland: bind to the linux-dmabuf in stable instead
It doesn't really matter, but it's probably more correct to use the
stable version.
2025-12-23 06:58:03 +01:00
Kacper Michajłow 670a266475 ci/build-linux-old: remove custom libplacebo build
Alpine 3.21 has libplacebo 6.338.2, we can use that.
2025-12-22 17:30:05 +00:00
Kacper Michajłow 604b43184f ci/linux-ffmpeg-6-1: add wayland-protocols
Bump Alpine to 3.21. It still on ffmpeg 6.1, but has newer Wayland
components that we want to test.
2025-12-22 17:30:05 +00:00
Kacper Michajłow b95846a28c meson: check wayland-scanner version
At least 1.23 is needed for 1.38 protocols. Also check other Wayland
deps to be 1.23, they are likely bundled at the same version as scanner
anyway.
2025-12-22 17:30:05 +00:00
Kacper Michajłow f011d73d5f wayland_common: suppress unused function warning on older protocols 2025-12-22 17:30:05 +00:00
Dudemanguy 4b6ebd79c8 wayland: guard wp_color_manager_v1_get_version usage
Old wayland protocol versions don't have this.

Fixes https://github.com/mpv-player/mpv-build/issues/261
2025-12-22 17:30:05 +00:00
llyyr 8ba0603ffa wayland: bump wayland-protocols minimum version to 1.38
Debian Stable has 1.44 but we're gated by Ubuntu LTS here.
2025-12-22 15:00:02 +01:00
llyyr 9adeeb02ea wayland: bump libwayland minimum version to 1.22
1.23.1 is available in Debian Stable, which was the last distro holding
us back from doing version bumps
2025-12-22 15:00:02 +01:00
Kacper Michajłow 5820906024 vo: limit manual redraws to estimated display fps 2025-12-22 11:14:58 +01:00
Kacper Michajłow c0433f064e vf_format: deprecate --vf=format=sig-peak 2025-12-22 10:19:38 +01:00
der richter 80155c3dc9 mac/touchbar: remove manual 1 second rate limit of position property
duration and position properties were observed as double which lead to a
lot of updates per second (high granularity). it is recommended to not
update the position of the touchbar too frequently, why we had a manual
1 second rate limit.

instead of manually rate limiting the property, just observe it as int64
which only updates every second. it also causes a bit less pressure for
our core.
2025-12-22 10:19:29 +01:00
der richter dc6886ebb5 mac/remote: remove manual 1 second rate limit of position property
duration and position properties were observed as double which lead to
a lot of updates per second (high granularity). it is recommended to not
update the position of the remote command center to frequently, why we
had a manual 1 second rate limit.

instead of manually rate limiting the property, just observe it as int64
which only updates every second. it also causes a bit less pressure for
our core.
2025-12-22 10:19:29 +01:00
der richter f1ad9dfdf0 mac/event: add MPV_FORMAT_INT64 handler 2025-12-22 10:19:29 +01:00
der richter bf9ddf1db2 mac/type: add Int64 type conversion helper 2025-12-22 10:19:29 +01:00
sfan5 d0e24ab17a Update MPV_VERSION 2025-12-21 20:14:18 +01:00
431 changed files with 29582 additions and 6518 deletions

No files matched your search

+3
View File
@@ -21,3 +21,6 @@ indent_style = unset
indent_size = unset
max_line_length = unset
trim_trailing_whitespace = unset
[menu.conf]
indent_style = tab
+11 -2
View File
@@ -4,6 +4,7 @@ labels: ["os:linux"]
type: Bug
body:
- type: textarea
id: mpv_information
attributes:
label: "mpv Information"
placeholder: |
@@ -24,6 +25,7 @@ body:
validations:
required: false
- type: textarea
id: other_information
attributes:
label: "Other Information"
description: >
@@ -38,7 +40,9 @@ body:
- The time when the problem started to happen (after updating mpv, system, driver, etc.)
- Possible screenshot or video of visual glitches
If you're not using git master or the latest release, update.
If you're not using the git master branch or the [latest release](https://github.com/mpv-player/mpv/releases/latest), please update.
Older versions are not supported. If your distribution does not provide the latest version, please report the issue to them.
Packages and builds can be found [here](https://mpv.io/installation/).
value: |-
- Linux version:
@@ -53,6 +57,7 @@ body:
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
@@ -74,18 +79,21 @@ body:
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
@@ -109,6 +117,7 @@ body:
validations:
required: true
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
@@ -133,7 +142,7 @@ body:
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
@@ -4,6 +4,7 @@ labels: ["os:mac"]
type: Bug
body:
- type: textarea
id: mpv_information
attributes:
label: "mpv Information"
placeholder: |
@@ -24,6 +25,7 @@ body:
validations:
required: false
- type: textarea
id: other_info
attributes:
label: "Other Information"
description: >
@@ -46,6 +48,7 @@ body:
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
@@ -67,18 +70,21 @@ body:
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
@@ -104,6 +110,7 @@ body:
validations:
required: true
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
@@ -128,7 +135,7 @@ body:
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
@@ -4,6 +4,7 @@ labels: ["os:win"]
type: Bug
body:
- type: textarea
id: mpv_information
attributes:
label: "mpv Information"
placeholder: |
@@ -24,6 +25,7 @@ body:
validations:
required: false
- type: textarea
id: other_information
attributes:
label: "Other Information"
description: >
@@ -48,6 +50,7 @@ body:
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
@@ -69,18 +72,21 @@ body:
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
@@ -105,6 +111,7 @@ body:
validations:
required: true
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
@@ -129,7 +136,7 @@ body:
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
+8 -1
View File
@@ -4,6 +4,7 @@ labels: []
type: Bug
body:
- type: textarea
id: mpv_information
attributes:
label: "mpv Information"
placeholder: |
@@ -24,6 +25,7 @@ body:
validations:
required: false
- type: textarea
id: important_information
attributes:
label: "Important Information"
description: >
@@ -46,6 +48,7 @@ body:
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
@@ -67,18 +70,21 @@ body:
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
@@ -102,6 +108,7 @@ body:
validations:
required: true
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
@@ -126,7 +133,7 @@ body:
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
@@ -4,6 +4,7 @@ labels: ["core:meson"]
type: Bug
body:
- type: textarea
id: important_information
attributes:
label: "Important Information"
description: >
@@ -21,6 +22,7 @@ body:
validations:
required: true
- type: textarea
id: reproduction_steps
attributes:
label: "Reproduction Steps"
description: >
@@ -30,18 +32,21 @@ body:
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: "Expected Behavior"
placeholder: "What were you expecting?"
validations:
required: true
- type: textarea
id: actual_behavior
attributes:
label: "Actual Behavior"
placeholder: "What happened instead?"
validations:
required: true
- type: textarea
id: log_file
attributes:
label: "Log File"
placeholder: "Drag and drop log file here (Don't paste content directly)"
@@ -55,7 +60,7 @@ body:
attributes:
label: "I carefully read all instruction and confirm that I did the following:"
options:
- label: "I tested with the latest mpv version to validate that the issue is not already fixed."
- label: "I tested and confirmed that the issue exists with the [latest release version](https://github.com/mpv-player/mpv/releases/latest) or newer."
required: true
- label: "I provided all required information including system and mpv version."
required: true
@@ -4,6 +4,7 @@ labels: ["meta:feature-request"]
type: Feature
body:
- type: textarea
id: expected_behavior
attributes:
label: "Expected behavior of the wanted feature"
description: >
@@ -20,9 +21,11 @@ body:
validations:
required: true
- type: textarea
id: alternative_behavior
attributes:
label: "Alternative behavior of the wanted feature"
- type: textarea
id: log_file
attributes:
label: "Log File"
description: >
@@ -34,6 +37,7 @@ body:
If you have trouble producing a log file, you can alternatively use `-v -v`, save the
terminal output to a file, and attach it to the issue.
- type: textarea
id: sample_files
attributes:
label: "Sample Files"
placeholder: "Drag and drop sample files here"
+8
View File
@@ -0,0 +1,8 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
commit-message:
prefix: "ci"
+354 -125
View File
@@ -29,6 +29,10 @@ on:
- 'README.md'
- 'RELEASE_NOTES'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
mingw:
runs-on: ubuntu-24.04
@@ -36,6 +40,7 @@ jobs:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
DOWNLOAD_CACHE: ${{ github.workspace }}/.ccache/downloads
TARGET: ${{ matrix.arch }}-w64-mingw32
RUST_TARGET: ${{ matrix.arch }}-pc-windows-gnu
strategy:
@@ -47,14 +52,14 @@ jobs:
- arch: x86_64
wine: wine64
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Get time
id: get_time
run: echo "timestamp=`date +%s%N`" >> $GITHUB_OUTPUT
- name: Restore cache
uses: actions/cache/restore@v4
uses: actions/cache/restore@v6
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
@@ -104,13 +109,21 @@ jobs:
run: |
cat ./mingw_build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v5
- name: Artifact name
id: artifact
run: |
VERSION_FILE=$(find . -path "*/common/version.h" -type f | head -n 1)
VER=$(grep VERSION "$VERSION_FILE" | cut -d'"' -f2)
PR=${{ github.event.pull_request.number && format('-pr{0}', github.event.pull_request.number) || '' }}
echo "name=mpv-$VER$PR-${{ github.run_id }}-$TARGET" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v7
with:
name: mpv-${{ env.TARGET }}
path: mpv-git-*.zip
name: ${{ steps.artifact.outputs.name }}
path: artifact/*
- name: Save Cache
uses: actions/cache/save@v4
uses: actions/cache/save@v6
if: always()
with:
path: ${{ env.CCACHE_DIR }}
@@ -124,19 +137,17 @@ jobs:
include:
- target: x86_64-pc-windows-msvc
arch: "x64"
os: "windows-latest"
os: "windows-2025-vs2026"
- 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-link"
CXX_LD: "lld-link"
WINDRES: "llvm-rc"
RUST_LD: "lld-link"
RUSTC: "rustc --target ${{ matrix.target }}"
WINDRES: "llvm-rc"
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: "${{ github.workspace }}\\.ccache"
CCACHE_MAXSIZE: 500M
@@ -146,7 +157,7 @@ jobs:
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Get time
id: get_time
@@ -154,17 +165,26 @@ jobs:
"timestamp=$((Get-Date).Ticks)" >> $env:GITHUB_OUTPUT
- name: Restore cache
uses: actions/cache/restore@v4
uses: actions/cache/restore@v6
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ matrix.target }}-
- name: Install Winget on windows-11-arm
if: matrix.os == 'windows-11-arm'
shell: pwsh
run: |
Install-Module -Name Microsoft.WinGet.Client -Repository PSGallery -Force
Repair-WinGetPackageManager -Latest -Force
- name: Install dependencies
run: |
python -m pip install meson==1.9.2
choco install ccache nasm
./ci/install-cmake.ps1 -arch ${{ matrix.arch }}
python -m pip install meson
winget install --accept-source-agreements --accept-package-agreements Ccache.Ccache NASM.NASM
echo "$env:LOCALAPPDATA\Microsoft\WinGet\Links" >> $env:GITHUB_PATH
# For cargo -C
rustup default nightly
- name: Update Meson WrapDB
run: |
@@ -175,13 +195,21 @@ jobs:
meson wrap install libpng
meson wrap install zlib
- name: Find Visual Studio
run: |
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
$vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if (-not $vsPath) { throw "Could not find a Visual Studio installation" }
"VS=$vsPath"
"VS=$vsPath" >> $env:GITHUB_ENV
- name: Build
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 = "$pwd\cmake\bin;" + $env:PATH + ';C:\Program Files\NASM'
$env:PATH += ';C:\Program Files\NASM'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }}"
./ci/build-win32.ps1
@@ -197,7 +225,7 @@ jobs:
$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 = "$pwd\cmake\bin;" + $env:PATH + ';C:\Program Files\NASM'
$env:PATH += ';C:\Program Files\NASM'
Import-Module "$env:VS\Common7\Tools\Microsoft.VisualStudio.DevShell.dll"
Enter-VsDevShell -VsInstallPath $env:VS -SkipAutomaticLocation -DevCmdArguments "-arch=${{ matrix.arch }} -host_arch=${{ matrix.arch }}"
meson test -C build -t 2
@@ -207,17 +235,33 @@ jobs:
run: |
cat ./build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v5
- name: Artifact name
id: artifact
run: |
$VERSION_FILE = gci . -r -Filter "version.h" | ? { $_.FullName -match "[/\\]common[/\\]version\.h$" } | select -First 1 -exp FullName
$VER = (sls $VERSION_FILE -Pattern 'VERSION').Line -replace '.*"([^"]+)".*', '$1'
$PR = if ("${{ github.event.pull_request.number }}") { "-pr${{ github.event.pull_request.number }}" } else { "" }
$name = "mpv-$VER$PR-${{ github.run_id }}-${{ matrix.target }}"
"name=$name" >> $env:GITHUB_OUTPUT
- uses: actions/upload-artifact@v7
with:
name: mpv-${{ matrix.target }}
name: ${{ steps.artifact.outputs.name }}
path: |
build/mpv.???
build/mpv-*.bat
build/vulkan-*.dll
!build/mpv.lib
!build/mpv.pdb
- uses: actions/upload-artifact@v7
with:
name: ${{ steps.artifact.outputs.name }}-pdb
path: |
build/mpv.pdb
- name: Save Cache
uses: actions/cache/save@v4
uses: actions/cache/save@v6
if: always()
with:
path: ${{ env.CCACHE_DIR }}
@@ -241,7 +285,7 @@ jobs:
swift: "-target arm64-apple-macosx10.15"
target: "10.15"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Remove stray upstream python binary symlinks under /usr/local
run: |
@@ -266,8 +310,11 @@ jobs:
else
brew update
fi
brew install -q autoconf automake pkgconf libtool python freetype fribidi little-cms2 \
luajit libass ffmpeg meson rust uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers
if brew list ffmpeg &> /dev/null; then brew unlink ffmpeg; fi
brew install -q autoconf automake curl pkgconf libtool python freetype fribidi little-cms2 \
luajit libass ffmpeg-full meson rust uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers \
libarchive libbluray libcaca libcdio-paranoia libdvdnav rubberband zimg
brew link ffmpeg-full
- name: Build with meson
id: build
@@ -299,10 +346,19 @@ jobs:
run: |
cat ./build/meson-logs/testlog.txt
- uses: actions/upload-artifact@v5
- name: Artifact name
id: artifact
run: |
VERSION_FILE=$(find . -path "*/common/version.h" -type f | head -n 1)
VER=$(grep VERSION "$VERSION_FILE" | cut -d'"' -f2)
TARGET=${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }}
PR=${{ github.event.pull_request.number && format('-pr{0}', github.event.pull_request.number) || '' }}
echo "name=mpv-$VER$PR-${{ github.run_id }}-$TARGET" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v7
if: ${{ matrix.arch != 'test' }}
with:
name: mpv-${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }}
name: ${{ steps.artifact.outputs.name }}
path: mpv.tar.gz
linux:
@@ -325,7 +381,7 @@ jobs:
ld: "lld"
args: "-Db_lto=true -Db_lto_mode=thin"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Build with meson
id: build
@@ -355,7 +411,7 @@ jobs:
CC: "clang"
CXX: "clang++"
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Build with meson
id: build
@@ -373,17 +429,18 @@ jobs:
linux-ffmpeg-6-1:
runs-on: ubuntu-latest
container:
# We want to test ffmpeg 6.1.1 which alpine 3.19 has exactly.
# Furthermore, this is a very minimal build of mpv without commonly
# used features to test build compatibility. Musl is a nice bonus as well
image: alpine:3.19
# We want to test ffmpeg 6.1.2, which Alpine 3.21 includes.
# Also test compatibility with Wayland Protocols 1.38 and Wayland libs 1.23.
# Musl support is an added bonus.
image: alpine:3.21
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Install dependencies
run: |
apk update
apk add \
binutils \
curl-dev \
ffmpeg-dev \
gcc \
git \
@@ -391,6 +448,7 @@ jobs:
libass-dev \
lua5.2-dev \
pulseaudio-dev \
libplacebo-dev \
libx11-dev \
libxfixes-dev \
libxkbcommon-dev \
@@ -400,7 +458,9 @@ jobs:
meson \
musl-dev \
rust \
samurai
samurai \
wayland-dev \
wayland-protocols
- name: Build with meson
id: build
@@ -425,102 +485,148 @@ jobs:
openbsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 15 # avoid any weirdness with the VM
defaults:
run:
shell: cpa.sh {0} --sync-files none
steps:
- uses: actions/checkout@v6
- name: Test in OpenBSD VM
uses: cross-platform-actions/action@v0.30.0
with:
operating_system: openbsd
version: '7.8'
- uses: actions/checkout@v7
- name: Start OpenBSD VM
uses: cross-platform-actions/action@v1.4.0
with:
operating_system: openbsd
version: '7.8'
sync_files: runner-to-vm
- name: Install dependencies
run: |
sudo pkg_add -U \
cmake \
ffmpeg \
git \
libarchive \
libbluray \
libcaca \
libcdio-paranoia \
libdvdnav \
libiconv \
libplacebo \
libv4l \
libxkbcommon \
luajit \
meson \
openal \
pkgconf \
pulseaudio \
python3 \
rubberband \
rust \
sdl2 \
shaderc \
spirv-cross \
spirv-headers \
uchardet \
vulkan-loader \
vulkan-headers \
zimg
./ci/build-openbsd.sh
if ! meson test -C build; then
cat ./build/meson-logs/testlog.txt
exit 1
fi
sudo pkg_add -U \
cmake \
curl \
ffmpeg \
git \
libarchive \
libbluray \
libcaca \
libcdio-paranoia \
libdvdnav \
libiconv \
libplacebo \
libv4l \
libxkbcommon \
luajit \
meson \
openal \
pkgconf \
pulseaudio \
python3 \
rubberband \
rust \
sdl2 \
shaderc \
spirv-cross \
spirv-headers \
uchardet \
vulkan-loader \
vulkan-headers \
zimg
- name: Build with meson
id: build
run: |
./ci/build-openbsd.sh
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
run: |
meson test -C build
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./build/meson-logs/testlog.txt
freebsd:
runs-on: ubuntu-latest # until https://github.com/actions/runner/issues/385
timeout-minutes: 15 # avoid any weirdness with the VM
defaults:
run:
shell: cpa.sh {0} --sync-files none
steps:
- uses: actions/checkout@v6
- name: Test in FreeBSD VM
uses: cross-platform-actions/action@v0.30.0
with:
operating_system: freebsd
version: '14.3'
- uses: actions/checkout@v7
- name: Start FreeBSD VM
uses: cross-platform-actions/action@v1.4.0
with:
operating_system: freebsd
version: '15.1'
sync_files: runner-to-vm
- name: Install dependencies
run: |
sudo pkg update
sudo pkg install -y \
alsa-lib \
cmake \
evdev-proto \
ffmpeg \
git \
iconv \
jackit \
libarchive \
libbluray \
libcaca \
libcdio-paranoia \
libdvdnav \
libdisplay-info \
libplacebo \
libXinerama \
libxkbcommon \
libXpresent \
libXv \
luajit \
meson \
mujs \
openal-soft \
pipewire \
pkgconf \
pulseaudio \
python3 \
rubberband \
rust \
sekrit-twc-zimg \
sdl2 \
sndio \
uchardet \
v4l_compat \
vulkan-headers \
wayland-protocols
./ci/build-freebsd.sh
if ! meson test -C build; then
cat ./build/meson-logs/testlog.txt
exit 1
fi
sudo pkg update
sudo pkg install -y \
alsa-lib \
cmake \
curl \
evdev-proto \
ffmpeg \
git \
iconv \
jackit \
libarchive \
libbluray \
libcaca \
libcdio-paranoia \
libdvdnav \
libdisplay-info \
libplacebo \
libXinerama \
libxkbcommon \
libXpresent \
libXv \
luajit \
meson \
mujs \
openal-soft \
pipewire \
pkgconf \
pulseaudio \
python3 \
rubberband \
rust \
sekrit-twc-zimg \
sdl2 \
sndio \
uchardet \
v4l_compat \
vulkan-headers \
wayland-protocols
- name: Build with meson
id: build
run: |
./ci/build-freebsd.sh
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
run: |
cat ./build/meson-logs/meson-log.txt
- name: Run meson tests
id: tests
run: |
meson test -C build
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./build/meson-logs/testlog.txt
msys2:
runs-on: ${{ matrix.os }}
@@ -529,11 +635,21 @@ jobs:
matrix:
include:
- sys: "clang64"
os: "windows-latest"
os: "windows-2025-vs2026"
auto-var-init: "uninitialized"
- sys: "clang64"
os: "windows-2025-vs2026"
asan: true
- sys: "clang64"
os: "windows-2025-vs2026"
auto-var-init: "zero"
- sys: "clang64"
os: "windows-2025-vs2026"
auto-var-init: "pattern"
- sys: "mingw64"
os: "windows-latest"
os: "windows-2025-vs2026"
- sys: "ucrt64"
os: "windows-latest"
os: "windows-2025-vs2026"
- sys: "clangarm64"
os: "windows-11-arm"
defaults:
@@ -545,17 +661,19 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
update: true
install: git
pacboy: >-
amf-headers:p
angleproject:p
ca-certificates:p
cc:p
cppwinrt:p
curl:p
ffmpeg:p
lcms2:p
libarchive:p
@@ -584,6 +702,8 @@ jobs:
./ci/build-msys2.sh meson
env:
SYS: ${{ matrix.sys }}
ASAN: ${{ matrix.asan }}
AUTO_VAR_INIT: ${{ matrix.auto-var-init }}
- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
@@ -594,8 +714,117 @@ jobs:
id: tests
run: |
meson test -C build
env:
GGML_NO_BACKTRACE: 1
- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
cat ./build/meson-logs/testlog.txt
publish:
name: Publish git release
needs: [mingw, win32, macos]
if: github.event_name == 'push' && github.ref == 'refs/heads/master' &&
github.repository == 'mpv-player/mpv'
runs-on: ubuntu-latest
permissions:
contents: write
actions: read
concurrency:
group: publish-git
cancel-in-progress: false
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Publish to git release
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -eu
tag=git-release
base_url="https://github.com/$GH_REPO/releases/download/$tag"
artifacts=$(gh api "repos/{owner}/{repo}/actions/runs/${{ github.run_id }}/artifacts")
# Attach every build artifact unchanged; the notes link to them with
# labels derived from the verbose names.
mkdir -p release
jq -r '.artifacts[] | "\(.id)\t\(.name)"' <<< "$artifacts" |
while IFS=$'\t' read -r id name; do
gh api "repos/{owner}/{repo}/actions/artifacts/$id/zip" > "release/$name.zip"
done
section() {
jq -r --arg url "$base_url" --arg re "$1" '
def pretty:
(if test("i686") then "i686"
elif test("aarch64") then "arm64"
elif test("-arm$") then "arm64"
elif test("intel") then "x86_64"
else "x86_64" end) as $arch
| [ (if test("mingw") then "GCC" elif test("msvc") then "Clang" else empty end),
(if test("macos") then "macOS " + capture("macos-(?<v>[0-9]+)").v else empty end),
(if test("-pdb") then "debug symbols" else empty end) ] as $q
| $arch + (if ($q | length) > 0 then " (" + ($q | join(", ")) + ")" else "" end);
# primary builds first (x86_64, arm64, i686; Clang before GCC), debug symbols last
def rank:
[ (if test("-pdb") then 1 else 0 end),
(if test("x86_64|intel") then 0 elif test("i686") then 2 else 1 end),
(if test("mingw") then 1 else 0 end),
(if test("macos") then (capture("macos-(?<v>[0-9]+)").v | tonumber) else 0 end) ];
[ .artifacts[] | select(.name | test($re)) ] | sort_by(.name | rank)
| map("* [\(.name | pretty)](\($url)/\(.name).zip)") | join("\n")
' <<< "$artifacts"
}
# Match the version string baked into the build (see common/meson.build).
version=$(git describe --abbrev=9 --tags --dirty --match "v0.*")
notes=$(cat <<EOF
Automated development build of the latest \`master\` branch.
- Version: \`$version\`
- Commit: ${{ github.sha }}
- Built: $(date -u '+%Y-%m-%d %H:%M:%S UTC')
### Windows
$(section 'w64|msvc')
### macOS
$(section 'macos')
> [!WARNING]
> These are untested development builds of the very latest \`master\`.
> They are **not** official releases. For stable builds see the
> [latest release](https://github.com/$GH_REPO/releases/latest).
EOF
)
# Create the release once (which also creates the tag), then only edit
# it in place so watchers aren't notified on every master push. Stale
# assets are dropped first since their names embed the run id.
if gh release view "$tag" >/dev/null 2>&1; then
gh release view "$tag" --json assets --jq '.assets[].name' |
while read -r asset; do
gh release delete-asset "$tag" "$asset" --yes
done
gh release edit "$tag" \
--prerelease \
--latest=false \
--title "mpv development build" \
--notes "$notes"
gh release upload "$tag" release/*
else
gh release create "$tag" \
--target "$GITHUB_SHA" \
--prerelease \
--latest=false \
--title "mpv development build" \
--notes "$notes" \
release/*
fi
+50 -25
View File
@@ -5,37 +5,62 @@ on:
workflows: [build]
types: [completed]
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions:
actions: write
jobs:
cache:
runs-on: ubuntu-latest
steps:
- run: |
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("aarch64-pc-windows-msvc-") or
startswith("x86_64-pc-windows-msvc-"))) |
group_by(.ref) |
map({
ref: .[0].ref,
caches: map({
key: .key,
prefix: (.key | capture("^(?<prefix>[\\w_-]+-)\\d+$").prefix)
}) | group_by(.prefix) | map({keys: map(.key)})
}) |
.[]
' |
while read -r group; do
pr=$(echo "$group" | jq -r '.ref | capture("refs/pull/(?<num>[0-9]+)/merge").num')
if [[ -n "$pr" ]] && [ "$(gh pr view $pr --json state --jq '.state')" != "OPEN" ]; then
keys=$(echo "$group" | jq -c '.caches | map(.keys) | .[]')
else
keys=$(echo "$group" | jq -c '.caches | map(.keys[1:]) | .[]')
fi
for key in $(echo "$keys" | jq -r '.[]'); do
gh cache delete "$key"
done
set -o pipefail
gh cache list -L 1000 --json id,key,ref -S last_accessed_at -O desc > caches.json
# Resolve the state of every pull request that owns a cache.
for pr in $(jq -r '.[].ref | select(test("^refs/pull/[0-9]+/merge$")) |
split("/")[2]' caches.json | sort -u); do
jq -n --arg pr "$pr" --arg state "$(gh pr view $pr --json state --jq .state)" \
'{($pr): $state}'
done | jq -s 'add // {}' > prs.json
jq -r --slurpfile prs prs.json --arg default "$DEFAULT_REF" '
$prs[0] as $state |
# Group caches by kind, dropping the timestamp or content hash
# that every save appends to the key.
def family: if startswith("msys2-") then "msys2"
elif test("-[0-9]+$") then "ccache"
else "other" end;
def group: if family == "msys2" then sub("-(files|state):.*$"; "")
else sub("-[0-9]+$"; "") end;
[ .[] | . + { family: (.key | family),
group: (.key | group),
pr: (.ref | if test("^refs/pull/[0-9]+/merge$")
then split("/")[2] else null end) } ]
| map(select(.family != "other")) as $all
# Caches of merged or closed pull requests, and msys2 caches
# outside the default branch, which every ref restores from.
| ( $all | map(select(
(.pr != null and $state[.pr] != "OPEN") or
(.family == "msys2" and .ref != $default)
)) ) as $dead
# Of the rest only the newest cache of each kind per ref is used.
| ( ($all - $dead) | group_by([.ref, .group]) | map(.[1:]) | add // [] ) as $superseded
| ($dead + $superseded)[] | "\(.id)\t\(.ref)\t\(.key)"
' caches.json |
while IFS=$'\t' read -r id ref key; do
echo "deleting $ref $key"
gh cache delete "$id"
done
env:
GH_REPO: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_REF: refs/heads/${{ github.event.repository.default_branch }}
+9
View File
@@ -5,6 +5,15 @@ on:
workflows: [build]
types: [completed]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
actions: read
contents: read
pull-requests: write
jobs:
pr_comment:
if: github.event.workflow_run.event == 'pull_request' &&
+6 -1
View File
@@ -13,13 +13,18 @@ on:
paths:
- 'DOCS/**'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
check-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Docs
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y python3-docutils rst2pdf
./TOOLS/docutils-wrapper.py rst2man --strip-elements-with-class=contents --halt=2 ./DOCS/man/mpv.rst mpv.1
./TOOLS/docutils-wrapper.py rst2html --halt=2 ./DOCS/man/mpv.rst mpv.html
+8 -1
View File
@@ -1,4 +1,5 @@
name: Pull Request Fuzzing
on:
pull_request:
branches: [master]
@@ -12,7 +13,13 @@ on:
- 'Copyright'
- 'README.md'
- 'RELEASE_NOTES'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: {}
jobs:
Fuzzing:
runs-on: ubuntu-latest
@@ -41,7 +48,7 @@ jobs:
report-timeouts: true
output-sarif: true
- name: Upload Crash
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v7
if: failure() && steps.build.outcome == 'success'
with:
name: ${{ matrix.sanitizer }}-artifacts
+11 -7
View File
@@ -9,11 +9,15 @@ on:
pull_request:
branches: [master]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
commit-msg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
fetch-depth: 50
@@ -24,20 +28,20 @@ jobs:
swift:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: norio-nomura/action-swiftlint@3.2.1
lua:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: lunarmodules/luacheck@v1
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Check
id: check
uses: astral-sh/ruff-action@v3
@@ -50,7 +54,7 @@ jobs:
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: python/mypy@master
with:
install_project_dependencies: no
@@ -60,12 +64,12 @@ jobs:
editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker -config .editorconfig-checker.json
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- uses: pre-commit/action@v3.0.1
+2 -1
View File
@@ -57,6 +57,7 @@ local mp_globals = {
disable_key_bindings = {},
enable_key_bindings = {},
find_config_file = {},
flush_keybindings = {},
format_time = {},
get_mouse_pos = {},
set_key_bindings = {},
@@ -78,7 +79,6 @@ local mp_internal = {
UNKNOWN_TYPE = { fields = { info = {}, type = {} }},
_legacy_overlay = { fields = { res_x = {}, res_y = {}, data = {}, update = {} }},
cancel_timer = {},
flush_keybindings = {},
get_osd_margins = {},
input_define_section = {},
input_disable_section = {},
@@ -106,4 +106,5 @@ stds = { mp = { read_globals = mp_globals } }
-- mp_internal seems to be merged with mp for other files too...
files["player/lua/defaults.lua"] = { globals = mp_internal }
files["player/lua/auto_profiles.lua"] = { globals = { "p", "get" } }
files["player/lua/select.lua"] = { globals = { "p", "get" } }
max_line_length = 100
+1 -1
View File
@@ -20,4 +20,4 @@ repos:
hooks:
- id: codespell
args: ["--ignore-words-list", "ALS,als,datas,DNE,enew,HDA,numer,ontop,optionA,Paeth,pathc,inout,requestor"]
exclude: ^misc/language.c$
exclude: ^(etc/menu.conf|misc/language.c)$
+34 -12
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-8.0
revision = meson-8.1
depth = 1
[provide]
libavcodec = libavcodec_dep
@@ -146,11 +146,23 @@ they will be automatically downloaded and built by Meson.
- Clang compiler for Windows
- C++ CMake tools for Windows
- Windows SDK
- Activate the developer shell:
- Activate the developer shell. The target and host architecture must match
(e.g. `amd64` for x86_64, `arm64` for ARM64):
```
& "<Visual Studio Path>\Common7\Tools\Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64 -SkipAutomaticLocation | Out-Null
```
2. Install Meson, as outlined in [Getting Meson](https://mesonbuild.com/Getting-meson.html):
2. Install the remaining build tools that are not part of the Visual Studio installer:
- [Meson](https://mesonbuild.com/Getting-meson.html), the build system.
- [NASM](https://www.nasm.us/), required to assemble the hand-written assembly
in FFmpeg, dav1d and aom. Make sure it is in `PATH`.
- [Rust](https://www.rust-lang.org/tools/install) (via `rustup`), required to
build mpv's Rust components and the `subrandr` subproject. A **nightly**
toolchain is needed, as the build relies on Cargo's unstable `-C` option:
```powershell
rustup default nightly
```
3. The following build script utilizes the Meson subprojects system to build mpv and its dependencies.
To make sure all dependency versions are up-to-date, update the subprojects database from Meson's WrapDB.
Also explicitly download several wraps as some nested projects may pull older versions of them.
@@ -162,12 +174,14 @@ they will be automatically downloaded and built by Meson.
meson wrap install libpng
meson wrap install zlib
```
4. Set environment variables or use the `--native-file` option in Meson.
4. Set environment variables so Meson uses the Clang/LLVM toolchain, or pass an
equivalent `--native-file` to Meson.
```powershell
$env:CC = 'clang'
$env:CXX = 'clang++'
$env:CC_LD = 'lld'
$env:CXX_LD = 'lld'
$env:CC_LD = 'lld-link'
$env:CXX_LD = 'lld-link'
$env:RUST_LD = 'lld-link'
$env:WINDRES = 'llvm-rc'
```
Note that some dependencies (e.g. LuaJIT) may require `sed` to configure. Fortunately, it is already bundled in
@@ -247,16 +261,24 @@ due to differences in compiler flags. Our build system is designed specifically
for GNU-like compiler drivers. However, you can still build programs in
Visual Studio and link them with libmpv.
If the toolchain used generates a ``.lib`` file, it will be ready for use.
Otherwise, you will need to create an import library for the mpv DLL with the
following command:
When ``libmpv`` is built with the recommended Clang/``lld-link`` toolchain,
``lld-link`` emits an import library (``mpv.lib``) next to the DLL in the build
directory. Add that ``mpv.lib`` to your MSVC project.
To generate an import library from a DLL yourself, first create a ``.def`` file
listing its exports. There are several ways to do this. One is ``gendef``, which
writes a ``.def``, based on DLL.
```bash
lib /name:mpv-2.dll /out:mpv.lib /MACHINE:X64
gendef libmpv-2.dll
```
Ensure that the string in the ``/name:`` parameter matches the filename of the
DLL, as this is the filename that the MSVC linker will reference.
Then build the import library from it. ``/name`` must match the DLL filename, and
``/machine`` must match the DLL's architecture (e.g. ``x64`` or ``arm64``):
```bash
lib /def:libmpv-2.def /name:libmpv-2.dll /out:mpv.lib /machine:x64
```
**Note:** Static linking is only feasible with matching compilers. For instance,
if you build with Clang in Visual Studio, static linking is possible.
+13
View File
@@ -261,6 +261,19 @@ General coding
code. Plain C API usages may stay as C, but can be written in Swift. Existing
Objective-C code can stay as is, though Swift rewrites are welcome.
AI-assisted Contributions
-------------------------
If you have used an AI/LLM for your contribution, you must disclose this in the
PR description. Such contributions are not forbidden, but the submitter takes
full responsibility for the code changes. This includes having full
understanding of the code (knowing what was changed and why) and the ability to
participate in the code review process with human-written responses. This also
includes confirming that the code can be submitted under the same license as the
relevant files (usually LGPLv2 or GPLv2).
Clearly vibe-coded patches will not be considered.
Code of Conduct
---------------
+4 -2
View File
@@ -214,6 +214,9 @@ It provides following parameters change track metadata:
``byterate``
Number of bytes per second this stream uses. (Purely informational.)
``program_id``
Assign this track to a program (integer, default: -1 meaning unset).
``index``
The numeric index of the track this should map to (default: -1). This is
the 0-based index of the virtual stream as seen by the player, enumerating
@@ -366,8 +369,7 @@ tracks. In this case, it's not obvious, which virtual tracks the EDL show should
expose when being played.
Currently, mpv will apply an arbitrary heuristic which tracks the EDL file
should expose. (Before mpv 0.30.0, it always used the first source file in the
segment list.)
should expose.
You can set the ``layout`` option to ``this`` to make a specific entry define
the track layout.
+1 -3
View File
@@ -42,9 +42,7 @@ section::
oacopts-add = b=96k
It's also possible to define default encoding options by putting them into
the section named ``[encoding]``. (This behavior changed after mpv 0.3.x. In
mpv 0.3.x, config options in the default section / no section were applied
to encoding. This is not the case anymore.)
the section named ``[encoding]``.
One can then encode using this profile using the command::
+1 -1
View File
@@ -852,7 +852,7 @@ Interface changes
(such as "sub-file"), deprecated in mpv 0.26.0
- deprecate the old command based hook API, and introduce a proper C API
(the high level Lua API for this does not change)
- rename the the lua-settings/ config directory to script-opts/
- rename the lua-settings/ config directory to script-opts/
- the way the player waits for scripts getting loaded changes slightly. Now
scripts are loaded in parallel, and block the player from continuing
playback only in the player initialization phase. It could change again in
+1
View File
@@ -0,0 +1 @@
change `ytdl_hook-all_formats` default to `yes`
@@ -0,0 +1 @@
make `--autocreate-playlist` only activate for regular files
@@ -0,0 +1 @@
make the `metadata/by-key` property writable
+1
View File
@@ -0,0 +1 @@
'command-list' now also returns a default value and available choices where applicable for each command argument.
+1
View File
@@ -0,0 +1 @@
make `mpv_command_node` accept `_name` for command name
@@ -0,0 +1 @@
add `--demuxer-hysteresis-bytes`
+3
View File
@@ -0,0 +1,3 @@
add `--disc-menu` option
add `disc-menu-active` property
add `discnav` command
+2
View File
@@ -0,0 +1,2 @@
add `--input-builtin-drag-and-drop` option
add `dropped-file` property
+2
View File
@@ -0,0 +1,2 @@
add `dvda://` protocol for DVD-Audio playback
add `--dvda-device` and `--dvda-page` options
+1
View File
@@ -0,0 +1 @@
add `vf=format=enhancement-layer` option
@@ -0,0 +1 @@
remove the deprecated `error` field from `end-file`
+1
View File
@@ -0,0 +1 @@
add `env` property that can be used to retrieve environment variables
@@ -0,0 +1 @@
the `expand-properties` command modifier also applies to string lists now
+1
View File
@@ -0,0 +1 @@
`track-list/N/ff-index` may be unavailable if no known mapping exists
@@ -0,0 +1 @@
`--geometry` x/y position is now applied only on initial window creation, unless `--force-window-position=yes` is set.
+1
View File
@@ -0,0 +1 @@
add libcurl-based stream backend (http, https, ftp, ftps), with new options `--curl-enabled`, `--curl-http-version`, `--curl-max-redirects`, `--curl-max-retries`, `--curl-connect-timeout`, `--curl-buffer-size` and `--curl-max-request-size`
@@ -0,0 +1 @@
change `--hwdec-extra-frames` default to `auto`, sized from VO frame retention
@@ -0,0 +1 @@
implement `lavfi-tempo` an alternative speed changing audio filter
@@ -0,0 +1 @@
add `libplacebo-version` property
@@ -0,0 +1 @@
the `loadfile` and `loadlist` commands can now take multiple flags (i.e. `append+play`)
+1
View File
@@ -0,0 +1 @@
deprecate `mp.input.log_error()`
+1
View File
@@ -0,0 +1 @@
stop searching the deprecated `lua-settings` directory for script config files
+1
View File
@@ -0,0 +1 @@
add `user-data/mpv/context-menu/open` sub-property
@@ -0,0 +1,4 @@
`mp.input.get()` `complete` callbacks are now passed a second argument,
a function which can be passed the completion values, which allows generating
completions asynchronously. The old method of returning completions from
the callback is now deprecated.
@@ -0,0 +1 @@
add `console_opt_overrides` argument to `mp.input.get()` and `mp.input.select()`
@@ -0,0 +1,2 @@
add `mp.utils.terminal_display_width()` function that measures the width of
a string in terminal cells
+1
View File
@@ -0,0 +1 @@
add `on_loaded` hook
+1
View File
@@ -0,0 +1 @@
add `audioonlyscreen` script option to osc
+2
View File
@@ -0,0 +1,2 @@
add `boxwidth` script option to osc
add `slimboxwidth` script option to osc
+2
View File
@@ -0,0 +1,2 @@
add `skip_{backward,forward}_mbtn_*_down_command` script-opt for osc
add `{close,minimize,maximize}_mbtn_*_command` script-opt for osc
@@ -0,0 +1 @@
add `osc-icon_style` option
@@ -0,0 +1,2 @@
remove `osc-livemarkers` script-opt because chapter markers are now updated
without reiniting the OSC
+3
View File
@@ -0,0 +1,3 @@
add `osc-dynamic_margins` option
add `osc-sub-margin` option
add `osc-osd-margin` option
+1
View File
@@ -0,0 +1 @@
add `osc-windowcontrols_independent` script-opt
@@ -0,0 +1 @@
remove `windowcontrols_title` script-opt from osc, use `title` mpv option instead
@@ -0,0 +1,2 @@
add `video_colorspace`, `max_luma`, `primaries` and `transfer` arguments
to the `overlay-add` command
@@ -0,0 +1 @@
make `player-operation-mode` readable as a property
@@ -0,0 +1 @@
add `--playlist-inherit-options` option
@@ -0,0 +1 @@
add `preserve-options` flag to `playlist-play-index`
@@ -0,0 +1,6 @@
``track-list`` is now filtered by the currently selected edition
add ``edition-list/N/metadata`` sub-property
add ``program_id`` support to EDL ``!track_meta`` header
add ``--flatten-editions`` option to disable program-based edition grouping
add ``track-list/N/program-ids`` sub-property
deprecate ``track-list/N/program-id`` in favor of ``track-list/N/program-ids``
@@ -0,0 +1 @@
bind right click to context menu
@@ -0,0 +1 @@
change `%tX` format specifier of `--screenshot-template` option to only accept C11 strftime specifiers or `%s` specifier
+1
View File
@@ -0,0 +1 @@
add `--target-trc=scrgb`
@@ -0,0 +1,2 @@
add `--secondary-sub-scale` option
`--sub-scale` now only affects primary subtitles
@@ -0,0 +1 @@
add `keep-open` argument support to select.lua script bindings
@@ -0,0 +1,2 @@
``track-list`` now hides dependent tracks (e.g. tile sub-streams, IAMF audio element layers, LCEVC enhancement streams) by default
add ``--show-dependent-tracks`` option to expose them
@@ -0,0 +1 @@
effective `--image-display-duration` takes `--speed` into consideration now
+2
View File
@@ -0,0 +1,2 @@
add `track_info_selected_only` script option for stats
add `track-list/N/demux-duration` property
@@ -0,0 +1 @@
add `--sub-hdr-peak=auto` to follow the reference white and make it the default
+1
View File
@@ -0,0 +1 @@
add `sub-lines` and `secondary-sub-lines` properties
@@ -0,0 +1 @@
`--target-gamut` now accepts custom CIE xy primaries as comma-separated values (Rx,Ry,Gx,Gy,Bx,By,Wx,Wy) in addition to named primary sets
+1
View File
@@ -0,0 +1 @@
remove the deprecated `time-start` property
@@ -0,0 +1 @@
change `--tls-verify` default to `yes`
@@ -0,0 +1,2 @@
add `update-clipboard` command
change `clipboard` property to require `update-clipboard` command when clipboard monitoring is disabled
+1
View File
@@ -0,0 +1 @@
add `--vf=amf_frc`
@@ -0,0 +1 @@
rename `d3d11vpp=mode=ivctc` to `d3d11vpp=mode=ivtc`
+1
View File
@@ -0,0 +1 @@
deprecate `--vf=format=sig-peak`
@@ -0,0 +1 @@
deprecate `--vo=vaapi`
@@ -0,0 +1 @@
add support for (a subset of) tunable parameter for `vo=gpu`
@@ -0,0 +1,2 @@
add `--wayland-session=<string>`
restore the mpv window on wayland using xdg-session-management-v1
+31
View File
@@ -189,6 +189,37 @@ Available filters are:
``window-size=<amount>``
Length in milliseconds of the overlap-and-add window. (default: 12)
``lavfi-tempo[=[filter=]<filter_name>]``
Scales audio tempo using ``atempo`` or ``ascale`` filters from FFmpeg's
libavfilter.
If ``ascale`` (Librempeg only) is not available in the loaded
libavfilter, ``atempo`` will be used as a fall-back.
This can be used in place of ``scaletempo`` and ``scaletempo2``.
.. admonition:: Examples
``mpv --af=lavfi-tempo --speed=1.2 media.ogg``
Would play media at 1.2x normal speed at normal pitch with tempo
scaled by the ``atempo`` filter from lavfi.
``mpv --af=lavfi-tempo=atempo --speed=1.2 media.ogg``
Same as above.
``mpv --af=lavfi-tempo=filter=atempo --speed=1.2 media.ogg``
Same as above.
``mpv --af=lavfi-tempo=ascale --speed=1.2 media.ogg``
Would play media at 1.2x normal speed at normal pitch with tempo
scaled by the ``ascale`` filter from lavfi, unless the filter is
not available, then ``atempo`` will be used as a fall-back.
``mpv --af=lavfi-tempo=filter=ascale --speed=1.2 media.ogg``
Same as above.
``rubberband``
High quality pitch correction with librubberband. This can be used in place
of ``scaletempo`` and ``scaletempo2``, and will be used to adjust audio pitch
+3 -3
View File
@@ -1,5 +1,5 @@
COMMANDS
========
CONSOLE COMMANDS
================
This script allows running and completing input commands in the console
interactively, and also adds mpv's log to the console's log.
@@ -27,7 +27,7 @@ Commands
``% script-message-to commands type "seek absolute-percent" 6``
Enter a percent position to seek to.
``Ctrl+o script-message-to console type "loadfile ''" 11``
``Ctrl+o script-message-to commands type "loadfile ''" 11``
Enter a file or URL to play, with autocompletion of paths in the
filesystem.
+8
View File
@@ -81,6 +81,12 @@ PGDN
Ctrl+r
Search the command history. See `SELECT`_ for the key bindings in this mode.
Shift+UP
Scroll the log one line up.
Shift+DOWN
Scroll the log one line down.
INSERT
Toggle insert mode.
@@ -124,6 +130,8 @@ This script can be customized through a config file ``script-opts/console.conf``
placed in mpv's user directory and through the ``--script-opts`` command-line
option. The configuration syntax is described in `mp.options functions`_.
Note that ``mp.input`` clients can selectively override these options.
Configurable Options
~~~~~~~~~~~~~~~~~~~~
+50 -6
View File
@@ -1,10 +1,48 @@
CONTEXT MENU SCRIPT
===================
CONTEXT MENU
============
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
The context menu is a menu that pops up on the video window. By default, it is
bound to right click.
menu.conf
---------
You can define your own menu in ``~~/menu.conf`` (see `FILES`_), or an
alternative path specified with ``--script-opt=select-menu_conf_path``. It is
recommended to use the default ``menu.conf`` from
https://github.com/mpv-player/mpv/blob/master/etc/menu.conf as an example to get
started.
Each line of ``menu.conf`` is a menu item with fields separated by 1 or more
tabs. The first field is the text shown in the menu. The second field is usually
the command that is run when that item is selected. Fields from the third
onwards can specify ``checked=``, ``disabled=`` and ``hidden=`` states in the
same way as `Conditional auto profiles`_.
When there is no command, the item will open a submenu. Fields below indented
with leading whitespace are added to this submenu. Nested submenu items are
defined by adding more leading whitespace than the parent menu entry.
Empty lines are interpreted as separators.
The second field can also be one of the following tokens to make that entry a
submenu with the relative items: ``$playlist``, ``$tracks``, ``$video-tracks``,
``$audio-tracks``, ``$sub-tracks``, ``$secondary-sub-tracks``, ``$chapters``,
``$editions``, ``$audio-devices``, ``$profiles``. These menus are automatically
disabled when empty.
To use the native context menu, you need to fill the ``menu-data`` property with
menu definition data, and call the ``context-menu`` command. In builtin scripts,
this is done by ``select.lua``, which parses ``menu.conf`` to populate
``menu-data``. It then calls the ``context-menu`` command on platforms where
integration with the native context menu is implemented, while on platforms
where it is not, it opens ``context_menu.lua``.
On platforms without integration with the native context menu,
``context_menu.lua`` can be disabled entirely using the
``--load-context-menu=no`` option. On platforms where the integration is
implemented, it is already disabled by default.
implemented, it is already disabled by default, and ``--load-context-menu=yes``
will make ``select.lua`` use it.
Script messages
---------------
@@ -56,6 +94,12 @@ Configurable Options
The color of the menu's border.
``background_alpha``
Default: ``0``
The transparency of the menu's background. Ranges from 0 (opaque) to 255
(fully transparent).
``corner_radius``
Default: 5
@@ -83,7 +127,7 @@ Configurable Options
``disabled_color``
Default: ``#555555``
The color of disabled items.
The color of disabled items and separators.
``seconds_to_open_submenus``
Default: 0.2
+1 -1
View File
@@ -102,5 +102,5 @@ You can encode files from one format/codec to another using this facility.
.. admonition:: Example
"``--oremove-metadata=comment,genre``"
excludes copying of the the comment and genre tags to the output
excludes copying of the comment and genre tags to the output
file.
+430 -126
View File
@@ -271,7 +271,7 @@ This applies to certain APIs, such as ``mp.command_native()`` (with tables that
have string keys) in Lua scripting, or ``mpv_command_node()`` (with
MPV_FORMAT_NODE_MAP) in the C libmpv client API.
The name of the command is provided with a ``name`` string field. The name of
The name of the command is provided with a ``_name`` string field. The name of
each command is defined in each command description in the
`List of Input Commands`_. ``--input-cmdlist`` also lists them. See the
``subprocess`` command for an example.
@@ -322,10 +322,6 @@ Playback Control
and ``absolute-percent`` seeks, while ``exact`` is used for ``absolute``
seeks.
Before mpv 0.9, the ``keyframes`` and ``exact`` flags had to be passed as
3rd parameter (essentially using a space instead of ``+``). The 3rd
parameter is still parsed, but is considered deprecated.
This is a scalable command. See the documentation of ``nonscalable`` input
command prefix in `Input Command Prefixes`_ for details.
@@ -517,7 +513,7 @@ Playlist Manipulation
Go to the first of the previous entries on the playlist with a different
``playlist-path``.
``playlist-play-index <integer|current|none>``
``playlist-play-index <integer|current|none> [preserve-options]``]
Start (or restart) playback of the given playlist index. In addition to the
0-based playlist entry index, it supports the following values:
@@ -531,6 +527,9 @@ Playlist Manipulation
Playback is stopped. If idle mode (``--idle``) is enabled, the player
will enter idle mode, otherwise it will exit.
Setting ``preserve-options`` (``MPV_FORMAT_FLAG``) will not reset file-local
options when the playback of the current playlist index is restarted.
This command is similar to ``loadfile`` in that it only manipulates the
state of what to play next, without waiting until the current file is
unloaded, and the next one is loaded.
@@ -553,29 +552,44 @@ Playlist Manipulation
Stop playback of the current file, and play the new file immediately.
<append>
Append the file to the playlist.
<insert-next>
Insert the file into the playlist, directly after the current entry.
<insert-at>
Insert the file into the playlist, at the index given in the third
argument.
<play>
If nothing is currently playing, start playback. (Always starts with the
added file, even if the playlist was not empty before running this
command).
Multiple flags can be combined, e.g.: ``append+play``.
By default, ``append``, ``insert-next``, and ``insert-at`` will not
immediately start playback even if the playlist was previously empty. Adding
the ``play`` flag to them forces playback to start.
The following values are considered deprecated and were the old way
(before mpv 0.42) of forcing playback to start before the ``play`` flag was
added.
<append-play>
Append the file, and if nothing is currently playing, start playback.
(Always starts with the added file, even if the playlist was not empty
before running this command.)
<insert-next>
Insert the file into the playlist, directly after the current entry.
<insert-next-play>
Insert the file next, and if nothing is currently playing, start playback.
(Always starts with the added file, even if the playlist was not empty
before running this command.)
<insert-at>
Insert the file into the playlist, at the index given in the third
argument.
<insert-at-play>
Insert the file at the index given in the third argument, and if nothing
is currently playing, start playback. (Always starts with the added
file, even if the playlist was not empty before running this command.)
The third argument is an insertion index, used only by the ``insert-at`` and
``insert-at-play`` actions. When used with those actions, the new item will
be inserted at the index position in the playlist, or appended to the end if
index is less than 0 or greater than the size of the playlist. This argument
will be ignored for all other actions. This argument is added in mpv 0.38.0.
The third argument is an insertion index, used only by the ``insert-at``
action. When used with those actions, the new item will be inserted at the
index position in the playlist, or appended to the end if index is less than
0 or greater than the size of the playlist. This argument will be ignored for
all other actions. This argument was added in mpv 0.38.0.
The fourth argument is a list of options and values which should be set
while the file is playing. It is of the form ``opt1=value1,opt2=value2,..``.
@@ -601,30 +615,45 @@ Playlist Manipulation
Stop playback and replace the internal playlist with the new one.
<append>
Append the new playlist at the end of the current internal playlist.
<insert-next>
Insert the new playlist into the current internal playlist, directly
after the current entry.
<insert-at>
Insert the new playlist at the index given in the third argument.
<play>
If nothing is currently playing, start playback. (Always starts with the
added playlist, even if the internal playlist was not empty before running
this command).
Multiple flags can be combined, e.g.: ``append+play``.
By default, ``append``, ``insert-next``, and ``insert-at`` will not
immediately start playback even if the playlist was previously empty. Adding
the ``play`` flag to them forces playback to start.
The following values are considered deprecated and were the old way
(before mpv 0.42) of forcing playback to start before the ``play`` flag was
added.
<append-play>
Append the new playlist, and if nothing is currently playing, start
playback. (Always starts with the new playlist, even if the internal
playlist was not empty before running this command.)
<insert-next>
Insert the new playlist into the current internal playlist, directly
after the current entry.
<insert-next-play>
Insert the new playlist, and if nothing is currently playing, start
playback. (Always starts with the new playlist, even if the internal
playlist was not empty before running this command.)
<insert-at>
Insert the new playlist at the index given in the third argument.
<insert-at-play>
Insert the new playlist at the index given in the third argument, and if
nothing is currently playing, start playback. (Always starts with the
new playlist, even if the internal playlist was not empty before running
this command.)
The third argument is an insertion index, used only by the ``insert-at`` and
``insert-at-play`` actions. When used with those actions, the new playlist
will be inserted at the index position in the internal playlist, or appended
to the end if index is less than 0 or greater than the size of the internal
playlist. This argument will be ignored for all other actions.
The third argument is an insertion index, used only by the ``insert-at`` action.
When used with those actions, the new playlist will be inserted at the index
position in the internal playlist, or appended to the end if index is less
than 0 or greater than the size of the internal playlist. This argument will be
ignored for all other actions. This argument was added in mpv 0.38.0.
``playlist-clear``
Clear the playlist, except the currently played file.
@@ -695,6 +724,14 @@ Track Manipulation
Marks the track as default.
<original>
Marks the track as being in the original language.
<commentary>
Marks the track as containing commentary.
<attached-picture> (only for ``video-add``)
Marks the track as an attached picture, same as ``albumart`` argument
@@ -867,7 +904,7 @@ OSD Commands
Show the progress bar, the elapsed time and the total duration of the file
on the OSD. ``no-osd`` has no effect on this command.
``overlay-add <id> <x> <y> <file> <offset> <fmt> <w> <h> <stride> <dw> <dh>``
``overlay-add <id> <x> <y> <file> <offset> <fmt> <w> <h> <stride> [<dw> [<dh> [<video_colorspace> [<max_luma> [<primaries> [<transfer>]]]]]]``
Add an OSD overlay sourced from raw data. This might be useful for scripts
and applications controlling mpv, and which want to display things on top
of the video window.
@@ -891,20 +928,17 @@ OSD Commands
``file`` specifies the file the raw image data is read from. It can be
either a numeric UNIX file descriptor prefixed with ``@`` (e.g. ``@4``),
or a filename. The file will be mapped into memory with ``mmap()``,
copied, and unmapped before the command returns (changed in mpv 0.18.1).
or a filename. The file will be read into memory before the command returns.
Note that since mpv 0.42.0, if a file descriptor is specified, the file
offset of the descriptor will be modified.
It is also possible to pass a raw memory address for use as bitmap memory
by passing a memory address as integer prefixed with an ``&`` character.
Passing the wrong thing here will crash the player. This mode might be
useful for use with libmpv. The ``offset`` parameter is simply added to the
memory address (since mpv 0.8.0, ignored before).
memory address.
``offset`` is the byte offset of the first pixel in the source file.
(The current implementation always mmap's the whole file from position 0 to
the end of the image, so large offsets should be avoided. Before mpv 0.8.0,
the offset was actually passed directly to ``mmap``, but it was changed to
make using it easier.)
``fmt`` is a string identifying the image format. Currently, only ``bgra``
is defined. This format has 4 bytes per pixels, with 8 bits per component.
@@ -930,14 +964,40 @@ OSD Commands
in display to ``dw`` and ``dh``. If parameters are not present, the
values for ``w`` and ``h`` are used.
``video_colorspace`` (default: no) interprets the overlay in the video's
colorspace, including HDR metadata, so it is tone mapped exactly like
the video.
``max_luma`` specifies the (optional) luminance peak of the overlay in
cd/m². If unset, it is inferred from the overlay's colorspace, or taken
from the video for ``video_colorspace`` overlays.
``primaries`` and ``transfer`` specify the (optional) colorspace the
overlay is encoded in, and accept the same values as ``--target-prim``
and ``--target-trc``. The default ``auto`` means sRGB (BT.709 primaries
and sRGB transfer). They are ignored if ``video_colorspace`` is set.
Currently only ``--vo=gpu-next`` honors these parameters. ``--vo=gpu``
always assumes the overlay is sRGB and adapts it to the display. Other
VOs ignore these parameters, and either blend the overlay without any
colorspace conversion or pass it to the system compositor.
.. note::
Before mpv 0.42.0, the file was mapped into memory with ``mmap()``,
copied, and unmapped before the command returns. Changing the file
before the command returns is highly discouraged as this could lead to
crashes on versions before 0.42.0.
Before mpv 0.18.1, you had to do manual "double buffering" when updating
an overlay by replacing it with a different memory buffer. Since mpv
0.18.1, the memory is simply copied and doesn't reference any of the
memory indicated by the command's arguments after the command returns.
If you want to use this command before mpv 0.18.1, reads the old docs
to see how to handle this correctly.
an overlay by replacing it with a different memory buffer. If you want
to use this command before mpv 0.18.1, read the old docs to see how to
handle this correctly.
Larger offsets should be avoided as mpv versions before 0.42.0 used to
mmap the whole file from position 0 to the end of the image. Before mpv
0.8.0, the offset was actually passed directly to ``mmap``. Since mpv
0.42.0, no mmap happens, so offset is handled by seeking on the file.
``overlay-remove <id>``
Remove an overlay added with ``overlay-add`` and the same ID. Does nothing
@@ -1166,10 +1226,11 @@ Execution Commands
~~~~~~~~~~~~~~~~~~
``run <command> [<arg1> [<arg2> [...]]]``
Run the given command. Unlike in MPlayer/mplayer2 and earlier versions of
mpv (0.2.x and older), this doesn't call the shell. Instead, the command
is run directly, with each argument passed separately. Each argument is
expanded like in `Property Expansion`_.
Run the given command.
This doesn't call the shell. Instead, the command is run directly, with each
argument passed separately. Each argument is expanded like in `Property
Expansion`_.
This command has a variable number of arguments, and cannot be used with
named arguments.
@@ -1254,8 +1315,6 @@ Execution Commands
``passthrough_stdin`` (``MPV_FORMAT_FLAG``)
If enabled, wire the new process' stdin to mpv's stdin (default: no).
Before mpv 0.33.0, this argument did not exist, but the behavior was as
if this was set to true.
The command returns the following result (as ``MPV_FORMAT_NODE_MAP``):
@@ -1314,7 +1373,7 @@ Execution Commands
::
local r = mp.command_native({
name = "subprocess",
_name = "subprocess",
playback_only = false,
capture_stdout = true,
args = {"cat", "/proc/cpuinfo"},
@@ -1374,7 +1433,7 @@ Scripting Commands
1. The string ``key-binding``.
2. The name of the binding (as established above).
3. The key state as string (see below).
4. The key name (since mpv 0.15.0).
4. The key name.
5. The text the key would produce, or empty string if not applicable.
6. The scale of the key, such as the ones produced by ``WHEEL_*`` keys.
The scale is 1 if the key is nonscalable.
@@ -1411,6 +1470,11 @@ Scripting Commands
return value of the ``mpv_client_id()`` API call of the newly created script
handle.
::
MPV_FORMAT_NODE_MAP
"client_id" MPV_FORMAT_STRING
Screenshot Commands
~~~~~~~~~~~~~~~~~~~
@@ -1451,11 +1515,16 @@ Screenshot Commands
If you combine this command with another one using ``;``, you can use the
``async`` flag to make encoding/writing the image file asynchronous. For
normal standalone commands, this is always asynchronous, and the flag has
no effect. (This behavior changed with mpv 0.29.0.)
no effect.
On success, returns a ``mpv_node`` with a ``filename`` field set to the
saved screenshot location.
::
MPV_FORMAT_NODE_MAP
"filename" MPV_FORMAT_STRING
``screenshot-to-file <filename> [<flags>]``
Take a screenshot and save it to a given file. The format of the file will
be guessed by the extension (and ``--screenshot-format`` is ignored - the
@@ -1506,6 +1575,15 @@ Screenshot Commands
The ``flags`` argument is like the first argument to ``screenshot`` and
supports ``subtitles``, ``video``, ``window``.
::
MPV_FORMAT_NODE_MAP
"w" MPV_FORMAT_INT64
"h" MPV_FORMAT_INT64
"stride" MPV_FORMAT_INT64
"format" MPV_FORMAT_STRING
"data" MPV_FORMAT_BYTE_ARRAY
Filter Commands
~~~~~~~~~~~~~~~
@@ -1693,6 +1771,62 @@ Miscellaneous Commands
``context-menu``
Show context menu on the video window. See `Context Menu`_ section for details.
``discnav <action> [<x> <y>]``
Send a navigation command to the optical-disc stream that is currently
playing. The command does nothing when no disc is being played.
``<action>`` is one of:
up, down, left, right
Move the on-disc button selection.
select
Activate the currently highlighted button.
menu
Jump to the root menu of the current title set (DVD: VTSM root menu,
BD: HDMV top menu).
title-menu
Jump to the disc's title menu (DVD: VMGM title menu, treated like
``menu`` on BD).
popup
Show / dismiss the Blu-ray popup menu. For DVDs, falls back to the
chapter menu where available.
prev
Return from a menu to playback, or to the previous menu domain.
mouse-move
Forward a mouse position to the disc, so it can update the focused
button under the cursor. With no ``<x> <y>`` arguments, the position
is read from the ``mouse-pos`` property and mapped from window into
source-video coordinates automatically.
mouse-click
Like ``mouse-move`` but also activates the button under the cursor.
``<x>`` and ``<y>`` are optional and only meaningful for the ``mouse-*``
actions. They are normalized coordinates in the range 0..1 (top-left at
``0,0``), and are used instead of the live ``mouse-pos``.
mpv ships default bindings for this command in the ``{discnav}`` input
section (``UP``/``DOWN``/``LEFT``/``RIGHT`` for navigation, ``ENTER`` to
select, ``ESC`` / ``BS`` to leave, ``MBTN_LEFT`` / ``MOUSE_MOVE`` for
mouse). The player enables and disables that section automatically as
the menu appears and disappears, so the bindings only shadow the normal
ones while a menu is actually on screen.
``update-clipboard <type> [timeout]``
Update the clipboard content so that the ``clipboard`` property reflects
up-to-date value. This command is required to update the ``clipboard``
property value if ``--clipboard-monitor=no``. ``<type>`` must be ``text``
or ``text-primary`` to indicate whether to update clipboard or primary
selection. ``[timeout]`` specifies the maximum timeout in ms to wait for
the clipboard content to be updated. A negative timeout means infinite.
The default timeout is 10 ms.
This command returns as soon as the clipboard content is updated or the
timeout has reached. On some platforms, this command does nothing and
returns immediately.
This command can be asynchronously aborted via API. See `Asynchronous
command details`_.
Undocumented commands: ``ao-reload`` (experimental/internal).
List of events
@@ -1753,8 +1887,7 @@ This list uses the event name field value, and the C API symbol in brackets:
Playback was ended by sending the quit command.
``error``
An error happened. In this case, an ``error`` field is present with
the error string.
An error happened.
``redirect``
Happens with playlists and similar. Details see
@@ -1773,10 +1906,7 @@ This list uses the event name field value, and the C API symbol in brackets:
``file_error``
Set to mpv error string describing the approximate reason why playback
failed. Unset if no error known. (In Lua scripting, this value was set
on the ``error`` field directly. This is deprecated since mpv 0.33.0.
In the future, this ``error`` field will be unset for this specific
event.)
failed. Unset if no error known.
``playlist_insert_id``
If loading ended, because the playlist entry to be played was for example
@@ -1914,14 +2044,14 @@ The following hooks are currently defined:
For example, you could read and write the ``stream-open-filename``
property to redirect an URL to something else (consider support for
streaming sites which rarely give the user a direct media URL), or
you could set per-file options with by setting the property
you could set file-local options by setting the property
``file-local-options/<option name>``. The player will wait until all
hooks are run.
Ordered after ``start-file`` and before ``playback-restart``.
``on_load_fail``
Called after after a file has been opened, but failed to. This can be
Called after a file has been opened, but failed to. This can be
used to provide a fallback in case native demuxers failed to recognize
the file, instead of always running before the native demuxers like
``on_load``. Demux will only be retried if ``stream-open-filename``
@@ -1932,7 +2062,7 @@ The following hooks are currently defined:
``on_preloaded``
Called after a file has been opened, and before tracks are selected and
decoders are created. This has some usefulness if an API users wants
decoders are created. This has some usefulness if an API user wants
to select tracks manually, based on the set of available tracks. It's
also useful to initialize ``--lavfi-complex`` in a specific way by API,
without having to "probe" the available streams at first.
@@ -1943,6 +2073,13 @@ The following hooks are currently defined:
Ordered after ``on_load_fail`` etc. and before ``playback-restart``.
``on_loaded``
Called after a file has been loaded, after tracks are selected but before
starting playback. This has some usefulness if an API user wants
to act on selected track metadata before the media is shown.
Ordered after ``on_preloaded``. and before ``playback-restart``.
``on_unload``
Run before closing a file, and before actually uninitializing
everything. It's not possible to resume playback in this state.
@@ -1990,8 +2127,7 @@ prefixes can be specified. They are separated by whitespace.
``repeatable``
For some commands, keeping a key pressed doesn't run the command repeatedly.
This prefix forces enabling key repeat in any case. For a list of commands:
the first command determines the repeatability of the whole list (up to and
including version 0.33 - a list was always repeatable).
the first command determines the repeatability of the whole list.
``nonrepeatable``
For some commands, keeping a key pressed runs the command repeatedly.
This prefix forces disabling key repeat in any case.
@@ -2045,10 +2181,6 @@ command behaves by itself. There are the following cases:
have an asynchronous implementation. The async libmpv API still never blocks
the caller in these cases.
Before mpv 0.29.0, the ``async`` prefix was only used by screenshot commands,
and made them run the file saving code in a detached manner. This is the
default now, and ``async`` changes behavior only in the ways mentioned above.
Currently the following commands have different waiting characteristics with
sync vs. async: sub-add, audio-add, sub-reload, audio-reload,
rescan-external-files, screenshot, screenshot-to-file, dump-cache,
@@ -2158,6 +2290,15 @@ Property list
.. note:: This is only an estimate. (It's computed from two unreliable
quantities: fps and possibly rounded timestamps.)
``env``
Read-only table of all the environment variables. A specific variable can be
accessed as a sub-property, e.g. ``${env/HOME}`` returns ``$HOME`` if set.
.. note:: On certain platforms (e.g Windows) environment variables are case
insensitive and so ``${env/PATH}`` and ``${env/Path}`` will
resolve to the same thing. However, the returned table will
contain the variable name as is without any case-normalization.
``pid``
Process-id of mpv.
@@ -2204,9 +2345,6 @@ Property list
property is unavailable. Note that the file duration is not always exactly
known, so this is an estimate.
This replaces the ``length`` property, which was deprecated after the
mpv 0.9 release. (The semantics are the same.)
This has a sub-property:
``duration/full``
@@ -2263,11 +2401,6 @@ Property list
``time-pos/full``
``time-pos`` with milliseconds.
``time-start``
Deprecated. Always returns 0. Before mpv 0.14, this used to return the start
time of the file (could affect e.g. transport streams). See
``--rebase-start-time`` option.
``time-remaining``
Remaining length of the file in seconds. Note that the file duration is not
always exactly known, so this is an estimate.
@@ -2336,12 +2469,11 @@ Property list
restart playback. The number of the first edition is 0.
For Matroska files, this is the edition. For DVD/Blu-ray, this is the title.
For MPEG-TS, HLS, and EDL streams, this maps to the underlying program/variant.
Before mpv 0.31.0, this showed the actual edition selected at runtime, if
you didn't set the option or property manually. With mpv 0.31.0 and later,
this strictly returns the user-set option or property value, and the
``current-edition`` property was added to return the runtime selected
edition (this matters with ``--edition=auto``, the default).
This strictly returns the user-set option or property value, and the
``current-edition`` property returns the runtime selected edition (this
matters with ``--edition=auto``, the default).
``current-edition``
Currently selected edition. This property is unavailable if no file is
@@ -2349,6 +2481,12 @@ Property list
between having no editions and a single edition, which will be reflected by
the property, although in practice it does not matter.)
``disc-menu-active``
``yes`` when the current optical-disc stream (DVD or Blu-ray) is showing
an interactive menu (a DVD menu domain, or a visible Blu-ray menu
overlay), and ``no`` otherwise. Unavailable when the currently playing
source is not an optical disc.
``chapters``
Number of chapters.
@@ -2374,6 +2512,9 @@ Property list
``edition-list/N/title``
Edition title as stored in the file. Not always available.
``edition-list/N/metadata``
Per-edition metadata key/value pairs.
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:
@@ -2385,6 +2526,7 @@ Property list
"id" MPV_FORMAT_INT64
"title" MPV_FORMAT_STRING
"default" MPV_FORMAT_FLAG
"metadata" MPV_FORMAT_NODE_MAP
``metadata``
Metadata key/value pairs.
@@ -2399,7 +2541,7 @@ Property list
This has a number of sub-properties:
``metadata/by-key/<key>``
``metadata/by-key/<key>`` (RW)
Value of metadata entry ``<key>``.
``metadata/list/count``
@@ -2456,7 +2598,8 @@ Property list
Equivalent to ``vf-metadata/<filter-label>``, but for audio filters.
``deinterlace-active``
Returns ``yes``/true if mpv's deinterlacing filter is active. Note that it
Returns ``yes``/true if mpv's deinterlacing filter is active. This is only
a guess with ``--deinterlace=auto`` and may not be accurate. Note that it
will not detect any manually inserted deinterlacing filters done via
``--vf``.
@@ -2473,7 +2616,7 @@ Property list
This also returns ``yes``/true if playback is restarting or if nothing is
playing at all. In other words, it's only ``no``/false if there's actually
video playing. (Behavior since mpv 0.7.0.)
video playing.
``cache-speed``
Current I/O read speed between the cache and the lower layer (like network).
@@ -2552,8 +2695,8 @@ Property list
MPV_FORMAT_NODE_MAP
"seekable-ranges" MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP
"start" MPV_FORMAT_DOUBLE
"end" MPV_FORMAT_DOUBLE
"start" MPV_FORMAT_DOUBLE
"end" MPV_FORMAT_DOUBLE
"bof-cached" MPV_FORMAT_FLAG
"eof-cached" MPV_FORMAT_FLAG
"fw-bytes" MPV_FORMAT_INT64
@@ -2564,10 +2707,10 @@ Property list
"raw-input-rate" MPV_FORMAT_INT64
"ts-per-stream" MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP
"type" MPV_FORMAT_STRING
"cache-duration" MPV_FORMAT_DOUBLE
"reader-pts" MPV_FORMAT_DOUBLE
"cache-end" MPV_FORMAT_DOUBLE
"type" MPV_FORMAT_STRING
"cache-duration" MPV_FORMAT_DOUBLE
"reader-pts" MPV_FORMAT_DOUBLE
"cache-end" MPV_FORMAT_DOUBLE
Other fields (might be changed or removed in the future):
@@ -2618,8 +2761,7 @@ Property list
``mixer-active``
Whether the audio mixer is active.
This option is relatively useless. Before mpv 0.18.1, it could be used to
infer behavior of the ``volume`` property.
This option is relatively useless.
``ao-volume`` (RW)
System volume. This property is available only if mpv audio output is
@@ -2692,9 +2834,8 @@ Property list
seek to refresh the video properly.) You can watch the other hwdec
properties to see whether this was successful.
Unlike in mpv 0.9.x and before, this does not return the currently active
hardware decoder. Since mpv 0.18.0, ``hwdec-current`` is available for
this purpose.
This does not return the currently active hardware decoder.
``hwdec-current`` is available for this purpose.
``hwdec-current``
The current hardware decoding in use. If decoding is active, return one of
@@ -2852,6 +2993,7 @@ Property list
"dw" MPV_FORMAT_INT64
"dh" MPV_FORMAT_INT64
"aspect" MPV_FORMAT_DOUBLE
"aspect-name" MPV_FORMAT_STRING
"par" MPV_FORMAT_DOUBLE
"colormatrix" MPV_FORMAT_STRING
"colorlevels" MPV_FORMAT_STRING
@@ -3080,8 +3222,15 @@ Property list
``mouse-pos/hover``
Boolean - whether the mouse pointer hovers the video window. The
coordinates should be ignored when this value is false, because the
video backends update them only when the pointer hovers the window.
coordinates should be ignored when this value is false if no mouse
button is being pressed, because the video backends update them only
when the pointer hovers the window in this case.
If a mouse button is pressed while the pointer hovers the video window
and then the mouse pointer moves out of window region without releasing
the button, some video backends "capture" the pointer and still report
the coordinates. In this case, the value of this property may be true or
false depending on the video backend.
``touch-pos``
Read-only - last known touch point positions, normalized to OSD dimensions.
@@ -3132,6 +3281,52 @@ Property list
``tablet-pos/pad-btns/N``
The state of the Nth tablet pad button, ``pressed`` or ``released``.
::
MPV_FORMAT_NODE_MAP
"x" MPV_FORMAT_INT64
"y" MPV_FORMAT_INT64
"tool-in-proximity" MPV_FORMAT_FLAG
"tool-tip" MPV_FORMAT_STRING
"tool-stylus-btn1" MPV_FORMAT_STRING
"tool-stylus-btn2" MPV_FORMAT_STRING
"tool-stylus-btn3" MPV_FORMAT_STRING
"pad-focus" MPV_FORMAT_FLAG
"pad-btns" MPV_FORMAT_NODE_MAP
(key and string value for each pad-btn entry)
``dropped-files``
Information of the most recent drag-and-drop event mpv received.
A client can observe this property to detect when a drag-and-drop event
happens. This property is unavailable if no drag-and-drop event has
happened.
Has the following sub-properties:
``dropped-files/time``
The timestamp of the last drag-and-drop event mpv received, in
nanoseconds. This uses the same clock as ``mpv_get_time_ns()``.
``dropped-files/action``
The action of the drag-and-drop event. This is normally ``replace``.
Depending on the platform, this can also be ``append`` in some cases,
such as shift key being held while files are dropped.
``dropped-files/files``
The dropped file names of the drag-and-drop event.
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_MAP
"time" MPV_FORMAT_INT64
"action" MPV_FORMAT_STRING
"files" MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_STRING
``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
@@ -3191,6 +3386,29 @@ Property list
``secondary-sub-end``
Same as ``sub-end``, but for the secondary subtitles.
``sub-lines``
The list of subtitle lines in memory. Not available if the subtitle is not
text-based (i.e. DVD/BD subtitles).
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 subtitle line)
"text" MPV_FORMAT_STRING
"start" MPV_FORMAT_DOUBLE
"end" MPV_FORMAT_DOUBLE
ASS tags are stripped from ``text``.
``end`` is absent if unknown.
``secondary-sub-lines``
Same as ``sub-lines``, but for the secondary subtitles.
``playlist-pos`` (RW)
Current position on playlist. The first entry is on position 0. Writing to
this property may start playback at the new position.
@@ -3202,8 +3420,6 @@ Property list
"current", this property returns -1. Likewise, writing -1 will put the
player into idle mode (or exit playback if idle mode is not enabled). If an
out of range index is written to the property, this behaves as if writing -1.
(Before mpv 0.33.0, instead of returning -1, this property was unavailable
if no playlist entry was current.)
Writing the current value back to the property will have no effect.
Use ``playlist-play-index`` to restart the playback of the current entry if
@@ -3299,14 +3515,16 @@ Property list
MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP (for each playlist entry)
"filename" MPV_FORMAT_STRING
"current" MPV_FORMAT_FLAG (might be missing; since mpv 0.7.0)
"playing" MPV_FORMAT_FLAG (same)
"title" MPV_FORMAT_STRING (optional)
"id" MPV_FORMAT_INT64
"filename" MPV_FORMAT_STRING
"current" MPV_FORMAT_FLAG (might be missing)
"playing" MPV_FORMAT_FLAG (same)
"title" MPV_FORMAT_STRING (optional)
"id" MPV_FORMAT_INT64
"playlist-path" MPV_FORMAT_STRING (optional)
``track-list``
List of audio/video/sub tracks, current entry marked.
List of audio/video/sub tracks, current entry marked. When the file has
editions, only tracks belonging to the currently selected edition are listed.
This has a number of sub-properties. Replace ``N`` with the 0-based track
index.
@@ -3380,7 +3598,13 @@ Property list
The bitrate of the HLS stream, if available.
``track-list/N/program-id``
The program ID of the HLS stream, if available.
The first program ID this stream belongs to, if any. Deprecated,
use ``track-list/N/program-ids``.
``track-list/N/program-ids``
A list of all program IDs this stream belongs to. A stream can belong
to more than one program (e.g. in MPEG-TS or HLS). Unavailable if the
stream does not belong to any program.
``track-list/N/codec``
The codec name used by this track, for example ``h264``. Unavailable
@@ -3416,7 +3640,7 @@ Property list
this can be potentially wrong if a demuxer other than libavformat
(``--demuxer=lavf``) is used. For mkv files, the index will usually
match even if the default (builtin) demuxer is used, but there is
no hard guarantee.
no hard guarantee. May be unavailable if no known mapping exists.
``track-list/N/decoder``
If this track is being decoded, the short decoder name,
@@ -3448,7 +3672,7 @@ Property list
Video FPS as indicated by the container. (Not always accurate.)
``track-list/N/demux-bitrate``
Audio average bitrate, in bits per second. (Not always accurate.)
Average bitrate, in bits per second. (Not always accurate.)
``track-list/N/demux-rotation``
Video clockwise rotation metadata, in degrees.
@@ -3456,6 +3680,9 @@ Property list
``track-list/N/demux-par``
Pixel aspect ratio.
``track-list/N/demux-duration``
Track duration as indicated by the container.
``track-list/N/format-name``
Short name for format from ffmpeg. If the track is audio, this will be
the name of the sample format. If the track is video, this will be the
@@ -3504,6 +3731,7 @@ Property list
"hearing-impaired" MPV_FORMAT_FLAG
"hls-bitrate" MPV_FORMAT_INT64
"program-id" MPV_FORMAT_INT64
"program-ids" MPV_FORMAT_NODE_ARRAY[MPV_FORMAT_INT64]
"selected" MPV_FORMAT_FLAG
"main-selection" MPV_FORMAT_INT64
"external" MPV_FORMAT_FLAG
@@ -3551,6 +3779,8 @@ Property list
If tracks of the requested type are selected via ``--lavfi-complex``, the
first one is returned.
Note that this property cannot be used directly, a sub-property is required.
``chapter-list`` (RW)
List of chapters, current entry marked.
@@ -3592,8 +3822,7 @@ Property list
"label" MPV_FORMAT_STRING [optional]
"enabled" MPV_FORMAT_FLAG [optional]
"params" MPV_FORMAT_NODE_MAP [optional]
"key" MPV_FORMAT_STRING
"value" MPV_FORMAT_STRING
(key and string value for each param entry)
It's also possible to write the property using this format.
@@ -3699,15 +3928,16 @@ Property list
::
MPV_FORMAT_NODE_MAP
"TYPE" MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP
"desc" MPV_FORMAT_STRING
"last" MPV_FORMAT_INT64
"avg" MPV_FORMAT_INT64
"peak" MPV_FORMAT_INT64
"count" MPV_FORMAT_INT64
"samples" MPV_FORMAT_NODE_ARRAY
MP_FORMAT_INT64
(key and array value for each TYPE entry)
MPV_FORMAT_NODE_ARRAY (for each pass entry)
MPV_FORMAT_NODE_MAP
"desc" MPV_FORMAT_STRING
"last" MPV_FORMAT_INT64
"avg" MPV_FORMAT_INT64
"peak" MPV_FORMAT_INT64
"count" MPV_FORMAT_INT64
"samples" MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_INT64
Note that directly accessing this structure via subkeys is not supported,
the only access is through aforementioned ``MPV_FORMAT_NODE``.
@@ -3827,6 +4057,10 @@ Property list
the left, right, top, and bottom margins respectively.
Values are between 0.0 and 1.0, normalized to window width/height.
``user-data/osc/draw-preview``
Used to communicate between osc and compatible thumbnailer (if
installed). See `OSC Preview API`_ section for more details.
``user-data/mpv/ytdl``
Data shared by the builtin ytdl hook script.
@@ -3843,6 +4077,9 @@ Property list
``user-data/mpv/console/open``
Whether the console is open.
``user-data/mpv/context-menu/open``
Whether the context menu script is open.
``menu-data`` (RW)
This property stores the raw menu definition. See `Context Menu`_ section for details.
@@ -3960,6 +4197,17 @@ Property list
somewhat weird form (apparently "hex BCD"), indicating the release version
of the libass library linked to mpv.
``libplacebo-version``
The contents of the ``PL_VERSION`` macro. This is a string which identifies
the build in some way, either through a release version number, or a git
hash.
``subrandr-version``
The value of ``sbr_library_version()`` as a string in the format
``<major>.<minor>.<patch>``, indicating the release version of the subrandr
library at runtime. This property is unavailable if mpv is not compiled
with subrandr enabled.
``platform``
Returns a string describing what target platform mpv was built for. The value
of this is dependent on what the underlying build system detects. Some of the
@@ -3978,9 +4226,14 @@ Property list
``file-local-options/<name>`` (RW)
Similar to ``options/<name>``, but when setting an option through this
property, the option is reset to its old value once the current file has
stopped playing. Trying to write an option while no file is playing (or
is being loaded) results in an error.
property, the option is marked as file-local, which causes it to reset to
its old value once the current file has stopped playing. Trying to write
an option while no file is playing (or is being loaded) results in an error.
If an option is applied through a file specific mechanism such as per-file
options, watch later, ``options`` parameter of the ``loadfile`` command,
or file-specific configuration files, the option is similarly marked as
file-local.
(Note that if an option is marked as file-local, even ``options/`` will
access the local value, and the ``old`` value, which will be restored on
@@ -4029,6 +4282,20 @@ Property list
are not actual choice options internally, may not have this info
available.
::
MPV_FORMAT_NODE_MAP
"name" MPV_FORMAT_STRING
"type" MPV_FORMAT_STRING
"set-from-commandline" MPV_FORMAT_FLAG
"set-locally" MPV_FORMAT_FLAG
"expects-file" MPV_FORMAT_FLAG
"default-value" MPV_FORMAT_NODE (optional, value of "type")
"min" MPV_FORMAT_DOUBLE (optional)
"max" MPV_FORMAT_DOUBLE (optional)
"choices" MPV_FORMAT_NODE_ARRAY (optional)
MPV_FORMAT_STRING
``property-list``
The list of top-level properties.
@@ -4044,6 +4311,16 @@ Property list
value (either because it was not set, or set explicitly to ``default``),
but in the future it might hold the value ``default``.
::
MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP (for each profile entry)
"name" MPV_FORMAT_STRING
"options" MPV_FORMAT_NODE_ARRAY (for each option entry)
MPV_FORMAT_NODE_MAP
"key" MPV_FORMAT_STRING
"value" MPV_FORMAT_STRING
``command-list``
The list of input commands. This returns an array of maps, where each map
node represents a command. This map has the following entries:
@@ -4079,9 +4356,12 @@ Property list
"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
"name" MPV_FORMAT_STRING
"type" MPV_FORMAT_STRING
"optional" MPV_FORMAT_FLAG
"default-value" MPV_FORMAT_NODE (optional, value of "type")
"choices" MPV_FORMAT_NODE_ARRAY (optional)
MPV_FORMAT_STRING
``input-bindings``
The list of current input key bindings. This returns an array of maps,
@@ -4121,6 +4401,18 @@ Property list
example, the input.conf entry ``f cycle bla # toggle bla`` would
result in an entry with ``comment = "toggle bla", cmd = "cycle bla"``.)
::
MPV_FORMAT_NODE_ARRAY
MPV_FORMAT_NODE_MAP
"key" MPV_FORMAT_STRING
"cmd" MPV_FORMAT_STRING
"is_weak" MPV_FORMAT_FLAG
"owner" MPV_FORMAT_STRING (optional)
"section" MPV_FORMAT_STRING
"priority" MPV_FORMAT_INT64
"comment" MPV_FORMAT_STRING (optional)
This property is read-only, and change notification is not supported.
``clipboard``
@@ -4146,10 +4438,28 @@ Property list
does not have this limitation.
See ``current-clipboard-backend`` property for more details.
.. warning::
Since mpv 0.42.0, this property does not return the current clipboard
content on certain platforms if ``--clipboard-monitor=no``.
When reading clipboard content, you must run ``update-clipboard``
command to update the clipboard content manually in this case.
::
MPV_FORMAT_NODE_MAP
"text" MPV_FORMAT_STRING
"text-primary" MPV_FORMAT_STRING
``current-clipboard-backend``
A string containing the currently active clipboard backend.
See ``--clipboard-backends`` option for the list of available backends.
``player-operation-mode``
A read-only string of the current player operation mode, mirroring the
``--player-operation-mode`` option. To set operation mode, set the option
at startup instead.
``clock``
The current local time in hour:minutes format.
@@ -4164,8 +4474,6 @@ caveats with some properties (due to historical reasons):
example, if you set ``aid=5``, and the currently played file contains no
audio track with ID 5, the ``aid`` property will return ``no``.
Before mpv 0.31.0, you could set existing tracks at runtime only.
``display-fps``
This inconsistent behavior is deprecated. Post-deprecation, the reported
value and the option value are cleanly separated (``override-display-fps``
@@ -4177,10 +4485,6 @@ caveats with some properties (due to historical reasons):
change. On the other hand, the next video to be played will fail, because
the initial filter chain cannot be created.
This behavior changed in mpv 0.31.0. Before this, the new value was rejected
*iff* a video (for ``vf``) or an audio (for ``af``) track was active. If
playback was not active, the behavior was the same as the current one.
``playlist``
The property is read-only and returns the current internal playlist. The
option is for loading playlist during command line parsing. For client API
-4
View File
@@ -204,8 +204,6 @@ string/boolean/number)
``mp.input.log(message, style)``
``mp.input.log_error(message)``
``mp.input.set_log(log)``
``exit()`` (global)
@@ -352,8 +350,6 @@ paths - like ``<script-dir>/modules`` for scripts which load from a directory).
The custom-init file is ignored if mpv is invoked with ``--no-config``.
Before mpv 0.34, the file name was ``.init.js`` (with dot) at the same dir.
The event loop
--------------
+1 -1
View File
@@ -22,7 +22,7 @@ You can write C plugins for mpv. These use the libmpv API, although they do not
use the libmpv library itself.
They are enabled by default if compiler supports linking with the ``-rdynamic``
flag on Linux/BSD platforms. On Windows the are always enabled.
flag on Linux/BSD platforms. On Windows they are always enabled.
C plugins location
------------------
+77 -38
View File
@@ -61,8 +61,7 @@ that uses the ``.foo`` file extension.
mpv also appends the top level directory of the script to the start of Lua's
package path so you can import scripts from there too. Be aware that this will
shadow Lua libraries that use the same package path. (Single file scripts do not
include mpv specific directories in the Lua package path. This was silently
changed in mpv 0.32.0.)
include mpv specific directories in the Lua package path.)
Using a script directory is the recommended way to package a script that
consists of multiple source files, or requires other files (you can use
@@ -100,17 +99,14 @@ The event loop will wait for events and dispatch events registered with
``mp.register_event``. It will also handle timers added with ``mp.add_timeout``
and similar (by waiting with a timeout).
Since mpv 0.6.0, the player will wait until the script is fully loaded before
continuing normal operation. The player considers a script as fully loaded as
soon as it starts waiting for mpv events (or it exits). In practice this means
the player will more or less hang until the script returns from the main chunk
(and ``mp_event_loop`` is called), or the script calls ``mp_event_loop`` or
The player will wait until the script is fully loaded before continuing normal
operation. The player considers a script as fully loaded as soon as it starts
waiting for mpv events (or it exits). In practice this means the player will
more or less hang until the script returns from the main chunk (and
``mp_event_loop`` is called), or the script calls ``mp_event_loop`` or
``mp.dispatch_events`` directly. This is done to make it possible for a script
to fully setup event handlers etc. before playback actually starts. In older
mpv versions, this happened asynchronously. With mpv 0.29.0, this changes
slightly, and it merely waits for scripts to be loaded in this manner before
starting playback as part of the player initialization phase. Scripts run though
initialization in parallel. This might change again.
to fully setup event handlers etc. before playback actually starts. Scripts run
though initialization in parallel.
mp functions
------------
@@ -159,11 +155,14 @@ The ``mp`` module is preloaded, although it can be loaded manually with
``mp.commandv()`` (but can be a native type instead of a string).
If the table contains string keys, it's interpreted as command with named
arguments. This requires at least an entry with the key ``name`` to be
present, which must be a string, and contains the command name. The special
entry ``_flags`` is optional, and if present, must be an array of
`Input Command Prefixes`_ to apply. All other entries are interpreted as
arguments.
arguments. This requires at least an entry with the key ``_name`` to be
present, which must be a string, and contains the command name.
For compatibility, if the key ``_name`` does not exist, then the entry with
the key ``name`` will be used instead. The special entry ``_flags`` is
optional, and if present, must be an array of `Input Command Prefixes`_ to
apply. All other entries are interpreted as arguments. Note that some
commands have arguments named ``name``, and can only be used if the command
name is specified with key ``_name`` instead of ``name``.
Returns a result table on success (usually empty), or ``def, error`` on
error. ``def`` is the second parameter provided to the function, and is
@@ -419,7 +418,7 @@ The ``mp`` module is preloaded, although it can be loaded manually with
and the function fn is a Lua function value.
Some events have associated data. This is put into a Lua table and passed
as argument to fn. The Lua table by default contains a ``name`` field,
as argument to fn. The Lua table by default contains a ``event`` field,
which is a string containing the event name. If the event has an error
associated, the ``error`` field is set to a string describing the error,
on success it's not set.
@@ -850,7 +849,7 @@ strictly part of the guaranteed API.
- rename ``cancellable`` field to ``playback_only``
- rename ``max_size`` to ``capture_size``
- set ``capture_stdout`` field to ``true`` if unset
- set ``name`` field to ``subprocess``
- set ``_name`` field to ``subprocess``
- call ``mp.command_native(copied_t)``
- if the command failed, create a dummy result table
- copy ``error_string`` to ``error`` field if the string is non-empty
@@ -913,8 +912,7 @@ strictly part of the guaranteed API.
mp.input functions
--------------------
This module lets scripts get textual input from the user using the console
REPL.
This module lets scripts get textual input from the user using the console.
``input.get(table)``
Show the console to let the user enter text.
@@ -929,11 +927,16 @@ REPL.
the text in the console.
``keep_open``
Whether to keep the console open on submit. Defaults to ``false``.
Whether to keep the console open on submit, allowing further input.
Defaults to ``false``.
If calling ``input.get()`` or ``input.select()`` again from inside the
``submit`` callback, setting this option to ``true`` allows a seamless
transition without the console closing and reopening.
``opened``
A callback invoked when the console is shown. This can be used to
present a list of options with ``input.set_log()``.
override keybinds set by the console with ``mp.add_forced_key_binding()``.
``edited``
A callback invoked when the text changes. The first argument is the text
@@ -941,14 +944,21 @@ REPL.
``complete``
A callback invoked when the user edits the text or moves the cursor. The
first argument is the text before the cursor. The callback should return
a table of the string candidate completion values and the 1-based cursor
first argument is the text before the cursor, and the second argument is
a response function which can be called to present completion values to
the user.
The first argument to the response function is a table of the string
candidate completion values, and the second argument is the 1-based cursor
position from which the completion starts. console will show the
completions that fuzzily match the text between this position and the
cursor and allow selecting them.
cursor, which the user can select with ``TAB``. The completions will only
be shown to the user if the text before the cursor has not since changed.
The response function should be called with an empty table if there are no
completion values to display.
The third and optional return value is a string that will be appended to
the input line without displaying it in the completions.
The third and optional argument to the response function is a string that
will be appended to the input line without displaying it in the completions.
``autoselect_completion``
Whether to automatically select the first completion on submit if one
@@ -975,20 +985,23 @@ REPL.
among the ones stored for ``input.get()`` calls. Defaults to the calling
script name with ``prompt`` appended.
``console_opt_overrides``
A table containing configuration overrides for the console script.
Can be used to change the visual style of the text input, among other things.
See `CONSOLE`_ for the full list of options.
``input.terminate()``
Close the console.
Closes any currently active input request. This will not close
requests made by other scripts.
``input.log(message, style, terminal_style)``
Add a line to the log buffer. ``style`` can contain additional ASS tags to
apply to ``message``, and ``terminal_style`` can contain escape sequences
that are used when the console is displayed in the terminal.
``input.log_error(message)``
Helper to add a line to the log buffer with the same color as the one used
for commands that error. Useful when the user submits invalid input.
Add a line to the log buffer of the latest ``input.get()`` request.
``style`` can contain additional ASS tags to apply to ``message``,
and ``terminal_style`` can contain escape sequences that are used
when the console is displayed in the terminal.
``input.set_log(log)``
Replace the entire log buffer.
Replace the entire log buffer of the latest ``input.get()`` request.
``log`` is a table of strings, or tables with ``text``, ``style`` and
``terminal_style`` keys.
@@ -1025,7 +1038,33 @@ REPL.
the 1-based index of the selected item.
``keep_open``
Whether to keep the console open on submit. Defaults to ``false``.
Whether to keep the console open on submit, allowing further input.
Defaults to ``false``.
If calling ``input.get()`` or ``input.select()`` again from inside the
``submit`` callback, setting this option to ``true`` allows a seamless
transition without the console closing and reopening.
``opened``
A callback invoked when the console is shown. This can be used to
override keybinds set by the console with ``mp.add_forced_key_binding()``.
``closed``
A callback invoked when the console is hidden, either because
``input.terminate()`` was invoked from the other callbacks, or because
the user closed it with a key binding. The first argument is the text in
the console, and the second argument is the cursor position.
``default_text``
A string to pre-fill the input field with.
``cursor_position``
The initial cursor position, starting from 1.
``console_opt_overrides``
A table containing configuration overrides for the console script.
Can be used to change the visual style of the select window, among other things.
See `CONSOLE`_ for the full list of options.
Example:
+116 -46
View File
@@ -174,6 +174,15 @@ z and Z
l
Set/clear A-B loop points. See ``ab-loop`` command for details.
Ctrl+m
Jump to the disc menu when playing a DVD or Blu-ray (see the ``discnav``
command). While a menu with a button highlight is on screen, the arrow
keys, ENTER, ESC/BACKSPACE and the mouse control the menu instead of
their usual functions.
Ctrl+M
Show or hide the Blu-ray popup menu.
L
Toggle infinite looping.
@@ -257,6 +266,10 @@ Ctrl+v
currently playing, it is played immediately. Only works on platforms that
support the ``clipboard`` property.
Ctrl+r
Reload the current file, preserving the time position and any changed
option. Empties any network cache.
i and I
Show/toggle an overlay displaying statistics about the currently playing
file such as codec, framerate, number of dropped frames and so on. See
@@ -332,8 +345,10 @@ g-e
Select an MKV edition or DVD/Blu-ray title.
g-l
Select a subtitle line to seek to. This currently requires ``ffmpeg`` in
``PATH``, or in the same folder as mpv on Windows.
Select a subtitle line to seek to.
g-L
Select a secondary subtitle line to seek to.
g-d
Select an audio device.
@@ -351,11 +366,14 @@ g-b
g-r
Show the values of all properties.
g-m, MENU, Ctrl+p
g-m, Ctrl+p
Show a menu with miscellaneous entries.
See `SELECT`_ for more information.
MENU, Shift+F10
Show the context menu (see `CONTEXT MENU`_).
(The following keys are valid if you have a keyboard with multimedia keys.)
PAUSE
@@ -384,7 +402,7 @@ Left double click
Toggle fullscreen on/off.
Right click
Toggle pause on/off.
Show the context menu (see `CONTEXT MENU`_).
Forward/Back button
Skip to next/previous entry in playlist.
@@ -399,16 +417,6 @@ Ctrl+Wheel up/down
Change video zoom keeping the part of the video hovered by the cursor under
it.
Context Menu
-------------
Context Menu is a menu that pops up on the video window on user interaction
(mouse right click, etc.).
To use this feature, you need to fill the ``menu-data`` property with menu
definition data, and add a keybinding to run the ``context-menu`` command,
which can be done with a user script.
USAGE
=====
@@ -443,12 +451,10 @@ because ``--fs`` is a flag option that requires no parameter. If an option
changes and its parameter becomes optional, then a command line using the
alternative syntax will break.
Until mpv 0.31.0, there was no difference whether an option started with ``--``
or a single ``-``. Newer mpv releases strictly expect that you pass the option
value after a ``=``. For example, before ``mpv --log-file f.txt`` would write
a log to ``f.txt``, but now this command line fails, as ``--log-file`` expects
an option value, and ``f.txt`` is simply considered a normal file to be played
(as in ``mpv f.txt``).
For options starting with ``--``, mpv expects that you pass the option value
after a ``=``. For example, ``mpv --log-file f.txt`` will fail, as
``--log-file`` expects an option value, and ``f.txt`` is simply considered a
normal file to be played (as in ``mpv f.txt``).
The future plan is that ``-option value`` will not work anymore, and options
with a single ``-`` behave the same as ``--`` options.
@@ -487,9 +493,9 @@ quotes.
The ``[...]`` form of quotes wraps everything between ``[`` and ``]``. It's
useful with shells that don't interpret these characters in the middle of
an argument (like bash). These quotes are balanced (since mpv 0.9.0): the ``[``
and ``]`` nest, and the quote terminates on the last ``]`` that has no matching
``[`` within the string. (For example, ``[a[b]c]`` results in ``a[b]c``.)
an argument (like bash). These quotes are balanced: the ``[`` and ``]`` nest,
and the quote terminates on the last ``]`` that has no matching ``[`` within the
string. (For example, ``[a[b]c]`` results in ``a[b]c``.)
The fixed-length quoting syntax is intended for use with external
scripts and programs.
@@ -528,6 +534,13 @@ UNIX path. To avoid problems with arbitrary paths, you should be sure that
absolute paths passed to mpv start with ``/``, and prefix relative paths with
``./``.
URLs that are passed to mpv should be percent-encoded for it to work reliably.
There are some heuristics in place that tries to automatically do it, but these
heuristics are not foolproof. For example, in order to play a file literally
named ``foo%20.mp4``, using ``http://localhost/foo%20.mp4`` without any
percent-encoding will not work. Percent-encoding it as
``http://localhost/foo%2520.mp4`` will work as expected.
Using the ``file://`` pseudo-protocol is discouraged, because it involves
strange URL unescaping rules.
@@ -618,7 +631,8 @@ reset when a new file is played.
Sometimes, it is useful to change options per-file. This can be achieved by
adding the special per-file markers ``--{`` and ``--}``. (Note that you must
escape these on some shells.) Example::
escape these on some shells.) When a file is loaded, the associated per-file
options are applied and marked as file-local options. Example::
mpv --a file1.mkv --b --\{ --c file2.mkv --d file3.mkv --e --\} file4.mkv --f
@@ -633,7 +647,8 @@ file4.mkv ``--a --b --f``
Additionally, any file-local option changed at runtime is reset when the current
file stops playing. If option ``--c`` is changed during playback of
``file2.mkv``, it is reset when advancing to ``file3.mkv``. This only affects
``file2.mkv``, it is reset when advancing to ``file3.mkv``, or when restarting
the current file with the ``playlist-play-index`` command. This only affects
file-local options. The option ``--a`` is never reset here.
@@ -699,8 +714,6 @@ recommended to use the ``-append`` variant. When using libmpv, prefer using
``MPV_FORMAT_NODE_MAP``; when using a scripting backend or the JSON IPC, use an
appropriate structured data type.
Prior to mpv 0.33, ``:`` was also recognized as separator by ``-set``.
Object settings list options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -814,6 +827,8 @@ file-specific configuration is loaded from ``~/.config/mpv``. In addition, the
``--use-filedir-conf`` option enables directory-specific configuration files.
For this, mpv first tries to load a mpv.conf from the same directory
as the file played and then tries to load any file-specific configuration.
The options loaded in this way are marked as file-local, which are reset when
the current file stops playing.
Profiles
@@ -858,7 +873,7 @@ or at runtime with the ``apply-profile <name>`` command.
[network]
demuxer-max-back-bytes=512MiB
# reference a builtin profile
profile=fast
profile=low-latency
Runtime profiles
----------------
@@ -1264,6 +1279,9 @@ modified after playback began, for example the volume and selected audio/subtitl
and restores their values the next time the file is played. Which options are
saved can be configured with the ``--watch-later-options`` option.
The options applied in this way are marked as file-local, and they are reset when
playback of the file associated with it stops.
When playing multiple playlist entries, mpv checks if one them has a resume
config file associated, and if it finds one it restarts playback from it. For
example, if you use ``quit-watch-later`` on the 5th episode of a show, and
@@ -1318,8 +1336,12 @@ PROTOCOLS
Play a Blu-ray disc. Since libbluray 1.0.1, you can read from ISO files
by passing them to ``--bluray-device``.
A Blu-ray ``.iso`` image passed directly (e.g. ``mpv disc.iso``) is also
detected and opened.
``title`` can be: ``longest`` or ``first`` (selects the default
playlist); ``mpls/<number>`` (selects <number>.mpls playlist);
playlist); ``menu`` (starts in the disc menu, see ``--disc-menu`` and the
``discnav`` command); ``mpls/<number>`` (selects <number>.mpls playlist);
``<number>`` (select playlist with the same index). mpv will list
the available playlists on loading.
@@ -1327,13 +1349,32 @@ PROTOCOLS
``dvd://[title][/device]`` ``--dvd-device=PATH``
Play a DVD. DVD menus are not supported. If no title is given, the longest
title is auto-selected. Without ``--dvd-device``, it will probably try
to open an actual optical drive, if available and implemented for the OS.
Play a DVD. If no title is given, the longest title is auto-selected.
``title`` can also be ``menu`` to start in the disc menu (see
``--disc-menu`` and the ``discnav`` command). Without ``--dvd-device``,
it will probably try to open an actual optical drive, if available and
implemented for the OS.
A DVD-Video ``.iso`` image passed directly (e.g. ``mpv disc.iso``) is also
detected and opened.
``dvdnav://`` is an old alias for ``dvd://`` and does exactly the same
thing.
``dvda://[title][/device]`` ``--dvda-device=PATH``
Play the AUDIO_TS zone of a DVD-Audio disc. Titles correspond to the
disc's audio groups, tracks are exposed as chapters. If no title is
given, the longest title is auto-selected. Menus are not supported.
Still images (ASVS), such as cover art or booklet pages a disc associates
with its tracks, are exposed as a video track and shown by default. Can be
disabled with ``--vid=no``.
A DVD-Audio ``.iso`` image passed directly (e.g. ``mpv disc.iso``) is also
detected and opened. For hybrid discs, the DVD-Audio zone is preferred over
the DVD-Video zone.
``dvb://[cardnumber@]channel`` ``--dvbin-...``
Digital TV via DVB. (Linux only.)
@@ -1439,22 +1480,28 @@ PROTOCOLS
Only works with seekable streams.
Examples::
.. admonition:: Example
mpv slice://1g-2g@cap.ts
::
This starts reading from cap.ts after seeking 1 GiB, then
reads until reaching 2 GiB or end of file.
mpv slice://1g-2g@cap.ts
mpv slice://1g-+2g@cap.ts
This starts reading from cap.ts after seeking 1 GiB, then
reads until reaching 2 GiB or end of file.
This starts reading from cap.ts after seeking 1 GiB, then
reads until reaching 3 GiB or end of file.
::
mpv slice://100m@appending://cap.ts
mpv slice://1g-+2g@cap.ts
This starts reading from cap.ts after seeking 100MiB, then
reads until end of file.
This starts reading from cap.ts after seeking 1 GiB, then
reads until reaching 3 GiB or end of file.
::
mpv slice://100m@appending://cap.ts
This starts reading from cap.ts after seeking 100MiB, then
reads until end of file.
``null://``
@@ -1470,6 +1517,24 @@ PROTOCOLS
Like ``memory://``, but the string is interpreted as hexdump.
``archive://[ARCHIVE PATH]|[FILE PATH IN ARCHIVE]``
Open a file at the specified path inside an archive. Requires libarchive
feature enabled. The archive path must have all ``%`` and ``|`` characters
URL escaped. The file path should not be URL escaped.
.. admonition:: Example
::
mpv "archive://file.zip|video.mkv"
This will play ``video.mkv`` in the archive file ``file.zip``.
``env://variable``
Read the environment variable ``variable`` as source data.
PSEUDO GUI MODE
===============
@@ -1498,7 +1563,7 @@ The profile is currently defined as follows:
[builtin-pseudo-gui]
terminal=no
force-window=yes
idle=once
idle=yes
screenshot-directory=~~desktop/
The ``pseudo-gui`` profile exists for compatibility. The options in the
@@ -1514,10 +1579,15 @@ works like in older mpv releases:
.. warning::
Currently, you can extend the ``pseudo-gui`` profile in the config file the
normal way. This is deprecated. In future mpv releases, the behavior might
change, and not apply your additional settings, and/or use a different
profile name.
normal way. This is deprecated and will be removed in future mpv releases.
As an alternative, a conditional autoprofile can be used instead:
::
[gui]
profile-cond=p["player-operation-mode"]=="pseudo-gui"
idle=once
.. include:: options.rst
+423 -162
View File
File diff suppressed because it is too large. Load diff
+166 -21
View File
@@ -175,8 +175,7 @@ Configurable Options
Default: bottombar
The layout for the OSC. Currently available are: box, slimbox,
bottombar, topbar, slimbottombar and slimtopbar. Default pre-0.21.0 was
'box'.
bottombar, topbar, slimbottombar, slimtopbar and floating.
``seekbarstyle``
Default: bar
@@ -230,7 +229,7 @@ Configurable Options
Set to ``no`` to disable any special mouse wheel behavior.
``deadzonesize``
Default: 0.5
Default: 0.75
Size of the deadzone. The deadzone is an area that makes the mouse act
like leaving the window. Movement there won't make the OSC show up and
@@ -238,13 +237,13 @@ Configurable Options
at the window border opposite to the OSC and the size controls how much
of the window it will span. Values between 0.0 and 1.0, where 0 means the
OSC will always popup with mouse movement in the window, and 1 means the
OSC will only show up when the mouse hovers it. Default pre-0.21.0 was 0.
OSC will only show up when the mouse hovers it. Default pre-0.42.0 was 0.5.
``minmousemove``
Default: 0
Minimum amount of pixels the mouse has to move between ticks to make
the OSC show up. Default pre-0.21.0 was 3.
the OSC show up.
``showwindowed``
Default: yes
@@ -261,6 +260,11 @@ Configurable Options
Show the mpv logo and message when idle
``audioonlyscreen``
Default: no
Show the mpv logo when no video track is present or selected.
``scalewindowed``
Default: 1.0
@@ -364,6 +368,16 @@ Configurable Options
The list of visibility modes to cycle through when calling the
osc-visibility cycle script message. Modes are separated by ``_``.
``boxwidth``
Default: 550
Width of the ``box`` layout.
``slimboxwidth``
Default: 660
Width of the ``slimbox`` layout.
``boxmaxchars``
Default: 80
@@ -379,27 +393,50 @@ Configurable Options
within the areas not covered by the osc (``yes``). If this option is set,
the osc may overwrite the ``--video-margin-ratio-*`` options, even if the
user has set them. (It will not overwrite them if all of them are set to
default values.) Additionally, ``visibility`` must be set to ``always``.
Otherwise, this option does nothing.
default values.) By default, ``visibility`` must be set to ``always``.
Use ``dynamic_margins`` to allow margins to update with OSC visibility
instead.
Currently, this is supported for the ``bottombar``, ``slimbottombar``,
``topbar`` and ``slimtopbar`` layouts only. The other layouts do not change
if this option is set. Separately, if window controls are present (see
below), they will be affected regardless of which osc layout is in use.
The border is static and appears even if the OSC is configured to appear
only on mouse interaction. If the OSC is invisible, the border is simply
filled with the background color (black by default).
This currently still makes the OSC overlap with subtitles (if the
``--sub-use-margins`` option is set to ``yes``, the default). This may be
fixed later.
Subtitles may still overlap with the OSC when ``--sub-use-margins`` is set
to ``yes`` (the default), as they are allowed to extend into the margin
area. Setting ``--sub-use-margins=no`` confines subtitles to the video
area.
This does not work correctly with video outputs like ``--vo=xv``, which
render OSD into the unscaled video.
``dynamic_margins``
Default: no
When set to ``yes``, margins follow the actual OSC visibility: they are
applied when the OSC appears and removed when it hides. Without this
option, margins are only applied when ``visibility`` is set to ``always``.
``sub_margins``
Default: no
Whether to adjust the subtitle margin so that subtitles do not overlap
with the OSC. Requires ``dynamic_margins`` or ``visibility=always`` to
take effect. Uses ``--sub-margin-y-offset`` to apply the adjustment.
With ``boxvideo`` enabled and ``--sub-use-margins=no``, subtitles are
already confined to the video area and this option has no additional
effect.
``osd_margins``
Default: yes
Whether to adjust the OSD margin so that OSD text does not overlap
with the OSC. Requires ``dynamic_margins`` or ``visibility=always`` to
take effect. Uses ``--osd-margin-y-offset`` to apply the adjustment.
``windowcontrols``
Default: auto (Show window controls if there is no window border)
Default: auto (Show window controls if there is no window border/title-bar)
Whether to show window management controls over the video, and if so,
which side of the window to place them. This may be desirable when the
@@ -411,6 +448,12 @@ Configurable Options
and ``quit``. Not all platforms implement ``minimize`` and ``maximize``,
but ``quit`` will always work.
``windowcontrols_independent``
Default: yes
Whether to show window controls independently of the OSC, or show them
together.
``windowcontrols_alignment``
Default: right
@@ -427,17 +470,35 @@ Configurable Options
windowcontrols title.
ASS tags are escaped, and newlines and trailing slashes are stripped.
``floatingtitle``
Default: yes
Whether to show the title row in the ``floating`` layout. When enabled,
window controls are rendered as compact buttons without a full-width
background bar.
``floatingwidth``
Default: 700
Width of the ``floating`` layout.
``floatingalpha``
Default: 105
Alpha of the ``floating`` layout background, 0 (opaque) to 255 (fully
transparent).
``tracknumberswidth``
Default: 35
Width of the track number labels next to the audio/subtitle track selector
icons. Set to ``0`` to hide track numbers and show only the icons.
``greenandgrumpy``
Default: no
Set to ``yes`` to reduce festivity (i.e. disable santa hat in December.)
``livemarkers``
Default: yes
Update chapter markers positions on duration changes, e.g. live streams.
The updates are unoptimized - consider disabling it on very low-end systems.
``chapter_fmt``
Default: ``Chapter: %s``
@@ -451,6 +512,19 @@ Configurable Options
Use a Unicode minus sign instead of an ASCII hyphen when displaying
the remaining playback time.
``icon_style``
Default: layout
Selects the icon set used for OSC buttons. Both sets are bundled in the
mpv-osd-symbols font.
``layout``
Select the icon set based on the current layout.
``classic``
The original mpv icon set.
``fluent``
Icons based on Microsoft's Fluent UI System Icons.
``background_color``
Default: #000000
@@ -516,8 +590,16 @@ Configurable Options
Use display fps to calculate the interval between OSC redraws.
``max_thumb_size``
Default: 200
Maximum display size of the preview thumbnail. Only meaningful when a
Thumbnailer is active. See the `OSC Preview API`_ section.
The following options configure what commands are run when the buttons are
clicked. ``mbtn_mid`` commands are also triggered with ``shift+mbtn_left``.
An option that ends with ``_down_command`` means that the command is
continuously called while the mouse button is held down.
``menu_mbtn_left_command=script-binding select/menu; script-message-to osc osc-hide``
@@ -597,6 +679,36 @@ clicked. ``mbtn_mid`` commands are also triggered with ``shift+mbtn_left``.
``fullscreen_mbtn_right_command="cycle window-maximized"``
``skip_backward_mbtn_left_down_command=seek -5``
``skip_backward_mbtn_mid_down_command=frame-back-step``
``skip_backward_mbtn_right_down_command=seek -30``
``skip_forward_mbtn_left_down_command=seek 10``
``skip_forward_mbtn_mid_down_command=frame-step``
``skip_forward_mbtn_right_down_command=seek 60``
``close_mbtn_left_command=quit``
``close_mbtn_mid_command=``
``close_mbtn_right_command=``
``minimize_mbtn_left_command=cycle window-minimized``
``minimize_mbtn_mid_command=``
``minimize_mbtn_right_command=``
``maximize_mbtn_left_command=cycle ${?fullscreen==yes:fullscreen}${!fullscreen==yes:window-maximized}``
``maximize_mbtn_mid_command=``
``maximize_mbtn_right_command=``
Custom Buttons
~~~~~~~~~~~~~~
@@ -649,3 +761,36 @@ to set auto mode (the default) with ``b``::
Controls the visibility of the mpv logo on idle. Valid arguments are ``yes``,
``no``, and ``cycle`` to toggle between yes and no. If a second argument is
passed (any value), then the output on the OSD will be silenced.
OSC Preview API
~~~~~~~~~~~~~~~
The OSC supports displaying preview thumbnails when hovering over the seekbar if
a compatible thumbnailer script is installed. It communicates with a thumbnailer
script via the following ``user-data`` properties:
``user-data/osc/draw-preview``
Set by the OSC to request a thumbnail within the currently playing file.
The ``draw-preview`` property is a table with the following fields:
``x``, ``y``
Top-left coordinates (positive integers) to draw the thumbnail at.
``w``, ``h``
Width and height (positive non-zero integers) of the area to draw the
thumbnail in. Note that this only specifies the drawing width and
height, the actual backing thumbnail size may differ.
``hover-sec``
Requested thumbnail timestamp in seconds.
``ass``
Optional ASS string to render alongside the thumbnail, using OSD
coordinates. This can be used for decorations such as a thumbnail
border.
The OSC sets this property to ``nil`` to signal the thumbnailer to clear
the displayed thumbnail.
Avoid installing/enabling multiple thumbnailer script since this api expects
only one to be active at a time.
+44 -3
View File
@@ -7,6 +7,8 @@ providing script bindings that gather and format the data to be selected in the
console and do operations on the selected item. It can be disabled using the
``--load-select=no`` option.
This script is also used to populate the context menu.
Key bindings
------------
@@ -28,6 +30,12 @@ PGUP and Ctrl+b
PGDN and Ctrl+f
Scroll down one page.
Shift+LEFT
Scroll left.
Shift+RIGHT
Scroll right.
Ctrl+y
Copy the focused item to the clipboard.
@@ -41,6 +49,12 @@ WHEEL_UP
WHEEL_DOWN
Scroll down.
WHEEL_LEFT and Shift+WHEEL_DOWN
Scroll left.
WHEEL_RIGHT and Shift+WHEEL_UP
Scroll right.
Typing printable characters does a fuzzy search of the presented items.
If the query starts with ``'``, only exact matches are filtered. You can also
@@ -54,10 +68,17 @@ By default select.lua's script bindings are bound to key sequences starting with
``g`` listed in `Keyboard Control`_. The names of the script bindings listed
below can be used to bind them to different keys.
All script bindings accept an optional ``keep-open`` argument that
prevents the menu from closing after a selection.
.. admonition:: Example to rebind playlist selection in input.conf
Ctrl+p script-binding select/select-playlist
.. admonition:: Example to keep the track menu open in input.conf
g-t script-binding select/select-track keep-open
Available script bindings are:
``select-playlist``
@@ -88,9 +109,6 @@ Available script bindings are:
``select-subtitle-line``
Select a subtitle line to seek to. This doesn't work with image subtitles.
This currently requires ``ffmpeg`` in ``PATH``, or in the same folder as mpv
on Windows.
``select-audio-device``
Select an audio device.
@@ -138,9 +156,15 @@ Available script bindings are:
``open-docs``
Open mpv's online documentation in the browser.
``open-chat``
Open mpv's chat in the browser.
``menu``
Show a menu with miscellaneous entries.
``context-menu``
Show the context menu.
Configuration
-------------
@@ -161,3 +185,20 @@ Configurable options
Default: yes
Whether to show only the last of history entries with the same path.
``menu_conf_path``
Default: ~~/menu.conf (see `FILES`_).
The path from which to read the custom context menu definition (see `CONTEXT
MENU`_).
``max_playlist_items``
Default: 25
The maximum number of playlist entries in the context menu.
``populate_menu_data``
Default: yes, except for libmpv
Whether observe the properties referenced in ``menu.conf`` and update
``menu-data`` with suitable menu items after mpv's window is created.
+5
View File
@@ -120,6 +120,11 @@ Configurable Options
Whether to clip lines to the terminal width.
``track_info_selected_only``
Default: yes
Show track info for selected tracks only instead of all tracks.
``plot_perfdata``
Default: no
+77 -7
View File
@@ -35,7 +35,7 @@ The exact syntax is:
and the ``filter-parameter-list``:
``<filter-parameter> | <filter-parameter> "," <filter-parameter-list>``
``<filter-parameter> | <filter-parameter> ":" <filter-parameter-list>``
and ``filter-parameter``:
@@ -323,6 +323,12 @@ Available mpv-only filters are:
Whether or not to include HDR10+ metadata (default: yes). If
disabled, any HDR10+ metadata will be stripped from frames.
``<enhancement-layer=yes|no>``
Whether or not to apply the image enhancement layer (default: yes).
If disabled, the enhancement-layer frame paired with each base-layer
frame is discarded. Currently this controls Dolby Vision Profile 7 FEL
application.
``<min-luma>``
Set the minimum luminance value for the mastering display metadata.
This is a float value in nits (cd/m²).
@@ -741,14 +747,78 @@ Available mpv-only filters are:
NVIDIA RTX Super Resolution.
``interlaced-only=<yes|no>``
If ``yes``, only deinterlace frames marked as interlaced (default: no).
``mode=<blend|bob|adaptive|mocomp|ivctc|none>``
``mode=<blend|bob|adaptive|mocomp|ivtc|none>``
Tries to select a video processor with the given processing capability.
If a video processor supports multiple capabilities, it is not clear
which algorithm is actually selected. ``none`` always falls back. On
most if not all hardware, this option will probably do nothing, because
a video processor usually supports all modes or none.
If a video processor supports multiple capabilities, it is not guaranteed
which algorithm will actually be selected, this is left to the driver.
However, ``blend`` and ``bob`` modes are enforced by not passing reference
frames and adjusting the output frame rate. The other modes are used to
select an appropriate video processor, but the algorithm chosen depends
on the driver and the content. ``ivtc`` mode outputs at the half rate.
.. note::
``ivtc`` mode only performs field matching and does not drop duplicate
frames. Duplicated frames can be removed manually using the ``decimate``
filter: ``--vf=d3d11vpp="deint:mode=ivtc,format=nv12,decimate=5"`` for
3:2 pulldown cadence. ``format=nv12`` is required to download frames back
to the CPU for decimation, the format should match the underlying format
of the d3d11 frame.
``nvidia-true-hdr``
Enable NVIDIA RTX Video HDR processing.
Enable NVIDIA RTX Video HDR processing. This only converts SDR to HDR,
so it is ignored when the source is already HDR.
``amf_frc``
AMD Frame Rate Conversion filter. Requires AMD hardware and drivers
supporting AMF FRC.
AMF FRC is a technique for achieving high-end video frame rate conversion
results from lower frame rate video inputs. The filter doubles the input
frame rate by generating intermediate frames.
AMF FRC only supports D3D11 input currently. Use `--hwdec=d3d11va` or
`--vf-pre=format=d3d11` to upload the data. `--d3d11va-zero-copy` is also
recommended for better performance.
``profile=<auto|low|high|super>``
Selects the quality profile for frame rate conversion.
``auto`` (default)
Select profile based on input resolution. Uses ``high`` for
resolutions up to 1440p, and ``super`` for 1440p and higher.
``low``
Less levels of hierarchical motion search. Only recommended for
extremely low resolutions.
``high``
Recommended for any resolution up to 1440p.
``super``
More levels of hierarchical motion search. Recommended for
resolutions 1440p or higher.
``mv-search=<native|performance>``
Selects the motion vector search mode.
``native`` (default)
Conduct motion search on the full resolution of source images.
``performance``
Conduct motion search on the down scaled source images.
Recommended for APU or low end GPU for better performance.
``fallback``
In case confidence is too low to do interpolation, fall back to simple
frame blending. If not set, the filter will repeat the last frame instead.
(default: no)
``indicator``
Specifies whether or not the FRC indicator square is shown in the top
left corner of the video. (default: no)
``future-frame``
When enabled, the information contained in the next frame in the
sequence will be used in FRC interpolation calculations, in addition to
the current pair of frames. This will introduce one extra frame time of
latency. (default: yes)
``fingerprint=...``
Compute video frame fingerprints and provide them as metadata. Actually, it
+9 -11
View File
@@ -118,8 +118,7 @@ Available video output drivers are:
Shared memory video output driver without hardware acceleration that works
whenever X11 is present.
Since mpv 0.30.0, you may need to use ``--profile=sw-fast`` to get decent
performance.
You may need to use ``--profile=sw-fast`` to get decent performance.
.. note:: This is a fallback only, and should not be normally used.
@@ -294,7 +293,7 @@ Available video output drivers are:
Instruct SDL to switch the monitor video mode when going fullscreen.
``dmabuf-wayland``
Experimental Wayland output driver designed for use with either drm stateless
Special Wayland output driver designed for use with either drm stateless
or VA API hardware decoding. The driver is designed to avoid any GPU to CPU copies,
and to perform scaling and color space conversion using fixed-function hardware,
if available, rather than GPU shaders. This frees up GPU resources for other tasks.
@@ -310,8 +309,8 @@ Available video output drivers are:
This driver is not required for mpv to work on Wayland. ``vo=gpu``
and ``vo=gpu-next`` will switch to the appropriate Wayland context
automatically. This driver is experimental and generally lower quality
than ``gpu``/``gpu-next``.
automatically. This video output is geared towards power efficiency
and has generally lower quality than ``gpu``/``gpu-next``.
``vaapi``
Intel VA API video output driver with support for hardware decoding. Note
@@ -319,6 +318,8 @@ Available video output drivers are:
This is low quality, and has issues with OSD. We strongly recommend that
you use ``--vo=gpu`` with ``--hwdec=vaapi`` instead.
.. warning:: This VO is deprecated will be removed next release.
The following global options are supported by this video output:
``--vo-vaapi-scaling=<algorithm>``
@@ -373,8 +374,7 @@ Available video output drivers are:
the images at full color range, but 256-colors output is also supported (see
below). On Windows it requires an ansi terminal such as mintty.
Since mpv 0.30.0, you may need to use ``--profile=sw-fast`` to get decent
performance.
You may need to use ``--profile=sw-fast`` to get decent performance.
Note: the TCT image output is not synchronized with other terminal output
from mpv, which can lead to broken images. The options ``--terminal=no`` or
@@ -629,8 +629,7 @@ Available video output drivers are:
environment (e.g. no X). Does not support hardware acceleration (if you
need this, check the ``drm`` backend for ``gpu`` VO).
Since mpv 0.30.0, you may need to use ``--profile=sw-fast`` to get decent
performance.
You may need to use ``--profile=sw-fast`` to get decent performance.
The following global options are supported by this video output:
@@ -739,7 +738,6 @@ Available video output drivers are:
Shared memory video output driver without hardware acceleration that works
whenever Wayland is present.
Since mpv 0.30.0, you may need to use ``--profile=sw-fast`` to get decent
performance.
You may need to use ``--profile=sw-fast`` to get decent performance.
.. note:: This is a fallback only, and should not be normally used.
+3 -2
View File
@@ -272,8 +272,9 @@ sub/:
sd_ass.c's internal state.
etc/:
The files input.conf and builtin.conf are actually integrated into the mpv
binary by the build system. They contain the default configs and keybindings.
The files input.conf, builtin.conf and menu.conf are actually integrated
into the mpv binary by the build system. They contain the default configs
and keybindings.
Best practices and Concepts within mpv
======================================
+1 -1
View File
@@ -1 +1 @@
0.41.0
0.41.0-UNKNOWN
+67
View File
@@ -0,0 +1,67 @@
# Security Policy
## Supported Versions
Only the most recent stable release of mpv is supported with security updates.
Older releases are **not** maintained and will not receive patches.
## What Qualifies as a Security Issue
mpv is a desktop media player. It is not designed to be exposed to untrusted
environments. By design, mpv provides features such as loading user scripts,
running subprocesses, and controlling playback via IPC. These documented
mechanisms are not considered security vulnerabilities.
A security issue is a bug in mpv's own code that allows untrusted input to cause
harm beyond the expected scope of playback. Examples include:
- Exploitable memory corruption (buffer overflows, use-after-free, etc.) caused
by crafted media files, subtitles, or playlists.
- Arbitrary code execution or unexpected file system access triggered by
malicious input.
- Information disclosure (e.g. unintended local file reads) through crafted
input.
The following are generally **not** considered security issues:
- Behavior resulting from documented features and interfaces.
- Denial of service (crashes, excessive memory or CPU usage) from crafted input.
These are typically unavoidable when processing complex media formats and are
treated as regular bugs.
- Bugs in third-party dependencies (FFmpeg, libass, libplacebo, etc.) that are
not caused by mpv-specific usage. These should be reported to the respective
upstream projects.
When in doubt, report it. We would rather triage a non-issue than miss a real
vulnerability.
## Reporting a Vulnerability
If you discover a security vulnerability in mpv, please report it responsibly
using **GitHub's private vulnerability reporting** feature:
1. Go to the [Security](https://github.com/mpv-player/mpv/security) tab of the
mpv repository.
2. Click **"Report a vulnerability"**.
3. Fill in the advisory form with as much detail as possible, including steps to
reproduce, affected versions, and potential impact.
This creates a private advisory visible only to you and our security team,
allowing us to discuss and address the issue before any public disclosure.
For more information on this process, see
[GitHub's documentation on private vulnerability reporting](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability).
## Direct Contact
If you are unable to use GitHub's reporting feature, you can reach out directly
to the security team:
- **@Akemi** - https://github.com/Akemi
- **@kasper93** - https://github.com/kasper93
## Disclosure Policy
- Please **do not** open public issues for security vulnerabilities.
- We aim to acknowledge reports promptly and work toward a fix in a reasonable
timeframe.
Loaded 100 of 431 files, more files were not shown because too many files have changed in this diff. Show more