Commit Graph

6391 Commits

Author SHA1 Message Date
Filip Hejsek
0a0ceb7439 vulkan/context_display: implement display fps and resolution info
Implement VOCTRL_GET_DISPLAY_FPS and VOCTRL_GET_DISPLAY_RES by returning
values obtained from Vulkan.

Currently, display fps and resolution info is not available in the
displayvk context. Display fps is needed for display sync to work
properly. The information is also used as the value of a few properties.

This slightly improves parity with the drm context.
2025-01-04 22:40:03 +00:00
Kacper Michajłow
59d1dc43b9 various: fix typos 2025-01-04 15:59:49 +02:00
Kacper Michajłow
efcee92d0e various: remove double new line at the end of file 2025-01-04 15:59:49 +02:00
Neko Asakura
50042f5ee0 mac: add support for --force-window-position 2024-12-31 14:49:39 +01:00
Dudemanguy
3218e74aaa x11: allow display sync modes to report no visibility
When this was originally implemented, I lazily skipped the optimization
when using display sync because mpv would rip through all the frames
without waiting since there was no blocking. With the previous commits,
we now fall back on the audio sync logic when the window is not visible,
so the extra condition can be removed.
2024-12-28 16:51:28 +00:00
Dudemanguy
a2fe5ee900 player/video: fallback to audio sync logic if VO is not visible
The previous commit put all the pieces in place so now this can be
implemented. Scheduling frames is already written with the assumption
that display sync maybe turn on/off at any time. So all that needs to be
done is check if the VO reports that it is not visible. If so, simply
flip mpctx->display_sync_active to false for that frame and skip the
display sync frame handling. It will become true again when the mpv
window comes back into view.
2024-12-28 16:51:28 +00:00
Dudemanguy
91c1b65de0 vo: change draw_frame API to a boolean
x11 and wayland VOs + backends all have logic that skips drawing frames
when the mpv isn't visible for efficiency reasons. This is implemented
in each individual VO, but it is useful for the core to be aware of this
as well. Currently, the display-sync modes on x11 do not try to be
efficient and always render anyways because there is no blocking on the
graphics API level if you skip rendering a frame (wayland works here by
accident). This means mpv would otherwise blaze through frames which is
not what anyone wants. We can instead improve this by implementing the
blocking mechanism in the core and using that when appropriate. This
commit does not implement that yet, but simply switches the draw_frame
to a boolean. Receiving false means that the VO is not drawing frames
and it should be treated as if the surface was hidden.
2024-12-28 16:51:28 +00:00
der richter
4dbf81c94c mac/title: use enum for material values instead of generic integers 2024-12-28 14:30:41 +01:00
der richter
4063cdf20b mac/title: use enum for appearance values instead of generic integers 2024-12-28 14:30:41 +01:00
der richter
cd9fa6daf0 mac/title: remove old libmpv color setter fallback 2024-12-28 01:46:41 +01:00
der richter
51af3caa77 mac/title: remove old libmpv material setter fallback 2024-12-28 01:46:41 +01:00
der richter
11a9f355c7 mac/title: remove old libmpv appearance setter fallback 2024-12-28 01:46:41 +01:00
der richter
bba198a713 mac: use isBundle function instead of manually checking bundle usage 2024-12-26 15:00:57 +01:00
Kacper Michajłow
d9eb9ed844 video/sws_utils: remove unused mp_image_swscale
This has been used before 2c43d2b75a. Now
that we have also zimg support, using swscale directly may not be wanted
depending on the user options.
2024-12-25 18:01:56 +01:00
der richter
d82701962f libmpv: deprecate MPV_RENDER_PARAM_AMBIENT_LIGHT render parameter
the equivalent options have been deprecated since mpv 0.35 in ac39661
and 2207236.

