Commit Graph

12228 Commits

Author SHA1 Message Date
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
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
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
norinoriko
68d9ed2572 sub/osd: adjust osd margins 2024-11-21 16:14:07 +01:00
nanahi
998bdef1d0 DOCS/man/input.rst: add sections to categorize commands
mpv has too many commands and they are unorganized in the
documentation, making it difficult to navigate.

This commit completely reorganizes the commands into several
categories to make the documentation easier to navigate.
The following categories are defined:

- Playback Control: Seeking and stepping.
- Property Manipulation: Changing property values.
- Playlist Manipulation: Playlist navigation and editing.
- Track Manipulation: Track navigation and editing.
- Text Manipulation: Text printing, expansion, escaping.
- Configuration: General configuration and related files.
- OSD: Displaying contents as OSD.
- Input and Keybind: Input configuration and key bindings.
- Execution: Execution of mpv and subprocesses.
- Scripting: Script loading and communication.
- Screenshot: Taking screenshots.
- Filter: Changing filters.
- Miscellaneous: Other commands.
2024-11-18 17:28:24 +01:00
nanahi
8d7fff5a2b DOCS/man/input.rst: make event and hooks sections a level higher
They're not related to commands so they shouldn't be a subsection
of list of commands.
2024-11-18 17:28:24 +01:00
Guido Cella
ca38b30de3 DOCS/options: add a Video sync section to group related options 2024-11-18 17:23:08 +01:00
Kacper Michajłow
a0d7265ce9 sub/osd/console/stats: use the same 1.65 outline size 2024-11-18 09:50:22 +01:00
Kacper Michajłow
fedd34e83c stats.lua: set border size to have similar relative thickness as OSD
It is 6% of font size. Little bit more relativelly to OSD, but stats has
smaller text, so we need to compensate for that.
2024-11-18 09:50:22 +01:00
Kacper Michajłow
8c3a7da619 sub/osd/console: adjust font sizes
The current OSD font size is excessively large, causing most
messages—except for very short ones to overflow horizontally.

I conducted testing across multiple devices of varying screen sizes and
under different scenarios. The adjusted font size strikes a good balance
for readability on non-high-DPI displays, while high-DPI displays should
utilize DPI scaling as needed.

Additionally, I compared the font sizes of subtitles and UI elements
across various VOD platforms, which generally use smaller font in most
cases.

The current sub font size was significantly larger than even PGS
subtitles, which are quite large on their own. Now, they are comparable.

The subtitle font size was chosen based on recommendations from the BBC
Subtitle Guidelines. It is set to 8% of the video height with a
recommended scaling factor of 0.67. Therefore, at 720p (the reference
size for mpv font scaling), the calculation is 8% * 0.67 * 720 = 38.592,
rounded down to 38. This value falls within the recommended scaling
range of x0.5–x1 for desktop PCs/Laptops and TVs (32"–42"). For more
information, see
https://www.bbc.co.uk/accessibility/forproducts/guides/subtitles/#Presentation-font-size.

OSD font size is smaller than font as those elements shouldn't be
distractful and only noticable when the user wants to look at them.

Outline size is set to 5.5% of font size.
2024-11-18 09:50:22 +01:00
Guido Cella
476ed609ea options: increase the default --image-display-duration
1 second is too short to view images, so increase the default duration
to 5 seconds.
2024-11-13 14:15:16 +00:00
Guido Cella
06ab9622e6 DOCS/man/input.rst: remove input commands subject to change heading
Most of the commands list here are several years old and we will
probably never change them. And it is already stated in the description
of individual commands if they are deprecated or subject to change.

Furthermore, it is easy to add new commands at the end of this section
by accident. I added load-config-file and load-input-conf here without
realizing it's a separate section, and I assume this was also the case
for begin-vo-dragging.
2024-11-08 15:26:52 +01:00
Dudemanguy
23843b4aa5 vo_gpu_next: set --target-colorspace-hint to yes by default
It simply does not make any sense to not signal the correct colorspace
and metadata by default.
2024-11-04 19:35:28 +00:00
llyyr
22116734e7 sd_ass: introduce sub-ass-prune-delay
Disabled by default because it breaks sub-seek and playback in cases
where the user changes play-dir from + to - during runtime and past
"seen" events need to be re-rendered.

Available since dcc9eb722e
2024-11-03 05:23:41 +01:00
llyyr
9bf0c53763 sub/sd_ass: set ASS_OVERRIDE_BIT_BLUR if available
4df64d060a

