Commit Graph

53776 Commits

Author SHA1 Message Date
Kacper Michajłow
d759e26fd0 libmpv: use correct header directory name
libmpv headers are installed to `mpv/`, so why are we pretending it is
`libmpv`?

Fixes documentation, libmpv meson dependency, tests.
2025-02-23 01:40:12 +01:00
Kacper Michajłow
77313f73a2 various: reduce the include scope of some public headers 2025-02-23 01:40:12 +01:00
Guido Cella
b848ffad12 select.lua: fix LSP warning
I don't know why I didn't get it before but Lua's LSP now complains with

Compute `"Edition " .. (edition.id + 1)` first. You may need to add
brackets. [ambiguity-1].

Just move the parenthesis to make it happy.
2025-02-22 15:32:27 +01:00
Dudemanguy
448abf1e3b wayland: add icc support using wp-color-management-v1
This makes --icc-auto work on wayland. Closes #8151.
2025-02-21 20:54:25 +00:00
Julian Orth
ebe31c912e vo_dmabuf_wayland: remove unnecessary commit
This commit does not take effect until the next video_surface commit
anyway.
2025-02-21 17:23:56 +00:00
Julian Orth
76da05092b vo_dmabuf_wayland: commit surfaces in correct order
osd_surface is a sync sub-surface of video_surface meaning that a commit
of osd_surface will not take effect until the next commit of
video_surface.

Some compositors (wlroots) do not implement sync sub-surface correctly,
meaning that the difference cannot be observed there. But it can easily
be seen on Jay and GNOME:

1. Open an mpv window.
2. Pause the video.
3. Enter the surface with the mouse.

Expected behavior:

1. The OSD shows up immediately.

Actual behavior:

1. Nothing happens for a few seconds.
2. The OSD shows up and immediately fades out.

This is because the fade-out commits cause the initial osd_surface
commit to become effective.
2025-02-21 17:23:56 +00:00
Dudemanguy
b90c1bb21b DOCS/man/mpv: remove bogus --cdrom-device mention
Missed in 131973806d
2025-02-21 17:23:45 +00:00
Yozora80
131973806d Revert "stream_{bluray,cdda,dvdnav}: deprecate setting device after schema"
This reverts part of PR #15899 (commit dd6e3a0ece).

"Why is this even useful?": It's very useful for multi-disc playlists. Compare:
`mpv bd:///DISC{1..4}`
`mpv -\{ bd:// --bluray-device=DISC1 -\} -\{ bd:// --bluray-device=DISC2 -\} -\{ bd:// --bluray-device=DISC3 -\} -\{ bd:// --bluray-device=DISC4 -\}`
2025-02-21 15:26:23 +00:00
Guido Cella
41f2bab8c9 console.lua: complete frame-step flags 2025-02-21 15:47:06 +01:00
Guido Cella
d840e7846c select.lua: don't add File info to the menu when no file is playing 2025-02-21 15:45:37 +01:00
Guido Cella
e32beaa0db input.conf: bind Shift+{HOME,END} to go to the first and last file 2025-02-20 15:54:11 +00:00
Guido Cella
036528d44d input.conf: bind HOME to seek to the beginning 2025-02-20 15:54:11 +00:00
Dudemanguy
4394ca5b6c demux: use a slightly better hack when seeking with dvd/bd
Basically just bits of a9d83eac40 that was
removed and ported to here. Not really smart but it seems like flushing
buffers during seek generally leads to better behavior and avoids some
errors. The additional stream_seek call that was being performed is
definitely bogus (will never work and spams errors). So that is skipped
for bd/dvd. SEEK_FORCE is no longer needed. Instead demux_disc calls
drop_buffers on the slave demuxer (i.e. lavf).
2025-02-20 15:50:25 +00:00
Dudemanguy
25a0c8307d player: add an optional mute flag when framestepping
Need to shuffle some stuff around but it's pretty simple. Mute the
audio stream before the frame step and then unmute it when we're done.
It's exactly the same as the default play mode otherwise.
2025-02-20 15:50:03 +00:00
Dudemanguy
723da77def DOCS/man/mpv: explain how to select and navigate through cdda
It's not exactly obvious and worth mentioning.
2025-02-20 15:49:45 +00:00
Dudemanguy
bb3265b9d3 stream_cdda: deprecate undocumented --cdda-span-{a,b} options
You probably wouldn't guess what this does from the name alone, but it
actually selects a range of tracks to play. It's slightly different than
using --start because it confines the range to just that track and you
cannot seek before it. The functionality is useful, but you can
accomplish exactly the same thing with --start and --end. Also the
implementation of the cdda option is weird because starting from a track
after 1 makes it impossible to seek before it. There's no reason to have
this when using the core option is simply better and works fine.
2025-02-20 15:49:45 +00:00
Dudemanguy
dd6e3a0ece stream_{bluray,cdda,dvdnav}: deprecate setting device after schema
This is allowed but it's pretty weird. You'd end up typing something
like dvd:////dev/sr0 or cdda:///dev/sr0 (notice the differing amount of
/). Why is this even useful? Just use the matching --cdda-device option.
There's no need to have two ways to do the same thing here.
2025-02-20 15:49:45 +00:00
llyyr
c9970b5ba6 ao_pipewire: don't load client-rt.conf properties
Deprecated in 24bcacc619

