Commit Graph

50417 Commits

Author SHA1 Message Date
sfan5 f4210f8490
Release 0.36.0 2023-07-23 19:10:36 +02:00
sfan5 5236003db5 Revert "vo_gpu_next: use pl_dispatch_info_move to avoid useless data copy"
We wanted to preserve the libplacebo v5.264.0 requirement for gpu_next
for this release, since this is the what most Linux distributions are shipping.
The VLC 3 <-> libplacebo v6 situation is an additional reason distros are not
likely to ship the newest libplacebo release soon.
This reverts commit b73d96776c.
2023-07-23 15:40:41 +02:00
Thomas Weißschuh 007019a303 ao_pipewire: for_each_sink: properly check termination condition
Doing a pw_thread_loop_wait() without checking conditions is invalid.
The thread loop could be signalled for other reasons and in this case
the wait needs to continue.

PipeWire added such additional signaling in
commit 33be898130f0 ("thread-loop: signal when started").

This meant that for_each_sink would return before the callbacks have
fired and session_has_sink() would incorrectly return "false", failing
the initialization of ao_pipewire.

Fixes #11995
2023-07-23 13:31:03 +02:00
Dudemanguy e8126e54e5 DOCS/vo: clarify dmabuf-wayland a bit
Make it clearer that you should be using --hwdec with this VO. Also make
some comments about the things that are required for this to work
correctly (i.e. working drivers/GPU and the right compositor).
2023-07-23 04:55:26 +00:00
Dudemanguy 783e2bf138 vo_dmabuf_wayland: correctly handle force-window
Since this works by mpctx giving us a dummy image, we can be reasonably
be confident that when we receive a matching imgfmt with no underlying
hw_subfmt that this is simply force window from the player. Just allow
this to go through the usual wayland logic and skip the hwdec checking.
When we get the real image later, it will still error out on the
compositors that don't have proper support.
2023-07-23 04:55:26 +00:00
Dudemanguy ca4192e2df player/video: check for forced eof
It's a bit of an edge case, but since we now allow the disabling of the
software fallback it's possible to have a situation where hwdec
completely fails and the mpv window is still lingering from the previous
item in the playlist. What needs to happen is simply that the vo_chain
should uninit itself and handle force_window if needed. In order to do
that, a new VDCTRL is added that checks vd_lavc if force_eof was set.
player/video will then start the uninit process if needed after getting
this.
2023-07-22 17:42:25 +00:00
Dudemanguy 61f0797557 vd_lavc: respect vd-lavc-software-fallback opt
There's an option that's supposed to stop mpv from falling back to
software decoding if hardware decoding fails. Except that it doesn't
work and can fallback to software decoding anyway. Correct this by
checking if all possible hwdec failed after the loop in
select_and_set_hwdec and that we have this option. If so, flag a bool to
force eof. In decode_frame afterwards, we then simply immediately return
an EOF.
2023-07-22 17:42:25 +00:00
Gusar321 bddf0efade vo_vaapi: restore hardware video decoding
Commit e50db42 changed how hwdec interop works. Adjust vo_vaapi accordingly by setting the appropriate image format.
2023-07-22 12:16:29 +02:00
Gusar321 800d9eaa42 vo_vaapi: fix segfault in draw_osd
When video width is not a multiple of slice size, the last slice will overflow. Fix this by adjusting the width of the last slice to fit within the video.

Fixes issue #10436
2023-07-22 12:16:29 +02:00
Thomas Weißschuh c9064b57c0 ao_pipewire: use native buffersize by default
Instead of trying to guess the correct number in mpv let the pipewire
server choose.

Fixes #9992
2023-07-22 12:16:21 +02:00
NRK 2dc8e70093 terminal-unix: fix not listening on input after being foregrounded
fixes regression caused by 2e7fcc5a2 where it wouldn't receive terminal
input if the process was foregrounded later on like this:

    $ mpv something.mp4 &
    $ fg

ref: https://github.com/mpv-player/mpv/issues/11795
2023-07-21 20:47:03 +02:00
llyyr 4198e6f35f osc: don't add margins to osc-deadzonesize
Currently, the osc will add a margin of (osc_height / 2) to the
deadzonesize for the window controls, the topbar and the bottombar,
i.e. when osc-deadzonesize=1, the osc will show up even if the cursor
is only hovering (osc_height / 2) pixels above or below it. This is not
what this option is supposed to do according to the manual, instead
osc-deadzonesize=1 should result in the osc only appearing when it is
directly hovered. The user can simply set osc-deadzonesize=0.9 or so if
such a margin is desired, instead make the option work as advertised by
removing this margin.