also bumping the MPV_CLIENT_API_VERSION to 2.5, since 2.4 was forgotten
in 6f619d5.
2024-12-21 16:15:44 +01:00
der richter
e785296a1c cocoa-cb: use new ambient-light property and remove old libmpv usage 2024-12-21 16:15:44 +01:00
der richter
e0f82b1a77 gamma-auto.lua: add this script as replacement for --gamma-auto
also mention this replacement for --gamma-auto.
2024-12-21 16:15:44 +01:00
der richter
2b06728df9 command: add ambient-light property
make it observable to make it usable as a replacement for --gamma-auto.
2024-12-21 16:15:44 +01:00
der richter
811062279e vo: change VOCTRL_GET_AMBIENT_LUX from int to double 2024-12-21 16:15:44 +01:00
Dudemanguy
96bebf0935 x11: simplify --geometry and --auto-window-resize logic
There were a few pitfalls with the way this was previously implemented
because --geometry implicitly depended on --auto-window-resize being
enabled to operate in a few cases. Instead, let's change the logic a bit
so that instead we choose whether or not to reuse the old rc (i.e. don't
resize) and use the wh_valid and xy_valid fields within the m_geometry
struct instead of using x11->geometry_change. This fixes several edge
cases involving setting the position with --geometry when using
--auto-window-resize=no.
2024-12-20 18:03:30 +00:00
nanahi
b174d98042 video/out/wayland_common: make all XF86 special keys mappable
Forgotten in 417869f845.
2024-12-20 14:54:35 +00:00
llyyr
7fffaf8557 vo: update base_vsync even for initial samples
This is still used for caclulating a/v sync and delay remaining even
for initial samples, so we should always update it to the actual vsync
for those initial samples so we have something to work with at least.

And if we receive bogus values, also reset it to 0 along with
prev_vsync.

Not having base_vsync set to _some_ value completely breaks
vsync_skip_detection, and mpv stays stuck in a permanent mistimed state
where every frame is marked as delayed and never recovers from it.
2024-12-11 16:42:13 +01:00
llyyr
bd915439d0 vo: use display clock to determine frame_end in display synced case 2024-12-11 16:42:13 +01:00
llyyr
84728fb5e9 vo: extract display synced frame end calculation
into get_display_synced_frame_end. Used in next commit.
2024-12-11 16:42:13 +01:00
Kacper Michajłow
3df8b0b297 video/out/gpu/video: don't pass big structs by value when not needed 2024-12-10 14:14:09 +01:00
Kacper Michajłow
db70ae6fa2 hwdec_vaapi: don't jump over variable init in try_format_upload 2024-12-10 10:17:34 +01:00
Kacper Michajłow
fe546c1841 w32_common: guard recursive call to mp_dispatch_queue_process
This is already done in WndProc, but the flag was not set if we exited
event loop and were processing mpv dispatch messages in fallback loop.

This fixes the case when Window is destroyed externally or otherwise
event loop fails for whatever reason. Calling vo_w32_uninit does call
DestroyWindow() through dispatch, which in turn calls WndProc, so we
need to guard recursive call.
2024-12-09 19:20:52 +01:00
Kacper Michajłow
8eea5902ba options/m_option: restore m_geometry_apply centering ability
This fixes geometry uses where it is expected to be centered. For
example this fixes video-crop option.

Fixes: e01eab4385
Fixes: #15398
2024-12-08 18:14:04 +01:00
Guido Cella
f7e6e30a49 aspect: add --video-recenter
This ignores --video-align-{x,y} when the video is smaller than the
window in the respective direction.

After zooming in, panning and zooming out, this is useful to recenter
the video in the window.

Unlike doing this by observing osd-dimensions in a script, this is done
before rerendering, so you don't see the image being rendered uncentered
for an instant after zooming out, before being rerendered centered.

Also update --video-align docs while at it.

This doesn't work well with --video-pan-{x,y} because you can move the
output rectangle far away from the image, and when zooming out pan is
abruptly reset to the center. It doesn't feel like natural like zooming
out after changing --video-align-{x,y}. So this commit doesn't set pan
to 0. Also this leaves a way to move scaled images within the window
even with --video-recenter.
2024-12-02 22:31:14 +01:00
llyyr
1a03d6ab84 vulkan/context: propagate --gpu-sw on vulkan contexts 2024-12-01 12:22:15 +01:00
der richter
dec0d02f9f vo_gpu: undeprecate --gamma-factor
deprecated since 0.35 in ac39661 and 2207236.
2024-11-30 02:32:39 +01:00
Kacper Michajłow
6ea2cd72ec vf_format: fix format=dolbyvision=no metadata stripping
If p->colormatrix is 0 if not set by user, so it would always override
_orig parameters with Dolby Vision ones and restore that erroneously.

