Commit Graph

53316 Commits

Author SHA1 Message Date
nanahi
b97e3b9e4b DOCS: add clipboard documentations 2024-11-27 20:31:41 +01:00
nanahi
510d634b5b console.lua: use native clipboard property on win32 and wayland
Since native clipboard is implemented on win32 and wayland,
use the clipboard property instead.

This fixes the problems with commandline implementations of clipboard:
- On win32, the powershell implementation is complex, and it can take
  several seconds to run for the first time.
- On wayland, it requires wl-paste to be installed, which isn't always
  available. It also works poorly on GNOME.
2024-11-27 20:31:41 +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
593d437dae command: notify-property command
Since VOCTRL is not suitable for frequent data query
(see 477a0f8318 for details),
it's not suitable to be used by the VO clipboard backend.
Instead, since the VO does the clipboard monitoring by itself,
it can notify the player when the clipboard is updated.

This adds an internal notify-property command so that VOs
can notify player when the clipboard is updated, so that clipboard
monitoring works.
2024-11-27 20:31:41 +01:00
nanahi
625900687e clipboard-win: implement clipboard monitoring
This uses GetClipboardSequenceNumber() to detect clipboard
content changes. Clipboard Format Listener is a better way to
do this according to MS docs, but sequence number works and
the listener requires creating a dedicated thread and HWND
for monitoring, so I will save it for a later time.
2024-11-27 20:31:41 +01:00
nanahi
1d36f7be05 clipboard: add clipboard monitoring API
This adds a clipboard monitoring API for backends which use polling
to monitor clipboard updates. --clipboard-monitor option can turn
clipboard monitoring on and off at runtime.
2024-11-27 20:31:41 +01:00
nanahi
dcde47e15b clipboard-win: add Windows clipboard backend
This adds a Windows clipboard backend. This doesn't depend on
VO, so it can be used even when no video window is created.
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
23b8fb3d9c clipboard-vo: implement VO clipboard backend
This adds a generic VO clipboard backend based on VOCTRLs
to get and set clipboard data.
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
nanahi
6e848a0b3c command: add clipboard property
This adds clipboard property which uses the clipboard
API to get and set clipboard contents. Currently only
clipboard text is implemented, but this can be extended in
the future to cover primary selection and other formats.
2024-11-27 20:31:41 +01:00
nanahi
e1d30c4c5a clipboard: add clipboard API
This adds a clipboard API with multiple backend and format support.
--clipboard-enable option can be toggled at runtime to turn native
clipboard on and off.
2024-11-27 20:31:41 +01:00
llyyr
af82f7cf29 DOCS/interface-changes: specify that new additions have to be listed
This has been happening for a while now apparently, so change it to
accurately reflect reality. I chose the next release as the point to
formally make this change, because I was under the impression that we
didn't have to list new options so I never did it and there may be
others like that too.
2024-11-27 20:28:51 +01:00
Kacper Michajłow
15ea3728a5 osc.lua: show file and track info on title left-click 2024-11-27 20:26:06 +01:00
Kacper Michajłow
92a98f1ce2 osc.lua: cycle sub/audio down on shift+L-click / middle-click 2024-11-27 20:26:06 +01:00
Kacper Michajłow
62db90634e osc.lua: cycle sub/audio on left-click, select on right-click 2024-11-27 20:26:06 +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
Guido Cella
d54a45d075 console.lua: enable runtime updates of script-opts 2024-11-27 15:32:10 +01:00
Kacper Michajłow
ad1fb9f448 player/loadfile: prefer independent track when selecting track
Dependent tracks are supposed to be processed further and not directly
used.

For example, an HEIF tiled image tracks are meant to be stitched into a
full image before being displayed and requires special handling.

Another example would be MPEG-TS audio track tagged with mix_type=0.
Which means that the audio stream is a dependent stream and is intended
to be mixed or combined with a separate complete and independent audio
stream by the receiver.

In either case we should not directly select such tracks.
2024-11-26 11:42:48 +01:00
Kacper Michajłow
81db3446fa DOCS/man/options: mention sub-box/osd-box/box profiles 2024-11-25 17:29:47 +01:00
Guido Cella
86bbe997ce console.lua: don't append spaces after completion
After pressing Tab a space is usually appended after the suggestion, and
with the new autocompletion you have to enter a space again before
seeing the completions for the next token even when there is only 1
matching completion. Just don't append spaces and let the user manually
type 1 space after completion, which is more intuitive.
2024-11-25 16:43:14 +01:00
Guido Cella
8464ba471a console.lua: highlight the first completion in the terminal
Follow up to a0d416e94b.
2024-11-24 13:28:58 +01:00
Guido Cella
e549bf0dec console.lua: update completions after moving the cursor
...and after navigating the history.

