Commit Graph

6126 Commits

Author SHA1 Message Date
Kacper Michajłow e720159f72 player/command: add video-codec-info and audio-codec-info
Adds support for extracting codec profile. Old properties are redirected
to new one and removed from docs. Likely will stay like that forever as
there is no reason to remove them.

As a effect of unification of properties between audio and video,
video-codec will now print codec (format) descriptive name, not decoder
long name as it were before. In practice this change fixes what docs
says. If you really need decoder name, use the `track-list/N/decoder-desc`.
2024-04-15 19:34:40 +02:00
llyyr 3995cd3714 wayland: fix segfault in surface_handle_enter due to memory read
Fixes: 895f40e150 ("wayland: only perform a rescale if window is on one output")
2024-04-15 16:41:01 +00:00
Dudemanguy cb6e7c7a55 wayland: check if scale actually changes in scaling events
The protocol strongly implies that this only happens when the value
changes, and it's also what you would naturally expect. But maybe it's
worth guarding this in cause for some reason the same value twice in a
row happens.
2024-04-14 17:09:31 +00:00
Dudemanguy 895f40e150 wayland: only perform a rescale if window is on one output
The mpv window overlapping multiple outputs with different scale values
can result in some weird behavior when dragging it from one monitor to
another one. This is due to the way some compositors implement
preferred_scale or preferred_buffer_scale (integer scale equivalent).
Depending on the scale values, mpv window has to be resized to match the
new scaling value (due to fractional scaling requiring a viewport). This
can cause the window to become smaller and no longer overlap the monitor
you were just trying to drag it to. Repeat this and the window will
become smaller and smaller. Depending on the layout, the reverse can
also happen (the window becomes larger). This can cause additional
events to fire as the preferred_scale value may change again which does
more weird things.

