1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-20 06:46:55 +00:00
Commit Graph

52535 Commits

Author SHA1 Message Date
Kacper Michajłow
965809f108 w32_common: stop IME initialization timer after first try
It will be set again on first key press, but no need to call IME api
every 250ms until any key is pressed.
2024-06-07 19:41:15 +02:00
nanahi
31ae111ff5 default.js: handle canceled key bindings 2024-06-06 23:38:39 +03:00
nanahi
eeb8e6e451 defaults.lua: handle canceled key bindings
There is a subtle behavior difference for built-in/input.conf key bindings
and key bindings registered by scripts: when a key binding is canceled
(e.g. a mouse button is bound to a command, is pressed down, and then
another key is pressed which is bound to another command), the command is
not invoked if the binding is built-in/input.conf, but is invoked if it's
registered by scripts, because it's handled with a different mechanism,
which gives no way for scripts to detect this.

Fix this by using the newly available canceled flag to detect this.
If a key binding is canceled, the callback is now not invoked unless
the key binding is registered with the complex option. In this situation,
the callback is invoked with the canceled state available so that scripts
can detect and handle this situation.
2024-06-06 23:38:39 +03:00
nanahi
5fcbe1c417 command: add canceled state to key-binding client message
This allows libmpv clients to know whether the key binding is canceled
and thus should normally be ignored.
2024-06-06 23:38:39 +03:00
nanahi
de97cb0964 input: mark a command as canceled if it is explicitly dropped
In certain situations (including but not limited to begin window dragging),
it is desired to cancel the current command completely. However, commands
which have on_updown flag set require the command to be invoked in this
situation. There is currently no way to know if the command is triggered
normally or triggered because it is dropped.

This adds a canceled state to mp_cmd which indicates this.
2024-06-06 23:38:39 +03:00
Kacper Michajłow
a8d95fd51a bstr: use memchr and memrchr for bstrchr and bstrrchr
May be faster to use optimized variants instead of simple loop.
2024-06-06 21:42:58 +02:00
Kacper Michajłow
a32674bb29 terminal-win: use proper NTAPI callback for FLS
Fixes crash when FLS data is attempted to be cleared.

This affects only 32-bit build where the calling convention were not
matching the expected one. It has to be __stdcall in this case.

Fixes: 3372e17d
2024-06-06 21:42:12 +02:00
Kacper Michajłow
112fa549be DOCS/compile-windows.md: update Windows compilation documentation
General update. Removed MXE as it is not supported, doesn't support
libplacebo and in general it doesn't do anything useful which native
Meson cannot do already.
2024-06-05 19:17:49 +02:00
Kacper Michajłow
00cfe1e1fd common: clang supports __builtin_clz also in non-GNU modes 2024-06-05 19:16:35 +02:00
Kacper Michajłow
0fd3fe857c parse_commandline: fix incorrect win32 check 2024-06-05 19:16:35 +02:00
Kacper Michajłow
7258ca3247 misc/thread_tools: fix incorrect win32 check 2024-06-05 19:16:35 +02:00
Kacper Michajłow
f394349066 ao_pcm: fix incorrect win32 check 2024-06-05 19:16:35 +02:00
Kacper Michajłow
f40b569426 player/main: concat string at compile time 2024-06-05 19:16:35 +02:00
Kacper Michajłow
b0aa088bc4 sub/sd_ass: rewrite is_animated()
Using strchr should be faster as it is optimized for the job. Also
ensure that tags are not escaped and are within {} correctly. This also
is important for performance as it allows to scan only needed areas of
the string.

