Commit Graph

888 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
Nick Hanley a1580b6424 DOCS/options: document required parameter for --x11-name 2023-05-06 21:26:50 +00:00
Harri Nieminen 292a5868cb various: fix typos
Found by codespell
2023-03-28 19:29:44 +00:00
Dudemanguy 9880b06a37 wayland: make wayland-edge-pixels-pointer default to 16
10 is ludicrously small. How did no one on an CSD compositor complain
about this?
2023-03-08 14:06:22 +00:00
Dudemanguy 3535e326dc player: remove unittest option
Since meson has its own unit testing system, let's rework mpv's tests so
they integrate nicely with this. To prepare for this, start off by
dropping the unittest option. Of course, this means that tests will no
longer be supported in the waf build at all but it will be dropped
anyway. Note that the tests option is preserved for the meson build. We
will still make use of this in the future commits.
2023-03-02 15:45:27 +00:00
Dudemanguy c31e145e1f DOCS/options: mention default value of cursor-autohide
Closes #11358.
2023-03-01 23:17:33 -06:00
Dudemanguy 7bd528dbeb DOCS/options: clarify hidpi-window-scale description
It's enabled by default everywhere. The sentences about macOS is
misleading and may imply it's disabled by default on the other
platforms.
2023-03-01 23:13:57 -06:00
Dudemanguy c993d5c0ce player: add --auto-window-resize option
mpv's window resizing logic always automatically resized the window
whenever the video resolution changed (i.e. advancing forward in a
playlist). This simply introduces the option to make this behavior
configurable. Every windowing backend would need to implement this
behavior in their code since a reconfigure event must always be a
resize. The params of the frame changed so you either have to resize the
window to the new size of the params or make the params the same size as
the window. This commit implements it for wayland, win32, and x11.
2023-03-02 02:55:36 +00:00
Frédéric Brière 779d4f99a7 sub: add --sub-fonts-dir and --osd-fonts-dir options
These options make it possible to specify the directory that will be
passed to ass_set_fonts_dir(), akin to VLC's `--ssa-fontsdir` and
FFmpeg's `fontsdir`.

Fixes #8338
2023-03-01 02:09:46 +00:00
sfan5 985a253f84 DOCS: clarify that GLX is deprecated 2023-02-22 23:25:47 +01:00
Niklas Haas 9a752e8b26 vo_gpu_next: add --tone-mapping-visualize 2023-02-19 21:01:40 +01:00
Leo Izen 2955a0759c
DOCS: document JPEG XL default effort change
Document the change in 7607432127.
2023-02-18 06:16:21 -05:00
Niklas Haas 2d4a243810 vo_gpu_next: expose --tone-mapping=st2094-40 and st2094-10 2023-02-13 17:52:35 +01:00
Dudemanguy 180b4faed0 DOCS/options: remove testing note in video-sync-max-factor
This option is a bit obscure, but some people do use it and it can be
useful. The actual code that implements this is very simple, so there's
really no need to have a scary note in the docs about it possibly
changing or being removed.
2023-02-11 00:50:11 +00:00
Leo Izen 8ba7b8f0d2 video/image_writer: change screenshot-tag-colorspace default to yes
With significant improvements to the color tagging support in various
screenshot formats, e.g. cICP in FFmpeg, and JPEG XL's generally robust
color support, it's safe to default this to yes.
2023-02-09 21:03:28 +01:00
Thomas Weißschuh 83681de3c1 ao_pipewire: add support for exclusive mode 2023-02-03 12:33:09 -08:00
Dudemanguy da81a6d532 wayland: add auto choice to wayland-configure-bounds
Previously, this defaulted to yes and configure-bounds from the
compositor would always apply. In the case where the user explicitly set
autofit or geometry, this could be confusing because configure-bounds
would take precedence over it. Instead, let's add an auto choice and
make that the default. If we detect that the option is on auto and that
there is autofit/geometry being set, then ignore the event. This should
be more intuitive since someone who bothers to explicitly set mpv's
geometry would naturally expect that geometry to actually apply.
2023-01-30 03:59:40 +00:00
sfan5 c7ea0cd68f vd_lavc: add "auto" choice for vd-lavc-dr
--vd-lavc-dr defaulted to "yes", which caused issues on certain
hardware. Instead of disabling it, add a new "auto" value and
make it the default.

The "auto" choice will enable DR only when we can request host-cached
buffers (as signalled by the new VO_DR_FLAG_HOST_CACHED).

