Commit Graph

53081 Commits

Author SHA1 Message Date
Kacper Michajłow 0c4c2caabf misc/codepoint_width: assume tabstop width to be 8
It has been hardcoded to the same value in stats.lua so keep the current
behaviour. Can be made configurable if requested in the future.
2024-10-21 20:06:48 +02:00
Kacper Michajłow cd62cc7ecb player/osd: don't add newlines when message would be empty anyway
When only control char is present there is no point to add part for it.
2024-10-21 20:06:48 +02:00
Kacper Michajłow 201a39d7fa msg: skip formatting if there is only control char present
This doesn't change behaviour just skips some redundant code early.
2024-10-21 20:06:48 +02:00
Kacper Michajłow 3cf0f8309f msg: add newline conditionally
In idle mode, there is not status line and we sometimes want to have
output without last new line, which were always added after truncation.

Also, make sure we don't overwrite important chars with ellipsis, this
could happen when cut point is near the end.

Fixes: bf025cd289
2024-10-21 20:06:48 +02:00
Dudemanguy 0f78584518 x11: remove nvidia blacklist logic from --x11-present=auto
When the present extension was originally implemented, nvidia was
specifically blacklisted. The reason was because at the time it would
give bogus values that appeared to be real but actively made playback
worse. So out of an abundance of caution, any nvidia detection at all
(e.g. on a multi-gpu system) would disable the use of the extension.
Well times have changed and actually presentation-time on wayland for
nvidia works now amazingly enough. For xorg, the extension still doesn't
work, but from user testing it does not seem to be harmful anymore. It
just does nothing. So we can remove the blacklist part and just only use
a whitelist. Like before, we only enable the extension for mesa drivers
by default so no practical change for anyone except multi-gpu systems
whom may have this enabled now but should not see any negative behavior
change.
2024-10-21 15:13:47 +00:00
Guido Cella 0490a89ba6 DOCS/man/input: input-bindings can change at runtime
This paragraph is clearly wrong. load-input-conf was recently added, but
even before that the enable-section and disable-section commands could
change key bindings at runtime without scripts.
2024-10-21 15:13:39 +00:00
Kacper Michajłow be9b3ccb41 ci/win32: use upstream meson
The fix for response files escaping issues has been merged.

See: https://github.com/mesonbuild/meson/pull/11715
2024-10-21 04:11:25 +02:00
nanahi ca7006a6a2 player/javascript: use stream_read_file for af_push_file
Remove the complicated fopen/realloc logic.
2024-10-20 19:31:49 +02:00
nanahi 607997db24 options/parse_configfile: use stream_read_file2 for reading config
Remove the duplication with stream_read_file2, which also handles
directory correctly.
2024-10-20 19:31:49 +02:00
nanahi 8c3fd2cd38 input: use stream_read_file2 for reading config
The existing logic already duplicates stream_read_file other than
the flags. With stream_read_file2, this duplication can be removed.
2024-10-20 19:31:49 +02:00
nanahi ac648d2e0b stream: delete extra newline 2024-10-20 19:31:49 +02:00
nanahi 7673c4e34a stream: add stream_read_file2
This is stream_read_file with the ability to specify flags.
2024-10-20 19:31:49 +02:00
sfan5 9737b99845 Revert "editorconfig: punish tab usage"
This reverts commit 3840c98b36.
There are multiple reasons:
- the correct way to prevent tabs being mistakenly added is a CI linting step
- it can affect the editing experience of foreign source files
  under mpv's tree (e.g. subprojects)
- at least one editor (BBEdit) misinterprets the values and also turns
  soft tabs into 7 spaces
- it does not consistently apply to GH code view either
2024-10-20 11:22:09 +02:00
der richter 37159a8ee0 mac/remote: show external covers in Now Playing Info Center 2024-10-19 17:20:43 +02:00
der richter 8cc3160f71 mac/event: add MPV_FORMAT_NODE handler 2024-10-19 17:20:43 +02:00
der richter f866893c9c mac/type: add mpv_node type conversion helpers 2024-10-19 17:20:43 +02:00
der richter 61a09501d6 mac/app: add option to adjust Bundle PATH variable
App Bundles operate in their own shell environment that is different
from the one in the terminal. the default PATH variable for all Bundles
is /usr/bin:/bin:/usr/sbin:/sbin. because of that mpv can not find
binaries installed by package manager that might be used in scripts for
example.