Co-authored-by: Avi Halachmi (:avih) <avihpit@yahoo.com>
Co-authored-by: rcombs <rcombs@rcombs.me>
2024-06-05 19:13:41 +02:00
Kacper Michajłow
0fd4c84a5e meson: clear flags used for build
Some were duplicated between GCC and Clange. Others were missing in
Clang case. Instead test all the flags and don't make assumptions that
will get invalid over time. Testing flags is almost free.
2024-06-05 19:07:58 +02:00
Kacper Michajłow
b4683fd3d8 {x11_common,context_x11egl}: suppress Wundef warning 2024-06-05 19:07:58 +02:00
Kacper Michajłow
b558b99f67 ao_pipewire: fix access to undefined byte order definitions
spa/param/audio/raw.h on FreeBSD accesses those, so defined them.
Probably should be fixed upstream, but to suppress warnings lets do it
locally.
2024-06-05 19:07:58 +02:00
Kacper Michajłow
8e4dcb15ce osdep/endian: add missing byte order defines 2024-06-05 19:07:58 +02:00
Kacper Michajłow
8657b20574 ao_coreaudio_chmap: fix shadowed variable 2024-06-05 19:07:58 +02:00
Kacper Michajłow
2e19420756 stream_cdda: suppress Wundef warning 2024-06-05 19:07:58 +02:00
Kacper Michajłow
fc0d0f10eb fuzzers/common: add prototype for LLVMFuzzerTestOneInput
To suppress warning.
2024-06-05 19:07:58 +02:00
nanahi
16612672fd input: fix grammar errors and typo 2024-06-05 13:35:33 +00:00
nanahi
0509e5b2ed input: only begin VO dragging if the section allows
Otherwise, on sections which don't allow VO dragging, the mouse button
is force released and dragging events won't be generated.

Fixes: 349aac462e
2024-06-05 11:11:00 +02:00
Kacper Michajłow
e7630722d8 autoload.lua: always accept current file as a valid file
This allows loading other types of media from the current directory,
with same_type=no, regardless of whether the current type is enabled for
autoload.

Fixes: #14287
2024-06-04 15:39:18 +02:00
Kacper Michajłow
a64a5c2222 autoload.lua: match also image extension
For clarity, it is already matched if extention is in EXTENSIONS if
pl_count == 1.
2024-06-04 15:39:18 +02:00
Kacper Michajłow
8dcd5ea288 autoload.lua: cosmetic changes 2024-06-04 15:39:18 +02:00
Kacper Michajłow
7d4719704e autoload.lua: fix options update
The extensions list needs to be cleared in this case. Also, add the
missing split_patterns().
2024-06-04 15:39:18 +02:00
Dudemanguy
fa89082f2e sub: avoid unneeded calls to is_animated
4e5d996c3a added this as part of a series
of patches written to avoid wasteful sub redraws when playing a still
image with subs. The is_animated special case was specifically for ASS
subtitles that have animations/effects and would need repeated redraws
in the still image case. This check was done unconditionally for all ASS
subtitles, but for very big ASS subtitles, this text parsing can get a
bit expensive.

Because this function call is only ever needed for the weird edge case
of ASS subtitles over a still image, some additional logic can be added
to avoid calling is_animated in the vast majority of cases. The animated
field in demux_packet can be changed to a tristate instead where -1
indicates "unknown" (the default state). In update_subtitle, we can look
at the current state of the video tracks and decide whether or not it is
neccesary to perform is_animated and pass that knowledge to sd_ass
before any subtitle packets are decoded and thus save us from doing this
potentially expensive call.
2024-06-04 12:29:13 +00:00
nanahi
7e82108bec input: reset doubleclick timer when dragging begins
This prevents doubleclick from activation if a second mouse click comes
quickly after a click which begins dragging.
2024-06-04 12:41:51 +02:00
nanahi
49b5e6d042 input: un-hardcode VO dragging
This adds the --input-builtin-dragging option, which allows the built-in
dragging behavior to be disabled. This allows scripts to implement custom
dragging behavior with left button down events and begin-vo-dragging
command, which could only be done for other mouse buttons before.
2024-06-04 12:41:51 +02:00
nanahi
349aac462e input: prevent MBTN_LEFT conflict with VO dragging
Currently, the built-in VO dragging conflicts with the MBTN_LEFT binding,
so the binding is activated even though the VO dragging begins. Fix this
by releasing the currently down command so that MBTN_LEFT can be bound to
a useful action (such as play/pause).
2024-06-04 12:41:51 +02:00
nanahi
a6683ea3c9 input: implement VO dragging deadzone
This adds the --input-dragging-deadzone option, which adds a deadzone
for the built-in VO deagging. This prevents accidental VO dragging.
2024-06-04 12:41:51 +02:00
nanahi
a23098b555 input: fix mouse position equality check
The stored mouse position mouse_vo_x/y are scaled (currently only for
vo_xv), but the position equality check compares between raw position
and scaled position.