It seems kwin is not affected by this because their implementation of
preferred_scale sends the event only if the window is fully on the new
monitor. Honestly, this is probably more logical anyway but we should at
least deal with the other implementations better. Try to deal with it by
reworking scaling changes so they only occur when the mpv window is
fully on one monitor. If we get a preferred_scale event and there is an
overlap, save it as a pending change to be performed on the next
surface_enter or surface_leave event (whichever results in there being
only one monitor. Some weird rendering glitches can still happen during
overlap but this makes it usable again.
2024-04-14 17:09:31 +00:00
Kacper Michajłow 078da37d5c vo_gpu_next: rotate target crop
Turns out libplacebo uses unrotated target crop in relation to source.
Use dst rect from VO, instead of extracting it from pl_frame, to avoid
another unrotating operation.

Fixes: a9354b36ca
2024-04-13 23:07:16 +02:00
Dudemanguy 1172c4ead9 wayland: apply keepaspect options to wayland configure bounds
Previously if mpv's size was constrained by the compositor's configure
bounds event, there was no attempt to preserve the aspect ratio of the
given coordinates if --keepaspect (the default) was used. Be sure to
apply keepaspect to the bounded widths and heights if we are using this
event.
2024-04-13 14:33:58 +00:00
Dudemanguy 307255d00d wayland: avoid unneeded calls to xdg_toplevel state functions
The reconfigure event handles setting fullscreen, maximize, etc. We were
implictly relying on the compositor to just ignore mpv if we set a
redundant state (e.g. setting fullscreen when we're already fullscreen),
but kwin actually doesn't and operates again. This causes some subtle
issues when handling geometry on state changes. Rework the state change
calls so they are only executed if wl->geometry_configured isn't set yet
(i.e. the window just opened up for the first time). It's the only time
this is actually needed.
2024-04-13 14:33:58 +00:00
Dudemanguy 4023146a04 wayland: enforce a state change after a reconfigure
If mpv is coming out of some locked size state (fullscreen, maximized,
tiled), the window size given by the reconfigure event should be used
assuming the --auto-window-size option is set.

Fixes 8a9749b8a5
2024-04-13 14:33:58 +00:00
Kacper Michajłow a9354b36ca vo_gpu_next: set target resolution to crop value
Use rect of the actual image instead of FBO size which includes
margins.
2024-04-13 13:37:12 +02:00
der richter ee6794225d mac/vulkan: add support for frame timing via presentation feedback 2024-04-10 19:14:20 +02:00
der richter 6df07ce90c mac/window: fix window pinch gesture and modify current-window-scale
this will prevent jumping of the window size in the case the window size
was 'externally' modified and not via the window-scale property, when
using the pinch gesture.

Fixes #11594
Fixes #13799
2024-04-10 19:13:00 +02:00
nanahi 9bb7d96bf9 various: make filter internal function names more descriptive
Lots of filters have generic internal function names like "process".
On a stack trace, all of the different filters use this name,
which causes confusion of the actual filter being processed.

This renames these internal function names to carry the filter names.
This matches what had already been done for some filters.
2024-04-10 19:00:22 +02:00
Kacper Michajłow 89cc477ef1 vo_gpu_next: keep target params in priv instead of alocating it 2024-04-10 18:35:47 +02:00
Dudemanguy 0d250892ba Revert "vo_dmabuf_wayland: assume counter-clockwise rotations"
This commit was originally sparked by a change in sway. When looking at
the wording of the spec, it was believed that the rotation should be
counter-clockwise. But that was interpreted incorrectly. The rotation
direction in the spec is meant for compositors not clients. Clients
should be rotating clockwise and compositors rotate it the opposite
direction. Also see the discussion in upstream wayland*.

*: https://gitlab.freedesktop.org/wayland/wayland/-/merge_requests/369

This reverts commit 27ef1725e7.
2024-04-09 13:48:08 +00:00
Kacper Michajłow d3941f235a bstr: change bstr0_s to bstr0_lit, restrict it only for string literals
Allows to avoid non-portable strlen usage. Also avoid "initializer
element is not constant" warnings on older GCC that doesn't like
explicit type specification in aggregate initialization.

Co-authored-by: NRK <nrk@disroot.org>
Co-authored-by: nanahi <130121847+na-na-hi@users.noreply.github.com>
2024-04-08 02:06:06 +02:00
Kacper Michajłow 2d4fae4f70 vo_tct: reduce lut_item size and generate it without snprintf 2024-04-07 20:23:04 +02:00
Kacper Michajłow 7d2b7fa019 vo_tct: use fwrite when appropriate 2024-04-07 20:23:04 +02:00
Kacper Michajłow 6177aa7616 vo_tct: add synchronized output support
See-Also: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036
2024-04-07 20:23:04 +02:00
Kacper Michajłow 5a53fa7cad vo_tct: add --vo-tct-buffering option 2024-04-07 20:23:04 +02:00
Kacper Michajłow fbc5e47e00 misc/bstr: add bstr0_s for static initialization 2024-04-07 20:23:04 +02:00
Kacper Michajłow 39d560676f vo_tct: write frame fully instead of every pixel
This is multiple times faster than just writing every pixel sequence
separately. Especially on slower terminal emulators. In general no need
to stress I/O, while we can just prepare the frame to print and do it
once.
2024-04-07 20:23:04 +02:00
Kacper Michajłow 2f76536f62 vulkan: use pl_vk_inst_create
This change is mostly motivated by missing
VK_KHR_portability_enumeration instance extension when enumerating the
devices. Which causes issues with MoltenVK which does not advertise full
Vulkan conformance.

To avoid duplicating code use pl_vk_inst_create() which correctly query
availability and enables the mentioned extension.

While at it fix the VkInstance leaking in vk_validate_dev().
2024-04-07 20:16:50 +02:00
Shuanglei Tao 3c1e983351 vo: add win32 context menu support 2024-04-06 08:24:06 +02:00
der richter c555cfccfe mac/common: reuse hidpi window scale frame calculation helper 2024-04-04 19:39:27 +02:00
der richter 5178c5b7d1 mac/window: cleanup unfsContentFrame usage and make it none optional 2024-04-04 19:39:27 +02:00
der richter fc36e5d71e mac/window: fix unfs window size retrieval
the unfsContentFrame wasn't updated when externally resized leading to
a wrong unfs window size afterwards. update it on windowDidResize event
when not in fs, not animating and not live resizing.
2024-04-04 19:39:27 +02:00
nanahi a140d2788c wayland_common: set mouse position on pointer enter
At least on some compositors, when the pointer enters a surface,
only a wl_pointer_enter event is generated, but not wl_pointer_motion.
This results in the initial mouse position being lost, which is
especially problematic when input simulation is used.

Fix this by setting the mouse position on pointer enter event.
2024-04-01 01:17:22 +00:00
der richter 92cb47338f mac/view: fix cursor visibility when toggling fullscreen
this broke with the recent refactor of the input handling. one of the
edge cases was not considered, where not every mouse down event has a
corresponding mouse up event, eg all double clicks or more only have one
up event after the first down event.

this was handled correctly previously.

Fixes #13777
2024-03-29 14:20:40 +01:00
der richter ba45f2004f mac: cleanup swift bridge header imports and unify them 2024-03-29 14:20:40 +01:00
der richter ed0587692f mac/log: rename log functions and cleanup class 2024-03-29 14:20:40 +01:00
der richter ceaabb7b98 mac: use LogHelper directly instead of mp_log 2024-03-29 14:20:40 +01:00
der richter e7df95b10d mac: rename mpvHandle to mpv 2024-03-29 14:20:40 +01:00
der richter e71e340b77 mac: remove now unnecessary objective-c forwarding 2024-03-29 14:20:40 +01:00
der richter 1bc680d32a mac/apphub: move menu bar into AppHub 2024-03-29 14:20:40 +01:00
der richter 1acca1d3c4 mac/apphub: move app icon into AppHub
split up AppHub header in obj-c and c parts and make it a bidirectional
bridging.
2024-03-29 14:20:40 +01:00
nanahi 6fed2f8e58 win32: fix native key repeat support
win32 does not respect --native-keyrepeat option, and native key
repeat has been broken since 0ab3482f73.

This lets mpv respect the --native-keyrepeat option on win32.
2024-03-29 14:07:37 +01:00
nanahi f4a7931c53 vo_gpu: support video-target-params 2024-03-27 22:08:56 +01:00
nanahi 3f17b18a33 vo_direct3d: support video-target-params
The backbuffer format is available.
2024-03-27 22:08:56 +01:00
nanahi 76541db2a7 vo_xv: support video-target-params
The target colorspace depends on whether the xv adaptor supports
setting BT.709 colorspace.
2024-03-27 22:08:56 +01:00
der richter 5ab3060961 cocoa-cb: use EventHelper for event handling 2024-03-24 23:03:48 +01:00
der richter 2a4bf7ca22 cocoa-cb: use a separate mpv_handle for cocoa-cb to simplify shutdown 2024-03-24 23:03:48 +01:00
der richter 7e07e1a087 mac/apphub: migrate remaining events functionality to new AppHub
add new app_bridge objc file for bridging between mpv core and app
functionality. replace old EventsResponder singleton with AppHub.

another step to clean up all App functionality and have one central
place for it.
2024-03-24 23:03:48 +01:00
Lynne cda5a787d5 hwdec/vulkan: enable the stable AV1 extension
As no drivers were ever released with the unstable extension,
it's not needed anymore.

Not bumping the required headers version yet.
2024-03-24 13:25:35 -07:00
der richter 12782aad6c mac: optimise and shorten some code 2024-03-21 18:33:15 +01:00
der richter 9e03ab5e1e mac/option: remove now unused computed option variables 2024-03-21 18:33:15 +01:00
der richter 204e3f0df6 mac/option: rename option structs to properly represent their content
also optimise option cache setup.
2024-03-21 18:33:15 +01:00
der richter f72dfd48d0 mac/libmpv: remove mac option handling in favour of option handler
since the option handler is not optional anymore and available on init
in cocoa-cb we don't need to duplicate this functionality in libmpv
anymore.
2024-03-21 18:33:15 +01:00
der richter b480daad88 mac/option: make option helper none optional
gets rid of some unwrapping boilerplate and nil coalescing operators.
2024-03-21 18:33:15 +01:00
der richter 6defd49aa1 mac/option: make option helper vo struct independent 2024-03-21 18:33:15 +01:00
der richter 2d9be04c00 mac/option: remove unused and obsolete variables 2024-03-21 18:33:15 +01:00