Fixes: #15914
2025-02-20 15:49:01 +00:00
der richter
9618aa3b21 DOCS/man/options: remove outdated wid embedding docs for cocoa
the old deprecated cocoa backend that supported wid embedding was
removed with fc4db18.
2025-02-20 15:48:44 +00:00
nanahi
f9271fbffe DOCS/man/options: fix missing space in hwdec doc
Fixes: d7159e4662
2025-02-19 17:26:39 +00:00
Guido Cella
6df54fa7b1 DOCS/man/options: document that --save-position-on-quit affects loadfile 2025-02-19 18:19:23 +01:00
der richter
76e3e8ae45 mac/dialog: release all input keys when modal steals key input
modal dialogs steal the key/mouse input and possibly eat corresponding
key up events when opening via key binding. this leads to key sequence
ends to not reported and key bindings not being triggered if no key up
event was triggered after closing the modal.
2025-02-19 16:10:25 +01:00
der richter
209521ff7c mac/dialog: remove delayed becomeFirstResponder() workaround
use the proper initialFirstResponder variable
2025-02-19 16:10:25 +01:00
Kacper Michajłow
fc2f176764 osdep/io: harden string conversions
We already abort if initial call fails, so there is no reason to not to
the same, even if we fully expect it wouldn't fail at this point.
2025-02-19 02:50:17 +01:00
Kacper Michajłow
2e0ccedfa1 win32-console-wrapper: don't use CRT in runtime wrapper
This is only needed for spawning main mpv process, there is no need to
spin CRT just to call main() and support basic memcpy.

Additionally adjust compilation flags to reduce the size of mpv.com.

This is the small binary using only kernel32 as dependecy now.

Stripped mpv.com built with clang 19.1.7 (x86_64-w64-windows-gnu)

Before:
   text    data     bss     dec     hex filename
   6982    7281       0   14263    37b7 mpv.com

After:
   text    data     bss     dec     hex filename
   1094    2894       0    3988     f94 mpv.com

Depending on compiler and options the size may vary. For example with
-flto and -Wl,-gc-sections it is:
   text    data     bss     dec     hex filename
    833     750       0    1583     62f mpv.com

but gc-sections were rejected as an default option before.

As a bonus add some error checking to this code.
2025-02-19 02:50:17 +01:00
Kacper Michajłow
30ea5da702 win32-console-wrapper: simplify error printing
No need for pointless prefix, print error directly. Don't use CRT
function. This will write only to console, but it's not meant to be
written to file anyway.
2025-02-19 02:50:17 +01:00
nanahi
66a7338027 f_decoder_wrapper: warn when using video-aspect-override of 0 or -1 2025-02-18 23:05:02 +00:00
nanahi
ccaa0e3d56 command: print "original" also for aspect ratio of "no" 2025-02-18 23:05:02 +00:00
nanahi
02199aeb3f input.conf: use no instead of -1 for video-aspect-override 2025-02-18 23:05:02 +00:00
nanahi
13f94700d9 f_decoder_wrapper: add --video-aspect-method=ignore
This adds --video-aspect-method=ignore to replace --video-aspect-override=0.
--video-aspect-override=0 and --video-aspect-override=-1 will no longer be
handled specially. For compatibility, 0 is mapped to always use ignore
and -1 is always mapped to always use container.

