0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00
Commit Graph

51210 Commits

Author SHA1 Message Date
Kacper Michajłow
24270b8587 msg: refactor how terminal messages are printed
- prepare string before printing
- reduce amount of fflush(), especially for multiline messages
- clear status line and keep it always at the bottom
- indent module name to the longest value
- disable cursor for status line
- properly support wrapped status line

Overall makes status line less flickering and remove stray status
instead of scrolling them up.
2023-11-08 21:55:08 +00:00
Kacper Michajłow
e682834234 stats.lua: disable ASS formatting when printing to terminal 2023-11-08 21:55:08 +00:00
Kacper Michajłow
d0b8472e5a msg: don't mix partial log messages, with unrelated log levels 2023-11-08 21:55:08 +00:00
Kacper Michajłow
477a0f8318 vo: replace VOCTRL_HDR_METADATA with direct VO params read
Currently VOCTRL are completely unusable for frequent data query. Since
the HDR parameter addition to video-params, the parameters can change
each frame. In which case observe on those parameter would be triggered
constantly. The problem is that quering those parameters involves VOCTRL
which in turn involves whole render cycle of delay.

Instead update VO params on each draw_frame. This requires changes to VO
reconfiguration condition, but in practice it should only be triggered
when image size or data layout changes. In other cases it will be
handled internal by VO driver.

I'm not quite happy with this solution, but don't see better one without
changing observe/notify logic significantly. There is no good way
currently to handle VOCTRL that are constantly queried.

This adds unfortunate synchronization of player command with VO thread,
but there is not way around that and if too frequent queries of this
param becomes a problem we can thing of other solutions.

Changes the way to get data from VO driver added by a98c5328dc

Fixes: 84de84b
Fixes: #12825
2023-11-08 21:45:07 +00:00
Thomas Weißschuh
a96d26e63a audio: avoid unnecessary silence padding in read_buffer()
Not all callers of read_buffer() require the buffer to be padded with
silence.
2023-11-08 20:26:23 +01:00
Thomas Weißschuh
0b43b74c15 ao_audiotrack: switch to ao_read_data_nonblocking() 2023-11-08 20:26:23 +01:00
Thomas Weißschuh
36d5b52612 ao_coreaudio: switch to ao_read_data_nonblocking() 2023-11-08 20:26:23 +01:00
Thomas Weißschuh
5aa2068270 ao_pipewire: switch to ao_read_data_nonblocking()
Avoid blocking the process callback as it runs with realtime privileges.
2023-11-08 20:26:23 +01:00
Thomas Weißschuh
4a134f441d audio: introduce ao_read_data_nonblocking()
This behaves similar to ao_read_data() but does not block and may return
partial data.
2023-11-08 20:26:23 +01:00
Kacper Michajłow
a5c32ea52e threads-win32: add comment about local decl of a function 2023-11-08 04:32:10 +00:00
Kacper Michajłow
2ae56e78dd threads-win32: support UWP in mp_thread_set_name 2023-11-08 04:32:10 +00:00
Kacper Michajłow
add2f3c8c9 meson: add missing source file for UWP 2023-11-08 04:32:10 +00:00
Kacper Michajłow
fa0929bf71 osdep/threads-posix: use CLOCK_MONOTONIC if supported 2023-11-08 04:32:10 +00:00
Kacper Michajłow
0a6c179026 osdep/timer-linux: check clock availability on init 2023-11-08 04:32:10 +00:00
Dudemanguy
468b9bede7 DOCS/option: discourage the use of video-latency-hacks a bit more
Who knows why this exists but maybe it's possibly useful in some obscure
case. Probably worth mentioning that it could break other options.
2023-11-08 00:11:34 +00:00
Niklas Haas
293fe9d74a vo_gpu_next: add --target-gamut option
Fixes: https://github.com/mpv-player/mpv/issues/12777
2023-11-08 00:55:39 +01:00
Guido Cella
c798f66343 stats.lua: remove unused variable
056072bf95 deleted the only use of property_list.
2023-11-07 20:58:30 +00:00
Guido Cella
5c2cdb749d console.lua: don't print the console log to the OSD when switching VO
Fixes #12735, fixes #12839.
2023-11-07 20:49:44 +00:00
Dudemanguy
00533ccdae player/command: handle force window on runtime vo changes
Without this, changing the vo at runtime with --force-window --idle
would kill the vo.
2023-11-07 20:49:36 +00:00
Christoph Heinrich
69c4ed585d stats: don't overwrite color and alpha of osd-back-color 2023-11-07 20:48:37 +00:00
Christoph Heinrich
2406a89e00 console: don't overwrite color and alpha of osd-back-color 2023-11-07 20:48:37 +00:00
Mohammad AlSaleh
d470766000 sub: add --sub-stretch-durations option
Stretch a subtitle duration so it ends when the next one starts.
 Should help with subtitles which erroneously have zero durations.

 I found such a subrip substitles stream in the wild.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2023-11-07 20:46:40 +00:00