Co-authored-by: Nicolas F. <ovdev@fratti.ch>
Co-authored-by: Niklas Haas <git@haasn.dev>
2023-01-23 14:13:34 +01:00
sfan5 9196abf111 DOCS: clarify wid casting on Windows
The situation here is that HWND is always a 32-bit value but the
win32 API also accepts sign-extended values as valid. The trouble
starts when the numeric value is negative, as mpv ignores those.
Apparently this only happens after a while (related to uptime
or number of handles created), which meant this problem was rare.

addresses #10189
2023-01-12 22:02:07 +01:00
Dudemanguy 6471afecd0 player: don't force saving start in watch-later-options
The watch-later mechanism has always unconditionally wrote start to
files to save the playback position. When this was later expanded to
watch-later-options, this logic was kept in place. But we don't actually
have to unconditionally write this and can allow users to remove the
option from the list if they want to. The start value still requires
some special handling; it should always be written if possible
regardless of the value changing. However, we can just place it within
the default set of options for watch-later-options so it can be removed
like any other.
2023-01-09 16:37:14 +00:00
Christoph Heinrich c4ec47a65e player: add video-sync=display-tempo
So far there was no way to sync video to display and have audio sync to
video without changes in pitch.

With this option the audio does not get resampled (pitch change) and
instead the corrected audio speed is applied to audio filters.
2023-01-09 15:17:09 +00:00
Sultan Alsawaf eb29aa4839 demux: add --demuxer-hysteresis-secs option to save power with caching
Buffering ahead nonstop into the cache results in nonstop disk or network
activity to read stream data from wherever it may originate. Currently,
there's no way to configure the demuxer to back off once it's buffered
ahead enough data, since the cache limit will be perpetually not-reached as
a stream continues to play, until the entire stream is eventually buffered.

On a laptop with an i9-12900H with decoding performed by the iGPU,
watching a locally-saved 1080p video which hasn't been buffered into the
page cache consumes approximately 15 W even with caching enabled. When
configuring a hysteresis to make the demuxer back off, power consumption
drops to 9 W when watching the same video, resulting in a whopping 6 W of
power savings.

To make it possible to attain significant power savings via caching, add
a --demuxer-hysteresis-secs option to configure a hysteresis to make the
demuxer back off until there's only the configured number of seconds
remaining in the cache from the current playback position.

This feature is disabled by default.
2022-12-30 10:30:22 +01:00
Dudemanguy 6623efb142 wayland: add support for content-type protocol
The content-type protocol allows mpv to send compositor a hint about the
type of content being displayed on its surface so it could potentially
make some sort of optimization. Fundamentally, this is pretty simple but
since this requires a very new wayland-protocols version (1.27), we have
to mess with the build to add a new define and add a bunch of if's in
here. The protocol itself exposes 4 different types of content: none,
photo, video, and game.

To do that, let's add a new option (wayland-content-type) that lets
users control what hint to send to the compossitor. Since the previous
commit adds a VOCTRL that notifies us about the content being displayed,
we can also add an auto value to this option. As you'd expect, the
compositor hint would be set to photo if mpv's core detects an image,
video for other things, and it is set to none for the special case of
forcing a window when there is not a video track. For completion's sake,
game is also allowed as a value for this option, but in practice there
shouldn't be a reason to use that.
2022-11-15 23:18:55 +00:00
Dudemanguy 38a626650a player: add --force-render option
mpv has an internal optimization on a couple of platforms where it will
not render any frames if the window is minimized or hidden. There's at
least once possible use case for wanting to force a render anyway
(screensharing with pipeware) so let's just add a simple switch for
this that always forces mpv to render. Closes #10846.
2022-11-15 15:31:21 +00:00
Niklas Haas 33136c276c vo_gpu_next: add tunable shader parameters
This is a very simple but easy way of doing it. Ideally, it would be
nice if we could also add some sort of introspection about shader
parameters at runtime, ideally exposing the entire list of parameters as
a custom property dict. But that is a lot of effort for dubious gain.

