Commit Graph

51966 Commits

Author SHA1 Message Date
Andarwinux 77e1cfb85f ci/msys2: fix vulkan package name 2024-03-24 16:55:38 +01:00
sfan5 8e3737ab63 ao_pulse: reenable latency hacks by default
As far as I can tell PulseAudio introduced a bug in 16.0
where if a stream is (un)paused too often the reported latency
will momentarily spike by 3000% or more. Apparently in certain cases
just pausing once and waiting can also cause this.

Save the remaining users of PA the trouble of debugging the various
obscure issues that can arise from this (desync is a harmless example)
by enabling the latency hack code again.

ref: <https://github.com/mpv-player/mpv/issues/12057>
     <https://github.com/mpv-player/mpv/issues/10333>
2024-03-24 09:58:41 +01:00
Shuanglei Tao 7490919a9a player/command: fix udata talloc parent 2024-03-23 02:28:18 +01:00
der richter 9cee44147a mac/libmpv: remove unused functions 2024-03-21 18:33:15 +01:00
der richter 12782aad6c mac: optimise and shorten some code 2024-03-21 18:33:15 +01:00
der richter 9e03ab5e1e mac/option: remove now unused computed option variables 2024-03-21 18:33:15 +01:00
der richter 204e3f0df6 mac/option: rename option structs to properly represent their content
also optimise option cache setup.
2024-03-21 18:33:15 +01:00
der richter f72dfd48d0 mac/libmpv: remove mac option handling in favour of option handler
since the option handler is not optional anymore and available on init
in cocoa-cb we don't need to duplicate this functionality in libmpv
anymore.
2024-03-21 18:33:15 +01:00
der richter b480daad88 mac/option: make option helper none optional
gets rid of some unwrapping boilerplate and nil coalescing operators.
2024-03-21 18:33:15 +01:00
der richter 6defd49aa1 mac/option: make option helper vo struct independent 2024-03-21 18:33:15 +01:00
der richter 90c534a821 mac/option: optimise option pointer access 2024-03-21 18:33:15 +01:00
der richter 2d9be04c00 mac/option: remove unused and obsolete variables 2024-03-21 18:33:15 +01:00
der richter dc5059d027 mac/option: move option functionality from mpv helper to option helper
delete now empty mpv helper
2024-03-21 18:33:15 +01:00
der richter 283d0877c4 mac/type: move c<>swift type bridging into a dedicated type helper 2024-03-21 18:33:15 +01:00
sfan5 1d8f28cea7 meson: conditionalize searching for ANGLE's EGL 2024-03-21 18:27:08 +01:00
sfan5 a392f91170 meson: get rid of 'egl-helpers' feature
This was just redundant because it's always present together with 'egl'.
2024-03-21 18:27:08 +01:00
sfan5 3679d18b54 meson: fix EGL version check 2024-03-21 18:27:08 +01:00
sfan5 6b8bd8072f video/egl_helpers: fix fallback logic for EGL_KHR_create_context
Both possible paths had bugs:
For OpenGL it passed EGL_CONTEXT_CLIENT_VERSION, which - in older versions
of the standard - was not permitted.
For GLES it always assumed EGL_CONTEXT_FLAGS_KHR to work, which belongs to the
aforementioned extension.

Ironically this was never a problem (probably saved by implementations
not being overly strict) except in 2024 on an emulated Android 14 device
that trips over this edge case. It is a mystery.
2024-03-21 18:27:08 +01:00
sfan5 b3ca600acb video/egl_helpers: log error for eglCreateContext 2024-03-21 18:27:08 +01:00
Dudemanguy 91489c9466 options: add --input-commands option
Basically a simple way to perform any command/property action from the
command line. This takes the exact same syntax as input.conf but not
including the key naturally. Potentially useful for weird properties
that don't map well to options (like ao-volume). Fixes #12353.
2024-03-21 14:48:53 +00:00
Guido Cella 46a35e2edc console.lua: complete fixed precision properties
Add support for the syntax introduced by 8708f4dc91 in the completion
system.
2024-03-21 08:54:58 +01:00
Kacper Michajłow 06edb04692 test: fflush output stream before abort
For `meson test` to not eat lines on abort.
2024-03-21 03:50:11 +01:00
Kacper Michajłow 8708f4dc91 m_property: add `>` for fixed precision floating-point expansion
This enhancement makes it easier to create constant width property
expansions, useful for the `--term-status-msg`. Additionally, it changes
to `%f` printing with manual zero trimming, which is easier to control
than `%g`. With this method, we can directly specify precision, not just
significant numbers. This approach also avoids overly high precision for
values less than 1, which is not necessary for a generic floating-point
print function.