add an option to prepend paths to the Bundle PATH. we prepend to make
the order fully configurable, opposed to appending where the default
Bundle binaries would always take precedence.
2024-10-19 17:18:29 +02:00
Dudemanguy c0fb6d0d62 wayland: be less stupid with color surface creation
Basically we only want to create the color surface if the compositor
supports parametric image descriptions and if the vo is dmabuf-wayland.
Instead of doing the weird dance of creating it in one spot and
destroying it later, just only make the wayland object when we actually
want it. It makes the logging less confusing as well.
2024-10-19 05:09:58 +00:00
Kacper Michajłow 6b695ac6e4 msg: use .. instead of … as ellipsis char
There were some concerns about the width of the … glyph, so avoid it and
use two dots.

Fixes: 6aa331289f
2024-10-18 19:57:53 +02:00
Guido Cella 1b53793a4c various: convert tabs to spaces 2024-10-18 18:32:26 +02:00
llyyr 7fe12574fa wayland: don't use functions not available in libplacebo338
Fixes #15120
2024-10-18 14:47:06 +00:00
Kacper Michajłow 5fed98e0ee various: use mp_tprintf_buf wrapper to work around mingw garbage
Look it up if you really care but basically z as a format specifier
often doesn't work in mingw because reasons. Our CI was working by
accident because of meson previously ignoring the CFLAGS variable. Use
our wrapper instead for these places.
2024-10-18 14:02:51 +00:00
Dudemanguy 3d3d06f981 ci/build-common: add -D_FORTIFY_SOURCE=3 2024-10-18 14:02:51 +00:00
Dudemanguy 04a2450aab ci/build-openbsd: don't enable cdda
We hit a -Wstrict-prototypes error which was fixed in the latest release
of libcdio-paranoia but openbsd is too old. We already have coverage of
this in other CIs so remove it.
2024-10-18 14:02:51 +00:00
Dudemanguy 09bbca8770 ci: refactor ci so common args are picked from one location
Mostly. It is annoying if we want to add some flag/option to all the cis
and then have to do it manually. Things easily get missed that way.
Skipped powershell because of course I'm not going to deal with that.
2024-10-18 14:02:51 +00:00
Kacper Michajłow 3e499ff3bc msg: fix width with ellipsis
Fixes: 6aa331289f
2024-10-18 00:25:10 +02:00
Guido Cella a0ca6ed5d5 options: rename --load-osd-console to --load-console
OSD is not accurate since when the console gained support for printing
to the terminal.
2024-10-17 23:57:24 +02:00
Kacper Michajłow b026fded7d msg: fix clipped output to non-tty
Not sure how it got lost.
2024-10-17 23:55:51 +02:00
Kacper Michajłow 6aa331289f msg: use … instead of ... dots 2024-10-17 23:55:51 +02:00
Kacper Michajłow 08e2acbae1 stats.lua: don't use io.write from builtin script
Scripts and especially internal scripts shouln't bypass msg.c logging
code for various resons, ranging from processing the input, filtering
the log levels, truncating the output and so on. io.write() is lazy way
of outputing to stdout without respecting mpv's logging module.

Uses osd message, because this has no prefixes. Added internal
flush-status-line command to flush current output without clearing
before exiting.

This commit will allow us to remove duplicated terminal handling code
from stats.lua, mpv core already handles all that and does it in better
way, without taking shortcuts.
2024-10-17 22:32:10 +02:00
Kacper Michajłow 2df582b839 msg: don't format status line if not printing to terminal 2024-10-17 22:32:10 +02:00
Kacper Michajłow c3404fdf37 console.lua: don't clear not ours osd messages
Note that this still is not perfect, because if osd message is changed,
console cannot know about it and would still clear it, but this change
make it at least not do it to every message even if console is not used.
2024-10-17 22:32:10 +02:00
nanahi 6880178269 DOCS/man/console.rst: document mouse bindings
Hiding console, pasting and history navigation are available
with mouse inputs.
2024-10-17 16:58:13 +02:00
Guido Cella 50faafd8bd stats.lua: exit with ESC if being toggled
If not opened in oneshot mode, close the stats with ESC. Especially now
that ? toggles showing key bindings by default, this provides an
intuitive way to close the stats.

Also do some minor reformatting of key binding documentation.
2024-10-17 16:57:35 +02:00
Dudemanguy 7e834ce870 meson: add back '-Wno-unused-result' for gcc
0fd4c84a5e removed this, but it turns out
gcc acts differently and (void) doesn't silence the warning. Hence why
the flag was there. Add it back.

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
2024-10-16 20:57:25 +00:00
Kacper Michajłow e40442676a DOCS: explain origin of sigmoidization 2024-10-16 15:17:48 +02:00
Kacper Michajłow cd9761651f filter_kernels: explain origin of LanczosSharp(est) filters 2024-10-16 15:17:48 +02:00
Kacper Michajłow 742142ca92 filter_kernels: link to explanation of ginseng filter 2024-10-16 15:17:48 +02:00
llyyr 198f2e7451 wayland: don't access vo->target_params directly
Use vo_get_target_params instead.
2024-10-16 15:11:05 +02:00
Guido Cella 1a558bf5c2 osc.lua: remove NIH list formatting
All of the code to format playlist/track-list/chapter-list is
unnecessary when mpv's core can already show-text these properties.

