0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00
Commit Graph

6235 Commits

Author SHA1 Message Date
Kacper Michajłow
421df7564a vulkan/context_display: don't fake avalibity of callbacks
There are generic fallback paths for those and it shouldn't be replaced
by noop.
2024-08-27 01:27:39 +02:00
llyyr
cb4fdb530a video/csputils: remove space from choice option for chroma loc
Also document the field
2024-08-24 17:11:39 +02:00
Kacper Michajłow
f44c29b223 vf_d3d11vpp: ensure width and height is even
Fixes: bbb3d5ba78
2024-08-20 20:27:03 +02:00
Kacper Michajłow
2848af5618 vf_d3d11vpp: add support for Intel VSR and NVIDIA RTX scaling modes
Adds `--vf=d3d11vpp=scaling-mode` to control which extensions should be
enabled.

Fixes: #11390
Co-authored-by: xc <wxc9312@gmail.com>
2024-08-20 03:34:08 +02:00
Kacper Michajłow
bbb3d5ba78 vf_d3d11vpp: add support for scaling
Adds `--vf=d3d11vpp=scale` to scale video using d3d11 video processor.

Co-authored-by: xc <wxc9312@gmail.com>
2024-08-20 03:34:08 +02:00
Lynne
a3baf94ab9 hwdec_vulkan: allow using multiple decoding family queues
Some devices may only support a single codec type on a single
queue family. The new libavutil API allows this.
2024-08-17 02:01:05 +02:00
Lynne
678ad90bf4 hwdec_vulkan: update to new libavutil queue family API
The new API allows duplicates to easily port any old API users.
It does require users to check and fill in video decode capabilities.
2024-08-17 02:01:05 +02:00
Mike Will
acc69e082f img_format: prevent an offset >= MP_MAX_PLANES into bpp
Addresses the warning: "writing 1 byte into a region of size 0"
2024-08-13 12:35:27 +02:00
Jonas Karlman
ea01b042c2 context_drm_egl: always use drmModeAddFB2WithModifiers
Change to always use drmModeAddFB2WithModifiers for all formats and fall
back on using drmModeAddFB2 if drmModeAddFB2WithModifiers fail.

With the DRM_MODE_FB_MODIFIERS-flag now only being used for formats with
modifiers all formats without modifiers should also work.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2024-08-11 08:22:59 -07:00
Jonas Karlman
84c18f6b96 drm_prime: fix use of formats with modifiers
Similar to handles the modifiers must be supplied for each plane of the
format or a framebuffer cannot be created.

Use the format_modifier tied to the object used for the plane to fix use
of formats with modifiers.

Also fix the improper use of the DRM_MODE_FB_MODIFIERS-flag for formats
without modifiers.

This fixes playback of videos decoded by e.g. rpivid into a NV12 format
using SAND128 modifer on RPi using the drmprime-overlay interop.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
2024-08-11 08:22:59 -07:00
nanahi
f3a00ea131 various: handle numpad add/subtract/multiply/divide keycodes 2024-08-11 15:08:42 +02:00
Philip Langdale
4b97c23dac video: hwdec: extend look up of hwdecs to consider device type as well
Now that we have identified the device types associated with each hwdec, we
can take advantage of this to ensure that get the right hwdec is chosen when
decoding frames and there are multiple choices available with different device
types.

This is also plumbed into the filter initialisation logic, although in practice
the decision on the hwdec has already been made at this point - still it's
easier than retaining the ambiguous look up logic and worrying that it might
lead to an inconsistent result.
2024-08-10 14:24:36 -07:00
Philip Langdale
7bbf132e20 vo: hwdec: add AVHWDeviceType property to hwdecs
As the first step towards handling scenarios where the are multiple hwdecs for
a given image format but backed by different AVHWDeviceTypes, let us annotate
the hwdecs with their corresponding device types.

From this, we can also see how all the existing hwdecs which match the same
image format also match the same device type.
2024-08-10 14:24:36 -07:00
Kacper Michajłow
6f619d5ef4 vo_libmpv: don't steal pointer provided by the API user
It won't be TA allocated and would fail on header check. Also
documentation doesn't mention that ownership is transfered to mpv, so it
is unexpected.

This will cause existing clients of this API leak this memory, but I
doubt anyone really used it in this broken state.

