Commit Graph

49585 Commits

Author SHA1 Message Date
sfan5 83f1c87676 ci/appveyor: fix package install line
It appears MinGW switched their pkg config implementation from pkg-config to pkgconf,
causing all builds to fail because we requested the former.
2022-02-06 12:00:21 +01:00
Avi Halachmi (:avih) 0197729949 osc.lua: seekbar hover: speed-up chapter access
This speeds up chapter name access while hovering the seekbar:

- Fetch the chapter-list property using observation rather than on
  every render while hovering the bar. Property access, especially
  with potentially lots of values (chapters), can be expensive-ish,
  and can involve locking, so the less per-render the better.

- Sort the list once (on change) to simplify the iteration logic when
  searching the chapter which matches the mouse position. It's still
  O(N) (no binary search currently), but with less work.

The cached sorted list is stored at the state. While there are other
places which access this property and could use this cache, for now we
don't touch them, because they're not performance-critical (on init
for the chapter markers, on ch_{prev,next} button click for OSD).

Caching properties using observation instead of using mp.get_property
can indeed speedup other places too, but it should be part of a system
rather than implemented per-property. Maybe some day.
2022-02-06 11:02:39 +02:00
Avi Halachmi (:avih) 7849a36beb js: utils.get_user_path: make wrapper of expand-path
When utils.get_user_path was added, the expand-path command didn't
exist. Now it does, so remove the C code, make it a trivial wrapper.

Keep this function for backward compat to not break scripts, but
technically it's not required anymore.
2022-02-04 12:53:16 +02:00
Niklas Haas 5d31c7310c libplacebo: switch to new target format API
`target_dummy` got deprecated in version v4.169. We unfortunately have
to hide this behind an #if for the time being.
2022-02-03 18:22:14 +01:00
Niklas Haas d59eb58007 libplacebo: switch to new GPU limits APIs
`caps` is deprecated, and replaced by individual fields in
`pl_glsl_version` / `pl_gpu_limits`.
2022-02-03 18:22:14 +01:00
Niklas Haas b2958670a3 libplacebo: switch to v4 naming convention
All of these const struct pointers got typedefs, clean up the code
accordingly.
2022-02-03 18:22:14 +01:00
Niklas Haas 88c6c84b64 libplacebo: update log helpers
Use the pl_log APIs introduced in libplacebo v4, replacing the
deprecated pl_context concept.
2022-02-03 18:22:14 +01:00
Niklas Haas e8e89fae38 libplacebo: bump minimum dependency to 4.157
This has been the latest stable release for about half a year now. This
version in particular lets us get rid of all the deprecation warnings in
the older code. (See the following commits)
2022-02-03 18:22:14 +01:00
Niklas Haas 9d1f48bda2 vo_gpu_next: create shader cache dir if missing
Failing to do this results in the shader cache not actually ever being
written, ergo no shader caching being done. Oops.
2022-02-03 18:22:14 +01:00
Niklas Haas a2b147abc6 build: rename libplacebo version check
Rename from "libplacebo-v4" to "libplacebo-next" to more closely capture
the intent, since this will become libplacebo v5 eventually (tm).
2022-02-03 18:22:14 +01:00
Julian Orth c25129339d wayland: always start rendering after a resize
The wayland backend contains logic to detect if the window is hidden. If
so, we skip rendering as an optimization. However, if we receive
multiple resize events in rapid succession, we will send the compositor
new buffers faster than the refresh rate of the monitor.  Therefore the
compositor will not send us frame events which we incorrectly interpret
as the window being hidden.

Once the last buffer has actually been rendered, the compositor sends us
a frame event. However, if at that point playback is paused, there is no
logic to restart rendering of frames that we skipped due to the above
optimization.  Therefore we never send the compositor new buffers
corresponding to the new size of the window and the surface will either
be too small or too large.

The simplest solution is to always render a few frames after we receive
a resize event.
2022-02-03 16:15:59 +00:00
Avi Halachmi (:avih) ddef9eb52d DOCS/options.rst: fix typo (double "aspect") 2022-02-03 12:48:17 +02:00
garamond13 67a2b2852c filter kernels: add cosine window
filter kernels: add cosine window
2022-02-03 01:25:50 +01:00
Jan Ekström 899850bedc wscript: bump libplacebo version requirement to 4.190
Was done in meson.build as part of
a9cb2e2821 , but the waf wscript
was missed.