A new print helper function is added, which can be used with adjusted
precision for specific cases where a different default is needed. This
also unifies the code slightly.
2024-03-21 03:50:11 +01:00
Guido Cella c84bb1ce67 osc.lua: escape text
Escape all messages in osc.lua, because other than the title they
weren't being escaped at all. If for example you did mpv foo.mp4
'{\fs50}bar.mp4' and script-message osc-playlist, it would just render
the second entry as bar.mp4 in big text.

The title was escaped partially, now the escaping is complete because:

- It escapes \. Backslashes at the end of the title are escaped instead
  of being stripped, and \n, \N and \h are now printed verbatim. In
  particular, "\\n" is no longer converted to space and is printed
  verbatim instead which is more correct.
- Newlines ("\n", not the "\\n" escape sequence) are converted to spaces
  instead of rendering them and messing up the text positioning within
  the OSC.
- Spaces at the start are preserved.

Fixes #11209, fixes #11275.
2024-03-21 03:20:14 +01:00
Guido Cella d6610a5b2f command: add escape-ass
This adds a command to escape ASS tags to remove code duplication
between sub/osd_libass.c, console.lua, osc.lua, stats.lua and any user
script that calls mp.create_osd_overlay().

A command is used instead of scripting functions so that all clients can
use this and not just use Lua and JS ones.

osd_mangle_ass() also interprets osd-sym-cc and osd-ass-cc/{0,1}, but
since they use invalid UTF-8 characters there is no risk of escape-ass
users using them by accident, like with any OSD message.

Always replacing \n with \\N in mangle_ass() even when it is not called
by escape-ass doesn't seem to cause any issue, but I made it conditional
anyway to avoid changing how all OSD messages are treated unnecessarily.
2024-03-21 03:20:14 +01:00
nanahi 520849dd48 input: remove max active section limit
585d8c6856 increased max active
section limit from 5 to 50 but this obviously doesn't properly fix
the problem. Input still breaks if more than 25 scripts are loaded,
or if some scripts define lots of input sections.

Remove the limit completely by using a dynamic array for active sections.

Fixes: https://github.com/mpv-player/mpv/issues/13707
2024-03-21 03:11:19 +01:00
nanahi a5dbf34094 input: raise maximum key down limit to 16
The current limit of 4 is stupidly low, and won't be future proof
in case proper multi-touch support is added.
2024-03-21 03:11:19 +01:00
Christoph Heinrich 97e16be294 stats.lua: use term-size as terminal output size
The terminal output was static in size with no way of automatically
adjusting it to the current terminal size.

The new term-size property makes truly automatic adjustment possible.
2024-03-21 03:08:52 +01:00
Christoph Heinrich 0c8f3bc73c player/command: add term-size/[w,h] property
There was no way for scripts to know the current size of the terminal,
which is essintial if they want to provide a good user experience even
without a window.
2024-03-21 03:08:52 +01:00
Christoph Heinrich 0230a0c25a stats.lua: fix and unify scroll hint
The scroll hint on page 4 had baked in ass tags, which shouldn't be
there in the terminal. Also the scroll hint on page 0 was missing.

Refactor scroll hint generation into a function and use that for
pages 2, 4 and 0.
2024-03-21 03:08:52 +01:00
Christoph Heinrich c89b8340d5 stats.lua: use term_ellipsis for page 4
Page 4 might as well use the same line shortening function as the other
pages instead of rolling it's own.
2024-03-21 03:08:52 +01:00
Christoph Heinrich 777f69bee8 stats.lua: truncate long lines for the terminal
The terminal is assumed to be 80x24 in size, the new options
`term_width_limit` and `term_height_limit` can be used to overwrite
that.

Lines longer then the terminal width cause problems with scrolling
pages and need to be shortened.

The algorithm used for shortening can deal with tabs and escape
sequences, has rudimentary support for UTF-8 and runs in O(n).

avih helped in the creation of the term_ellipsis() function and split()
is also from him.
2024-03-21 03:08:52 +01:00
Christoph Heinrich 344ac5501d stats.lua: use scroll function for page 2 and 0
Pages 2 and 0 had their own scroll implementations, which worked fine
for ass, but didn't work well in the terminal.

Now they both use the same scroll function as page 4.

That scroll function requires each output line to be one entry
in the table. Page 0 did not adhere to that new requirement, instead
it generated two table entries for a single output line when a graph
is shown. To fulfill that requirement the generated graph now gets
directly appended to the same table entry that's used for the rest
of the line.
2024-03-21 03:08:52 +01:00
Christoph Heinrich 16a480375b stats.lua: refactor page 4 scrolling into function
This scrolling implementation will be used for other pages in future
commits.