Fixes: #14633
2024-08-06 20:17:35 +02:00
Brad Smith
a36f8ad162 build: detect VT_GETMODE on OpenBSD 2024-07-29 15:09:49 +00:00
Dudemanguy
3c7b6db205 options: move all wayland specific options to vo_opts
Unlike most other platforming backends, wayland has its own specific
sub_options struct. 027ca4fb85 originally
introduced this and some more options were added later, but in
retrospect it's an unneccesary complication. There are already x11,
and windows-specific options within vo_opts. In fact, there actually is
a wayland one in there already as well (wayland-content-type) so it's
split btween two places. The wayland code already has to handle vo_opts
and it is already handles callbacks if needed. There is no advantage to
having a separate wayland-specific sub_options struct which is stuck
with whatever you set at init time.

So solve everything by deleting the old sub_options struct, moving it to
vo_opts and make some minor option naming changes for clarity (i.e.
adding a 'wl_' in front of the name). This simplifies the wayland common
code and also makes it have more functionality since you get runtime
updates for free.
2024-07-24 18:46:04 +00:00
Guido Cella
bde7cac447 various: allow changing GPU API options at runtime
Set UPDATE_VO to GPU API options that are only set on init.

To change multiple options without multiple reinits, use
set vo null; set opengl-foo 1; set opengl-bar 1; set vo gpu
2024-07-24 18:44:41 +00:00
Guido Cella
a5937ac7e3 m_option: add UPDATE_VO flag
This will allow reiniting the VO when more options are changed without
hardcoding them in options.c

Also reinit the VO when changing --gpu-debug and --gpu-sw.
2024-07-24 18:44:41 +00:00
Dudemanguy
e3682f7f2b vo_gpu_next: support --gamma-factor
There's broad agreement that this option will be undeprecated, so just
factor in the multiplier for vo_gpu_next.
2024-07-17 14:09:00 +00:00
der richter
8fc557cc6e mac/vulkan: error out on context creation without an NSApplication
if no NSApplication has been initialized, applications using Appkit
functionality are not supposed to work properly or just deadlock
indefinitely. properly error out on macvk context creation in that case.
2024-07-16 11:20:40 +02:00
Dudemanguy
d15660f4ed wayland: avoid potential floating point errors while scaling
Described in more detail in the upstream MR*. mpv naively rounds which
makes us susceptible to the mentioned error. Fix this by keeping
wl->scaling and wl->pending_scaling in the base 120 units. Use the
simple rounding algorithm when needed for calculating widths/heights.
Create a wl->scaling_factor as convenient shorthand for scale / 120
which is what wl->scaling used to previously be.

*: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/309
2024-07-12 20:48:51 +00:00
nanahi
fea6adbc97 x11_common: handle runtime keepaspect/keepaspect-window change
On X11, aspect ratio constraint is applied on the window manager side,
so whenever keepaspect and keepaspect-window change, mpv should update
the size hint immediately, otherwise the new constraint isn't applied.
2024-07-12 20:19:11 +00:00
Kacper Michajłow
6c56a413ab win32: unregister window class on dll detach
Window classes are global per process, but they are associated with the
module that registered them. Documentation is clear that it is the DLL's
responsibility to unregister its own classes:

No window classes registered by a DLL are unregistered when the DLL is
unloaded. A DLL must explicitly unregister its classes when it is
unloaded.

See: https://learn.microsoft.com/windows/win32/api/winuser/nf-winuser-registerclassw

Using a window class after the DLL is unloaded would result in access
violation errors. This is not that important for libmpv, where it is
unlikely someone would use the "mpv" window class externally. The real
issue comes from the fact that reloading libmpv would fail to register
the class (as it still exists) and consequently fail to create a window.

This commit fixes the operability of libmpv after reloading it.

Fixes: #11638
2024-07-11 21:55:21 +02:00
Kacper Michajłow
d448598588 vo/opengl/context_win: fix crash on init failure
Don't try to access window context if it failed to create.
2024-07-11 21:55:21 +02:00
llyyr
14571f0f77 vo_dmabuf_wayland: don't use -ve margins in window size calculation
This happens with a positive --video-zoom value. We send invalid
toplevel size and get killed by the compositor.
2024-07-10 19:22:24 +00:00
llyyr
6c59b0272b wayland: use wl_list_empty instead of wl_list_length 2024-07-08 13:33:32 +00:00
llyyr
9d7d861202 wayland: bump wayland-protocol requirement to 1.31
And wayland-client/cursor to 1.21