Fixes: https://github.com/mpv-player/mpv/issues/14852
2024-11-03 05:12:34 +01:00
Kacper Michajłow
42ff6f92c3 vo_gpu_next: add chroma location and HDR metadata to shader parameters 2024-11-02 21:20:20 +01:00
Guido Cella
bb0b9f4cc8 defaults.lua: add an exit() function
Scripts can terminate execution by setting mp.keep_running = false. Add
an exit() function to wrap setting mp.keep_running and properly expose
this feature. It can be used e.g. by a thumbnail script to spawn workers
with load-script and then let them quit.

It is not added to the mp namespace as mp.exit because that would make
it look like it terminates mpv.

This mirrors the exit() function which already exists in js.

The note in javascript.rst about having to remove key bindings before
exit is not kept because they are actually removed automatically since
bf385e1140 (though it was accurate when the JS backend was developed
before upstreaming it).
2024-11-02 14:03:02 +02:00
Guido Cella
4def28ad0d DOCS/man/input: note that properties can be unavailable on init
It comes up often in IRC and issues that users don't understand why the
path property is initially unavailable, so link the section that
mentions it from the Properties section, and expand on how to get these
properties.
2024-11-02 01:41:11 +01:00
Guido Cella
6085261146 DOCS/man/input: remove duplicate paragraph
This is mentioned again below in Property list and it makes more sense
near the list of properties.
2024-11-02 01:41:11 +01:00
Guido Cella
680e7022ee DOCS/man/input: suggest normalize-path to get absolute paths
Because it is a bit shorter than calling
utils.join_path(working_directory, path), it gives you a canonical path,
and it doesn't concate working-directory before URLs.
2024-11-02 01:41:11 +01:00
Kacper Michajłow
de42e11662 demux_edl: disallow nested edl to avoid infinite loop
Found by OSS-Fuzz.
2024-11-02 01:40:41 +01:00
nanahi
56e2689894 command: add the ability to set comment for keybind command
This allows the keybind to have a comment field which can be
read from input-bindings, and displayed by e.g. stats.lua.
2024-11-02 01:39:15 +01:00
nanahi
affa953dd4 DOCS/man/input.rst: fix keybind command keyword argument name
It's "cmd" rather than "command".
2024-11-02 01:39:15 +01:00
nanahi
f476c0275b DOCS/man/osc.rst: fix binding documentation
The documentation doesn't agree with the implementation and
commit message (which agree with each other).
2024-10-29 20:36:38 +01:00
nanahi
4c93447dbb DOCS: mention restore-osc-bindings.conf 2024-10-29 20:36:38 +01:00
Guido Cella
3986f34e2a stats.lua: calculate sizes like --osd-*-size options
Currently --script-opt=stats-font_size=n is much bigger than
--osd-font-size=n, which can confuse users, so calculate sizes the same
way.

The \fs value to replicate --osd-font-size is
${osd-font-size} * 288 / 720 with --osd-scale-by-window, and
\fs${osd-font-size} * 288 / ${osd-height}
with --osd-scale-by-window=no. This is because
sub/osd_libass.c:update_playres() sets
track->PlayResY = ass->res_y ? ass->res_y : MP_ASS_FONT_PLAYRESY,
where MP_ASS_FONT_PLAYRESY is 288.

This also works with persistent_overlay=yes.

{\fscx100}{\fscy100} would also replicate --osd-font-size with show-text
and with osd-verlay + --osd-scale-by-window, but not with osd-overlay +
--osd-scale-by-window=no.

The default sizes are multiplied by 720/288 = 2.5 to keep them the same
as before.
2024-10-29 20:35:35 +01:00
Wertzui123
daf52f9761 DOCS/contribute.md: fix a typo 2024-10-29 20:25:47 +01:00
rkscv
8cd69e6de8 DOCS/man/lua: correct example syntax 2024-10-29 12:26:04 +02:00
Kacper Michajłow
466b5530c9 DOCS/man/osc: remove non-existent options
Fixes: a80f535a6d
2024-10-29 00:45:59 +01:00
Guido Cella
aa66f0dced console.lua: default to a proportional font for select
In the select menu there are no completions to align in a grid, so the
better looking proportional font of --osd-font can be used by default.
It is also easier to read for the visually impaired.

The text width calculation is no longer performed if the console is only
opened through select, it is only performed the first time something is
completed. This avoids having to pass an argument to get_font() to make
it use the monospace font regardless of selectable_items.

