Commit Graph

51569 Commits

Author SHA1 Message Date
Avi Halachmi (:avih) d70c77b6b6 js: complex key-binding: send also key_text
This is doumented and has been part of the table in lua, but until
now not in the JS object.

Fixes #13448
2024-02-09 16:54:57 +02:00
Dudemanguy a45518cf57 wayland: set current_output on surface leave if applicable
When the mpv surface leaves the output, we no longer mark it as the
current output. However, this implicitly depends on there being a
preceding surface entrance event to a different output. This is not
necessarily the case. Consider moving the window from monitor 1, to
monitor 1-2, and then back to 1 again. mpv gets the entrance event to
monitor 2 and sets that as the current output to work off of. Then when
you move back to only monitor 1, it removes monitor 2 from the current
output. However, monitor 1 is not updated again as the current output
because there is not a new surface entrance event in this case (the
window never left). So the numbers that mpv's core is using are
incorrect and for the wrong monitor. Luckily, we already keep track of
what outputs the mpv surface is currently on no matter how many there
are so it is simply a matter of setting current output again in the
leave event if we have a different output that has the mpv surface.

Ref: https://github.com/swaywm/sway/issues/7932
2024-02-08 22:26:15 +00:00
Kacper Michajłow 399a96db5b demux_mkv: set only image flag and ignore still_image
Also check if stream is already image to avoid probing.
2024-02-08 22:21:08 +00:00
Kacper Michajłow 9254231175 demux_mkv: increase probing size for still image
Some files, especially with quite a few audio tracks have video blocks
further away, which made them false detected as still images.

Fixes: 26a5146
2024-02-08 22:21:08 +00:00
Dudemanguy df720b5218 sd_lavc: support secondary subs properly
Before 3250f6e447, secondary subtitles
didn't work properly with sd_lavc at all. They would render but be in
the same position as the primary subtitles. sd_ass used SD_CTRL_SET_TOP
to specifically place secondary subtitles in a different spot, but it
was unused by sd_lavc. With that above mentioned commit, it became
possible to distinguish between the position of primary and secondary
subtitles via mpv's option system. sd_lavc was missed however because at
the time we simply didn't realize this could work and was actually
simple. With some subsequent refactoring that happened later, the fix is
to just use the correct sd->order when accessing the shared subtitle
options instead of hard coding 0. Fixes #13440.
2024-02-08 11:43:24 -06:00
Guido Cella 36153d1a4a console.lua: move functions to strip common characters
Move common_prefix_length() and related functions before the first call
to common_prefix_length(). It works now because it's global but if we
ever make all functions local for consistency it will stop working.
2024-02-08 18:18:33 +01:00
nanahi aa100d1512 f_output_chain: prevent double free of child filters
When mp_output_chain_update_filters() fails, talloc_free() is called on
each mp_user_filter. But because the structure doesn't have a talloc
destructor, the args aren't freed, resulting in stale references.

Fix this by calling the destructor of the wrapped filter instead.
2024-02-08 18:16:21 +01:00
Dudemanguy fd2c5ee21d stats.lua: use deinterlace-active property instead
But still read the deinterlacing option to distinguish between yes and
auto.
2024-02-07 14:50:09 +00:00
Dudemanguy 003fb15cbb player/command: add deinterlace-active property 2024-02-07 14:50:09 +00:00
Dudemanguy 8dbbc2ad82 player: add an auto option to deinterlace
Deinterlacing required that the user set it on/off themselves, but we
actually have handy flags for detecting if a frame is interlaced. So
it's pretty simple to make an auto option using that. Unfortunately,
life is not quite that simple and there are known cases of false
positives from the ffmpeg flags so we can't make auto the default value.
However, it still may have some utility for some people, and the
detection could potentially be improved upon later. Closes #10358.
2024-02-07 14:50:09 +00:00
Kacper Michajłow 9ce2bafbe9 vo_vdpau: cosmetic changes to timings
Remove unneded range check.
Print time difference with more precision.
Use the same data formats for fps and interval as in other VOs.
2024-02-07 14:45:07 +00:00
Kacper Michajłow 5d8faff9bf ao_sndio: add missing config.h include 2024-02-07 14:44:52 +00:00
nanahi 29c250c8d8 github/workflows: ignore more files from build workflow
Exclude more files not participating in the build process,
including README.md, to achieve the original goal of preventing
artifacts comment spam.
2024-02-07 14:44:01 +00:00
Guido Cella b8c6070f01 demux_mf: detect webp
This lets you play mf://*.webp. It is not necessary to play webp
normally because they are already detected by demux_lavf.
2024-02-06 18:08:53 +01:00
Guido Cella addf4ad023 Revert "demux: put type2format into codec_tags with helper functions"
This reverts commit be0a979a0b.