Debian Stable has these
2024-07-08 13:33:32 +00:00
Dudemanguy
00f43e0916 wayland: fix missed int -> double conversion for cursor scaling
Client side cursors have always had some issues with fractional scaling.
However since we changed to using viewporter for cursor scaling, most
(or all?) of the problems can be fixed. Unfortunately, a scaling factor
was being truncated to int instead of kept as a double. This matched the
old behavior with buffer_scale, but it's better to use double so the
viewport is actually set to the correct size. Of course, none of this is
relevant if the compositor is using cursor shape.

Fixes f0a6578259
Fixes #14001
2024-07-06 09:03:40 -05:00
Guido Cella
dc523b137f video/out/gpu/context: convert --gpu-api to object settings list
This follows up 96e1f1dfa5 which converted --gpu-context, and has the
same advantages as listed there.

Unlike with --gpu-context auto can be used anywhere in the list, e.g.
--gpu-api=d3d11,auto works.

I wanted to use the list of GPU contexts as the description in
get_type_desc(), but there is no talloc context to allocate it to, so I
set a print_help_list to print them. The APIs go before the contexts so
that etc/_mpv.zsh doesn't try to complete the contexts.
2024-07-04 22:23:17 +00:00
Guido Cella
3f43999bd6 video/out/gpu/context: simplify --gpu-context's check_unknown_entry
This function is used to reject invalid context names early, and without
it the context fails to create and only audio is played, but it doesn't
need to check for known entries again.
2024-07-04 22:23:17 +00:00
Dudemanguy
68a1a3879c wayland: add a --wayland-present option
Mainly for debugging. It might be handy to disable presentation feedback
on wayland to make sure something isn't going wrong with the
calculations somewhere.
2024-06-28 03:33:16 +00:00
Dudemanguy
111571bd05 options: remove some options with .deprecation_message
In both cases, setting these options did nothing other than give you a
warning that they may be removed in the future. Remove them now.
2024-06-25 02:18:58 +00:00
Dudemanguy
4d7e440533 options: remove various OPT_REMOVED usage
Most of these are pretty obscure things that were replaced a long time
ago. The special messages they were printing are also not really useful
at all so just remove them.
2024-06-25 02:18:58 +00:00
Dudemanguy
6e3d90d72a options: remove some deprecated OPT_REPLACED option mapping
These were all deprecated in mpv 0.37.0 or earlier and are not
considered common enough options to warrant keeping the deprecated
mapping longer. Since demux_cue had only a single option in it, the
entire option substract is removed. This can be readded later if someone
wants to introduce a specific option to it again.
2024-06-25 02:18:58 +00:00
nanahi
265056fa54 vo_gpu: optimize pass_info_reset
No need to reset mp_pass_perf which is only read when desc.len > 0.
This avoids zeroing >16384 uint64_t's every time it's called.
Profiling shows that this reduces CPU usage for frame rendering by ~4%.
2024-06-22 22:48:40 +02:00
Kacper Michajłow
687eb4c875 various: remove no longer needed availability checks
image_writer: remove jpegxl availability check

meson: remove check for lavu vulkan support

image_writer: remove avif availability check

ad_spdif: remove no longer needed definitions

demux_lavf: remove side data extraction compatibility code

demux/packet: remove ITU T.35 availability check

filters/f_lavfi: remove avfilter_filter_pad_count availability check

image_writer: remove PNG cICP support check

mp_image: remove AV_FRAME_DATA_DOVI_METADATA availability check

mp_image: remove AV_FRAME_FLAG_INTERLACED availability check

vd_lavc: remove ctx->pic->duration availability check

sws_utils: remove av_chroma_location_enum_to_pos availability check

vd_lavc: remove AV_CODEC_EXPORT_DATA_FILM_GRAIN availability check