Fixes: e2365bfece
2024-11-28 17:33:31 +01:00
nanahi
d9f30cc079 video/out/wayland_common: support clipboard monitoring
Works by notifying property update when clipboard content is
updated.
2024-11-27 20:31:41 +01:00
nanahi
d47ce38e20 video/out/wayland_common: implement VOCTRL_GET_CLIPBOARD
This adds support for VOCTRL_GET_CLIPBOARD which makes the VO
clipboard backend be able to get clipboard content for Wayland.
2024-11-27 20:31:41 +01:00
nanahi
b93d3046e2 video/out/wayland_common: implement clipboard support
Clipboard contents are available as selection data offers under
Wayland. The offer can become invalid at any time, so request the
text format content immediately when an offer is received,
and cache the content for later use.
2024-11-27 20:31:41 +01:00
nanahi
fa3a167347 video/out/wayland_common: generalize check_fd 2024-11-27 20:31:41 +01:00
nanahi
240ebd6ad3 vo: add VOCTRL_GET/SET_CLIPBOARD
This adds VOCTRLs needed for VO-based clipboard backend.
2024-11-27 20:31:41 +01:00
der richter
639ef09807 mac: implement VOCTRL_BEGIN_DRAGGING
this removes the old isMovableByWindowBackground mechanism with the
newer performDrag(with:) function.
2024-11-27 18:48:47 +01:00
Guido Cella
f7e2a8c1cc bstr: add bstr_xappend0 2024-11-27 15:37:42 +01:00
Guido Cella
b9e6030053 command: highlight selected list items with color
Instead of printing circles in show-text ${playlist}, ${chapter-list}
and ${edition-list}, introduce --osd-selected-color and
--osd-selected-outline-color to reduce clutter, make the selected item
easier to differentiate, and have visual consistency with select.lua.

The defaults are taken from the style of the selected item in the
console. These new options are also used there, replacing the hardcoded
styles. Due to being user-configurable, selected item styles are changed
to take priority over default item styles.

The default selected style is yellow and bold. The bold (hardcoded)
allows differentiating the selected item with color blindness. There is
also a separate --osd-selected-outline-color option defaulting to black,
since without it if the user changes --osd-outline-color yellow text
becomes unreadable without a black border. --osd-selected-back-color is
omitted for now.

Text and background colors are inverted for the selected item in the
terminal. This is hardcoded, adding an option is overkill.

A disadvantage of this commit is that if you run print-text ${playlist}
with a VO, the selected style ASS is printed to the terminal (but ASS
printed in the console is interpreted). This commit avoids printing the
reset ASS sequence for non-selected items to reduce clutter in this
case.
2024-11-27 15:37:42 +01:00
Kacper Michajłow
5730c631fd player/video: update dynamic hdr params 2024-11-24 11:32:12 +01:00
Kacper Michajłow
96d2c044fc mp_image: always force RGB formats to full-range RGB
It turns out mpv doesn't tag at all when doing conversions, so we just
re-tag here and hope for the best. This should be improved, but there
are many different code paths when conversion can happen, so for now
revert to previous behavior.

Fixes: 4e5cc9cf1d
2024-11-24 11:22:46 +01:00
Dudemanguy
c089aaafbe wayland: always recalculate scaling if wl->current_output is not set
If we lose the current output for any reason (unplug, turns off, etc.)
and then later it comes back, mpv should always recalculate all the
scaling stuff. The optimization to avoid needless scaling calculations
didn't consider this case and would always exit since the scaling is the
same. So just check wl->current_output's existence as well.

Fixes #15361.
2024-11-24 05:19:09 +00:00
Kacper Michajłow
4908a632d3 vo_gpu_next: use display values in target-contrast=auto 2024-11-23 22:16:44 +01:00
Kacper Michajłow
2c2ac3cb36 vo_gpu_next: add target-colorspace-hint=auto 2024-11-23 22:16:44 +01:00
Kacper Michajłow
d53dae1fd6 video/out/gpu/context: add target_csp callback to ra_swapchain
This allows to get target display parameters.
2024-11-23 22:16:44 +01:00
Kacper Michajłow
2183f771ef vo_gpu_next: fix mp_image colorspace with some hwdecs
Fixes: ef6052c01e
2024-11-23 10:48:22 +01:00
llyyr
e2a23e08b8 wayland: don't print same message for fractional and wl_surface scale 2024-11-23 04:42:52 +00:00
nanahi
33e297bd8f video/out/wayland_common: initialize offer fd 2024-11-22 11:21:26 +01:00
nanahi
70e02e7b4e video/out/wayland_common: fix dnd with focus follow mouse
Whenever mpv window gains focus, a new data offer is sent for the
selection. However, mpv currently treats it the same as dnd data
offers, which results in wrong handling. One bug which results from
this is when focus follow mouse is enabled, dropping the dnd file
results in the window being focused and selection offer being sent,
freeing the existing dnd offer. This results in dnd being broken
on at least GTK3.

Fix this by separating selection and dnd offer handling. Since there
is no way to know whether an offer introduced by
data_device_handle_data_offer is a selection or dnd offer, make it
pending, and move them once the identity is confirmed.
2024-11-22 11:21:26 +01:00