Commit Graph

50215 Commits

Author SHA1 Message Date
Dudemanguy 4502522a7a player: use XDG_CACHE_HOME by default
This adds cache as a possible path for mpv to internally pick
(~/.cache/mpv for non-darwin unix-like systems, the usual config
directory for everyone else). For gpu shader cache and icc cache,
controlling whether or not to write such files is done with the new
--gpu-shader-cache and --icc-cache options respectively. Additionally,
--cache-on-disk no longer requires explicitly setting the --cache-dir
option. The old options, --cache-dir, --gpu-shader-cache-dir, and
--icc-cache-dir simply set an override for the directory to save cache
files. If unset, then the cache is saved in XDG_CACHE_HOME.
2023-05-09 20:37:17 +00:00
Dudemanguy 7c4c9bc86f player: use XDG_STATE_HOME for watch_later
A pain point for some users is the fact that watch_later is stored in
the ~/.config directory when it's really not configuration data. Roughly
2 years ago, XDG_STATE_DIR was added to the XDG Base Directory
Specification[0] and its description, user-specific state data, actually
perfectly matches what watch_later data is for. Let's go ahead and use
this directory as the default for watch_later. This change only affects
non-darwin unix-like systems (i.e. Linux, BSDs, etc.). The directory
doesn't move for anyone else.

Internally, quite a few things change with regards to the path
selection. If the platform in question does not have a statedir concept,
then the path selection will simply return "home" instead (old
behavior). Fixes #9147.

[0]: 4f2884e16d
2023-05-09 20:37:17 +00:00
Dudemanguy 5158b85b21 path: expand internal path selection API to allow for additional types
Currently, nothing new is actually implemented but the idea is simply to
just pass a type string all the way up from mp_find_user_file down to
actually getting the platform path. This allows for selecting different
directories besides the user's native config directory. See the next
commit for an implementation.
2023-05-09 20:37:17 +00:00
Dudemanguy baa9d56481 osdep: separate out macos paths from path-unix.c
macOS really has completely different path conventions that mpv doesn't
take into account and it treats it just like any other old unix-like
system. This means mpv enforces certain conventions on it (like all the
XDG stuff) that doesn't really apply. Since we'd like to use more of
this but at the same time not distrupt mac users even more, let's just
copy and paste the current code to a new file, update the build and call
it a day. This way, the paths of these two platforms can more freely
diverge.
2023-05-09 20:37:17 +00:00
Nick Hanley a1580b6424 DOCS/options: document required parameter for --x11-name 2023-05-06 21:26:50 +00:00
Dudemanguy a3eb163303 meson: bump required version to 0.62
This lets us use meson's custom dl dependency as well as the version
method when checking rst2pdf's version.
2023-05-02 19:20:50 +00:00
Simon Ser 6234a70920 wayland: add support for wl_surface.preferred_buffer_scale
See [1] for the motivation. Very similar to the fractional scale,
except it's in core and integer-only.

[1]: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/220
2023-04-30 21:20:18 +00:00
Thomas Weißschuh 6d422b3edc options: read config file as stream
This aligns the possible sources of config files other loaded data.
For example `--input-conf`.
2023-04-29 22:34:54 +00:00
Kacper Michajłow 7668361685 ci: switch to lua51 for MSYS build
luajit is currently crashing on 32-bit build:
https://github.com/msys2/MINGW-packages/issues/17042
2023-04-29 19:07:45 +00:00
Kacper Michajłow e836b58050 ci: use auto detection for lua library version for MSYS 2023-04-29 19:07:45 +00:00
low-batt 6d208d38d2 charset_conv: fix memory corruption in mp_iconv_to_utf8
If mp_iconv_to_utf8 was given an empty string to convert in the buf
parameter it would corrupt memory when writing a null into outbuf
before returning it to the caller. This happened when streaming from a
URL that ends in a slash. For such a URL the method mp_basename returns
an empty string. The method append_dir_subtitles passes the result
returned from mp_basename to mp_iconv_to_utf8 which then corrupts
memory. This was detected using Guard Malloc. The fix changes
mp_iconv_to_utf8 check up front if buf is empty and if it is return
buf as the result in compliance with the documented behavior of the
method when no conversion is needed.