The list of images codecs is no longer used by demux_mkv.c because
26a51464b6 made it check the number of blocks instead to not misdetect
animations in image codecs, so move it back to demux_mf.c since it is
its only user, so it is easier to understand how it is used, keeping the
jxl addition from e9d0a31dfe.
2024-02-06 18:08:53 +01:00
Dudemanguy 343a5fd345 player: remove all rpi-specific code
vo_rpi and its related code has pretty much historically been a
disaster in mpv. The build regularly gets broken and since nobody uses
it, it takes months for anyone to notice. There was also that time where
fullscreen was broken for about a year and a half. Also building in waf
was entirely broken for about a couple of years or so due to mysterious
reasons no one ever figured out (meson magically fixed it).

Anyways, once again the build is broken due to rpi being forgotten about
again, but instead of pretending to support this crap. Just drop it all.
Nowadays, mmal hwdec is a relic since these devices are better off using
the v4l2m2m ffmpeg fork instead which actually uses KMS properly. RPI 1
and 2 probably can't do this and will remain broken but oh well blame
Broadcom for being special snowflakes and not using standard APIs (my
rockpro worked out of the box; just saying). RPI 2 is nearly 10 years
old anyways, so I think you can afford a new SBC by now. If we were
nicer, there would be a deprecation period, but this is broken in the
last major release anyway so too late.

Closes #13402.
2024-02-05 17:41:06 +00:00
Thomas Weißschuh 8ecb462a9c audio: rename ao_read_data_unlocked
As mentioned in [0] the suffix "_locked" would have been the appropriate
naming in line with similar uses inside mpv.
See `mp_abort_recheck_locked()`, `mp_abort_trigger_locked()`,
`retrigger_locked()`, `wakeup_locked()`...

[0] https://github.com/mpv-player/mpv/pull/12811#discussion_r1477518525
2024-02-05 09:25:48 -08:00
Dudemanguy 531868fe0d player: ensure runtime updates of certain rendering options
When adding things like brightness or gamma, the video obviously needs a
redraw if paused. This happened to work in the normal case because the
OSD notification triggered a redraw, but if you use no-osd the picture
won't change. Fix this by adding another option flag, UPDATE_VIDEO, and
simply signalling we want a redraw. This gets handled along with the
normal osd redrawing check in the playloop so something like "no-osd add
gamma 1" actually works.
2024-02-05 17:23:47 +00:00
Kacper Michajłow 7616190aa4 github/workflows: revert to github-script@v6
There is an upstream regression in v7. Use v6 until Node 16 is still
available.

See: https://github.com/actions/github-script/issues/448
2024-02-05 11:13:18 +01:00
Dan Oscarsson b23e8b2ffb vo_vdpau: fix timing for nanoseconds
df764bc0c3 and
c82c55b4b9 blindly converted the units for
this VO since neither of us actually have the hardware/setup to test the
VO. Well it was not actually correct (maybe just one was wrong or both
who knows) since vo_vdpau using timing very differently than all the
other VOs and no one reported on it until just now. Anyways, just apply
this random patch from @DanOscarsson which apparently works for him and
call it a day. Fixes #13397.
2024-02-04 10:01:49 -06:00
Guido Cella 4ab521f080 command: add load-input-conf
This can be used to auto reload the input configuration file, e.g. in
vim:

autocmd BufWritePost ~/.config/mpv/input.conf silent !echo load-input-conf %:p | socat - /tmp/mpvsocket

Partially fixes #6362.

Additionally this can be used as a replacement for deprecated input
sections if they are ever actually removed. For example, if you want to
define different bindings for images, you can load-input-conf an
input.conf for images, and load the original again when switching to a
video. Though currently you would have to redefine builtin bindings that
were overwritten with image ones in the default input.conf.
2024-02-04 15:12:02 +00:00
Guido Cella 68e3412fee input: make parse_config_file return bool
This return value is only used to set bool config_ok in
mp_input_load_config so it makes more sense to return bool.
2024-02-04 15:12:02 +00:00
Guido Cella 484ab32a41 input: remove unused parameter from parse_config_file
This is unused since fb4d26e769.
2024-02-04 15:12:02 +00:00
Guido Cella e2284fba18 command: add load-config-file
Unlike set include mpv.conf, this works after playback has started. It
can be used to auto reload the configuration, e.g. in vim:
autocmd BufWritePost ~/.config/mpv/mpv.conf silent !echo load-config-file %:p | socat - /tmp/mpvsocket