I thought of making the new function accept the new cursor position and
set it, but it would not be clear that you're only supposed to call it
when handle_edit() is not already called.
2024-11-24 12:19:45 +01:00
Kacper Michajłow
5730c631fd player/video: update dynamic hdr params 2024-11-24 11:32:12 +01:00
Guido Cella
a0d416e94b console.lua: highlight the first completion suggestion before cycling
2f271a92de made it so that the first completion suggestion is
automatically selected when pressing Enter, if none was manually
selected. So automatically highlight the first completion in yellow to
show this.
2024-11-24 11:23:04 +01:00
Guido Cella
40724f81e1 console.lua: save commands in history after autocompletion
2f271a92de made it so that the first completion suggestion is
automatically selected when pressing enter, but that was done after
saving the command in the history. Save it to the history after
expanding it, so re-running the previous command actually works, e.g.
save "set vo gpu-next" instead of "set vo gn".
2024-11-24 11:23:04 +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
Arcitec
2d813de6b6 DOCS/man/mpv: improve path docs and clarify config-dir path behavior
The previous documentation was pretty scary and misleading, and was
also outdated in several sections.

It was also difficult to understand some of the paragraphs.

The path documentation has now been overhauled to be much easier
to understand and to document the latest mpv behavior.
2024-11-23 22:17:30 +01:00
Guido Cella
200065cc2f options: rename --sub-ass-hinting to --sub-hinting
Because it also affects plain text subtitles.
2024-11-23 22:17:21 +01:00
Guido Cella
d1c2ee1c82 options: rename --sub-ass-shaper to --sub-shaper
Because it also affects plain text subtitles.
2024-11-23 22:17:21 +01:00
Guido Cella
3291254263 options: rename --sub-ass-line-spacing to --sub-line-spacing
Because it also affects plain text subtitles.
2024-11-23 22:17:21 +01: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
Guido Cella
2f271a92de console.lua: expand the first completion on Enter
If you run a command without manually selecting a completion, select the
first one. e.g. set vo gn runs set vo gpu-next.
2024-11-23 10:48:32 +01:00
Guido Cella
57a6f12ed3 console.lua: dont crash when typing a command prefix
Typing a command prefix crashes console because first_useful_token is
nil. This already happened before implementing autocompletion if you did
no-osd<Tab>, but autocompletion made it evident.
2024-11-23 10:48:32 +01:00
Guido Cella
57b73f1af6 console.lua: show completions as you type
Show available completion suggestions as you type without having to
press Tab.

This is fast even on a 2011 CPU, so we can get away with doing this in
the same thread that draws the console. The one case where it could make
the console hang is file completion of network drives, but in general it
is convenient for loadfile.

mp.input.get clients also get a request to complete on each character
typed, but those run in a different thread so performance is always
fine, and completions were already rejected if the input line or cursor
changed after the request. If I ever make running mpv commands an
mp.input client in the future, command completion will also benefit from
running in a different thread.
2024-11-23 10:48:32 +01:00
Guido Cella
2e265f33e3 console.lua: complete fewer properties
10k properties makes the console hang and the CPU fan spin with live
fuzzy filtering, so print fewer sub-properties. These are rarely useful
anyway.
2024-11-23 10:48:32 +01:00
Guido Cella
a0de894d4c console.lua: determine completions with fuzzy search
For example, set vo gn<Tab> will complete to gpu-next.
2024-11-23 10:48:32 +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
Kacper Michajłow
3e10309b62 player/loadfile: prefer non-image when selecting video track
This fixes `ytdl_hook`, which would start playback with the thumbnail
track selected. This issue occurs because the thumbnail track is added
first. If the main track is not marked as default afterward, which it
isn't for single streams, the first track (the image track) would be
selected.

In general, if a non-image track is available, it should be preferred.
2024-11-22 21:14:52 +01:00
Jan Ekström
7f49806cf4 ci/lint-commit-msg: move away from things deprecated in Python 3.9
As normal types started being supported better for type hinting,
their alternatives in the typing module would be deprecated.
2024-11-22 21:50:25 +02:00
Jan Ekström
45a72d6bec github/workflows: switch Ubuntu mingw-w64 build to pkgconf
Ubuntu 24.04's pkg-config is already an almost empty transitional
package that depends on pkgconf, and pkgconf contains the
`/usr/bin/pkg-config` binary.

Thus while we are moving macOS to it, we shall do the same with
this mingw-w64 build.
2024-11-22 21:50:25 +02:00
Jan Ekström
1f0ec5cd02 github/workflows: unlink macOS pkg-config if installed
This works around an issue with recent Github CI runners where
Homebrew is in an intermediate state. This is where old pkg-config
is installed, yet pkg-config as a package has become an alias
for pkgconf, thus causing failures to automatically switch symlinks
from one to the other.

Ref: actions/runner-images#10984
2024-11-22 21:50:25 +02:00