The comment said it takes up 20 lines of the terminal, but in reality
it was 22 lines.
2024-03-21 03:08:52 +01:00
Kacper Michajłow 2a08440afb stats.lua: add more information in audio section
- current AO
- AO device
- AO volume
- audio delay
- output format
2024-03-21 02:40:00 +01:00
Kacper Michajłow 0deefd80bf msg: clear buffered status_line on flush
It shouldn't be used after flush anymore.
2024-03-21 01:47:15 +01:00
Kacper Michajłow 17a0756ed3 msg: simplify the line_skip calculation
Make it more straightforward by always calculating top offset first
instead of having two branches, that tries to calc it directly.

This also fixes missing negative check before `\033[%dA` which was in
practice only problem on macOS which was handling negative values, while
in fact it shouldn't.

Fixes: #13484
2024-03-21 01:47:15 +01:00
Dudemanguy 188155457d TOOLS: add an interface-changes generator script
Convenience script to automatically generate interface-changes.rst based
on the workflow introduced in the previous commit.
2024-03-20 22:38:56 +00:00
Dudemanguy 58363d209c DOCS: document the new way to handle interface changes
Manually editing interface-changes.rst is a giant maintenance pain that
causes merge conflicts all the time. Stop doing that nonsense and
instead have changes be written to files in DOCS/interface-changes. Also
remove that one sentence in changes.rst because it's just not true.
2024-03-20 22:38:56 +00:00
nanahi 8c1117b2cb meson: remove winmm dependency for win32 desktop target
Not needed anymore as timeBeginPeriod() is removed.
2024-03-19 20:23:25 +01:00
nanahi aff376e066 win32: increase hires timer resolution
timeBeginPeriod() only allows setting minimum timer resolution
to 1 ms. However, modern x86 platforms support a minimum timer
resolution of 0.5 ms. Use NtSetTimerResolution() instead for
the increased resolution, which can be set with MPV_HRT_RES.

Additionally, change the units of mp_start_hires_timers(),
mp_end_hires_timer(), MPV_HRT_RES, and MPV_HRT_MAX to nanoseconds,
in accordance with other functions used in timer.h.
2024-03-19 20:23:25 +01:00
Kacper Michajłow bfd016d101 win32: avoid multi byte string to wide conversion if not needed 2024-03-19 19:58:09 +01:00
Kacper Michajłow fc55f355fc win32: add puts/fputs wrappers 2024-03-19 19:58:09 +01:00
Kacper Michajłow 3372e17d51 win32: optimize mp_vfprintf a little
- remove redundant strlen/wcslen
- reuse allocated temporary buffers

The difference is not big, but it satisfies me to remove those
redundancies.
2024-03-19 19:58:09 +01:00
Kacper Michajłow 2ee0db4c5d misc/bstr: add bstr_to_wchar for win32
Convenience to avoid strlen above other things.
2024-03-19 19:58:09 +01:00
Kacper Michajłow c1282d4d43 player/main: move terminal_uninit to the end
It is strange to do terminal_uninit() and still use terminal after. Even
tho it has no side-effects.
2024-03-19 19:58:09 +01:00
Kacper Michajłow 8ee25db71f win32: cache GetConsoleMode state for stdout/stderr
GetConsoleMode() can be quite slow and in mpv the mode never changes, so
we can just check it once.

Fixes performance when writing lots of logs to terminal.
2024-03-19 19:58:09 +01:00
Kacper Michajłow 7bdd673a72 win32: don't touch buffering options 2024-03-19 19:56:25 +01:00
Kacper Michajłow fe29152d06 win32-console-wrapper: fix printf specifiers
%s is evaluated as wchar_t only in "Windows classic" semantic. It is not
C standard compliant.

%ls is compatible with both and means the same wchar_t format.

This commit fixes error output from mpv.com.

See: https://devblogs.microsoft.com/oldnewthing/?p=102823
2024-03-19 19:56:25 +01:00
Kacper Michajłow c3843d79de win32: don't pass std handles if they are attached to console
This is default behavior to attach to existing console, passing custom
handles is useful if we want to replace them, but in case they are
already attached to console we want to attach to console directly.

In theory, it should work out of the box because "console-like" handles
should be managed by Windows internally, which works for INPUT and
OUTPUT, but in certain cases, not for ERROR. This allows using VT
features in those cases for stderr too.
2024-03-19 19:56:25 +01:00