This brings the two files in sync again.
2022-02-02 22:53:32 +02:00
Jan Ekström 053f10003c vo_gpu_next: initial attempt at adding d3d11 support 2022-02-02 22:53:32 +02:00
Jan Ekström 723a2ba762 vo_gpu_next/context: common'ize things that would be common for non-vulkan
This prepares us to not duplicate all of this code for d3d11.
2022-02-02 21:48:01 +02:00
Jan Ekström 13d0df7c21 vo_gpu/d3d11: enable access to the underlying ra_ctx swap chain
This enables us to utilize it from gpu-next.
2022-02-02 21:48:01 +02:00
James Ross-Gowan 3c4b8433dc vo_gpu/d3d11: add more usage flags to the swapchain images
vo_gpu_next and libplacebo expect swapchain images to be able to be
blitted to, which for libplacebo on FL11_0 and up means they have to
have DXGI_USAGE_UNORDERED_ACCESS, since libplacebo uses a compute shader
to emulate certain kinds of blits. For libplacebo's benefit, set all
applicable usage flags on swapchain images.
2022-02-02 21:48:01 +02:00
Jan Ekström 65f9a688a4 vo_gpu/d3d11: early exit in start_frame if output fbo is nullptr 2022-02-02 21:48:01 +02:00
Avi Halachmi (:avih) 555c15efba win32: apply geometry position to content instead of window
The docs specify that the +-X+-Y geometry values position the content.
This used to work correctly but got broken at 8fb4fd9a .
Geometry size is unaffected - this only concerns position.

Commit 8fb4fd9a made it center the window rather than the content by
taking the borders into account during positioning, but forgot to make
an exception when a position is specified explicitly.

This commit adds this exception, and now if a specific position is
requested then the borders are ignored, and the content is positioned
correctly.
2022-02-02 13:05:55 +02:00
Andrew Krasavin 8172c501ac meson: fix libdl existence check for *bsd systems 2022-02-02 02:34:49 +00:00
CogentRedTester 712ef65e2a auto_profiles.lua: don't warn if profile-restore=default
The code assumed that the value of the profile-restore field is
"default" for such profiles, but the C implementation is such
that the field is intentionally omitted in such case.

This resulted in incorrectly trying to restore such profiles. However,
there are no stored values with profile-restore=default, so it only
resulted in a harmless warning, but otherwise behaved correctly (i.e.
nothing is restored).

Fix the condition by taking into account that missing field means
"default", so that it doesn't try to restore in such case, and
avoid the warning.
2022-01-30 15:13:10 +02:00
Avi Halachmi (:avih) 9fd9239990 DOCS/input.rst: profile-list: profile-restore could be missing
Currently the profile-restore field is intentionally omitted if it
holds the default value (i.e. no values are stored for the profile,
and trying to restore would only warn).

See m_config_get_profiles at command.c .
2022-01-30 15:13:10 +02:00
Dudemanguy 4d3ebb9d83 meson: add version check to wayland-protocols
This was mistakenly left out. mpv requires at least 1.15 for the
xdg-decoration protocol. This just matches the waf build.
2022-01-29 12:12:45 -06:00
Dudemanguy 19dd61fa19 wayland: always resize when scale changes on surface enter
a02901cae7 changed how mpv was handling
wl_surface_set_buffer_scale. It's correct in that constantly setting the
surface scale on every resize (which mpv was previously doing) is
unneccessary and not right. However, it introduced a slight regression
if someone moved a surface to a new monitor with the same resolution but
a different scale. It did not trigger a resize and thus the video would
have incorrect dimensions. A later refactor changed how things looked
inside here, but this regression wasn't fixed. A resize should always be
triggered if the scale changes in this surface event. Fixes #9426.
2022-01-27 18:34:17 -06:00
Ryan Hendrickson 9098ae5a16 wayland: support extra mouse buttons
Mouse button event codes above `BTN_EXTRA` (the ones currently defined
in `input-event-codes.h` are `BTN_FORWARD`, `BTN_BACK`, and `BTN_TASK`)
are mapped to `MP_MBTN9` and up. (Reminder that due to historical
reasons, the names `BTN_FORWARD` and `BTN_BACK` are completely
misleading; the real forward and back buttons are `BTN_SIDE` and
`BTN_EXTRA` and are already mapped correctly by mpv.)