It's worth noting that, as currently implemented, re-setting
`glsl-shader-opts` to a new value doesn't reset back previously mutated
values to their defaults.
2022-11-11 13:58:35 +01:00
Dudemanguy adb556bf15 vo_dmabuf_wayland: use special ra_ctx_create_by_name
vo_dmabuf_wayland has its own ra and context so it can handle all the
different hwdec correctly. Unfortunately, this API was pretty clearly
designed with vo_gpu/vo_gpu_next in mind and has a lot of concepts that
don't make sense for vo_dmabuf_wayland. We still want to bolt on a
ra_ctx, but instead let's rework the ra_ctx logic a little bit. First,
this introduces a hidden bool within the ra_ctx_fns that is used to hide
the wldmabuf context from users as an option (unlike the other usual
contexts). We also want to make sure that hidden contexts wouldn't be
autoprobed in the usual ra_ctx_create, so we be sure to skip those in
that function. Additionally, let's create a new ra_ctx_create_by_name
function which does exactly what says. It specifically selects a context
based on a passed string. This function has no probing or option logic
is simplified just for what vo_dmabuf_wayland needs. The api/context
validations functions are modified just a little bit to make sure hidden
contexts are skipped and the documentation is updated to remove this
entries. Fixes #10793.
2022-10-28 02:36:46 +00:00
Aaron Boxer aeb4792cb6 vo_vaapi_wayland: remove, as it is superceded by vo_dmabuf_wayland 2022-10-26 18:41:47 +00:00
Aaron Boxer 7358b9d371 vo_dmabuf_wayland: wayland VO displaying dmabuf buffers
Wayland VO that can display images from either vaapi or drm hwdec

The PR adds the following changes:

1. a context_wldmabuf context with no gl dependencies
2. no-op ra_wldmabuf and dmabuf_interop_wldmabuf objects
   no-op because there is no need to map/unmap the drmprime buffer,
    and there is no need to manage any textures.

Tested on both x86_64 and rk3399 AArch64
2022-10-26 18:41:47 +00:00
Leo Izen b3d77397eb
DOCS: fix minor typo with keep-open description
Fix a minor typo in the description of --keep-open
in DOCS/man/options.rst
2022-10-12 10:19:09 -04:00
Niklas Haas 7f5541fc3c vulkan: remove --vulkan-disable-events
This has had no effect since libplacebo v4.192.0, and was deprecated
upstream a year ago. No deprecation period in mpv is justified by this
being a debug / work-around option.
2022-10-05 16:35:14 +02:00
sfan5 5463d3eeff vo_gpu: hwdec: add Android hwdec utilizing AImageReader 2022-10-02 14:12:26 +02:00
Leo Izen 2207236aaa DOCS: deprecate --gamma-factor and --gamma-auto
Removed the outdated information about environmental brightness
with respect to --gamma-factor, and mention that the option is
deprecated and subject to future removal. Also deprecated the
--gamma-auto option as it relies on the same outdated way of doing
things.
2022-10-01 10:01:09 -04:00
Niklas Haas 00813c7629 manpage: document bt.2390 parameter
Closes #9788
2022-09-28 01:55:39 +02:00
Leo Izen 4856a7bd59
DOCS/man/options.rst: replace some legacy single-hyphen syntax
Replace some occurrences of ``-option`` with ``--option`` to
coincide with the current option sytnax.
2022-09-20 10:08:28 -04:00
Cairn a7098a4336 DOCS: Mention "mono" audio channels option 2022-09-09 13:00:58 -04:00
sfan5 0421e81965 DOCS/options: update vd-lavc-skiploopfilter, skipidct and related descriptions
Cross-checked the current functionality of these with the FFmpeg source.
2022-08-31 11:29:39 +02:00
Dudemanguy f0011552e7 wayland: add support for configure bounds
In wayland-protocols 1.25, xdg-shell got a version bump which added the
configure_bounds event. The compositor can send this to clients to
indicate that they should not resize past a certain size. For mpv, we'll
choose to only listen to this on reconfig events (i.e. when the window
first appears and if the video resolution changes later in the
playlist). However, this behavior is still exposed as a user option
(default on) because it will neccesarily conflict with a user setting a
specific geometry size and/or window scale. Presumably, if someone is
setting a really large size that goes beyond the bounds of their
monitor, they actually want it like that. The wayland-protocols version
is newer-ish, but we can get around having to poke the build system by
just using a define that exists in the generated xdg-shell header.
2022-08-14 16:04:49 +00:00
Dudemanguy b669a20bb5 DOCS/options: correct wayland-disable-vsync option
This is actually dated. It works on all wayland outputs/VOs and has for
some time now.
2022-08-12 23:14:09 -05:00
Philip Langdale 25fa1b0b45 hwdec/drmprime: add drmprime hwdec-interop
In the confusing landscape of hardware video decoding APIs, we have had
a long standing support gap for the v4l2 based APIs implemented for the
various SoCs from Rockship, Amlogic, Allwinner, etc. While VAAPI is the
defacto default for desktop GPUs, the developers who work on these SoCs
(who are not the vendors!) have preferred to implement kernel APIs
rather than maintain a userspace driver as VAAPI would require.