It should be noted that osc-layout=box does not share this behavior,
and it already works as advertised in the manual.
2023-07-21 20:24:18 +02:00
Dudemanguy 45b006b958 DOCS: clarify screenshot window and screenshot-sw 2023-07-21 20:23:11 +02:00
Dudemanguy 9a95cb9fd1 vo_drm: remove VOCTRL_SCREENSHOT_WIN
With the generic screenshot window implemented, this is no longer
needed since vo_drm already uses software scaling.
2023-07-21 20:23:11 +02:00
Dudemanguy d16c59096c screenshot: implement screenshot-window in sw for most VOs
mpv already has a bunch of software scaling utils. Instead of forcing
every VO to implement this, we can just grab the frame and scale it in
software in one central place. Fixes #11968.
2023-07-21 20:23:11 +02:00
Dudemanguy 97457a837e screenshot: clarify software screenshot logic
We should always be trying hardware screenshots (VOCTRL_SCREENSHOT and
VOCTRL_SCREENSHOT_WIN) before software ones. Rearrange all the logic
here to hopefully make this clearer. The mode is passed to add_osd
(renamed since it will also be used to add the osd) which will be used
more in the next commit.
2023-07-21 20:23:11 +02:00
NRK fd03d0038b image_writer: use proper specifier for int64_t 2023-07-20 20:38:06 +02:00
sfan5 15252e13d5 {zsh,bash}-completion: run mpv with --no-config
Reading the config when we're just interested in the option list
(not sure why mpv does that anyway) only has the potential to mess
this process up when it prints errors or the user has funny options
like msg-level or log-file set, so avoid doing so.
2023-07-19 13:01:08 +02:00
sfan5 5f664e2a1d bash-completion: do not complete removed options 2023-07-19 13:01:08 +02:00
sfan5 da9c94989a zsh-completion: do not complete removed options 2023-07-19 13:01:08 +02:00
sfan5 a0d8962be8 zimg: fix broken sig_peak handling
In sum there were three issues:
1. nominal_peak_luminance is an output parameter, not input
2. mpv internally uses MP_REF_WHITE which we need to scale by
3. the value should be left at its default for SDR

Together with the last change this means mpv can sucessfully
take HDR screenshots with --screenshot-sw without resulting
in a brightly colored mess. Though note that zimg does not
perform proper tonemapping.
2023-07-19 13:01:08 +02:00
sfan5 a960b75604 image_writer: move tag_csp check into image_writer_flexible_csp()
This ensures the sRGB fallback to happen in all situations involving
the image writer code, notably --screenshot-sw.

fixes: cbbe2e5221
2023-07-19 13:01:08 +02:00
sfan5 157ef77427 image_writer: replace sprintf usage
also fixes the buffer being cut off (?!)
2023-07-19 13:01:08 +02:00
sfan5 f95339c02a image_writer: share some code between write_lavc and write_avif
As a consequence:
- write_avif now respects tag-colorspace=no
- write_lavc additionally sets colorspace and chroma_location
  (of no consequence for png or jpeg)
2023-07-19 13:01:08 +02:00
sfan5 8f26d99fbd image_writer: error check avif-pixfmt option 2023-07-19 13:01:08 +02:00
sfan5 8aa8e21da9 image_writer: fix still-picture option for AVIF
Gets rid of validation warnings on the produced files.
2023-07-19 13:01:08 +02:00
sfan5 d7ef91fecd image_writer: remove duplicate packet writing code 2023-07-19 13:01:08 +02:00
sfan5 608b430b56 TOOLS: remove obsolete travisCI-related scripts 2023-07-19 13:01:08 +02:00
sfan5 d46a31317f wayland_common: remove questionable gcd impl and global state 2023-07-19 13:01:08 +02:00
Dudemanguy e399266400 wayland: don't treat tiled and maximized windows the same
mpv has historically always treated the various tiled states in
xdg-shell as maximized (probably because it was easier). Well it turns
out that there are some tiling compositors (hyprland) that allow tiled
windows to maximize themselves. This can lead to some scenarios where
mpv ends up doing a maximize on hyprland which actually works since it's
not a no-op like on sway. Fix this by separating out the tiled state
from maximize. It works mostly the same, but the main difference is that
there's no request to tile yourself like there is with maximize. Should
fix #11954.
2023-07-19 01:14:32 +00:00
Dudemanguy 949e1f0dcc wayland: add locked_size convenience shorthand
There's a lot of checks that are along the lines of !maximized &&
!minimized or vice versa. Make a locked_size boolean and store the
value of this in here to avoid writing long lines since the next commit
will add yet another condition to this.
2023-07-19 01:14:32 +00:00
Niklas Haas dbbcd9ec9c builtin.conf: add --hdr-contrast-recovery to gpu-hq
The first change to the gpu-hq profile in aeons.
2023-07-18 15:22:18 +02:00
Niklas Haas 02595011eb vo_gpu_next: add --hdr-contrast-recovery/smoothness
New upstream feature. Disabled by default.
2023-07-18 15:22:18 +02:00
rcombs ac725764ec builtin.conf: unset default languages in libmpv and encode profiles
The `auto` behavior doesn't really make sense in these contexts.
2023-07-18 00:42:56 -07:00
Philip Langdale fbd0be1cf4 vd_lavc: repeatedly attempt to fallback if hwdec fails in receive_frame
There is an additional failure path I didn't account for in my previous
work. While I ensured that a late hwdec failure in receive_frame can be
recovered from by trying the next hwdec, there is a specific
combination where if an hwdec fails in receive_frame, and the next
hwdec is a full decoder (eg: v4l2m2m), and that also fails, we are left
with no decoder and so the entire decoding process ends and playback is
stopped.