demux_lavf: always use io_close2
2024-06-22 16:12:14 +02:00
Kacper Michajłow
0d8f74231f misc/uuid: remove no longer needed vendored implementation 2024-06-22 16:12:14 +02:00
Kacper Michajłow
4ec060f946 vo_tct: clear backbuffer on reconfig
We were drawing garbage data after reconfig, if there is no video
frame ready or with --force-window without video track.

Found by OSS-Fuzz.
2024-06-22 00:50:38 +02:00
der richter
55241da4ad cocoa-cb: guard color spaces that are only available on 10.15.4 upwards 2024-06-18 19:30:07 +02:00
Kacper Michajłow
ab0a50874b d3d11: return minimum bitdepth for display output and swapchain
If the output display reports high bitdepth, 12-bit and 10-bit swapchain
is used the value returned from d3d11_color_depth needs to take it into
account.
2024-06-15 01:18:44 +02:00
Crend King
6031a0e173 vf_vapoursynth: upgrade to VapourSynth API v4
VapourSynth introduced their version 4 API in R55, 3 years ago. mpv is
still using the deprecated version 3. I think it is good to migrate
before VapourSynth completely removes it.

The most impacted area is the video format. Previously we have a fixed
table of supported formats, each represented by an integer. In v4, the
integer is replaced by pointer to the full struct of the format.

Second, the way to create video filter is changed. Previously caller
needs to supply a "initialization" callback to `createFilter()`, which
sets up video info etc. In v4, video info is prepared first, passed to
the `createVideoFilter2()` and we get back the node.

Also, previously mpv was using the `fmSerial` filter mode, which means
VapourSynth 1) can only request one frame from mpv at a time, and 2) the
order of frames requested must be sequential. I propose to change it to
the parallel request mode, which requests multiple frames at a time in
semi random order. The reasons are, for 1), the get frame function,
`infiltGetFrame()`, unlocks the mutex during output image generation,
thus can benefit from parallel requests. For 2) thanks to the frame
buffer, unordered frame requests are acceptable. Just make sure the
buffer is large enough.

Third, the way VapourSynth scripting environment works change. In v4,
the scripting API is operated through struct pointer, much like the
exist `vsapi` pointer. The "finalize" function is also no longer needed.
2024-06-14 00:25:18 +02:00
Kacper Michajłow
b4bbc27d9c input: map Num 5 to distinct value when numlock is off
Until now both numlock on and off were mapped to KP5.
2024-06-13 20:42:24 +02:00
Misaki Kasumi
c55ff4176c opengl: add --egl-output-format 2024-06-08 10:23:32 +02:00
Misaki Kasumi
cd74f8f7c5 opengl: add --egl-config-id 2024-06-08 10:23:32 +02:00
Crend King
fe709c986b vf_vapoursynth: add parameter to pass arbitrary string to script
Currently the vapoursynth video filter does not accept any argument for
passing arbitrary user data. This limits what the VS script can do.

Ideally, the vapoursynth filter has an user-data parameter that contain
string value. mpv passes that value to the VS script just like
container_fps and others. Once the VS script gets the data, it can do
all sorts of data extraction and transformation.

Another benefit is that instead of mpv always have to catch up to user
needs for this filter, with this users can just pass whatever needed
themselves, thus becomes more future-proof.

Fixes #14214
2024-06-08 03:13:41 +02:00
Kacper Michajłow
dea176a7bf hwdec_vaapi: suppress comparision warning
comparison of unsigned expression in '< 0' is always false
2024-06-07 21:12:38 +02:00
nanahi
b2a4c0ce91 wayland_common: properly handle modifiers for keyboard enter keys
Wayland protocol only guarantees the delivery of modifier information after
the enter event. To handle it properly for keys pressed in the enter
event, save those keys for later processing in the modifier event.
2024-06-07 18:57:35 +00:00
Kacper Michajłow
8dd262ffa5 ra_d3d11: make cache header constant size regardless of the build
This makes cache entries compatible between 32-bit and 64-bit builds and
avoids issues with loading cache wrong.
2024-06-07 19:41:50 +02:00
Kacper Michajłow
965809f108 w32_common: stop IME initialization timer after first try
It will be set again on first key press, but no need to call IME api
every 250ms until any key is pressed.
2024-06-07 19:41:15 +02:00
Kacper Michajłow
b4683fd3d8 {x11_common,context_x11egl}: suppress Wundef warning 2024-06-05 19:07:58 +02:00