Commit Graph

53251 Commits

Author SHA1 Message Date
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
nanahi 9543426889 options: move dvd options to stream_dvdnav
The options and struct are only used in stream_dvdnav.c.
Also use dvd prefix for dvd_conf.
2024-11-18 17:22:02 +01:00
nanahi 354ad7f27d sub/osd_libass: simplify osd bar variable names 2024-11-18 17:22:02 +01:00
nanahi 8612f802dd options: move OSD bar opts to a separate struct
Move them to a suboption so the suboption prefix can be
used.
2024-11-18 17:22:02 +01:00
nanahi e056ad374f options: move mp_sub_filter_opts to sd_ass.c
Also use sub-filter common prefix.
2024-11-18 17:22:02 +01:00
nanahi f3b56c846d options: remove extra spaces 2024-11-18 17:22:02 +01:00
Kacper Michajłow 51f02679d4 common/playlist: don't allocate duplicated playlist_path
If the playlist is loaded directly from a protocol like memory://, the
playlist_path represents the entire playlist. In cases where we have a
large playlist, this results in the entire playlist being duplicated for
each item. For example, if the input size is 300 kB with 10k items, we
end up using 3 GB of memory just to store the playlist_path strings.
2024-11-18 17:14:38 +01:00
Guido Cella 2e31502cb1 console.lua: don't override the offset of opaque boxes
With --osd-border-style=opaque-box and background-box, respect
--osd-shadow-offset.

I am not sure if --osd-shadow-offset should be inherited with
--osd-border-style=outline-and-shadow, especially since it doesn't let
you specify different x and y offsets.
2024-11-18 17:10:19 +01:00
Guido Cella b71ab51996 console.lua: use OSD margins
Now that default OSD margins have been decreased to 15 it is reasonable
to let console.lua inherit them for consistency.
2024-11-18 10:36:43 +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
Kacper Michajłow e8fd7b8798 meson: define _UCRT_NOISY_NAN to workaround the non-constant NAN define
Windows SDK 10.0.26100.0 defines the NAN macro in a non-constant manner.
This violates the C/C++ standard and breaks the compilation of
initializers with Clang.

See:
https://developercommunity.visualstudio.com/t/NAN-is-no-longer-compile-time-constant-i/10688907
2024-11-17 03:19:17 +01:00
Guido Cella dd5f2069b8 loadfile: move mp_format_track_metadata to misc.c
Move the function added in 3ea8d751f5 to misc.c because command.c is too
big. The circle definitions are also moved to core.h
2024-11-16 16:59:11 +01:00
Guido Cella da82c0428e input/cmd: increase the command length for --input-cmdlist
--input-cmdlist crops playlist-next-playlist, playlist-prev-playlist,
write-watch-later-config and delete-watch-later-config, so increase the
string length to that of the longest command.

Also stop specifying both the minimum and maximum length since they are
the same.
2024-11-16 16:58:38 +01:00
nanahi 1c9d066c9e input: fix memory leak with scalable input and nonscalable commands
With scalable input source, scale_units can be 0, and cmd is not
freed. Fix this by freeing cmd when scale_units is 0.

Fixes: 937128697f
2024-11-16 16:58:21 +01:00
Kacper Michajłow 70aaba71d6 player/command: remove /100 from sub-pos print
It already prints %, so there's no need for '/100'. Also, use the print
helper while at it.

6ea08be59a added a percent sign but didn't
remove '/100', so we ended up with both, which is redundant.
2024-11-14 18:56:04 +01:00
Kacper Michajłow 3772b8e385 meson: disable subprocess command for fuzzing
Allowing arbitrary command execution for the fuzzer is not ideal. While
some testing of this code is valid, unsupervised fuzzing of the input is
not. It may be better to add a dedicated test or fuzz-test for this
case.
2024-11-14 18:55:29 +01:00
Kacper Michajłow b982027b64 fuzzer_options_parser: limit input size to 2048 bytes
To encourage fuzzing to mutate shorter test cases, avoid continuously
adding more elements into a single input.
2024-11-14 18:55:29 +01:00
Guido Cella 1c3f09270f defaults.js: send the right number of arguments to input.get callbacks
Only send how many arguments were actually passed by console.lua instead
of sending extra undefined arguments.
2024-11-14 11:09:08 +01:00
Guido Cella ea6b1119d3 defaults.js: fix the opened event with mp.input.get
The opened event doesn't send any arguments. Don't call
JSON.parse(undefined) in that case because it errors.

Fixes eb4c6be630, fixes #15301.
2024-11-14 11:09:08 +01:00
llyyr c60d8523ed meson: rename meson_options.txt to meson.options
This is preferred name since 1.1.0, and we already require >=1.3.0 so
there's no harm in doing it.
2024-11-13 14:16:48 +00: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
llyyr 43d896657e wayland: cleanup check_for_resize function
xdg_toplevel_resize_edge enum values allow for this to work, e.g.
`TOP | LEFT = TOP_LEFT`

No functional change.
2024-11-11 22:11:23 +00:00
nanahi ca7aeb71ee video/out/gpu/video: fix chroma offset rotation matrix calculation
82231fd74d mentioned that for the "rot"
transform flip=true must be set, which "makes no sense at all".

The reason this is happening is that the rotation matrix calculation
is only valid for the 2D coordinate system where y axis is 90 degrees
counterclockwise from x axis, but the coordinate system of chroma
offset has its origin at top-left so it is the opposite, which results
in the rotation going to the opposite way. Setting flip=true fixes the
rotation direction, but results in a flipped y coordinate.