This functionality is analogous to what the X11 backend supports in
`video/out/x11_common.c` and what the Cocoa backend supports in
`video/out/cocoa/events_view.m`.
2022-01-28 00:14:56 +00:00
Dudemanguy 073fbd98ee wayland: actually handle 0x0 resizes correctly
According to the xdg-shell protocol spec, a 0x0 size from the compositor
means that "the client should decide its own window dimension". We were
not doing this correctly. What should happen is that mpv should simply
reuse the old window size if it is not maximized or fullscreened. This
should work on all (reasonably recent) versions of mutter and an
compositor that follows the spec.

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/stable/xdg-shell/xdg-shell.xml#L1050
2022-01-27 15:15:43 +00:00
Dudemanguy 5bcf061744 Revert "wayland: ignore 0x0 resizes"
So actually according to the xdg-shell spec, a 0x0 resize is meant to
indicate that "the client should decide its own window dimension".
Previously, this just accidentally worked. In mutter 41.3, they changed
how 0x0 resizes were sent and what actually happened was that mpv tried
to resize itself to 0x0. This was obviously broken, so the reverted
commit naively just ignored 0x0. It actually seemed to work, but it
ended up breaking older versions of mutter. It's also not exactly the
correct fix so it deserves a revert.

This reverts commit d16defac27.

https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/stable/xdg-shell/xdg-shell.xml#L1050
2022-01-27 15:15:43 +00:00
Dudemanguy 8087e3371f build: remove aviocontext bytes_read check
This define was always just a stopgap for that two month period (August
2021 - October 2021) where the bytes_read field in ffmpeg was completely
missing. Before that time, it was a private member in a struct (which
mpv used). Afterwards, it officially became public. Fortunately, the
lack of this field never actually made it into a release, so it could
have only possibly affected people building from the master branch.
Since ffmpeg 5.0 came out recently, and it's been plenty of months since
that two month window, we can go ahead and drop this check. This
finishes up the work done in 78cfeee2b9.

Sidenote: the cached ffmpeg version in the mingw ci were from that time
period when the bytes_read field was missing. The N in the workflow is
bumped to force a full rebuild and fresh clone of ffmpeg.
2022-01-25 00:17:01 +02:00
Dudemanguy e809ef0441 x11: sanitize window title to UTF-8 for EWMH
Both _NET_WM_NAME and _NET_WM_ICON_NAME (part of Extended Window Manager
Hints) require that the string is UTF-8*. mpv was not doing this and
thus violating the spec. Just sanitize the title for these two atoms.
Note that XA_WM_NAME and XA_WM_ICON_NAME have no such requirement so
those atoms are left the same. Fixes #8812.

*: https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html
2022-01-24 15:07:00 +00:00
Dudemanguy 5b16fe4134 wayland: sanitize toplevel title to UTF-8
The xdg-shell protocol requires that the toplevel title is UTF-8*. Go
ahead and leverage existing mpv tools to sanitize the title. Fixes #9694

*: 0aaf12157e/stable/xdg-shell/xdg-shell.xml (L638)
2022-01-24 15:07:00 +00:00
Dudemanguy d16defac27 wayland: ignore 0x0 resizes
Apparently mutter can send us 0x0 resizes* for whatever reason. Probably
there's some interal reason why this occurs, but for us trying to resize
to 0x0 is obviously terrible and results in all kinds of brokenness.
Just ignore any 0 values. Fixes #9748.

*: https://gitlab.gnome.org/GNOME/mutter/-/issues/2091
2022-01-23 13:58:15 -06:00
Dudemanguy 93d77b781d version.py/version.sh: bump copyright year 2022-01-22 13:22:23 -06:00
Dudemanguy 95257eaa88 ci/build-freebsd: enable sndio ao during build
We have this ao again since #9298 so let's run it through the CI.
2022-01-22 19:06:31 +00:00
Andrew Krasavin b01598510f ao_sndio: bugfix and small refactoring for #8314
Changes:
  * fixed hangups in the loop function and in some other cases
  * refactoring according to @michaelforney's recommendations in #8314
  * a few minor and/or cosmetic changes
  * ability to build ao_sndio using meson
2022-01-22 18:44:34 +00:00
rim adc32e25e0 ao_sndio: add this audio output again
Changes:
- rewrite to use new internal MPV API;
- code refactoring;
- fix buffers size calculations;
- buffer set to auto;
- reset() - clean/reinit device only after errors;
2022-01-22 18:44:34 +00:00
Dudemanguy 024e0cd4c1 options: only apply sub-visibility to primary subs
Previously, the sub-visibility option changed the visibility of all
subtitles including secondary ones. This meant that it was not possible
to only display secondary subtitles while hiding the primary ones. This
modifies the sub-visibility option so that it only affects primary
subtitles which allows only secondary subtitles to be displayed.
2022-01-22 16:22:25 +00:00
Avi Halachmi (:avih) 9cddd73f67 Revert "options: add --sub-visibility=<primary-only|secondary-only>"
This reverts commit 04f0b0abe4.