Kacper Michajłow
c2b3d967ba player/command: fix typo in sig-peak value computation
Fixes: 73fbe09a49
2023-11-07 20:59:46 +02:00
Kacper Michajłow
6dafc44ed0 win32: fix hit test using client rc instead window
windowrc in vo_w32_state is actually client size, for hit test we need
proper window size. When border is disabled those sizes are the same,
but when only title bar is disabled it is not.

Reduce the hit area to more sane values when the border is not
drawn to minimize amount of covered client area in borderless mode.
2023-11-07 16:42:28 +00:00
sfan5
242066a5ef vo_gpu: apply ICC profile and dithering only to window screenshots 2023-11-07 16:15:19 +01:00
sfan5
ff521dfbd1 vo_gpu_next: drop alpha channel from screenshots if unneeded 2023-11-07 16:15:19 +01:00
sfan5
8c751a0d78 image_writer: improve format conversion logging 2023-11-07 16:15:19 +01:00
Christoph Heinrich
f41805081b console: wrap rows at the top
The previous commit was already a big improvement, but it was still
somewhat slow on the lua interpreter. By wrapping the table at the top
we loose the consistent placement of items while resizing (at least as
long as the column count didn't change), but we avoid taking all the
off screen items into account.

The fewer items fit on screen the faster this becomes.
2023-11-07 01:36:59 +00:00
Christoph Heinrich
ff131d7a20 console: optimize table generation
Showing all properties was terribly slow.
Instead of starting at one row and increasing the row count until it
fits, the column count can be increased until it doesn't fit anymore.

That alone already reduces the required iterations, but from the column
count an upper and lower bound for the row count can be calculated.

For large tables this dramatically reduces the amount of iterations.
2023-11-07 01:36:59 +00:00
Christoph Heinrich
bca0b20c09 console: enable completions without a prefix
This way it is possible to get a list of all options or all properties,
instead of having to guess the first letter before any suggestions are
shown.
2023-11-07 01:36:59 +00:00
Guido Cella
386de3f275 console.lua: complete raw properties 2023-11-07 00:59:16 +00:00
Christoph Heinrich
43ed0a83d0 console: avoid redundant completion appendage
So far completing something like `${some-pro}` with the cursor between
`o}` would result in `${some-property}}`. Adding that superfluous `}` can
be avoided by checking if it's already in the string after the cursor.
2023-11-07 00:55:15 +00:00
Dudemanguy
4aa3866400 present_sync: remove unneeded clear_values function
This was specifically special logic for drm. Before present_sync, it
would also clear out all of its vsync values like this. The old drm code
would save a bunch of samples which would confuse vo.c when unpausing
since it got old, bogus values. Since we make sure to match successive
vsync samples with the swapchain depth and that present sync samples
also match the swapchain depth, this is unneeded.
2023-11-07 00:52:46 +00:00
Dudemanguy
506e8d9eaf vo: require successive vsyncs to be more than swapchain depth
To make sure that present_sync is in line with the vsync timings here.
2023-11-07 00:52:46 +00:00
Dudemanguy
2872e929bb present_sync: only save as many entries as the swapchain depth
Saving more than the swapchain depth is just wasteful. We can just save
a copy of the vo_opts here and check the value whenever we're updating
values.
2023-11-07 00:52:46 +00:00
Dudemanguy
cf69fa03ca vo: replace max swapchain depth magic number 2023-11-07 00:52:46 +00:00
Christoph Heinrich
bd4bf6e383 DOCS/mpv: consistent formatting of keybindings 2023-11-07 00:43:38 +00:00
Christoph Heinrich
d3355679b3 DOCS/console: correct capitalization of keybindings 2023-11-07 00:43:38 +00:00
Dudemanguy
f4c5fa12cb wayland: improve wl_output guessing before mpv window is mapped
There's some geometry-related things that mpv has to calculate before
the window is actually mapped onto the screen in wayland. But there's no
way to know which output the window will end up on before it happens, so
it's possible to calculate it using the wrong values. mpv corrects
itself later when the surface event happens, but making the initial
guess work better can help in certain cases.

find_output is the only thing that needs to be changed here. Its main
purpose is to grab the right output based on user settings when we're
trying to full screen and giving a fallback in case we don't have
wl->current_output yet. The x11 code already does something similar, so
we're basically just copying it. Allow user settings like --screen and
--screen-name to influence the initial wl_output guess. Those options
won't actually place the window on that specific screen since we can't
do that in wayland, but if the user knows where the window will end up
beforehand it makes sense to listen to the arguments they pass. If
something goes wrong, then we just fallback to 0 like before.
2023-11-06 23:13:31 +00:00
Dudemanguy
953176ee42 sub: adjust offsets when sub seeking/stepping
In the sub seek code path, there was an arbitrary small offset added to
the pts before the seek. However when seeking backwards, the offset was
an additional subtraction. de6eace6e9
added this logic 10 years ago and perhaps it made sense then, but the
additional subtraction when seeking backwards causes the subtitle seek
to go too far to the previous subtitle if the durations overlap. This
should always be an addition to work correctly. Additionally, the sub
stepping code path also could use this offset for the same reason
(duration overlaps). However, it is only applicable to sd_ass not
sd_lavc. sd_lavc has step_sub support but on a sample it didn't even
work anyway. Perhaps it only works for certain kinds of subtitles
(patches welcome).

Anyways instead of keeping this offset as a magic number, we can define
it in sd.h which is handy for this. For sd_ass, we add the offset when
sub stepping, and the offset is always added for sub seeking like it was
before. Update the comment to be a little more relevant to what actually
happens today. Fixes #11445.
2023-11-06 23:12:13 +00:00
Guido Cella
7d004bf15c DOCS/input: stop documenting vf del
Because b56e63e2a9 removed it.
2023-11-06 16:33:57 +00:00
Dudemanguy
ad26c3b0a5 dec_sub: always copy packet for new segments
Since 062104d16e, we started saving cached
packets for subtitles. However, these can point to the same address as
what is stored in sub->new_segment. When a segment is updated, the
packet is potentially freed. Later during decoding, this can lead to a
double free since the cached packets will naturally try to free itself
and update. Fix this by simply always making sub->new_segment a full
copy of the packet so its lifetime doesn't have to be tied to the cached
packet stuff.
2023-11-06 10:12:23 -06:00
Dudemanguy
a96d04f19d drm: use present_sync mechanism for presentation feedback
A ton of code and drm-specific abstractions can be dropped with this.
One important thing to note is that the usage of sbc is completely
dropped here. The utility of that is not particularly clear since the
sbc value was manually incremented before the flip and it's not as if
the drm page flip event gives it to us like it does with the msec and
ust. It can be reintroduced later if there is a need. For drm, we also
add a present_sync_clear_values helper since all presentation feedback
needs to be cleared on pause/resume for it.
2023-11-06 15:44:45 +00:00
Dudemanguy
f629d7a2ff present_sync: rename function to present_sync_update_values
This had to have been a mistake. It was just confusing.
2023-11-06 15:44:45 +00:00
Dudemanguy
261f51b475 present_sync: rewrite around linked list
When this was originally written, the queuing/list approach was
deliberately removed since it adds more complication and xorg/wayland
don't really use it anyway. In practice, you only really have one frame
in flight with presentation timestamps. However, one slight annoyance is
that the drm code has its own thing which is almost exactly the same and
does its own calculations. Ideally, we'd port drm to this instead, but
the implementation there takes into account N-frames in flight which
probably does actually work. So we need to make present_sync smarter and
be able to handle this.

mpv does actually have its own linked list implementation already which
is a good fit for this. mp_present becomes the list and each
mp_present_entry has its own set of timestamps. During initialization,
we create all the entries we need and then simply treat it like a queue
during the lifecycle of the VO. When an entry is fully used
(present_sync_get_info), then we remove it from the list, zero it out,
and append it to the end for future use. This avoids needing to allocate
memory on every frame (which is what drm currently does) and allows for
a reasonable number of in flight frames at the same time as this should
never grow to some obscene number. The nice thing is that current users
of present_sync don't need to change anything besides the initialization
step.
2023-11-06 15:44:45 +00:00
Christoph Heinrich
bcbd821fa9 ytdl_hook: fix mixed thumbnail.preference availability 2023-11-06 14:59:05 +00:00
llyyr
d9b33dd79a Revert "vo: clear vsync_offset if drawing while paused"
This reverts commit 640c07fb19.

This commit isn't needed anymore after the previous commit.
2023-11-06 11:39:45 +01:00
llyyr
0257d53d2c video: reset display_sync_error when resetting state
This would cause mpv to, in some very specific scenarios, have a
negative vsync_offset after seeking which would result in mpv requesting
a pts before the first frame to libplacebo.

Fix it by setting it to 0 when we reset state, such as after seeking.

Fixes: https://github.com/mpv-player/mpv/issues/12813
2023-11-06 11:39:45 +01:00
Kacper Michajłow
a7186777de threads: unbreak mpv on builds without asserts
Also remove duplicated macro.

Fixes: #12818 #12820
2023-11-06 04:14:49 +00:00
Kacper Michajłow
84de84b8aa player/command: add video-params and siblings to MPV_EVENT_TICK
It contains metadata that may change per frame.
2023-11-05 18:57:36 +01:00