Partially fixes #6362.
2024-02-04 15:12:02 +00:00
nanahi 27cb193f0e wayland_common: warn if scrolling will be broken
Since the scroll event handler is moved to wl_pointer_frame, version 5 of
wl_seat is required. Warn that scrolling is broken if the compositor
doesn't support that verison.
2024-02-04 02:14:11 +00:00
nanahi e0f9cf61b9 wayland_common: add touch listener boilerplate
Required if seat version >=6 is used.
2024-02-04 02:14:11 +00:00
nanahi b3edb46fd9 wayland_common: prefer axis_value120 if supported
Prefer axis_value120 for high resolution scrolling if supported, which
matches the existing win32 behavior.
2024-02-04 02:14:11 +00:00
nanahi f95b7146d7 wayland_common: properly handle high resolution scrolling
Commit f54ad8eb05 broke high resolution
scrolling because one logical mouse click is generated for every scroll
event, no matter the magnitude. This makes scrolling on trackpad way
too fast.

Revert the axis scaling change in that commit and clamp the resulting
value between -1 and 1 to make sure mouse wheel scrolling works as
intended on compositors which send a value larger than 10 for these events.
2024-02-04 02:14:11 +00:00
Guido Cella fe0c181b1c DOCS/mpv: document how mf:// URLs are formed 2024-02-02 11:39:47 +01:00
Guido Cella b2bc3c239c demux_mf: explain why a printf format is unsupported 2024-02-02 11:39:47 +01:00
Guido Cella f935dafa24 demux_mf: remove code repetition 2024-02-02 11:39:47 +01:00
nanahi aaaadc9d6b x11_common: support --title-bar
Some X11 window managers support controlling the title bar independently
from other window decorations with _MOTIF_WM_HINTS. This allows hiding
the title bar while keeping other decorations like the resizing borders.

Let mpv respect the --title-bar option on X11 so --no-title-bar can hide
the title bar only like on win32.
2024-02-02 11:39:30 +01:00
Dudemanguy 26a51464b6 demux_mkv: detect images by reading blocks and timecodes
4709a94aec along with some related commits
added a way to detect image codecs embedded into mkv streams that
weren't tagged with attached picture (arguably a broken file anyways,
but maybe not the worst thing to workaround). Unfortunately, this has
some false positives particularly with mjpeg playback. So, as usual,
revert and rewrite. Instead, we can probe the file and count blocks in
the stream. If the video stream has only 1 block and 1 timecode, then
assume it's a still image.
2024-02-01 22:12:22 +00:00
Dudemanguy 289b3a432e Revert "demux_mkv: check if the video codec is an image"
This reverts commit 4709a94aec.
2024-02-01 22:12:22 +00:00
Dudemanguy adcc6794b5 wayland: look for "default" cursor as well as "left_ptr"
Some themes are apparently getting rid of "left_ptr" and using the
cursor spec names instead. Check for "default" as well. Fixes #13376.
2024-02-01 15:26:46 +00:00
Kacper Michajłow 57d6826249 meson: bump libplacebo required version to 6.338.2 2024-01-31 15:38:21 +00:00
Kacper Michajłow e2e75906da io: add mp_save_file
Move from vo_gpu_next.c to io.c and return result.
2024-01-31 15:38:21 +00:00
Kacper Michajłow 69891c4070 vo_gpu_next: save cache to separate files
Save the cache to separate files to avoid loading/saving a huge combined
libplacebo.cache. This approach allows the saving of only new cache
objects and avoids resaving the entire cache, especially even if only a
tiny change was made.

This commit improves the cold start time of mpv and avoids saving data
when it's not necessary.

Number of changes were made:
- each cached object is saved in its own file
- cache files are prefixed with the name of cached object
- cache directory is cleaned on each uninit
    - the least recently used cache files are removed if cumulative cache
      size is above limit
    - files used in the recent 24 hours are not removed to allow changes
      to mpv.conf without worrying about the cache being removed during
      experimentation
- shader cache size limit is set to 128 MiB
- icc cache size limit is set to 1.5 GiB
- cache objects are loaded/saved as needed

