Commit Graph

53235 Commits

Author SHA1 Message Date
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
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 b057af0a56 w32_common: update window style after changing maximized state
Maximized state is not allowed without WS_OVERLAPPEDWINDOW style and
doesn't stick. Set the style after.

Fixes: #15093
2024-11-03 02:21:15 +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
Niklas Haas 89e608e169 vo_gpu_next: add dynamic hook parameters
Fixes: https://github.com/haasn/libplacebo/issues/230
Fixes: https://github.com/mpv-player/mpv/issues/8206
2024-11-02 21:20:20 +01:00
averne 32bcaf865b osdep/terminal: fix dummy implementation
c2ed2e7 introduced the terminal_set_mouse_input function to various terminal
backends, but overlooked the dummy backend.
This causes linking errors when trying to build on platforms with no terminal,
as vo_kitty and vo_tct are unconditionally enabled and make use of that
function.
2024-11-02 20:05:11 +01:00
Guido Cella a9d57938b2 .luacheckrc: add_hook is not undocumented
It's a commonly used function so group it with the documented functions.
2024-11-02 14:03:02 +02:00
Guido Cella 5dc4047415 auto_profiles.lua: actually exit when no auto profiles are defined
Unsetting _G.mp_event_loop at the top level quits the script, but not
within callbacks. Use the new exit() function instead. Fixes e2284fba18.

This actually has an edge case since e2284fba18 where you can add auto
profiles only later with load-config-file and the script stays unloaded,
but it's still reasonable to quit if mpv.conf has no conditional
profiles. You could always explicitly set --load-auto-profiles=yes in
this case.
2024-11-02 14:03:02 +02: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
nanahi e734f5ae33 video/out/w32_common: don't move window if position isn't set
The geometry output of vo_calc_window_geometry does not have
any information about the current window position. This causes
the window to move when setting geometry even without setting
x/y.

Change it so that the window position is unchanged if x/y are not
set and after startup.
2024-11-02 11:14:57 +01:00
nanahi 512f5e2e82 video/out/w32_common: always move window when setting state
Make sure the window is at the correct position when
fullscreen while geometry is set.

Fixes: e5159de811
2024-11-02 11:14:57 +01:00
Kacper Michajłow d78c35d360 fuzzers/fuzzer_json: add simple fuzzing for our json code 2024-11-02 05:28:11 +01:00
Kacper Michajłow 207aa647a5 options/m_option: free all list elements when removing them
Elements are not parented to the add list, as they are directly copied
to the target list. Therefore, we need to clean them up manually.

Fixes: 1f5a67d8fa
2024-11-02 04:24:00 +01:00
Kacper Michajłow 2054d872d4 m_property: stop expanding strings after 10 properties during fuzzing
Some properties, like `${decoder-list}`, are resource-intensive to
expand. Prevent fuzzing from generating strings with excessive
expansions to encourage shorter test cases.

Expanding properties on each playback frame for `osd-msg1` can be
demanding. However, in regular use cases, this typically isn’t an issue,
so implementing a caching solution wouldn’t be practical in real
scenarios.

Fixes timeouts on OSS-Fuzz.
2024-11-02 04:24:00 +01: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