Basically, we must keep re-attempting the fallback in receive_frame
until we get a valid decoder (software or hardware). This edge case
will rarely be encountered as there are only a couple of decoder based
hwdecs.

Fixes #11947
2023-07-17 18:37:41 -07:00
Dudemanguy 1f8013ff3f wayland: handle modifier keys correctly
I don't know why we've been doing this wrong for so long or how I didn't
notice until now. Wayland specifically has an event for handling
modifiers. We even named it "keyboard_handle_modifiers" in the code.
What we should do is just get the modifier and save it after the xkb
state is updated. Then later if the user does something else (press
another key or clicks the mouse button), the saved modifier key is
applied. If you let go of the modifier at any point, the xkb will just
update its state again and we save a 0 again here (i.e. no modifier).

There is one bit of an edge case however. If a key is pressed BEFORE the
modifier, then we have to handle the mp_input_put_key in the modifier
event instead since the ordering is not guarenteed. What we do here is
keep track of the mpkey as well as the mpmod. However if we are unable
to find a matching mpkey and the key state is pressed down, assume it's
a modifery key that was pressed and don't update mpkey. That way
whenever the modifier event does happen, it can correctly handle this
and we know that the keys must be pressed down if we end up there in the
code path.

As another fun historical note, the xkb_keysym_to_utf8 line was actually
written by wm4 himself in 460ef9c7a4
nearly 10 years ago. As the commit shows, it was clearly intended to
handle modifiers (if lookupkey finds nothing, then try to find a mod
instead). Of course, this is extremely dated and wayland hasn't worked
like that in ages. This branch never actually did anything, and thus
we'll remove it here along with modifier lookup changes.

