Commit Graph

3269 Commits

Author SHA1 Message Date
Kacper Michajłow 1805681aab m_option: initialize m_option_value union properly
C standard says that `= {0}` activates and initializes first member of
union. We expect whole union to be zeroed, it is used as default value.

Initialize union with one zeroed default instance to ensure proper init.

Fixes: #12711
2023-10-23 20:33:51 +02:00
llyyr f5ca11e12b meson: make libplacebo a required dependency
Make it not possible to build mpv without the latest libplacebo anymore.
This will allow for less code duplication between mpv and libplacebo,
and in the future also let us delete legacy ifdefs and track libplacebo
better.
2023-10-23 13:03:29 +02:00
Dudemanguy 1382a854c9 stats.lua: disable tonemapping plot by default
Nobody except a chosen few (I'm not one of them) even knows what it
means. Multiple people thought it was actually some kind of rendering
bug. Just disable it by default. Closes #12671.
2023-10-22 13:34:56 +02:00
Dudemanguy 6e428c261e ytdl_hook: remove extra playlist insert
b388c73540 should have deleted this line
since the insert is done a little below it instead, but it was missed
during review.
2023-10-21 18:29:57 -05:00
Umar Getagazov b388c73540 ytdl_hook: parse the separate cookies field
https://github.com/yt-dlp/yt-dlp/security/advisories/GHSA-v8mc-9377-rwjj
https://github.com/yt-dlp/yt-dlp/commit/1ceb657bdd25
2023-10-21 22:30:22 +00:00
NRK d05ef7fdc4 various: sort some standard headers
since i was going to fix the include order of stdatomic, might as well
sort the surrouding includes in accordance with the project's coding
style.

some headers can sometime require specific include order. standard
library headers usually don't. but mpv might "hack into" the standard
headers (e.g pthreads) so that complicates things a bit more.

hopefully nothing breaks. if it does, the style guide is to blame.
2023-10-20 21:31:09 +02:00
NRK 2070331f64 osdep: remove atomic.h
replace it with <stdatomic.h> and replace the mp_atomic_* typedefs with
explicit _Atomic qualified types.

also add missing config.h includes on some files.
2023-10-20 21:31:09 +02:00
NRK 2fa695c3f9 osdep: drop atomic fallback
even msvc (which mpv apparently doesn't support) supports C11 atomics
now. no need to carry around fallback with subtle semantic differences.
2023-10-20 21:31:09 +02:00
Guido Cella 9a40a0977b stats.lua: hide images' FPS
It is useless to show this because it's just a bogus value taken from
--mf-fps.
2023-10-19 13:33:47 -05:00
Kacper Michajłow 02d009bc5c player/command: truncate anything < 1e-4 in pretty printer
To avoid switching to scientific notation. Apparently it is "jarring"
for some users.

This preserves status quo from before 9dddfc4f where pretty printer were
truncated to 3 decimal places.
2023-10-18 11:34:52 +02:00
Dudemanguy 8f432b2e37 timer: remove microsecond timer functions
With the previous series of commits, all internal usage has been
replaced by the nanosecond functions. There's not really any point in
keeping these around anymore plus there are macros for unit conversions
now so we can just axe them. It's worth noting that mpv_get_time_us()
obviously still needs to work for API reasons, but we can just divide
mp_time_ns() by 1000 to get the same thing.
2023-10-16 15:38:59 +00:00
Dudemanguy 92976b1e8c client: change underlying mpv_wait_event timer to nanoseconds
No change in the actual API.
2023-10-16 15:38:59 +00:00
Dudemanguy 9ac0085031 dispatch: change mp_dispatch_queue_process timer to nanoseconds
The playloop is the only thing that adjusts the timeout with a value
other than 0, so nothing else needs to be changed.
2023-10-16 15:38:59 +00:00
Dudemanguy 9d3e607cf7 command: unbreak runtime play-dir changes
The whole mess with setting the option value explictly and saving the
old stop_play value only needs to happen if we're at the end of file.
Doing it in general is unneccessary and breaks other things.
Fixes #12424.
2023-10-16 09:14:20 -05:00
llyyr 056072bf95 stats.lua: remove compatibility aliases of properties
These are ancient and have existed since before stats.lua lived in the
mpv repository. We don't need to worry about ancient mpv versions
anymore, so remove these.
2023-10-15 14:30:09 +00:00
Christoph Heinrich 4a88e3d5c0 stats.lua: fix page 2 alignment of "Total"
The text didn't line up with with the percentages above it because it
didn't use a monospace font.

Instead insert the text at the same position in the template as the
percentages and convert one o.prefix_sep from the percentages into hard
coded \h\h to ensure alignment even when the user changes o.prefix_sep.
2023-10-15 13:39:46 +00:00
Kacper Michajłow 991f834e9e stats.lua: add chroma-location 2023-10-14 12:30:46 +02:00
Kacper Michajłow 28ecbcd36b stats.lua: change "Pixel Format" to "Format" 2023-10-14 12:30:46 +02:00
Kacper Michajłow 81cf697e28 stats.lua: fix missing newline when print_perfdata_passes is enabled 2023-10-14 12:30:46 +02:00
Kacper Michajłow 73db283296 stats.lua: sort filter parameters to ensure consistent output 2023-10-14 12:30:46 +02:00
Kacper Michajłow 9dddfc4fcc player/command: change how floating point number are printed
Use "%.7g" to show 7 significant digits. Removes the trailing zeros, and
in general makes it more readable, than fixed 3 decimal digits.

For avsync use "%+.2g" to add plus sign, similar to display-sync
values.
2023-10-14 12:30:46 +02:00
Kacper Michajłow 52fc378494 stats.lua: don't print custom pixel format, when hwdec
There is already other place to indicate hw decoding. "cuda" or "d3d11"
is not a pixel format.
2023-10-14 12:30:46 +02:00
Kacper Michajłow e5446399e1 stats.lua: remove leading zeros from pass timings
Makes it more readable in my opinion.
2023-10-14 12:30:46 +02:00
Kacper Michajłow 31ba5cd6df stats.lua: add frame info 2023-10-14 12:30:46 +02:00
Kacper Michajłow 6ff165f4a4 stats.lua: simplify fps display
- rename prefix to `Framerate:`
- if both estimated and specified values are the same display fps once
- skip the suffix if both the estimated and specified values agrees
2023-10-14 12:30:46 +02:00
Kacper Michajłow c4b8ddeee3 stats.lua: adjust spacing between values a little 2023-10-14 12:30:46 +02:00
Kacper Michajłow 499a9d90ab stats.lua: show HDR meta if not equal to 203
SDR white (203) is indeed not interesting, but anything else, even if
lower is.
2023-10-14 12:30:46 +02:00
Kacper Michajłow f2f33ac1e8 stats.lua: separate video parameters from video out
Source video parameters are interesting, but we mix them with video
output/target parameters. Which will differ. Add "Display" showing
true output params from VO, including HDR passthrough info and
everything. This makes much more consistent output and alows to quickly
diagnose how is source video translated to target display.
2023-10-14 12:30:46 +02:00
Kacper Michajłow c4f0b24deb command: fix fps property name
fps property was not renamed in events.
2023-10-14 12:30:46 +02:00
Kacper Michajłow eb4031e6db command: early exit in some properties to avoid going through VOCTRL 2023-10-14 12:30:46 +02:00
Guido Cella c470934236 command: fix segfault with playlist-{next,prev}-playlist
This was wrongly assuming that playlist_path is always set for the
current playlist entry, but it's only set when a file was added by
expanding a playlist.

The crash in playlist_get_first_in_next_playlist can be reproduced with
mpv foo.mkv foo.zip, playlist-next, playlist-prev,
playlist-next-playlist. You need to run playlist-next, playlist-prev
first because foo.zip's playlist_path is NULL until you do that, which
makes playlist_get_first_in_next_playlist return immediately.

The crash in cmd_playlist_next_prev_playlist can be replicated with mpv
--loop-playlist foo.zip foo.mkv, running playlist-next until foo.mkv,
and playlist-play-next. Again, you need to open foo.zip first or its
playlist_path is NULL which skips running strcmp(entry->playlist_path,
mpctx->playlist->current->playlist_path).

Fixes https://github.com/mpv-player/mpv/issues/12495#issuecomment-1760968608
2023-10-13 13:54:43 +00:00
Guido Cella 9c9ba3cf30 console.lua: print the log and input line to the terminal 2023-10-11 21:09:40 +00:00
Guido Cella 8134f18c28 ytdl_hook.lua: set metadata with single tracks
Use EDL for single tracks with metadata to set the uploader, channel url
and description metadata with --ytdl-format=best. Currently, these are
only set with the other ytdl formats with video and audio in different
streams.

The uploader tag is commonly available in sites other than Youtube too,
so it may be simpler to always use EDL with single tracks.
2023-10-11 21:05:33 +00:00
Mike Will 5ac37500c5 defaults.lua: add a disabled parameter to timer constructors
Added to the functions `mp.add_timeout` and `mp.add_periodic_timer`.

If the `disabled` argument is set to `true` or a truthy value, the
timer will wait to be manually started with a call to its `resume()`
method.
2023-10-11 21:04:13 +00:00
Dudemanguy fcebee9080 libmpv: add mpv_time_ns()
9606c3fca9 added mp_time_ns(). Since we
apparently expose the mp_time_us() to clients already, there's no reason
to not also expose the new nanosecond one.
2023-10-10 19:10:55 +00:00
Dudemanguy c82c55b4b9 vo: use nanoseconds for frame duration and pts 2023-10-10 19:10:55 +00:00
Dudemanguy 8fccd6bf91 player: store last_time timestamp in nanoseconds 2023-10-10 19:10:55 +00:00
Dudemanguy ae335ef155 vo: remove vo_get_estimated_vsync_interval conversion to seconds
This is weird. The caller should be responsible for converting the value
if desired. Move the conversion to player/command.c instead.
2023-10-10 19:10:55 +00:00
Guido Cella cf762c1482 console.lua: exit with with Ctrl+[
This binding commonly closes similar input buffers like vim's
Command-line mode and dmenu.
2023-10-10 18:18:07 +00:00
Guido Cella 81dea9031d command: add playlist-next-playlist and playlist-prev-playlist
playlist-prev-playlist goes to the beginning of the previous playlist
because this seems more useful and symmetrical to
playlist-next-playlist. It does not go to the beginning when the current
playlist-path starts with the previous playlist-path, e.g. with mpv
--loop-playlist foo/, which expands to foo/{1..9}.zip, the current
playlist path foo/1.zip beings with the playlist-path foo/ of {2..9}.zip
and thus playlist-prev-playlist goes to 9.zip rather than to 2.zip.

Closes #12495.
2023-10-09 15:09:35 +00:00
Dudemanguy e17375f151 core: remove duplicate init_{audio,video}_decoder declarations 2023-10-08 09:57:41 -05:00
lcksk 89261178d7 core: remove declarations of unused functions 2023-10-08 14:56:51 +00:00
Christoph Heinrich e475e1abc0 console: support utf8 for table formatting 2023-10-07 22:45:50 +00:00
Christoph Heinrich d2c92f7653 console: cull lines outside of visible area
Lines that would be outside of the visible area are now culled.
The log messages were already culled, however with the introduction
of suggestions, they also needed a small update.
2023-10-07 22:45:50 +00:00
Christoph Heinrich ed8a919812 console: show completion suggestions as table
Completion suggestions are now nicely formatted into a table.
Maximum width of the table is estimated based on OSD size and
font size.
This requires a new scaling factor option `font_hw_ratio`.
A factor of 2.15 works great for me,
but the default is 2.0 to avoid problems with other fonts.
The space between columns is automatically adjusted to be
between 2 and 8 spaces.
It tries to use as few rows as possible.
2023-10-07 22:45:50 +00:00
Christoph Heinrich 659353b7d6 console: show suggestions for completion
Tab completion now shows a list of all potential completions
between the log messages and prompt.
The text is colored to differentiate it from regular text.
The color matches the theme and is similar to the mpv logo.
2023-10-07 22:45:50 +00:00
Christoph Heinrich 898a4cd8a8 console: refactor text styles for log levels
The text styles are now in a table.
The color definitions of the theme where the colors were taken from
are now included in a comment for future reference.
The colors have been converted to BGR as is required by ASS.
2023-10-07 22:45:50 +00:00
Kacper Michajłow bc81b3d19e player/video: mention --profile=fast and --hwdec in AV desync message 2023-10-07 23:06:16 +02:00
Kacper Michajłow 44c398c3e1 Revert "video: remove another redundant wakeup"
vo_still_displaying() is racey with vo_request_wakeup_on_done() and above
that it doesn't work as expected. VO can run out of work and go to sleep
for 1000s, while the play thread still returns on vo_still_displaying()
check, because of a check `now < frame_end` so it never advances and go
to sleep itself.

This fixes dead lock that we have when image parameters changes during
playback.

This reverts commit 0c9ac5835b.

Fixes: #12575
2023-10-07 17:50:50 +00:00
Dudemanguy 07995f5d5f vo_gpu_next: improve updating overlays
fbe154831a added a new VOCTRL to signal
when the OSD changed for gpu-next's handling of subtitles, but this is
both not necessary and actually incomplete. The VOCTRL would signal OSD
changes, but not all subtitle changes (like selecting another
non-external sub track for example). VOCTRL_OSD_CHANGED was used to
increment p->osd_sync which would then redraw the blended subtitles if
the player was paused.

But there's already a VOCTRL_PAUSE and VOCTRL_RESUME. Plus, the
sub_bitmap_list object will have items in it if it changed in any way,
so we don't need the VOCTRL_OSD_CHANGED method at all. That can be
removed.

The check that fp->osd_sync < p->osd_sync stays in place since that's an
optimization while the video is playing, but we also check the pause
state as well since the VO can know this. If we're paused, then always
do update_overlays since core must be signalling a redraw to us if we
get a draw_frame call here. Additionally in update_overlays itself, the
p->osd_sync counter is incremented if we have any items since the frame
signature will need that. As for the actual bug that is fixed, changing
subtitle tracks while paused with blended subtitles now correctly works.
Previously, it was never updated so the old subtitle stayed there
forever until you deselected it (since VOCTRL_OSD_CHANGED triggered
there).

Also include some cosmetic code fixes that were noticed.
2023-10-05 22:32:06 +00:00