Commit Graph

49386 Commits

Author SHA1 Message Date
sfan5 39bed5c7fc encode_lavc: replace deprecated av_init_packet() 2022-01-10 22:56:52 +01:00
sfan5 b1bf4393a8 demux/packet: replace deprecated av_init_packet() 2022-01-10 22:56:52 +01:00
sfan5 8b4a613c54 image_writer: replace deprecated av_init_packet() 2022-01-10 22:56:52 +01:00
Niklas Haas 79783f4ac5 vo_gpu: placebo: add missing gamma functions
These got added upstream a while ago. Need to be added to the mapping
helpers.

It might be time to think about bumping the minimum dependency here.

Reported-by: Uoti Urpala <uau@glyph.nonexistent.invalid>
2022-01-10 15:43:57 +01:00
Dudemanguy d77b30abce meson: remove iconv hacks and bump req. version
There was some breakage with regards to the iconv detection in some
older meson versions. This was all settled in 0.60.3 and now it simply
just works. Remove the workarounds and bump the needed meson version to
0.60.3.
2022-01-09 16:34:50 +00:00
Dudemanguy 5ac8f85d3d github/workflows: remove some pip3 usages
When this was originally added, some OS package managers were slow and
behind the required meson version needed for mpv to build. Both opensuse
tumbleweed and freebsd now appear to carry meson 0.60.3 in their repos
so we no longer need to do the two-step process of installing pip3 and
then installing meson via pip. Instead, just use the OS package manager
version.
2022-01-09 16:34:50 +00:00
Niklas Haas e3b835de7c vo_gpu_next: forward dovi metadata to libplacebo 2022-01-09 13:06:27 +01:00
Niklas Haas 05ccc51d53 vf_format: add dolbyvision sub-option
Useful to strip dolbyvision from the output, in cases where the user
does not want it applied. Doing this as a video filter gives users the
abiilty to easily toggle this stripping at runtime in a way that
properly propagates to any (potentially stateful) VO.

It also thematically fits the rest of the options in vf_format, which
are similarly concerned with modifying the video image parameters.
2022-01-09 13:06:27 +01:00
Niklas Haas 88047f7654 demux_lavf: properly forward dovi config record
This needs to be forwarded from the AVStream to the AVPacket itself, so
that it reaches the decoder. There exists an FFmpeg function for this,
we just need to call it. (Also add some logging)
2022-01-09 13:06:27 +01:00
Lynne 0e5f7b48d2 mp_image: add dolbyvision metadata
Co-authored-by: Niklas Haas <git@haasn.dev>
2022-01-09 13:06:27 +01:00
Julian Orth 777628e761 wayland: use `xkb_keymap_new_from_buffer`
Instead of `xkb_keymap_new_from_string`. The protocol does not require
the keymap to be null terminated and if the size of the keymap is a
multiple of the page size, using `_from_string` could lead to problems.

Some compositors include a null byte and even include the null byte in
`size`. Therefore we have to use `strnlen` to find the real length of
the string. Note that `_from_string` internally uses `strlen` and then
calls `_from_buffer`.
2022-01-08 15:20:02 +00:00
Julian Orth 3978669ece wayland: map keymaps with `MAP_PRIVATE`
While mpv uses version 1 of the `wl_seat` protocol and `MAP_PRIVATE` is
only required from version 7 on, using `MAP_PRIVATE` allows us to be
compatible with compositors that have only been tested with newer
applications.

Since the keymap is not modified after `mmap`, using `MAP_SHARED` has no
advantage over `MAP_PRIVATE`.
2022-01-08 15:20:02 +00:00
Niklas Haas d09c73c7b2 vo_gpu: add --tone-mapping-mode
This merges the old desaturation control options into a single
enumeration, with the goal of both simplifying how these options work
and also making this list more extensible (including, notably, new
options only supported by vo_gpu_next).

For the hybrid option, I decided to port the (slightly tweaked) values
from libplacebo's pre-refactor defaults, rather than the old values we
had in mpv, to more visually match the look of the vo_gpu_next hybrid.
2022-01-07 06:28:14 +01:00
Niklas Haas f3fccfc395 vo_gpu: add --gamut-mapping-mode
Merge --gamut-clipping and --gamut-warning into a single option,
--gamut-mapping-mode, better corresponding to the new vo_gpu_next APIs
and allowing us to easily extend this option as new modes are added in
the future.
2022-01-07 06:28:14 +01:00
Niklas Haas 2332445d8d vo_gpu_next: use new HDR metadata options
Properly forward the HDR metadata from the mpi to the equivalent (new)
fields in pl_color_space. Used by the new tone mapping code.
2022-01-07 06:28:14 +01:00
Niklas Haas a9cb2e2821 vo_gpu_next: update for new tone mapping options
This was significantly refactored upstream. Switch to new APIs and add
new tone mapping curves and options.