Fix this by reversing the rotation angle for chroma offset rotation
matrix calculation. This also allows removing some duplicated code.
2024-11-11 02:30:26 +01:00
nanahi 70b202a8f4 video/out/gpu/video: prevent OOB access when larger angles are used 2024-11-11 02:30:26 +01:00
Guido Cella d66ed2d8be sub/osd_libass: don't blur the osd-bar
High --osd-blur values break the osd-bar by not drawing the filled
portion, and even low values just make it look worse, so don't apply
--osd-blur to the osd-bar.
2024-11-09 12:44:05 +01: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
Olivier Perret 3bbc770b14 options: add .qoi to the list of image extensions 2024-11-08 10:01:28 +01:00
Kacper Michajłow ddba159b51 ci/win32: restrict shaderc version to fix build errors
The same as 87826224a2.
2024-11-08 09:59:29 +01:00
sfan5 87826224a2 ci/mingw: restrict shaderc version to fix build errors
https://github.com/KhronosGroup/glslang/issues/3787 was fixed already
but shaderc uses pinned revisions, so let's just downgrade.
2024-11-07 22:39:38 +01:00
davince 46fe3cded0 ao_audiotrack: make audiotrack jni multi-instance and multi-thread safe
The detailed issue is here:
#15212

problem: Since The AudioTrack is not an mpv instance level but a global object, it cannot support multiple mpv instances at the same time. For example, if you create two instances and then destroy one of them, the other instance may crash.

Add jni usage count to fix this.
2024-11-06 18:54:50 +01:00
nanahi f8db474090 .github/ISSUE_TEMPLATE: ask for last known working version
Currently it asks which version introduced the problem, but
users are unlikely to know if they don't update and test every
single version released, and this field is rarely filled in
practice by non-developers.

On the other hand, it's much easier to recall the last working
version that they have used before.

So ask for the last known working version, which is useful
information for developers to narrow down bisecting range.
Also ask when did the issue start in general since the issue
can be caused by system or driver updates.
2024-11-06 18:00:42 +01:00
nanahi 1818c423da .github/ISSUE_TEMPLATE: unify source of mpv description 2024-11-06 18:00:42 +01:00
nanahi c9bc1e6cfe .github/ISSUE_TEMPLATE: clarify the template is for other platforms
It currently says "different" issue which is unclear.
Clarify this by saying it's for other platforms.
2024-11-06 18:00:42 +01:00
llyyr 168fb56fe8 osc.lua: observe playlist-count instead of playlist property
Observing playlist property with "native" type is too expensive for
larger playlists, and we only observe this property to
activate/deactivate next/prev buttons on the osc. We actually only need
to know if the playlist-count has changed, nothing else.

Fixes: https://github.com/mpv-player/mpv/issues/15264
2024-11-06 18:00:09 +01:00
der richter 91d4e6f937 mac/type: change never mutated variable to let 2024-11-05 18:34:15 +01:00
der richter c80757d782 videotoolbox: silence OpenGL deprecation warnings 2024-11-05 18:34:15 +01:00
der richter 84adbd9d35 ao_coreaudio: fix CoreAudio deprecations 2024-11-05 18:34:15 +01:00
der richter 6f009a91a6 mac/common: fix light sensor deprecations 2024-11-05 18:34:15 +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
Dudemanguy d5f1cd07dc vo_gpu_next: add a pass_colorspace override for drm
The libplacebo colorspace hint api makes sense for things like vulkan,
but for other APIs like drm that are capable of directly handling
colorspaces and hdr metadata it's a nuisance. Add a pass_colorspace fns
that signals to vo_gpu_next that the backend doesn't need the color
information to be manipulated and can handle the metadata itself.
2024-11-04 19:35:28 +00:00
Dudemanguy ca31b94843 wayland: guard devices_are_equal completely
Only used if we have drm. Avoids a -Wunused-function error.
2024-11-04 19:35:28 +00:00
Dudemanguy c0f1954d66 github/workflows: install libdisplay-info on freebsd
Needed for drm to build now.
2024-11-04 19:35:28 +00:00
Dudemanguy a4d9bdd262 drm: parse edid using libdisplay-info
libdrm unfortunately doesn't give us what is actually supported by the
connector in question. To do that, we would have to parse the edid blob.
Use libdisplay-info to do this and make it required for drm support.
Using what we get back from the library, we can do a bit of sanity
checking for hdr metadata to make sure that the display in question can
handle it before we try setting the metadata. Strictly speaking,
libdisplay-info has stuff for dynamic metadata that we could potentially
use, but as a first pass and for simplicity, only static is considered
for now.
2024-11-04 19:35:28 +00:00
Dudemanguy 8039128693 vo_gpu: explicitly set target_params to NULL on uninit
Prevents vo_get_target_params from segfaulting if called somewhere else
in the code since the underlying p->renderer was just freed.
2024-11-04 19:35:28 +00:00
Dudemanguy 2827c9f323 context_drm_gl: add support for hdr metadata
It seems what we can do on this level is a bit limited but it's better
than nothing. Closes #8219.
2024-11-04 19:35:28 +00:00
Guido Cella a61518db98 player/client: reduce log level for hooks not sent to clients
If a hook event can't be sent to a client because it no longer exists,
stop logging it as a warning, as there is no way for a client to remove
hooks, so it is expected that the hook can't be sent. This is documented
in libmpv/client.h.

If the hook event can't be sent for other reasons, like the event queue
being full (currently the only other possible reason), keep logging as
warning.

Also add the client and hook type to the message. They are also logged
just above, but only in verbose mode, so when only the warning is logged
you didn't see the client before.

auto_profiles.lua logs these warning since 5dc4047415, and this commit
fixes that.

Fixes #15244.
2024-11-03 20:03:49 +02:00