This solves bizarre issues with modifiers not working with random keys
while working fine with others (don't ask me why). Fixes #10286 and
fixes #11945.
2023-07-17 18:53:50 +00:00
Kacper Michajłow 347fbd6fa3 vo_gpu_next: add --target-contrast option
For better control over target display levels.
2023-07-17 18:50:34 +02:00
llyyr fbd392bcbb loadfile: make get_audio_lang function static
This fixes a build warning about missing prototypes
2023-07-17 18:02:07 +02:00
sfan5 8a6cabce35 DOCS/release-policy.md: add additional advice 2023-07-17 11:55:45 +02:00
rcombs 9e6c6c0897 loadfile: compute audio lang for sub selection when using lavfi-complex
When using lavfi-complex, no single track populates current_track for audio.
We work around this by iterating over the list of tracks and using the first
non-null language from a selected track. If multiple tracks are selected
(i.e. used by the filter) and have conflicting language tags, we'll ignore
them all and maintain the previous behavior (null).
2023-07-16 21:32:50 -07:00
Dudemanguy 9e9abb1a0f wayland: wrap resize requests in prepare_resize
828dd65ef8 started this and put it in the
most common place, but any resize mpv is doing should be accompanied by
that function call to correctly inform the compositor of the window
bounds. Since we also have to set VO_EVENT_RESIZE at the same time, it
makes sense to just put these in the same function. A slight thing to
note is that xdg_surface_set_window_geometry uses surface local
coordinates which means they are divided by the wl->scaling factor. If
possible, we should use surface local coordinates directly if available
(like in the toplevel config) to avoid potential rounding errors.
Otherwise, just calculate it out. The linked commit actually broke
some weston resizes in weird ways (window disappearing or completely
freezing). Don't ask me why and I didn't attempt to find out why either,
but with this it all appears to work normally again (the other
compositors don't appear to be any different, and they shouldn't be), so
we'll go with this since it fixes soemthing and it also is more
conceptually correct.
2023-07-16 21:20:50 -05:00
llyyr 580f36e436 sd_ass: fix converted subtitles having too-wide borders
Libass commit f08f8ea5 (between 0.16 and 0.17) changed how PlayResX
affects some aspects of rendering.

The libass change fixes a VSFilter compatibility issue which existed
for about two decades, and there are no libass plans to support the
previous behavior, so ultimately we have to adjust the mpv code, and
we can't guarantee to restore the old behavior in all cases.

Starting at this commit, vector drawing coords, font spacing, border
and shadow widths are all affected by PlayResX (specifically, by
the aspect), while previously they were unaffected by PlayResX.

This changed converted sub border and shadow widths in mpv, because
ffmpeg generates the ass with fixed PlayResX of 384 (aspect of 4:3),
and with libass 0.17, if this doesn't match the display aspect, then
borders and shadow were too wide - because most clips aspect is more
than 4:3.

The fact that ffmpeg uses fixed PlayResX of 384 could be considered
an issue, but for now we have no control over it, and ffmpeg doesn't
have the video resolution when it converts an srt source to ass.

So here we adjust PlayResX accordingly so that border/shadows are
now rendered with correct width.

However, regardless of that commit, changing PlayResX also affects
the margin value, so to compensate, we adjust sub-margins-x too.

According to libass devs, this should cover basic srt-to-ass
conversion by ffmpeg to work correctly with libass 0.17.

However, there could be srt extensions which use more complex ass,
and/or ffmpeg conversion of other sub formats (such as aribb24,
aribcaption and movtext), where more things need adjustments.
As of now we don't know what these are, and so we don't really know
what else might remain broken or get broken.
2023-07-16 21:02:54 +03:00
Dudemanguy cab544889a sd_ass: don't reconfigure ass on every frame
dbc5d7b7db seems to have originally
introduced this behavior. At the time, wm4 simply reconfigured ass on
every frame in order to accommodate runtime changes in sub options. This
certainly works, but these libass API calls are not free and there is at
least one known performance regression due to a change in libass*.
Regardless of whether or not the libass change is good/bad, there is no
need for mpv to constantly reconfigure this. When wm4 made that commit,
there was no notification mechanism for options changing that could
easily be used so he didn't really have any other choice. But it's
nearly 10 years later now and internally we have all the necessary
pieces to only configure ass again when we need to: on option changes or
resizes. So go ahead and implement that in this commit which simply uses
the already existing SD_CTRL_UPDATE_OPTS and compares osd_res sizes to
determine whether or not an ass configure is needed.

*: https://github.com/libass/libass/issues/698
2023-07-15 23:57:16 +00:00
m154k1 b077cf72df player: set default cache dir on macOS
Use ~/Library/Caches/io.mpv for caches instead of ~~home.
2023-07-15 23:56:57 +00:00
Dudemanguy 031e172cef DOCS/mpv: clarify the location of cache/state files 2023-07-15 15:10:41 +00:00
Dudemanguy d482bf6ef0 path-win: implement cache directories
4502522a7a implemented cache directories
but only on linux which meant other OSes continued to save this stuff in
their config directory. Since we turned on cache by default, people are
getting cache files in there which is understandably causing some
confusion. Let's go ahead and implement a separate cache directory for
windows since there seems to be some established conventions for this
already. For people using the portable_path, the cache is saved in a
subdirectory within the portable_path since the idea is for that to be
completely self contained.
2023-07-15 15:10:41 +00:00
Philip Langdale 93f95f61e9 DOCS/interface-changes: document change in ctrl+h behaviour
We now use `auto-safe` when turning on hardware decoding instead of
`auto`.
2023-07-15 18:58:28 +08:00
Philip Langdale e64ef6089f vd_lavc: map `hwdec=yes` to `hwdec=auto-safe`
To remain consistent with our belief that `auto-safe` should be the
recommended mode when turning on hw decoding, let's remap `yes` from
`auto` to `auto-safe`.
2023-07-14 20:41:24 -07:00
Philip Langdale 7fe2a76621 vd_lavc: add `drm` and `drm-copy` to the `auto-safe` list
We have supported `hwdec=drm` for some time now, and on devices where
this method is present, it is the preferred, and only, method
available. Combine that with the fact that software decoding on
embedded devices will not turn out well, and it's clear that we should
put `drm` and `drm-copy` on the `auto-safe` list to maximise usability
in simple configurations.
2023-07-14 20:41:24 -07:00
Philip Langdale 9f7f9c1614 input: update ctrl+h to toggle `auto-safe` rather than `auto`
It has been odd that ctrl+h toggles `auto` for hwdecs even though we
always recommend people start with `auto-safe`, and `auto` will attempt
various hwdecs that can fail so badly we can't fall back to software
decoding.

With the change to more exhaustively attempt to use hwdecs, it is now
easier to get into situations where these fragile hwdecs will get
attempted in basic scenarios, like pressing ctrl+h.

So it is high time to default to `auto-safe`.
2023-07-14 20:41:24 -07:00