While there are two v4l2 APIs (m2m and requests), and multiple forks of
ffmpeg where support for those APIs languishes without reaching
upstream, we can at least say that these APIs export frames as DRMPrime
dmabufs, and that they use the ffmpeg drm hwcontext.

With those two constants, it is possible for us to write a
hwdec-interop without worrying about the mess underneath - for the most
part.

Accordingly, this change implements a hwdec-interop for any decoder
that produces frames as DRMPrime dmabufs. The bulk of the heavy
lifting is done by the dmabuf interop code we already had from
supporting vaapi, and which I refactored for reusability in a previous
set of changes.

When we combine that with the fact that we can't probe for supported
formats, the new code in this change is pretty simple.

This change also includes the hwcontext_fns that are required for us to
be able to configure the hwcontext used by `hwdec=drm-copy`. This is
technically unrelated, but it seemed a good time to fill this gap.

From a testing perspective, I have directly tested on a RockPRO64,
while others have tested with different flavours of Rockchip and on
Amlogic, providing m2m coverage.

I have some other SoCs that I need to spin up to test with, but I don't
expect big surprises, and when we inevitably need to account for new
special cases down the line, we can do so - we won't be able to support
every possible configuration blindly.
2022-08-09 10:19:18 -07:00
Dudemanguy 24f4582b6f x11: add --x11-present option
With the recent addition of the libxpresent, it should improve frame
timings for most users. However, there were known cases of bad behavior
(Nvidia) which lead to a construction of a whitelist instead of just
enabling this all the time. Since there's no way to predict whatever
combination of hardware/drivers/etc. may work correctly, just give users
an option to switch the usage of xorg's presentation statistics on/off.
The default value, auto, works like before (basically, Mesa drivers and
no Nvidia are allowed), but now one can force it on/off if needed.
2022-06-22 03:55:49 +00:00
Sagnac aab9ab97f0 DOCS/options: fix incorrect labelling of hr-seek default
The `absolute` value was incorrectly labelled as the default instead of
the value named `default`, which was somewhat confusing. When the newer
default option was added in 679e410 it seems like wm4 forgot to remove
the label in the manual on the previous default.
2022-06-10 13:42:10 +00:00
Aaron Boxer defb02daa4 vo: add new vaapi-wayland driver
This driver makes use of dmabuffer and viewporter interfaces
to enable efficient display of vaapi surfaces, avoiding
any unnecessary colour space conversion, and avoiding scaling
or colour conversion using GPU shader resources.
2022-05-24 21:39:34 +00:00
Leo Izen 6605b6d619 DOCS/options: properly capitalize JPEG XL
The appropriate style for jxl images is JPEG XL,
not Jpeg XL. Update the docs to reflect this.
2022-04-26 12:47:07 -04:00
Leo Izen 1345977f99 video/image_writer: add Jpeg XL screenshots
Add Jpeg XL as a possible output format for screenshots, which
should make it possible to take fast screenshots with much better
quality than JPEG, or take lossless high-bit-depth screenshots
with lower file sizes than PNG.
2022-04-26 16:48:00 +03:00
Cœur bb5b4b1ba6 various: fix typos 2022-04-25 09:07:18 -04:00
Guido Cella f75701b219 DOCS/options: update the --load-osd-console documentation
- Say built-in which is more common than builtin
- Move "By default" because only the key to open the console is
  customizable, and fix the punctuation and case of the sentence
- ` opens the console, not ´
- Remove the sentences that explains which user script console.lua is
  based on since it's no longer relevant now that the console has been
  part of mpv for over 2 years.
2022-04-21 17:07:47 +00:00
Guido Cella ccff82e610 options: make --cover-art-auto=exact the default
Now that a separate --cover-art-whitelist option exists, files like
cover.jpg are loaded even without setting --cover-art-auto to fuzzy, so
only load files that have exactly the media filename by default, since
fuzzy loading is probably more likely to load unwanted images than to
load cover art that the user intended to display, especially if you play
audio files with a short filename like a.mp3.
2022-04-21 16:42:27 +00:00
Guido Cella 9d2a6dc302 player: add cover-art-whitelist option
This allows more fine grained control over which cover art to load. With
--cover-art-auto=exact and --cover-art-whitelist=yes, you can now load
cover art with the exact media filename and the whitelisted filenames,
but not cover art that contains the media filename
(--cover-art-auto=fuzzy).
2022-04-21 16:42:27 +00:00
hooke007 c317abbb63 DOCS: fix the typo of --sub-justify 2022-04-21 16:04:50 +00:00