Fixes #11626
2023-04-29 01:37:41 +00:00
Lypheo e928bd5fdb sub: fix UPDATE_SUB_HARD for converted and external subtitles
Upon an option update with an UPDATE_SUB_HARD flag,
the ass_track that stores all the decoded
subtitle packets/events is destroyed and recreated, which means
the packets need to be read and decoded again to refill
the ass_track. This caused issues (no subs displayed) in 2 cases:
1. external sub files
  Previously, external sub files were read and decoded only
  once when loaded. Since this meant all decoded events were lost
  forever when recreating the ass_track, we need to change this
  and trigger a new preload during sub reinits.
2. converted subs (non-ASS text subs like srt)
  For converted subs, we maintain a list of previously
  seen packets to avoid decoding and adding duplicate events
  to the ass_track. Previously this list wasn’t synchronized with
  the corresponding ass_track, so the sub decoder would reject
  any previously seen sub packets, usually meaning only subs sometime
  after the current pts would be displayed after sub reinits.
  Fix this by resetting the list upon ass_track recreation.
2023-04-29 00:30:15 +00:00
Guido Cella c5211dbf4a console.lua: add a script-opt for the border size
Because I find the console log easier to read with a thicker border.
2023-04-26 16:30:01 +00:00
Kacper Michajłow 4fd0a39fc8 vo_gpu_next: fixes to allow using dllimport
Address of variables can't be used for constant initialization in C
language modes.

See 0c43d8077e
2023-04-24 13:16:55 +02:00
Thomas Weißschuh 71f9e97fc0 ao_pipewire: clarify --pipewire-buffer=native 2023-04-23 21:03:58 -07:00
Thomas Weißschuh 993553e138 ao_pulse: clarify --pulse-buffer=native 2023-04-23 21:03:58 -07:00
Thomas Weißschuh cb6b4af1d7 ao_pipewire: let sound server determine latency
Fixes #11467
2023-04-23 21:03:58 -07:00
Thomas Weißschuh eafd0e5fad ao_pipewire: give sound server more flexibility for buffers 2023-04-23 21:03:58 -07:00
EmperorPenguin18 c7a8e71578 hwdec_drmprime: support rpi4_8 and rpi4_10 formats
HEVC hardware decode with drm wasn't working on the RPi 4. Mpv would
report the image format (rpi4_8 for 8-bit and rpi4_10 for 10-bit) wasn't
supported. The change to hwdec_drmprime.c identifies these two formats
as NV12 because it functions exactly the same. The change to
dmabuf_interop_gl.c adds support for P030 which rpi4_10 uses. These
changes were tested on a Pi 4 with this fork of ffmpeg:
https://github.com/jc-kynesim/rpi-ffmpeg.

Signed-off-by: EmperorPenguin18 <60635017+EmperorPenguin18@users.noreply.github.com>
2023-04-20 14:37:15 -07:00
Arnold Stanovský c50f536bd1 ytdl_hook: fix clip start and end 2023-04-12 02:14:09 +00:00
Sam Van Den Berge b573a4967d libmpv: fix file name in documentation
render_cb.h doesn't exist but render.h does.
2023-04-11 20:06:42 +00:00
Dudemanguy 3c1686488b meson: use the new build_options method
This finally allows us to put any user defined options into the
CONFIGURATION variable like what waf does. The arbitrary hardcoded
fallback is left in place for old meson versions. Also update the
documentation in regards to the mpv-configuration variable to be
relevant to meson.
2023-04-11 20:05:36 +00:00
iczero d65e56216d wayland: correctly scale configure_bounds 2023-04-11 20:05:17 +00:00
Leo Izen cbbe2e5221 player/screenshot: avoid non-sRGB spaces with --screenshot-tag-csp=no
If --screenshot-tag-csp=no, then there won't be any color tags in the
output space, so PNG and JXL screenshots should be written as sRGB
rather than the native space of the input video.
2023-04-10 18:29:56 -04:00
Mika Kuoppala 95d7b05e71 video/out/gpu: Fix compilation warning of out of bound access
Make the index into the arrays in copy_image()
unsigned to make compiler trust that we dont access
out of bounds.
2023-04-10 10:48:16 -04:00
quietvoid 1808f264b3 mp_image: always add AV_FRAME_DATA_DOVI_METADATA when present
As the Dolby Vision metadata is only supported for vo_gpu_next, the check
whether to use the metadata is now handled by `mp_map_dovi_metadata_to_pl`.