It's not a good idea to unify the names only for visibility, while
keeping secondary-* for everything else.

This needs a bit more thought before we allow secondary sub to be
visible on its own.
2022-01-19 21:56:28 +02:00
Ripose 04f0b0abe4 options: add --sub-visibility=<primary-only|secondary-only>
Adds --sub-visibility choices 'primary-only' for only displaying the
primary subtitle track, and 'secondary-only' for only displaying
secondary subtitle track.

Removes --secondary-sub-visibility and displays a message telling the
user to use --sub-visibility=yes/primary-only instead.

These changes make it so that the default 'sub-visibility' bind 'v'
cycles through all the 'sub-visibility' choices, 'no', 'yes',
'primary-only', and 'secondary-only'.
2022-01-19 14:27:04 +00:00
chelobaka 1ab3f56df0 player: add thd (TrueHD) to whitelist of audio extensions 2022-01-19 14:00:05 +00:00
LaserEyess 471b3c2b59 player: fix parentheses warning with &&
Was tripping -Wparantheses as the && after the || was not explicitly
wrapped. However, due to operator precedence the intended effect was
still correct.
2022-01-18 13:49:19 +00:00
LaserEyess 4cb4660c7c meson: add check kwarg to run_command() calls
Warning from meson:

WARNING: You should add the boolean check kwarg to the run_command call.
         It currently defaults to false,
         but it will default to true in future releases of meson.
         See also: https://github.com/mesonbuild/meson/issues/9300

All of the run_command() calls currently use need to succeed for the
build to work properly.
2022-01-18 13:49:19 +00:00
Philip Langdale 22b0bac28e ao/pipewire: Add copyright header
Sometimes the most obvious things can be missed.

Reflects authorship described in the original commit.

* https://github.com/mpv-player/mpv/pull/7902
* fddb143282
* https://github.com/mpv-player/mpv/pull/9587
2022-01-17 13:48:44 -08:00
Thomas Weißschuh 87aba146ed ao_pipewire: Add PipeWire audio backend
The AO provides a way for mpv to directly submit audio to the PipeWire
audio server.
Doing this directly instead of going through the various compatibility
layers provided by PipeWire has the following advantages:

* It reduces complexity of going through the compatibility layers
* It allows a richer integration between mpv and PipeWire
  (for example for metadata)
* Some users report issues with the compatibility layers that to not
  occur with the native AO

For now the AO is ordered after all the other relevant AOs, so it will
most probably not be picked up by default.
This is for the following reasons:

* Currently it is not possible to detect if the PipeWire daemon that mpv
  connects to is actually driving the system audio.
  (https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1835)
* It gives the AO time to stabilize before it is used by everyone.

Based-on-patch-by: Oschowa <oschowa@web.de>
Based-on-patch-by: Andreas Kempf <aakempf@gmail.com>
Helped-by: Ivan <etircopyhdot@gmail.com>
2022-01-17 11:43:02 -08:00
Niklas Haas 1ba0547bfb vo_gpu: add HOOKED_gather
Can be used conditionally (via #ifdef HOOKED_gather) to use
textureGather in custom shaders.
2022-01-15 10:27:21 +01:00
Niklas Haas eca78ee925 vo_gpu_next: fix SUBBITMAP_BGRA
The only way to fix the channel order here is to create the texture with
bgra format. Incidentally, there used to be a way to set the component
map for overlays directly, but no more. Shouldn't matter since
everything supports bgra8 anyways, though.

Fixes #9699
2022-01-11 23:45:08 +02:00
Niklas Haas 9e2c0b8baa sub: rename SUBBITMAP_RGBA to SUBBITMAP_BGRA
This was a misnomer, the actual channel order is IMGFMT_BGRA (as the
comment explicitly point out). Rename the enum for consistency.
2022-01-11 23:45:08 +02:00
sfan5 429402cb08 af_lavcac3enc: fix some minor things
mark an array as static, a typo and a missing free
2022-01-10 22:56:52 +01:00
sfan5 d28a792c00 af_lavcac3enc: replace deprecated av_init_packet() 2022-01-10 22:56:52 +01:00
sfan5 39bed5c7fc encode_lavc: replace deprecated av_init_packet() 2022-01-10 22:56:52 +01:00