"no" is now the replacement for --video-aspect-override=-1, which is
internally remapped to -2 to avoid using a deprecated value.
2025-02-18 23:05:02 +00:00
nanahi
4456dc1d1f Revert "m_option: forbid non -1 negative values for video-aspect-override"
This is poorly implemented and will break existing scripts which set
the value directly with double without a string value, like
mp.set_property_native, or if the value is set with add/multiply commands.
Revert this until a better solution is found.

This reverts commit cb91de2a34.
2025-02-18 23:05:02 +00:00
nanahi
704f995c49 Revert "m_option: deprecate setting -1 to --video-aspect-override"
This reverts commit 18257375e4.
2025-02-18 23:05:02 +00:00
nanahi
184ace21a0 DOCS/man/options: fix sub-ass-video-aspect-override documentation
Negative values have never worked for this option since it's clamped
to M_RANGE(0, 10).
2025-02-18 23:05:02 +00:00
nanahi
84ae87bedd DOCS/man/options: use american spelling for "behavior"
For consistency with rest of documentation.
2025-02-18 23:05:02 +00:00
Dudemanguy
1a70de259d wayland: add some sanity checking when setting mastering luminance
Actually found a file in the wild that violated this which is a protocol
error (fatal).
2025-02-18 23:04:54 +00:00
Dudemanguy
d26131e158 wayland: cleanup redundancy and global state in color-management
Maybe the xx version was different (probably not), but looking over this
code again it's pretty clear that there is a lot of unneeded
complication. There's no need to keep track of the image description,
creator params, etc. globally. This can all be passed around on the fly.
Also, reset_color_management was redundant because it would execute on
reconfig and also on the first draw after the reconfig. We don't need
both so delete the reconfig path. Collapse the various color functions
into one simple "set_color_management" and let the wayland listeners do
all the object destroying for us.
2025-02-18 23:04:54 +00:00
Dudemanguy
59c4ab5339 vd_lavc: add auto-unsafe and auto-copy-unsafe to the opt help
d7159e4662 added these two new options.
2025-02-18 22:42:19 +00:00
Dudemanguy
cd5378e1ef vd_lavc: nuke some mmal remnants
343a5fd345 killed all mmal hardware
decoding, but there was still some junk lying around. There's
IMGFMT_MMAL still, but that's harmless to keep around.
2025-02-18 22:42:19 +00:00
Kacper Michajłow
97e4cd35a5 meson: minor simplification in link flags 2025-02-18 22:31:39 +01:00
Kacper Michajłow
ea045b4755 osdep/timer-win32: add missing guards for ARM64
Does anyone compile libmpv for UWP?

Fixes: e908efe0b9
2025-02-18 10:47:03 +01:00
Dudemanguy
bfb67c60b2 wayland: unvoid some wayland protocol structs
I started doing this in f594482451 for
protocol objects that were newer than the lowest version, but I can't
remember why (some waf-related reason?). This wasn't even followed for
other PRs merged recently like ext-data-control and color-management.
Anyways, it's not needed and works fine if you're on wayland-protocols
1.31 so stop doing this void weirdness.
2025-02-18 03:56:43 +00:00
Xaver Hugl
6bfbaf6bc6 wayland: update color management protocol to the upstream version 2025-02-17 23:36:02 +00:00
Kacper Michajłow
5e3f8d336d input.conf: add ctrl+p and g-m keybind for menu
Many keyboards doesn't even have MENU key and ctrl+p is common keybind
for command style menus like this one.
2025-02-17 22:54:04 +01:00
Kacper Michajłow
3baa255d47 builtin.conf: set menu corner_radius to 0 in box profile
OSD mesages are floating in exactly the same way as menu, they should be
consistent.
2025-02-17 22:54:04 +01:00
Kacper Michajłow
ba31aa72ba console.lua: use the same opacity for menu as for everything else
There was a mistake of using hex (50) instead of decimal (80) it is
converted to %x later on.
2025-02-17 22:54:04 +01:00
Kacper Michajłow
e908efe0b9 osdep/threads-win32: add implementation for mp_thread_cpu_time_ns() 2025-02-17 22:50:03 +01:00
Avi Halachmi (:avih)
1c3eecd821 common/stats: improve accuracy of quick timed measurements
Previously stats_time_start first sampled cpu-time and then real-time,
while stats_time_end sampled them in reverse order.