It doesn't hurt to keep the metadata in `mp_image`, and might be useful to
library users.
2023-04-10 05:18:58 -04:00
sfan5 9a8b31707e ci: add a workflow that lints commit messages 2023-04-08 17:08:57 +02:00
Dudemanguy 7ae7fc0112 auto_profiles: try to distinguish invalid properties better
6e4a76db08 attemped to reject invalid
properties and print an error for users so they actually know that
something is going wrong. This worked by simply checking if the property
not found error is returned, but it is actually perfectly possible for a
property to not be found (different than being unavailable just to be
clear here) at first and then show up later. An example would be
user-data which can be created at any time. It's also possible with
subproperties of things like track-list where a new track could be added
later.

In light of this, let's soften the error checking logic here with a
simple trick. mpv already keeps track of all toplevel properties and it
can be easily retrieved with the "property-list" property, so just cache
that. When we get a property not found error, instead of rejecting it,
try to match it something in the property-list first. If we have a
match, then consider the property valid and allow the script to behavior
normally. If not, we reject it. This approach means property names that
are obviously wrong like "fake-property-here" will reliably get rejected
and something like "user-data/test" works as usual. The downside is that
errors in the subproperty level are not caught, so something like
"track-list/0/fake-property" would still be considered valid and the
user gets no warning that this won't work. We'll just accept the
compromise and hope this isn't too common.

Fixes #11550.
2023-04-07 01:48:55 +00:00
Guido Cella 41372c5e1f auto_profiles.lua: apply profiles when conditions are truthy
Instead of erroring when values returned by profile-cond expressions
aren't booleans, apply the relative profiles as long as the return
values are truthy. This allows shortening conditions like

profile-cond=path:match('foo') ~= nil

to

profile-cond=path:match('foo')
2023-04-05 18:32:18 +00:00
Christoph Heinrich b7ffe0d16e osc: skip rendering when osd_dimensions are 0
The idle logo could appear on the left side of the window for a split
second after starting.
That is because when osd dimensions can be reported as 0 at the very beginning.
Since the width gets calculated based on a fixed height and the aspect ratio,
which is 0, that results in a width of 0 until the next update.
2023-04-05 17:14:43 +00:00
Kacper Michajłow 9feeb324ed win32: follow Windows settings and update dark mode state
Microsoft documented how to enable dark mode for title bar:

https://learn.microsoft.com/windows/apps/desktop/modernize/apply-windows-themes
https://learn.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute

Documentation says to set the DWMWA_USE_IMMERSIVE_DARK_MODE attribute to
TRUE to honor dark mode for the window, FALSE to always use light mode.
While in fact setting it to TRUE causes dark mode to be always enabled,
regardless of the settings. Since it is quite unlikely that it will be
fixed, just use UxTheme API to check if dark mode should be applied and
while at it enable it fully. Ideally this function should only call the
DwmSetWindowAttribute(), but it just doesn't work as documented.

