Commit Graph

49325 Commits

Author SHA1 Message Date
Jan Ekström dd6fce5138 ci/build-freebsd: require OSSv4 AO to be enabled 2021-11-10 17:08:16 +01:00
Niklas Haas c413720801 vo_gpu_next: fix slight performance regression
This logic, which was working around a libplacebo bug, ended up always
alpha blending - even for sources without an alpha channel. This caused
a minor slowdown to be constantly enabled.

Due to the recent bump to libplacebo v170, this is no longer needed.
2021-11-10 10:38:58 +01:00
Starsam80 69527077c1 vo_gpu_next: Initialize `pl_frame_mix`
Without initializing, the random data causes the `pl_render_image_mix`
function to abort with a SIGSEGV.
2021-11-09 02:14:30 +01:00
Niklas Haas 4470eaf5e5 vo_gpu_next: implement HDR passthrough
Completely untested, since Linux still can't into HDR in 2021. Somebody
please make sure it works.

Technically covers #8219, since gpu-context=drm can be combined with
vo=gpu-next.
2021-11-08 20:57:54 +01:00
Niklas Haas 3cf6147368 vo_gpu_next: drop PL_API_VER checks
These are no longer needed with the minimum version bump.
2021-11-08 18:24:11 +01:00
Niklas Haas ff0864d5f0 vo_gpu_next: fix resource exhaustion on minimized windows
This required an upstream API change to implement in a way that doesn't
unnecessarily re-push or upload frames that won't be used. I consider
this a big enough bug to justify bumping the minimum version for it.

Closes #9401
2021-11-08 18:24:11 +01:00
Dudemanguy f5d545c917 wayland: remove bogus scale_change variable
This was originally added in f2afae55e9
for unclear reasons (way to go me). This concept is clearly incorrect.
It doesn't matter what state the window is in. As soon as mpv detects a
scale change, it needs to reset the buffer scale of the window. Just
remove all this junk and put wl_surface_set_buffer_scale in
set_surface_scaling like it should be. Related issue: #9426.
2021-11-08 09:49:49 -06:00
Niklas Haas 73563cebf9 vo_gpu_next: add automatic translation for ewa_lanczossharp
This one hits a lot of people. Probably because the man page explicitly
recommends it.

Fixes #9408
2021-11-07 22:32:00 +01:00
Niklas Haas eca1b8dc29 vo_gpu_next: implement --dither-depth
I somehow completely forgot about this option existing.

Closes #9416
2021-11-07 18:12:42 +01:00
Niklas Haas 459f7d4a8d vo_gpu_next: remove --builtin-scalers option
Looking at this again I'm not sure it does anything useful at all. The
man page entry is also wrong: `bicubic` is not affected, only
`bicubic_fast`, and those filters are not configurable anyways.

So this would only ever be a debugging option, and I don't see a
pressing need for it.

No interface-change.rst update because it only just got added anyways.
2021-11-07 11:32:57 +01:00
sfan5 ec16769c2d f_lavfi: replace deprecated avfilter_pad_count 2021-11-05 23:34:20 +01:00
sfan5 6996588254 audio: replace deprecated av_mallocz_array 2021-11-05 23:34:20 +01:00
Dudemanguy 662c793a55 vo_gpu_next: call start_frame in vulkan/context.c
In practice, this is for wayland. vo_gpu_next doesn't check the
check_visible parameter since it didn't descend into the
vulkan/context.c file when starting a frame. To make this happen, just
call the start_frame function pointer but pass NULL as the ra_fbo. In
there, we can do the visibility checks and after that bail out of the
start_frame function if ra_fbo is NULL.
2021-11-04 15:59:56 +00:00
Dudemanguy acde63f05a wayland_vk: rename start_frame to check_visible
This vulkan-specific parameter was poorly named and probably causes
confusion. Just rename it to check_visible instead to make clear what is
going on here. Only wayland uses it for now but in theory anyone else
can. As an aside, wayland egl accomplishes this by using an external
swapchain instead (an opengl-only concept in the mpv code). This may or
may not need to be changed in the future when gpu-next gets opengl
support.
2021-11-04 15:59:56 +00:00
Niklas Haas a73e5cdbed manpage: document --sharpen not affecting vo_gpu_next
Fixes https://github.com/mpv-player/mpv/issues/9387
2021-11-03 15:37:19 +01:00
Niklas Haas 8bd0dee531 osdep: rename MP_UNREACHABLE
It was pointed out on IRC that the name is misleading, since the actual
semantics of the macro is to assert first.
2021-11-03 15:15:20 +01:00
Niklas Haas 701bd783ca vo_gpu_next: fix --tone-mapping-param mapping
vo_gpu defaults this to NAN, libplacebo uses 0.0 as the default.