Fixes #15176.
2024-10-28 23:30:34 +01:00
Guido Cella
29cffadf60 console.lua: document the new hipdi scaling behavior
Update the docs for the changes of a670f75679.
2024-10-27 21:36:32 +00:00
Guido Cella
d2fd394036 console.lua: increase the font and border size
Make the console easier to read because the current default is too
small. See for example
https://github.com/mpv-player/mpv/discussions/14903#discussioncomment-10794701
or https://github.com/mpv-player/mpv/pull/15036#discussion_r1794178379
or https://github.com/mpv-player/mpv/pull/15145#issuecomment-2428762898
or https://github.com/mpv-player/mpv/pull/15031#issuecomment-2402289600.

This also prevents libass from decreasing performance by printing many
lines.
2024-10-27 21:07:37 +01:00
Guido Cella
e00d8dcb03 console.lua: add scale_with_window script-opt
If this is set to yes or auto and --osd-scale-by-window is true, console
scales with the window height like everything else in mpv.

Defaults to auto.
2024-10-27 21:07:37 +01:00
Guido Cella
fbf869584c osc.lua: cycle tracks on right click
This might be more useful than having the same binding as middle click.
Suggested by llyyr.
2024-10-27 01:24:03 +02:00
nanahi
c6883c4a56 options: add option to control OSD bar marker style
This adds --osd-bar-marker-style option which can be used to
customize OSD bar marker style. In addition to the existing triangle
style, a new style option is added to draw markers as lines.
2024-10-26 20:02:04 +02:00
nanahi
ea8ac49f11 options: add options to control OSD bar marker size
This adds --osd-bar-marker-scale and --osd-bar-marker-min-size
options which can be used to customize OSD bar marker size.
2024-10-26 20:02:04 +02:00
Guido Cella
4598ceb3f2 osc.lua: show track-list for one more second
Useful now that track metadata is printed. This now uses the same
duration as playlist and chapter-list.
2024-10-24 22:04:09 +02:00
Guido Cella
dec1b00a75 DOCS/man/osc: update default playlist mbtn_right bindings 2024-10-23 14:22:14 +02:00
Guido Cella
f999b0a5c8 osc.lua: don't show the osd-bar on chapter navigation
It is redundant if you're already using the OSC, so only show the
chapter text. Also fix the documented default commands of these buttons
which were outdated.
2024-10-23 14:22:14 +02:00
Guido Cella
165159fdef osc.lua: cycle window-maximized when right clicking fullscreen
And add script-opts to configure the fullscreen button bindings.
2024-10-23 00:21:15 +02:00
Guido Cella
dab5cf4ab0 osc.lua: toggle looping when right clicking playpause
Inspired by ModernX.

Closes #5067.
2024-10-22 22:44:21 +02:00
Guido Cella
a80f535a6d osc.lua: make mouse bindings customizable
This adds several script-opts to configure what OSC buttons do when
clicked. It lets you restore the bindings present before they were
changed to call select.lua.

The script-opts are listed one per line in the manual to not make that
section huge.

skip_backward and skip_forward script-opts are omitted to lower the
script-opts number because they are only in box layout and undocumented.

I'm not sure if it's worth adding script-opts for the wheel on the
seekbar.

script-opts for the current and remaining time and fullscreen are not
added to not add more script messages.

Closes #6291 and #11878.
2024-10-22 22:44:21 +02:00
Guido Cella
cd2acb477c osc.lua: open select.lua by clicking buttons
8bf5548 added mouse support to the console's select menu, so open it
from OSC buttons.

Left click on the title opens the playlist selector and showing the
stats is moved to right click.

Right click on chapter buttons opens the chapter selector.

Left click on track buttons opens the track selectors because seeing
which track you're selecting beforehand is useful.

Fixes #10621.
2024-10-22 22:44:21 +02:00
Guido Cella
68e2b51066 osc.lua: show stats page 5 when clicking the title
Now that the playlist counter is shown by default there is no use in
showing it again, so repurpose the binding to show the stats page with
file and track info.
2024-10-22 22:44:21 +02:00
Guido Cella
8ca7386a38 osc.lua: add osc-hide script-message
This will be used to hide it when opening select.lua.
2024-10-22 22:44:21 +02:00
Guido Cella
f156461360 osc.lua: show the playlist position when playing multiple files 2024-10-22 22:27:40 +02:00
Kacper Michajłow
153d4927ab options: add --script-opt alias for --script-opts-append 2024-10-22 18:54:16 +02:00
Guido Cella
7a652344ee osc.lua: seek to the nearest chapter when right clicking the seekbar
This allows seeking to the start of a chapter without exactly clicking a
chapter mark.

Inspired by ModernX.
2024-10-22 18:52:56 +02:00