Fixes: #6901
2023-04-04 20:04:57 +02:00
Kacper Michajłow 68b3239b52 d3d11: retry device creation without debug, if SDK is not available
Fixes #11512
2023-04-02 21:43:53 +03:00
Kacper Michajłow 9d120a4411 build: add check for eglext_angle.h when checking for ANGLE
This better follows the actual required bits, and makes sure that
a file not part of standard EGL headers is available, as the
handle type is part of standard EGL extensions header.
2023-04-02 21:23:48 +03:00
Kacper Michajłow 911d742817 context_angle: include eglext_angle.h explicitly
Recent MSYS update switched to using vanilla EGL headers, which doesn't
include eglext_angle.h implicitly.
2023-03-30 22:00:38 +03:00
feltcat 0f13c38e72 DOCS/input: fix typo 2023-03-30 13:57:08 +00:00
Dudemanguy 6e4a76db08 auto_profiles: check for non-existent properties
Previously, it just silently didn't do anything which is not very
intuitive. Since the lua api returns an error string, check to see if
it matches the "property not found" case and print an error message.
Additionally, don't add the fake property to the internal
cached_properties list or try to observe it. This avoids redundant
evaluate calls which will never actually succeed. We do still mark it
under watched_properties however. This avoids having to call
mp.get_property_native multiple times.
2023-03-29 13:33:57 +00:00
Alexander Seiler bdf7b5c3b8 various: fix various typos in the code base
Signed-off-by: Alexander Seiler <seileralex@gmail.com>
2023-03-28 19:29:44 +00:00
Harri Nieminen 292a5868cb various: fix typos
Found by codespell
2023-03-28 19:29:44 +00:00
Philip Langdale 24bed9b949 demux_lavf: update to handle deprecation of `io_close`
`io_close2` was introduced as a superior replacement for `io_close` in
ffmpeg 5.0, and then deprecated in 6.0. The difference is that
`io_close2` can return errors. In our case, we're just calling through
to the original function anyway, so we don't need to do more than pass
the return value back.
2023-03-28 11:32:51 -07:00
Kacper Michajłow 6a62aa0330 ci: bump cache version to rebuild libplacebo
libplacebo-next version requirement was increased recently, need to
rebuild it to fix mingw CI builds.
2023-03-28 09:23:38 -07:00
Kacper Michajłow 21301dc12d ci/mingw: require libplacebo-next
libplacebo is build by us, so we can explicitly enable it.
2023-03-28 09:23:38 -07:00
Kacper Michajłow 10136e77a3 build: add an option to control gpu-next
Also simplify meson logic
2023-03-28 09:23:38 -07:00
Kacper Michajłow 1ea74f10a7 ci/mingw: update meson
libplacebo requires >= 0.63
2023-03-28 09:23:38 -07:00
Philip Langdale d1d0b1a8ee meson: fix libplacebo-next version comparison
Should just compare against '264'.
2023-03-26 22:01:06 -07:00
llyyr 685d9cbe5b vo_gpu_next: drop various PL_API_VER checks
We don't need these anymore now that we require PL_API_VER>=264 for
building libplacebo-next
2023-03-26 20:55:58 -07:00
llyyr 631b7d54dc wscript: bump libplacebo-next required version to 5.264
b77f88157e only bumped the version for
meson builds.
2023-03-26 20:55:58 -07:00
Philip Langdale b77f88157e meson: bump libplacebo-next required version to 5.264
This is the latest stable release, and what we should use for
libplacebo-next per haasn's recommendation.

The previous 202 version wasn't even a release.
2023-03-26 21:00:23 +02:00
cloud11665 664f197746 player/screenshot: add filename return field
DOCS/input: add screenshot return value description
2023-03-25 16:24:21 +00:00
Christoph Heinrich 34a04d0567 player: set playlist title to media title if not set already
The playlist title only got set when it was specified in the playlist
file.
If there is a title after opening a file, that should also be reflected
in the playlist.
2023-03-24 02:28:49 +00:00
Christoph Heinrich 5ddf6d479e Revert "player: set playlist title to media title if not set already"
As it turns out that approach was suboptimal.
The playlist title would only ever get set when media-title actually
gets read, which depending on the configuration and usage might never
happen.

The next commit reimplements that feature in a different way.

This reverts commit 048d4d8b75 except for
the input.rst change.
2023-03-24 02:28:49 +00:00