Fixes https://github.com/mpv-player/mpv/issues/9386
2021-11-03 14:43:17 +01:00
Niklas Haas 9d5d9b2424 vo_gpu_next: add new libplacebo-based renderer
As discussed in #8799, this will eventually replace vo_gpu. However, it
is not yet complete. Currently missing:

- OpenGL contexts
- hardware decoding
- blend-subtitles=video
- VOCTRL_SCREENSHOT

However, it's usable enough to cover most use cases, and as such is
enough to start getting in some crucial testing.
2021-11-03 14:09:27 +01:00
Niklas Haas 872015813c sub: assert potential pitfall
This one got me debugging for quite a while. Assert it for the future.
2021-11-03 14:09:27 +01:00
Niklas Haas c704824b45 osdep: add MP_UNREACHABLE
This seems to work on gcc, clang and mingw as-is, but I made it
conditional on __GNUC__ just in case, even though I can't figure out
which compilers we care about that don't export this define.

Also replace all instances of assert(0) in the code by MP_UNREACHABLE(),
which is a strict improvement.
2021-11-03 14:09:27 +01:00
Niklas Haas 2107671691 build: add check_preprocessor
This can be used to do things like query the values of preprocessor
defines like version macros, among other potential uses.
2021-11-03 14:09:27 +01:00
Niklas Haas edb0caa441 vo_gpu: allow using bare windows as --(t)scale
A lot of people seem to do something like --tscale=box
--tscale-window=<function>. Just let them use --tscale=<function>
directly, by also accepting raw windows.

Kinda hacky but needed for feature parity with vo_gpu_next, which no
longer has `--tscale=box`. Note that because the option struct is still
shared, vo_gpu_next inherits the same option handling code, so we have
to export this feature for vo_gpu as well.
2021-11-03 14:09:27 +01:00
Niklas Haas 242cd76ee7 vo_gpu: vulkan: expose swapchain to mpvk_ctx
So I can reuse it in vo_gpu_next.
2021-11-03 14:09:27 +01:00
Niklas Haas 432581b604 vo_gpu: lift ra_ctx_* opts to a global struct
So I can re-use them for vo_gpu_next.
2021-11-03 14:09:27 +01:00
Dudemanguy 5512f53722 player: fix autofit/geometry related segfault
Back when runtime updating of autofit/geometry was added for wayland and
x11 (commits: 4445ac828d and
ced92ba607 respectively), the naive
assumption was that window-related geometry would always be available.
While this is true 99% of the time, this isn't a guarentee. It is
possible for certain things such as loading shaders to delay starting up
the player. This causes autofit/geometry options to be registered as a
runtime update and triggers VOCTRL_VO_OPTS_CHANGED. This ends up calling
some geometry-related functions but this happens before the actual
values are available. Hence, a nullptr was accessed which segfaults. At
least one user experienced this with a combination of options in wayland
but in theory the same thing could happen under x11.

