Commit Graph

50741 Commits

Author SHA1 Message Date
Kacper Michajłow eab3842d8b cplugin: allow loading mpv_* symbols dynamically
Defining MPV_CPLUGIN_DYNAMIC_SYM during plugin compilation will replace mpv_*
functions with function pointers. Those pointer will be initialized when
loading the plugin.

It is recommended to use this symbol table when targeting Windows. The loader
does not have notion of global symbols. Loading cplugin into mpv process will
not allow this plugin to call any of the symbols that may be available in
other modules. Instead cplugin has to link explicitly to specific PE binary,
libmpv-2.dll/mpv.exe or any other binary that may have linked mpv statically.
This limits portability of cplugin as it would need to be compiled separately
for each of target PE binary that includes mpv's symbols. Which in practice
is unrealictis, as we want one cplugin to be loaded without those restrictions.

Instead of linking to any PE binary, we create function pointer for all mpv's
exported symbols. For convinience names of entrypoints are redefined to those
pointer so no changes are required in cplugin source code, except defining
MPV_CPLUGIN_DYNAMIC_SYM. Those function pointer are exported to make them
available for mpv to init with correct values during runtime, before calling
`mpv_open_cplugin`.

Note that those pointer are decorated with `selectany` attribute, so no need
to worry about multiple definitions, linker will keep only single instance.

This fixes cplugin usability on Windows. Without any API changes, only
recompilation with -DMPV_CPLUGIN_DYNAMIC_SYM is needed.
2023-09-20 02:16:45 +00:00
Kacper Michajłow 4435b1a0d5 libmpv: remove not used mpv.pc.in
waf leftover
2023-09-20 02:16:45 +00:00
chuck- adb118290b osdep/io: provide dlopen, etc. abstraction wrappers for windows 2023-09-20 02:16:45 +00:00
chuck- 0084854f8f scripting: dll cplugins 2023-09-20 02:16:45 +00:00
Kacper Michajłow 703f158880 builtin.conf: modernize internal profiles
The goal is to provide simple to understand quality/performance level
profiles for the users.

Instead of default and gpu-hq profile. There main profiles were added:
    - fast: can run on any hardware
    - default: balanced profile between quality and performance
    - high-quality: out of the box high quality experience. Intended
      mostly for dGPU.

Summary of three profiles, including default one:

[fast]
scale=bilinear
cscale=bilinear (implicit)
dscale=bilinear
dither=no
correct-downscaling=no
linear-downscaling=no
sigmoid-upscaling=no
hdr-compute-peak=no

[default] (implicit mpv defaults)
scale=lanczos
cscale=lanczos
dscale=mitchell
dither-depth=auto
correct-downscaling=yes
linear-downscaling=yes
sigmoid-upscaling=yes
hdr-compute-peak=yes

[high-quality] (inherits default options)
scale=ewa_lanczossharp
cscale=ewa_lanczossharp (implicit)
hdr-peak-percentile=99.995
hdr-contrast-recovery=0.30
allow-delayed-peak-detect=no
deband=yes
scaler-lut-size=8
2023-09-19 22:26:56 +02:00
Kacper Michajłow 7e692ee490 vo: change tscale to oversample by default
Keep it sharp, let users opt-in more blurry result.
2023-09-19 22:26:56 +02:00
Kacper Michajłow 4bedcd36f6 vo: make cscale follow scale by default 2023-09-19 22:26:56 +02:00
Kacper Michajłow 8121d41245 vo: enable correct-downscaling, linear-downscaling, sigmoid-upscaling 2023-09-19 22:26:56 +02:00
Dudemanguy 27a78276eb vo: avoid unnecessary redraws when the OSD shows
296d40dc6f changed how the vo handled
redraw requests in order to fix a race condition that can occur with
pausing. However, there was a slight oversight because a redraw request
that occurred while the core was unlocked and the video was still
playing would still be kept true (previously, this was always cleared).
That redraw is essential if mpv is paused otherwise the old issue comes
back, but if the video is playing it's unnecessary since the next loop
around will simply draw whatever we needed. The extra redraw could cause
a frame drop for some people in certain instances, so the solution is to
simply always clear redraw requests if !in->paused. This eliminates the
extra redraw but still keeps it when pausing.