cf. https://code.videolan.org/videolan/libplacebo/-/merge_requests/212
2022-01-07 06:28:14 +01:00
sfan5 57bc5ba6d6 vo_gpu: move image2D precision qualifier to point of use
image2D is only defined from GLSL ES 3.1 onwards, so those statements
broke GLES 2.0. Move the qualifier to a place that is only reached with
the right version requirements.
fixes commit 584ab29c88
2022-01-02 14:01:33 +01:00
rcombs f40d66f624 vd_lavc: enable hwdec for prores by default 2021-12-29 01:04:09 +02:00
Niklas Haas 4b43800079 vo_gpu_next: fix --target-peak scaling
This is in nits, so it needs to be converted.
2021-12-29 00:02:54 +01:00
Avi Halachmi (:avih) 2157bb1995 js: events registration: clarify breakage/fix
This commit is mainly for correcting the previous commit message.

The previous commit fixed an issue where [un]registering events above
the first event ID "hole" is not requested from libmpv, and that's
indeed true.

However, this had nearly zero impact in practice, because libmpv
enables all events by default anyway (except TICK).

Therefore, above the first ID "hole" [un]register requests are not
sent to libmpv, and the events just keep arriving.

But the callback functions are still added/removed correctly (at
defaults.js), and so the script is not called back even if unregister
did not actually happen with libmpv.

The only event which was affected is TICK - which is not enabled by
default as it's deprecated, and before the previous commit could not
be enabled.

So the fix is more a general correctness fix now that the IDs array
can have "holes", but with effctively no impact in practice.
2021-12-26 21:00:21 +02:00
Avi Halachmi (:avih) 5c5e35c1bc js: fix event registration (keys, script-message, more)
Commit 63205981 removed some events but left all other event IDs at
their original values, which created "holes" at the events IDs array.

The JS backend for mp.register_event maps a name to an ID by scanning
all IDs and stopping when the name was found or a NULL name was
returned. Lua does the same except that it doesn't stop on NULL name.

Previously it was not possible to have a NULL name before the end of
the array, but now it is possible due to the enumeration holes.