The fix is simple. Just be sure to check that the required geometry is
available before doing any calculations. In wayland, this would be
wl->current_output. Additionally add an assert to set_geometry (we
should never use this function without wl->current_output) to be extra
sure. In x11, the check is on x11->window. Later when the reconfig for
each backend actually happens, the autofit/geometry set by the user
happens anyway so ignoring it in this case does no harm. Fixes #9381.
2021-11-03 00:32:27 +00:00
sfan5 171627b267 Update VERSION 2021-11-01 15:46:09 +01:00
sfan5 9ca9066d05
Release 0.34.0 2021-11-01 15:44:39 +01:00
Avi Halachmi (:avih) f6b834a2fc js: ~~/init.js: use mp.find_config_file
The problem with the previous code - which used mp.get_user_path, is
that it returns a path even with --no-config, and even if the file
doesn't exist.

This is why we tested the "config" property, and also used
mp.utils.file_info to check that the file exists.

mp.find_config_file doesn't return a path with no-cofig and doesn't
return a path if the file doesn't exists. It's simpler and better.
2021-11-01 14:31:18 +01:00
sfan5 3ea1f8e80a DOCS: clarify what the ~~/ path means
As it turns out the manual was very wrong about this.
2021-11-01 14:30:59 +01:00
Guido Cella 87c9eefb29 console.lua: define remaining emacs keybindings 2021-11-01 23:42:16 +11:00
Niklas Haas c82ffb6670 vo_gpu: libplacebo: simplify tex transfers for libplacebo 168+
Upstream libplacebo got refactored to use byte-sized strides rather than
texel-sized strides. This commit makes mpv's ra_pl wrapper take
advantage of that, rather than forcing a stride-fixing memcpy.

Note that, technically, we would still need a stride fixing memcpy in
cases when the true stride is not a multiple of the format's texel
*alignment*, however this is a much rarer case and extremely unlikely to
occur in practice, since all relevant formats use power-of-two texel
alignments.
2021-10-31 19:39:58 +01:00
Guido Cella 4a80de90d2 DOCS/input: fix subprocess typo 2021-10-26 20:29:18 +00:00
Guido Cella 8778c296b4 DOCS/options: clarify watch-later-options examples
Make it clearer that watch-later-options controls which options are not saved
and not which ones are restored.
2021-10-26 20:27:49 +00:00
Dudemanguy e4ee0c6ebc wayland: remove incorrect keepaspect check
In the reconfig event, the keepaspect option was checked before setting
the window_size geometry to the new params obtained from the vo. This is
incorrect. If a user disabled keepaspect on wayland, the video's size
would not change on a reconfigure event (i.e. loading a new video in the
playlist with a different size). No other windowing backend (x11, win32,
etc.) behaves like this or uses keepaspect in its code like wayland did
in this case. Clearly, this is not correct. Such functionality should be
handled by a separate option entirely. Just remove this if statement.
2021-10-26 13:21:08 -05:00
Noralf Trønnes e6ab676d20 drm_common: add connector types USB, SPI and Writeback
Add support for the newly added USB connector type and also SPI and Writeback.
2021-10-26 17:44:54 +00:00
Noralf Trønnes 9cf95baaf3 drm_common: support unknown connector types
Avoid 'Segmentation fault' by using the connector type name UNKNOWN if
the connector type is not known to mpv.
2021-10-26 17:44:54 +00:00
Jan Ekström 78cfeee2b9 {wscript,demux_lavf}: clean up last bits of !FFMPEG_STRICT_ABI
The bytes_read struct member in AVIOContext is now officially public,
so its usage no longer has to be specified as non-compliance with
FFmpeg's ABI/API rules.

That said, unfortunately there was a short period of time between
August 2021 and October 2021 where the struct member did not exist
in FFmpeg's git master, so keep a feature check for it alive for
now to enable building with those versions. Thankfully, no release
version of FFmpeg will be without this field, so it should be
possible to drop this check with time.

Finally, simplify the function in case the struct member is not
found. After all, there is zero reason to iterate through the AVIO
contexts if we cannot get the information we require.
2021-10-26 01:21:56 +03:00
Jan Ekström f560437594 drm_common: enable specific device selection by means of path 2021-10-25 20:37:03 +02:00
Jan Ekström e6cf918eb8 drm_common: utilize drmGetDevices when iterating over cards
Based on the idea behind emersion's change to drm_info
(869e789a64).