This commit eliminates the runtime performance penalty associated with
the size cache. While we continue to maintain the cache limit to prevent
retaining stale objects, mpv now only loads a small subset of files that
are currently required for playback, instead of loading all files.
2024-01-31 15:38:21 +00:00
Kacper Michajłow a59b8edb96 stream: increase max_size to INT_MAX minus padding
No need to magic number limit, we can support up to INT_MAX with current
code. Which should be more than enough.
2024-01-31 15:38:21 +00:00
boogie d90a5ff17a hwdec_drmprime: add P010 and P210 support 2024-01-28 13:56:58 -08:00
sfan5 c6ccabe585 hwdec_aimagereader: handle lack of JNI gracefully
Hwdec drivers are always loaded so it's rude to abort.
fixes #13367
2024-01-27 22:35:25 +01:00
sfan5 dcf8adf289 common: don't force terminal log buffer to small size
Using the 'terminal-default' log level a client can request
to get all messages that would normally appear on the terminal.

8c2d73f112 changed the size of the
relevant buffer to 100 lines, which was prone to quickly overflowing
once you enable verbose or debug output.
This size is kept for the early terminal buffer but now enlarged
once a client actually requests this log level. This fixes the overflow
risk while not consuming more resources if this feature is unused.
2024-01-27 10:04:16 +01:00
nanahi c08e626578 version.h.in: bump copyright year 2024-01-27 10:00:36 +01:00
Kacper Michajłow dd491c7c61 vo: change vo_frame duration to double
32-bit signed integer can hold ~2.1s stored as nanoseconds. While frame
duration doesn't make sense to be this long, the existing clamp is to
10s. Change type to double, which is consistent with other fields in
vo_frame.
2024-01-27 05:12:36 +00:00
Dudemanguy c243946338 vo_dmabuf_wayland: scale smarter in hidpi situations
Previously, all scaling was forced to 1 with this vo and all coordinates
were calculated as if the scale was 1. This works since viewport relies
on the compositor completely for scaling so it doesn't really matter if
we don't draw directly to the correct size since the compositor will
just scale the rest for us. This does have some downsides however since
the OSD text might not be drawn at the actual resolution of the final
size of the video.

We can instead handle this by getting rid of the dmabuf_wayland specific
scaling logic and using the same values as everything else. In the
resize in vo_dmabuf_wayland, we just need to adjust the viewport
destination calls so they go to the wayland local coordinates and not
the physical ones. This should ensure that vo_dmabuf_wayland directly
goes to the desired size and the compositor doesn't need to operate on
it after the fact.
2024-01-27 05:12:12 +00:00
Dudemanguy ded181f642 wayland: don't rescale dimensions if hidpi-window-scale is disabled
If the scaling value changed for some reason, the window geometry would
be recalculated with the new scaling even if this option was disabled.
Properly ignore it.
2024-01-27 05:12:12 +00:00
Dudemanguy e32554cd57 wayland: drop buffer_scale use for viewporter
The core wayland protocol way of handling scaling is to use the
buffer_scale mechanism. But this sucks in several ways for reasons I
won't list here and fractional scaling rightly avoids this altogether
and uses a buffer_scale of 1 (i.e. not setting it) along with
viewporter. When originally implemented, this was only specifically used
when the fractional scale protocol was available, but we actually can
use it as a full replacement instead. This means that mpv now hard
requires viewporter, but this protocol is supported by everyone and is
one of the few that is actually stable.

How it works is the same regardless of fractional scaling or not. When
the compositor has a scale value not equal to 1, it will always scale
the client by that factor (unless you set buffer_scale). What we do here
is pass a viewporter size that exactly undos the compositor-side scale
(sans a possible rounding error). So what we are left with is just the
exactly physical pixels we want to display. Fixes #13316.
2024-01-27 05:12:12 +00:00
Dudemanguy 99d387bbc8 vo: ensure a dropped frame is always freed
7b8a30fc81 made it possible for a VO to
have direct ownership of frame objects since the it may be beneficial
for the frame to follow the lifecycle of that particular VO instead
(i.e. the wayland compositor for dmabuf-wayland). But when frames are
dropped, this always has to be unconditionally freed since the VO isn't
aware of it. Fixes #13364.
2024-01-26 22:56:50 -06:00
Kacper Michajłow e9076896cd all: add missing repr assignments
Fixes: 66e451f4
2024-01-26 18:17:02 +02:00
Kacper Michajłow 7b67b1ddd3 github/workflows: update actions package versions 2024-01-26 03:28:55 +00:00