Fix this by storing and checking the raw position instead. The raw
position is useful for the next commit.
2024-06-04 12:41:51 +02:00
nanahi
82c8a98884 input: begin VO dragging when moving mouse while left button is down
Will be used for the VO dragging deadzone.
2024-06-04 12:41:51 +02:00
nanahi
23d9c8dc6a DOCS/man/options.rst: remove DVD menu reference for --input-cursor
Not supported anymore.
2024-06-04 12:41:51 +02:00
Kacper Michajłow
0c716e762f test/meson: remove unneded sources 2024-06-03 19:18:06 +02:00
Kacper Michajłow
8f220067df ci/mingw: resolve pkgconfig deprecation warning in meson
pkgconfig is deprecated in favor of pkg-config. Define both for
compatibility with meson < 1.3.0.

https://mesonbuild.com/Release-notes-for-1-3-0.html#machine-files-pkgconfig-field-deprecated-and-replaced-by-pkgconfig
2024-06-03 19:18:06 +02:00
Kacper Michajłow
bec3f606cf ci/mingw: run meson tests 2024-06-03 19:18:06 +02:00
Kacper Michajłow
bb078b8303 ci/mingw: add exe_wrapper to cross file
Allows running complied binaries on build machine.
2024-06-03 19:18:06 +02:00
Kacper Michajłow
7e8c887873 ci/mingw: support encode mode 2024-06-03 19:18:06 +02:00
Kacper Michajłow
edcc72ba02 ci/mingw: use ninja for cmake builds 2024-06-03 19:18:06 +02:00
Kacper Michajłow
4caca3e6c0 test/paths: skip normalize tests if pathcch library is not available
If pathcch is not available paths are not normalized on Windows.

Fixes tests on ancient mingw.
2024-06-03 19:18:06 +02:00
Kacper Michajłow
734846c123 test_utils: don't use subprocess for diffing test results
Helps with testing during cross-compilation and avoids external
dependency.

Output maybe is not that nice, but this output in our tests is not
useful anyway. We know if it changes it is beacuse one of the dependency
version changed.
2024-06-03 19:18:06 +02:00
Kacper Michajłow
09c359e1d3 test/libmpv_encode: print logs also during initialize 2024-06-03 19:18:06 +02:00
Kacper Michajłow
8a9901963d test/libmpv_encode: don't use mpv internals for test
mktemp is good enough for this test purposes and also tests if libmpv is
able to create a file that doesn't exist.
2024-06-03 19:18:06 +02:00
Kacper Michajłow
d70a0b4494 player/playloop: remove now unused get_percent_pos() 2024-06-03 19:16:35 +02:00
Kacper Michajłow
37127276cc win32: quantize taskbar playback position into uint8 range
Also, if the position is valid, set it to 1 / INF. Windows interprets 0
as non-progress.

Progress is quantized into uint8 range, it is good enough for this
use-case. This avoids unnecessary vo_control and
ITaskbarList3::SetProgressValue calls and should be visually
indistinguishable in practice.

Fixes #14282
2024-06-03 19:16:35 +02:00
Kacper Michajłow
d3b251bb99 Revert "d3d11: calc vsync interval on real stats, not just last interval"
The values provided since last disjoint event may include significant
error in case there are periods of slower presentation. We should look
at more localized/current values of presentation.

For more accurate approximation of vsync rate I plan to add better
algorithm to calculate it.

Revert this commit alone as it is not neccessary and gives as separation
from other changes for better regression testing.

This reverts commit f27767f59e.
2024-06-03 19:16:01 +02:00
Guido Cella
e95af5b607 TOOLS/autoload.lua: fix directory_mode and ext options
Operations on option values need to be performed after they are read.

Fixes 843161d96e.
2024-06-03 15:25:51 +02:00
nanahi
cfc651a805 osd: don't use get_percent_pos function
Use get_current_pos_ratio instead, and round the value to integer with
printf precision specifier.
2024-06-03 15:14:40 +02:00