Fixes #12426 and fixes #11579.
2023-09-19 13:11:30 -05:00
Dudemanguy 7a76cf4d65 demux: prepend some cache options with demuxer
--cache-dir is an awful name that leads to confusion (see #12418).
Change the name to --demuxer-cache-dir and --demuxer-cache-unlink-files
instead.
2023-09-18 17:13:15 +00:00
llyyr 1c09ee44c3 filter_kernels: remove bcspline filter
After fixing the B and C params for bcspline, it ended up being the same
thing as bicubic. There's no reason to have two names for the same
filter, so remove bcspline and keep bicubic to match libplacebo.
2023-09-18 17:44:18 +02:00
llyyr 816de3f064 filter_kernels: fix bcspline params
bcspline is defined as B=1, C=0 in ImageMagick (as CubicFilter) and
libplacebo, so we should match that.
2023-09-18 17:44:18 +02:00
llyyr faf5a4bc8d filter_kernels: add hermite filter
Matches HermiteFilter from Imagemagick (B=C=0, R=1)
2023-09-18 17:44:18 +02:00
llyyr 5efc04006b vo_gpu_next: fix blur and taper values being zero
This would always apply the config blur and taper values to the kernel,
even if it was zero because the user didn't specify any.
2023-09-18 17:42:28 +02:00
Dudemanguy ed5c744aa9 vo_dmabuf_wayland: support 90 degree rotations
All we have to do is set VO_CAP_ROTATE90 and then use buffer transform.
Maybe ideally we would rotate with vavpp instead if possible, but this
would be a convoluted mess that I'm not really interested in dealing
with right now.
2023-09-17 19:29:59 -05:00
Dudemanguy c6cef1bad3 DOCS/vo: remove outdated reference to --vo-vaapi-deinit-mode
This option was removed in db2268d5b1, but
the manual was never updated to reflect that.
2023-09-17 15:24:55 -05:00
Kacper Michajłow a4bf0bd695 demux_mkv: support ProjectionPoseRoll element 2023-09-17 16:48:42 +00:00
Kacper Michajłow 338f31e0b6 demux_mkv: support PixelCrop* elements
Fixes #6017
2023-09-17 16:48:42 +00:00
Kacper Michajłow 008e7db843 TOOLS/matroska.py: add PixelCrop* elements 2023-09-17 16:48:42 +00:00
Kacper Michajłow c40b064e38 demux: add crop to mp_codec_params 2023-09-17 16:48:42 +00:00
Kacper Michajłow 63ca12d7bc win32: remove noisy debug log
It is quite unnecessary to log every window move.
2023-09-17 17:14:34 +02:00
llyyr 181eddc80e osc: add scrolling to audio/sub buttons
Consistent with other osc buttons now
2023-09-17 00:03:45 +02:00
Niklas Haas bc35180933 vo_gpu: remove --scale-wblur etc
No need for this since it's entirely redundant with just changing the
filter radius directly. In fact, that's the whole *point* of the filter
radius - it does not modify the filter, it modifies the scaling of the
window.

Of course, this does not work for non-resizable kernels. But, really,
who cares?
2023-09-16 14:33:45 +02:00
Niklas Haas a24aa6b8f7 filter_kernels: add ewa_lanczos4sharpest
Mainly for vo_gpu_next.
2023-09-16 14:33:45 +02:00
Niklas Haas 93ff7554ac filter_kernels: refine ewa_lanczossharp/soft constants
Replaced by mathematically and numerically precise constants, the result
of exact computation. Also updates the description to provide more
explanation and motivation.
2023-09-16 14:33:45 +02:00
Niklas Haas 2ec79f8bb7 filter_kernels: use true jinc radius
For all filters. For consistency between vo_gpu and vo_gpu_next. Also
makes ewa_lanczossharp less special.
2023-09-16 14:33:45 +02:00
Niklas Haas aef62063f7 filter_kernels: replace magic jinc radius by constant (cosmetic) 2023-09-16 14:33:45 +02:00
Niklas Haas 06e65778be filter_kernels: properly sharpen/blur filter radius
We currently always scaled the window to the size of the configured
radius. However, this is wrong - we should instead be scaling it to the
size of the sharpened/blurred kernel. Since the window is always
stretched to the configured size of the filter, we can accomplish this
easily by just multiplying the blur value into the filter radius
directly, and then using that adjusted radius in place of `f.radius`
everywhere.

On a side note, this gives a very minor performance boost to
ewa_lanczossharp for no downside.
2023-09-16 14:33:45 +02:00
Niklas Haas 87162f0722 vo_gpu: slight bump to hard-coded option size limits
ewa_lanczos4sharpest, for example, overflows this buffer.
2023-09-16 14:33:45 +02:00
Niklas Haas 818ef158e8 vo_gpu_next: remove ewa_lanczossharp nag
Upstream finally caved in to peer pressure and added this filter. Of
course, this also removes the fallback for people on older versions of
libplacebo, but people using mpv git master are probably using
libplacebo git master anyway. It's time to debloat this code.
2023-09-16 14:33:45 +02:00
Christoph Heinrich 3972fd1be4 TOOLS/lua/autoload: rename local variable to lowercase 2023-09-15 21:19:34 +00:00
Christoph Heinrich 43e960e1f6 TOOLS/lua/autoload: pass extensions to recursive call
Closes #12400
2023-09-15 21:19:34 +00:00
llyyr 55a46214c4 hwtransfer: make probe_formats logging less spammy
This demotes the logs from VERBOSE to DEBUG, as well as making it log
formats in one line rather than one per line.
2023-09-15 09:39:16 -07:00
Niklas Haas 40de03fdba vo_gpu: vo_gpu_next: support --icc-3dlut-size=auto
And make it the default. In libplacebo, this uses internal heuristics to
pick a good size based on the actual ICC characteristics. This is
significantly less wasteful than always generating a 64x64x64 3DLUT (the
old status quo).

In vo_gpu, for simplicity, just default to 65x65x65. Note that this
provides slightly better accuracy than the old default of 64x64x64 for
technical reasons, and matches what libplacebo defaults to for typical
display profiles.
2023-09-15 10:58:37 +02:00
Niklas Haas 400c12fe00 vo_gpu_next: update for new ICC profile API
Upstream has moved from passing struct pl_icc_profile to directly
attaching a managed pl_icc_object, plus providing a new function
pl_icc_update to update the ICC profile object parameters (if needed).

To facilitate this move, pull our ICC params back out of pl_options and
update the target ICC object directly.
2023-09-15 10:58:37 +02:00
Dudemanguy 8a2fbfc2b8 present_sync: allow future timestamps
The original OML sync implementation (which is where this calculation
originally comes from) made now_monotonic and ust_mp_time unsigned. This
is fine except it has the assumption that now_monotonic is always
greater than ust. This actually isn't always the case. In wayland, I
observed instances where the reported timestamp is in the future. Of
course, it's a valid question to wonder if this even makes sense but
these UST values are essentially opaque black boxes to us anyways. It's
entirely plausible that the gpu is expecting the actual presentation of
the last swap to be a bit in the future, the compositor gets this and
reports this to us. So we'll consider such stats as valid. Note that
xorg doesn't have this problem because it's roughly one swap buffer call
behind because of how the event loop works (honestly something that
should be fixed).

Of course, the problem with the unsigned type here is that it overflows
on the subtraction so make it signed and allow the appropriate negative
value to happen if it does. Note that this will simply result in a small
addition to mp_time_us() which is exactly what we want here (timestamp
slightly in the future). Some small style changes included just because.
2023-09-14 22:19:18 +00:00
Niklas Haas c9d5b482c1 vo_gpu_next: map --scaler-resizes-only 2023-09-14 18:24:47 +02:00
dyphire 24cedfec8b TOOLS/lua/autoload: change EXTENSIONS_TARGET to a local variable 2023-09-14 13:40:19 +00:00
dyphire df3a0fa979 TOOLS/lua/autoload: fix specify loading only one type of files
Fixes: 5100e7acba
2023-09-14 13:40:19 +00:00
Christoph Heinrich da400ed3a9 TOOLS/lua/autoload: add directory_mode option
This option behaves the same as the builtin one, and if it's value
is anything other then recursive|lazy|ignore it will fall back on the
builtin one as a sort of "auto" mode. It defaults to that auto mode.
2023-09-13 22:47:59 +00:00
Christoph Heinrich 5100e7acba TOOLS/lua/autoload: add recursive directory loading
Recursion depth has been limited to 20, the same depth the demuxer uses.
2023-09-13 22:47:59 +00:00
Christoph Heinrich 5de1f5ad83 TOOLS/lua/autoload: avoid adding entries to the playlist more then once
Playlist entries should be added at most once, independent of if they
got added by autoload or not.
2023-09-13 22:47:59 +00:00
Christoph Heinrich 6714f6b820 TOOLS/lua/autoload: support directories
Adds support for adding directories to the playlist in addition to
files. The propertiy `directory-mode` controls if directories get added.
Recursive directory loading will get added in a later commit.

Directories get sorted after files to behave the same way mpv
behaves when it loads directories directly.
2023-09-13 22:47:59 +00:00
syphyr 662650bde3 meson: check vulkan version
The symbol "vkGetPhysicalDeviceProperties2" was recently added
after refactoring context.c.
2023-09-13 00:00:57 +02:00
Y0J1G3N 97dc202787 stream: accept dav:// and davs:// urls
The GNOME Nautilus file manager supports browsing of dav:// and davs:// links only. Additionally, dav:// and davs:// are also types of webdav links. Therefore, adding an "or" operation to include support for dav:// and davs:// links.
2023-09-11 18:24:03 +02:00
sfan5 329d94af41 meson: rename last feature with underscore
fixes: ecbaf34701
2023-09-11 15:20:22 +02:00
dokur0chan e15619e70d DOCS/options: add catmull_rom as an example for --scale
Adds catmull_rom as an example for --scale in the user manual, alongside
a brief description of the filter.

catmull_rom was only exposed to users as an available filter through
--scale=help. However, catmull_rom is very often aliased as "Bicubic" in
other applications such as GIMP and VapourSynth, and is a relatively
popular resizing filter. The documentation lacked any description of
catmull_rom, outside of a brief mention of it in the --tscale section.
2023-09-11 13:30:37 +02:00
Kacper Michajłow 8536aaac3c sd_lavc: fix subtitle presentation time
Packet duration is not necessarily related to the display time of the
subtitle. Use start/end_display_time fields as source of the timing.

Fixes subtitles with infinite duration that should be on screen until
next sub is displayed.
2023-09-11 01:58:07 +00:00
Kacper Michajłow f5690e3c97 Revert "sub: add auto option to --sub-fix-timing"
This reverts commit b47a58516a.
2023-09-11 01:58:07 +00:00
Kacper Michajłow 6f83529f21 vd_lavc: by default enable cropping by decoder
While this resolves limitations of lavc decoder crop, it also introduces
artifacts with some of the source files or hwdec.

Depending on chroma sampler it is possible to sample outside the decoder
crop area, pulling dirty pixels into the image. Some decoders left them
zeroed, not black. To fix that we would need specifc solution during
mapping of avframes.

As most of the files require the crop only in bottom/right area, the
AVCodecContext::apply_cropping works ok for those.

For all other cases that require more fancy cropping like 1440x1080+240+0
user can manually set `--vd-apply-cropping=no`.

Limitations of the lavc crop are explained here:
https://ffmpeg.org/doxygen/trunk/structAVCodecContext.html#a4745c7455c317272c4e139d6f369936c

Fixes: 826ce82cad
2023-09-10 18:33:50 +02:00