Also an issue with this custom formatting is that showing fewer entries
than can fit on the OSD can make it seem like the playlist ends there
and there are no entries afterwards.

Also remove lots of pointless code around the track-list (mpv's track id
and the osc_id are exactly the same).

This simplification will make it easier to bind customizable commands,
otherwise yet another script message to call set_track would have to be
added, when cycle sub/audio already output information about the new
track on their own.
2024-10-16 15:10:23 +02:00
Guido Cella 65135e0f44 DOCS/input: list property values are not useless
The raw value of these properties is definitely not useless since they
return the whole list.
2024-10-16 15:10:23 +02:00
Guido Cella 3522dd836e command: implement printing ${track-list/{video,audio,sub}}
This brings show-text ${track-list} in line with osc.lua's
get_tracklist(type) before replacing it with show-text.
2024-10-16 15:10:23 +02:00
Guido Cella 89d78369c6 command: print the number of chapters in show-text ${chapter-list}
Call cut_osd_list() like with ${playlist} to print position/count above
the chapters. This is useful for movies with many chapters.

Stop printing the chapter numbers because they are not useful here, they
are only useful when navigating to a chapter.

Remove one of the spaces before the circles because they are too many.

This replicates osc-chapterlist before replacing it with show-text
${chapter-list}.
2024-10-16 15:10:23 +02:00
Guido Cella 841b66d3ec command: consider the terminal height in cut_osd_list()
cut_osd_list() calls osd_get_text_size() even when outputting to the
terminal, which results in max_lines = 19. Use the actual terminal
height instead.
2024-10-16 15:10:23 +02:00
Guido Cella be1be8ca61 command: print position/count in show-text ${playlist}
...instead of "n hidden items". This brings it in line with osc-playlist
before replacing it with show-text ${playlist}. Also make count_lines()
return the correct count.
2024-10-16 15:10:23 +02:00
Guido Cella 4e4d6a16d8 osd_libass: fix integer overflow in osd_get_text_size()
If show-text ${playlist} is used with --osd-scale-by-window=no while
printing to the terminal or while mpv is starting, the out_screen_h
assignment in osd_get_text_size() causes runtime error: signed integer
overflow: 288 - -2147483648 cannot be represented in type 'int'. Fix
this by not making prepare_osd_ass() use an infinite playresy.

This prevents printing show-text ${playlist} without a line limit to the
terminal with --osd-scale-by-window=no, which makes only the last
playlist entries be printed, and the selected one is not printed if it
isn't among them. A later commit will make the line calculation
accurate.
2024-10-16 15:10:23 +02:00
Guido Cella 0f74b1bc2d console.lua: improve hovered line calculation
- Don't do anything if clicking on the top counter, the input line or
  the new line between the items and the input line

- Don't scroll upwards when hovering the counter

- Don't redraw before clicking to avoid quickly updating the overlay
  before closing it with touch input, where the item you touch can be
  different from the one that was highlighted
2024-10-16 14:29:21 +02:00
Guido Cella b0f1830a8e console.lua: make the wheel scroll selectable items instead of the match
This makes scrolling with the wheel more usable because it doesn't
matter if the focused item is reset by moving the mouse slightly, and
scrolling always begins immediately.

This makes the MBTN_MID binding to handle_enter() unnecessary so it is
removed.
2024-10-16 14:29:21 +02:00
Guido Cella e88a1a7de7 console.lua: print position/count instead of n hidden items
This makes it consistent with the new changes to show-text ${playlist}
and greatly simplifies the logic, making it sane to implement scrolling
the view with the wheel in the commit.
2024-10-16 14:29:21 +02:00
Dudemanguy 77239b87f1 sub/sd_ass: handle subs with unknown durations on a per packet basis
A packet with an unknown duration flagged the entire context and then
this was saved forever throughout the entire lifetime of the object.
This inherently doesn't work with the redecoding sub logic which will go
through all the packets again. So the second time around, packets with
known durations get treated as if they were unknown and things go awry.
Rework this so it is per packet like it should be and not a global
state. Note that f9cefbfec4 originally
added this for specifically eia-608 subtitles but their packets are all
detected as unknown anyway due to the durations so this is not needed
anymore and interferes with other things.
2024-10-16 02:26:06 +00:00