Fix by skipping missing names, like lua does.
2021-12-26 20:02:45 +02:00
Dudemanguy d92cf77be5 meson: fix incorrect egl_drm operator in build
Back when the meson build was still in the PR state, this particular
variable was a dictionary. Later, it was refactored to simply be a
feature object instead. All uses of egl_drm['use'] should have been
replaced with egl_drm.allowed() but this particular line was missed
(that's what I get for not just doing find/replace). The conditional in
this line is usually satisified before egl_drm ever needs to be checked
which was why no one noticed until now. Fixes #9631.
2021-12-21 15:30:12 -06:00
Dudemanguy 87286fe820 wayland: avoid doing unneccesary window resizes
Commits 04018c3061
cd7a7a1de8 introduced behavior that
updated window geometry during wayland events (specifically surface and
output). This is good but they also are too aggressive with
automatically resizing. For example, if a window is manually resized by
the user and then dragged to a different monitor with different geometry
than the initial monitor, mpv will automatically resize itself to the
window's resolution. The initial thought behind this logic was for
autofit to automatically readjust itself on a new monitor, but doing
that breaks other common use cases. An attempt could be made to
distinguish between autofit and a manual resize but that introduces a
lot of complexity for an edge case. It's better to simply not change the
window geometry here. Internal values are recalculated and scaled of
course, but wl->window_size and wl->geometry should not change.
2021-12-20 22:51:03 +00:00
Dudemanguy 2db7a148d3 meson: remove unneccesary shaderc_static check
shaderc is a special case dependency in meson. According to the
documentation*, it first checks for shaderc_shared and will fallback to
shaderc_combined (the order is reversed if the static keyword is true).
However, shaderc also has a third .pc file (shaderc_static) which should
be checked. The meson documentation doesn't indicate this, but it also
actually checks shaderc_static*. shaderc_combined is first checked if
meson looks for static libs and if that is not found it tries
shaderc_static. So this extra fallback check is not needed.

*: https://mesonbuild.com/Dependencies.html#shaderc
*: a2934ca9d1/mesonbuild/dependencies/misc.py (L539)
2021-12-19 19:11:56 +00:00
sfan5 2858073fd0 wscript: switch shaderc checks to pkgconfig
Shaderc has been shipping .pc files for almost three years and we all
know of the advantages. If this turns out to be problematic the old checks
can be re-added but I'd like to avoid doing this preemptively.
2021-12-19 19:08:01 +01:00
sfan5 24dcb5d167 subprocess: unblock/reset signals before running child process
During execve() ignored and blocked signals carry over to the child
process, though apparently for SIGCHLD (which the bug report was about)
this is implementation-defined.
fixes #9613
2021-12-19 15:02:18 +01:00
Philip Langdale fd63bf398a vo_gpu: stop hard-coding max compute group threads
We've been assuming that maximum number of compute group threads is
never less than the 1024 defined by the desktop GL spec. Given that we
haven't had working compute shaders for GLES and I guess the Vulkan
spec defines at least as high a value, we've gotten away with it so
far.

But we should really look the value up and respect it.
2021-12-19 01:51:54 +01:00
sfan5 c8b6dc489b vo_gpu_next: implement VOCTRL_EXTERNAL_RESIZE
This is only needed on Android and supposed to handle a context
resize without reconfiguring the image parameters. reconfig()
already does exactly this so plug it in there.
2021-12-19 01:44:52 +01:00
Philip Langdale e79cd6227b meson: look for rst2man.py as well as rst2man
If you install docutils with pip in the default way, you will get a
script called `rst2man.py` rather than `rst2man`, so look for both
names.
2021-12-17 11:10:50 -08:00
Alex Xu (Hello71) 3ec2012cec mp_image, f_decoder_wrapper: implement AV_FRAME_DATA_DISPLAYMATRIX
fixes #9249 (JPEG orientation support) with ffmpeg commit [0].

[0] e93c998602
2021-12-15 16:39:45 +01:00
sfan5 f9fd50c654 player: make deprecated track/chapter/metadata events internal
We still need these to track or notify of modifications to certain properties,
but they're now gone from the libmpv ABI.
2021-12-15 12:29:10 +01:00
sfan5 dfcd561ba9 lua: remove mp.suspend, resume and resume_all
These functions were deprecated in v0.21.0 and no-ops
since v0.23.0. The matching client API functions were
removed in the previous commit.
2021-12-15 12:29:10 +01:00
sfan5 632059816a libmpv: remove opengl_cb API and other deprecated symbols
Not all deprecated symbols were removed. Only three events were removed for now
since these are not used internally.
This bumps the library version to 2.0.
2021-12-15 12:29:10 +01:00
sfan5 72915e8b76 {player,video}: remove references to obsolete opengl-cb API 2021-12-15 12:29:10 +01:00
Niklas Haas 0bb15c7a13 af_lavcac3enc: fix memory leak on no-op
Simply returning out of this function leaks avpkt, need to always "goto
done".

Rewrite the logic a bit to make it more clear what's going on (IMO).

Fixes #9593
2021-12-14 21:25:02 +01:00
Philip Langdale 584ab29c88 vo_gpu: opengl: some fixes to make compute shaders work with GLES
It's supposed to work with GLES >= 3.1 but we had all sorts of bad
assumptions in our version handling, and then our compute shaders
turn out not to be GLSL-ES compliant.

This change contains some necessary, but insufficient, tweaks to the
shaders. Perhaps we'll make it actually work some day.
2021-12-12 20:23:31 -08:00
Philip Langdale 2fc327f2fd vo_gpu: opengl: fix OpenGL ES version and extension handling
Some of the extension declarations did not include the ES version where
they became core functionality, and in some of these cases, there was
never actually an ES extension - it first appeared in core. We also had
a number of buggy version checks where ES versions were compared
against required desktop GL versions.
2021-12-12 20:23:31 -08:00
Philip Langdale 0e76372e86 vo_gpu: opengl: try and create context at version 440 again
nvidia follow the OpenGL spec very strictly, with two particular
consequences:

* They will give you the exact context version that you ask for,
  rather than the highest possible version that meets your request.
* They will hide extensions that the specs say require a higher
  version than you request, even if it's technically possible to
  provide the extension at lower versions.

In our case, we really want a variety of extensions, particularly
compute shaders that are only available in 4.2 or higher. That means
that we must explicitly include a high enough version in our list of
versions to check for us to be able to get a 'good' enough context.

As for which version? We restore the 4.4 version that we had in the
old version selection logic. This is the highest version we ever asked
for, and we have separate logic that clamps the GLSL version to 4.4,
so anything newer wouldn't make a difference.
2021-12-07 15:37:29 -08:00
Niklas Haas 9b06a71a5d vo_gpu: opengl: fix wrong glMemoryBarrier
This call was completely wrong.
2021-12-06 23:59:14 +01:00
Jan Ekström 77142ed9b8 sub/lavc_conv: only set subtitle text format when required
Since libavcodec major version 59, the requested "ass" format became
the default as the old timing-included format was disabled starting
with that version. Additionally, this option by itself has since
been deprecated as it no longer serves any purpose.

References:
FFmpeg/FFmpeg@1f63665ca5
FFmpeg/FFmpeg@176b8d785b

Fixes #9413
2021-12-05 22:31:32 +02:00
Niklas Haas 036bda9166 vo_gpu_next: fix UB in query_format()
`plane_data_from_imgfmt` doesn't zero-initialize the struct, so this
contained invalid values for e.g. `row_stride`, causing formats to
*randomly* fail. (Especially any formats with specific alignment
requirements)

Might fix #9424 and #9425.
2021-12-05 21:24:57 +01:00
Kurt Kartaltepe fc94c8c365 wayland: ensure read and draw buffers are assigned
This is a workaround for nvidia proprietary drivers. The authors of
those drivers interpret the spec such that eglMakeCurrent will not
reconfigure the read and draw buffers. Thus windows wont display
anything drawn by opengl. nvidia authors refer to
https://www.khronos.org/registry/EGL/extensions/KHR/EGL_KHR_no_config_context.txt
specifically Issues 2/3 which reference eglMakeCurrent.

On mesa this is a non-issue and the read/draw targets are assigned with
eglMakeCurrent.

The context must be made current in order to query OpenGL strings. An
earlier proposal to create the wayland window surface similarly to X11
during init was deemed inappropriate so instead we manually set the
targets once we have created a window surface.
2021-12-04 03:04:17 +00:00
Aman Karmani 181656955b audio: fix typo 2021-12-03 14:04:58 -08:00
Kurt Kartaltepe d86bfebe6d opengl: support DebugMessageCallback on ES
This function is provided by a different extension on OpenGL ES so we
add a separate gl_functions.
2021-12-02 12:20:16 +01:00
Ivan 87ce3b31a9 ao_openal: enable AL_SOFT_direct_channels_remix extension by default
Prevent audio distortions caused by OpenAL's 3D effects.
2021-11-29 11:27:39 +01:00
Leo Izen ac39af461d player: make --keep-open=always work with --loop-playlist
Allow --keep-open=always to work with --loop-playlist, where
before this patch it would work only on the last playthrough of the
playlist. This patch allows it to work on all playthroughs.

Fixes #9470.
2021-11-28 19:45:52 -05:00
Niklas Haas 4991ffa859 vo_gpu_next: implement VOCTRL_SCREENSHOT
Somewhat annoying but still relatively straightforward. There are
several ways to approach this, but I settled on reusing the pl_queue as
a cheap way to get access to the currently mapped frame. This saves us
from having to process `vo_frame` at all, and also avoids any overhead
from re-uploading the same frame twice.

(However maybe there's some circumstance in which `vo_frame` needs to be
queried/updated first, to get a screenshot of the correct frame? I'm not
sure.)

I also had the option of going with either pl_render_image() on the
extract pl_frame, or just calling pl_render_image_mix directly on it. I
went for the latter, because in the optimal case, this allows the
rendered frame to be directly retrieved from the cache, actually
entirely avoiding any sort of recompute overhead. This makes e.g. ctrl+s
during playback essentially free. (Except for the download cost,
obviously)

It would be even neater if we could make this VOCTRL asynchronous and
thereby leverage libplacebo's asynchronous download capabilities. But oh
well. That will have to wait for a sufficiently rainy day.

Closes #9388
2021-11-28 11:58:53 +01:00
Niklas Haas c66f3b0123 vo_gpu_next: factor out some common helpers
In preparation of VOCTRL_SCREENSHOT support
2021-11-28 11:58:53 +01:00
Dudemanguy f08db00d26 client API: also export mpv_client_api_version
20c4036daa switched to using symbol
visibility attributes for mpv client api functions (for the meson build
at least). Unfortunately mpv_client_api_version was mistakenly missed.
We need to export this function as well. Fixes #9531.
2021-11-27 22:46:54 -06:00
Funami580 448fe0226b osc: fix cache displaying 60s in some cases
It was caused by string.format rounding e.g. 59.9 to 60.
2021-11-27 21:37:24 +02:00