Lets us by default skip devices which are not capable of doing what
the DRM master output requires (not primary devices), as some devices
have card0 actually not be such.

Negative part is that the number given to drm-connector is no
longer a direct mapping against a file name.
2021-10-25 20:37:03 +02:00
Dudemanguy 12056fdcd4 version.sh: bump copyright year
It's been 2021 for a while now.
2021-10-25 10:20:54 -05:00
Niklas Haas 254730d891 vo_gpu: fix rotated compute shader vertex simulation
Upon re-examination I have no idea why this code was ever written or
what problem it was trying to solve. But, getting rid of it fixes #9291.

It might be a remnant from before 2af2fa7a27. Who knows. This code will
be replaced soon(tm) anyways.
2021-10-22 19:08:13 +02:00
Jan Ekström a76527772e github/workflows: use xcode 13.1 if image defaults to xcode 13.0
I find it both hilarious and sad that Github decided that defaulting
to XCode 13.0 was a good idea... At least they added 13.1 quickly.

Ref actions/virtual-environments#4180
Ref actions/virtual-environments#4300
2021-10-21 21:29:08 +03:00
Aman Karmani 06392e7ec1 ao_audiotrack: change buffer sizing logic
Previously number of channels was being ignored.

The buffer will now be between 75ms and 150ms

Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
Aman Karmani fa691e0f69 ao_audiotrack: allocate chunk buffer based on negotiated size
Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
Aman Karmani 6473711dce ao_audiotrack: support delay up to 2s as normal
Fixes issues streaming to echo speaker pair from firetv devices.

Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
Aman Karmani 432c0255bc ao_audiotrack: set device_buffer based on underlying buffer size when available
Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
Aman Karmani 7356ee5339 ao_audiotrack: use new style initializer for AudioTrack when available
Fixes deprecation warnings printed when using this driver.

Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-10-21 17:20:51 +02:00
Dudemanguy 7ad5ad4098 egl_helpers: ensure debug context attrs/bit exist
Regression from e13fe1299d. Apparently,
Broadcom's EGL does not support the EGL_CONTEXT_FLAGS_KHR attribute nor
EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR. Just define these as EGL_NONE and 0
respectively if we do not have them.
2021-10-21 03:16:33 +00:00
Emil Velikov ef301893a5 editorconfig: add initial file/config
editorconfig configuration files hold editor style hints, and
is supported by many popular editors. See https://editorconfig.org/ .

The vast majority of the mpv source/text files are already styled as
4 space indentation, trailing newline at EOF, and UTF-8 encoding.

This commit adds a single .editorconfig root file which applies these
rules to all files using the glob "[*]".

If it turns out to be too inclusive then we can narrow it down later.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
2021-10-20 12:26:20 +03:00
Avi Halachmi (:avih) 32e851d2bc lua: makenode: prevent lua stack corruption
Normally there was no issue, but when the code converted a deeply
nested table into an mpv node - it didn't ensure the stack has room.

Lua doesn't check stack overflow when invoking lua_push* functions,
and leaves this responsibility to the (c) user via lua_checkstack.

Normally that's not an issue because when a lua (or autofree) function
is called, it's guaranteed at least LUA_MINSTACK (20) pushes.

However, pushnode and makenode are recursive, and each iteration can
add few values at the stack (which are popped when the recursion
unwinds), so checkstack must be used on (recursive) entry.

pushnode already checked the stack, makenode did not.

This commit checks the stack at makenode as well. The value of 6
(stack places to reserve) is with some room to spare, and in pratice
each iteration needs 2-3 at most (pushnode also leaves room).

Example which could previously corrupt the stack:
  utils.format_json({d1={d2={<8 more times>}}}

This uses makenode to convert the lua table into an mpv node which
the json writer uses as input, and if the depth is 10 or more then
corruption could occur. mp.command_native is also affected, as well as
any other mp/utils command which takes a lua table as input.

While at it, fix the error string which pushnode used (luaL_checkstack
uses the provided string with "Stack overflow (%s)", so the user
message only needs to be additional info).
2021-10-20 12:07:30 +03:00