This resulted in real-time delta values being possibly a bit smaller
than the respective cpu-time deltas, which could become meaningful if
the start/end durations are consistently very short and very frequent.

In one test case (measuging the time spent at the event loop of
a script which spins on zero timeouts), this resulted in accumulated
real-time value of ~230ms per second, with a respective cpu-time
values of ~500ms. This should not be possible with single thread load.

Now start and end sample the values at the same order, so that it
balances on average. Each start/end delta now includes overhead of one
of each sample type, and excludes one of each sample type on average.

With the test case above, it's now 490 +-1 ms for both.
(the other 510ms real-time are at the excluded mpv_wait_event calls
and the unmeasured-overhead-parts of stats_time_start/end).
2025-02-17 22:50:03 +01:00
Avi Halachmi (:avih)
be68ca94ad common/stats: fix incorrect cpu-time value reset
This fixes a bug where if stats reset happened after stats_time_start
and before stats_time_end, then the next reported cpu-time value of
that measurement was from the thread startup.

The long version:

stats resets the time-accumulated values if more than two seconds
ellapsed since last poll.

The reset keeps the elements, but makes them as if no measurement was
yet taken, so that they don't show up at new reports until a new
measurement is taken.

While the events and (untimed) cpu are reset, the timed-cpu value
was only partially reset - the values are reset but the indication
that the element is empty was not enough for stats_time_end.

So when reset happened between start/end calls, stats_time_end was
entered eventhough it shouldn't have, but with reset cpu-time value
it calculated the time since the thread's startup, hence this bug.

Further polls were ok, because they are of the delta since the
previous poll. But at the next reset it happened again.

Now the cpu-value is reset correctly, which fixes this bug.
2025-02-17 22:50:03 +01:00
Avi Halachmi (:avih)
7162c960e7 common/stats: report: account for ongoing timed-measuremets
stats_time_start and stats_time_end accumulate real-time and cpu-time
between these calls, but the total was only updated on stats_time_end.

This resulted in two issues:
- Inaccurate measured value if a report (read the perf-info property)
  happened between start/end. No biggie because it's OK on average and
  typically each start/end duration is quite smaller than the interval.
- If the start/end duration is bigger than the interval, then one or
  more intervals had a report value (delta) of 0, and then one report
  with a value bigger than the interval - which shouldn't be possible.

This commit effectively does end+start at the report time for ongoing
timed measurements, so that the report accounts for them too.

Doing end+start at the report required two more changes:

Store the element type (VAL_TIME) at stats_time_start rather than at
the end. Otherwise if the report happens after the first start but
before the first end, then the type is not yet set and the element
is skipped at the report (bypassing the end+start).

Store the thread id at the element. start/end measure the cpu-time at
the current thread so they used pthread_self(), but with the report
usually running on a different thread, it needs the thread id for the
measurement. Measuring cpu-time from a different thread is OK, and
already happens with VAL_THREAD_CPU_TIME elements during the report.

While at it, stats_time_end now uses the thread id which was stored on
start instead of using pthread_self(). This also serves as a general
protection against measuring start/end from different threads, which
would yield generally meaningless results anyway. In mpv all the
start/end calls for the same element are at the same thread.
2025-02-17 22:50:03 +01:00
Avi Halachmi (:avih)
40fb226cc2 common/stats: don't report cpu-time on unsupported platforms
On Windows and any other platform where cpu-time is unsuported,
previously the cpu-time was reported as 0, and now it's omitted
(at the perf-info property native value).

Code which process this report, like stats.lua, could not distinguish
between 0 which was due to unsupported platform, and "real" 0 which
indicates zero cpu activity in this poll-period.

In stats.lua this resulted in a whole lot of empty cpu graphs,
including one for every loaded script.

Now cpu-time is excluded from the report on unsupported platforms.
Real-time is obviously still being reported where requested.

Implementation wise, this is slightly hacky, by literally only
excluding the cpu-time nodes from the report itself, while keeping
all the other cpu-tinme code intact.

A more correct solution might be to identify support at compile
(configure) time, and no-op the relevant code if needed.

However, stats.c is already hacky in parts, and there's no real cost
to keeping the code active even if the result is excluded at the
report, and it's also way simpler and less bug prone. So be it.
2025-02-17 22:50:03 +01:00