Similar to the previous commit but the other way around. If you start
mpv as idle, load up a playlist without immediately hitting play and
then try to go to the next item, nothing happens. Naturally, you would
expect this to go to the first item. Fix this detecting if the playlist
has not started yet, the direction, and going to the first item in the
list.
Previously, playlist-prev didn't work if you played a playlist to
completion using --idle and tried to go back. Naturally, one would
expect this to bring up the last item in the playlist, but nothing
happens. This is just because playlist_get_next is stupid and doesn't
take this into account since pl->current is NULL and thus returns NULL.
Fix this by considering the direction, checking if the playlist was
played to completion and grabbing the last entry in the index.
Most of these are pretty obscure things that were replaced a long time
ago. The special messages they were printing are also not really useful
at all so just remove them.
These were all deprecated in mpv 0.37.0 or earlier and are not
considered common enough options to warrant keeping the deprecated
mapping longer. Since demux_cue had only a single option in it, the
entire option substract is removed. This can be readded later if someone
wants to introduce a specific option to it again.
This prevents line wraps in select mode with terminal output which hide
the top items (OSD output no longer uses truncate_utf8 since the
previous commit). This is not ideal as even accented letters are assumed
to be 2 cells wide. The alternative is using \e[?7l and \e[?7h to
disable and enable text wrapping, but it won't work in Windows console
with VT processing disabled.
In select mode and when printing the OSD, use \q2 to let libass clip
lines longer than the OSD. This works around having to leave a large
horizontal space unused due to libass subtracting the left margin from
the max text width even though the ASS event is anchored to the bottom
left. It also fixes truncating wide Unicode characters.
Even if ass:pos() hardcodes the position at 6px from the left, we still
need to subtract the left --osd-margin-x from the available text width.
See how libass/ass_render.c:ass_render_event() subtracts it from
max_text_width without checking if the event is positioned.
The calculation is still not perfect as the width could be made a bit
larger before the text wraps.
Stop making unselected tracks and editions grey because they can be hard
to read over a dark background (\033[2m would be hard to differentiate
from regular text with a light theme instead), and because there is no
way to not print the escape sequences in --log-file.
Just use the same circles as the OSD and OSC. We need to print the empty
circles for alignment on mlterm with East Asian fonts (we could also
make them invisible with \033[8m but it would still get added to log
files).
Add back the space before tracks and editions when printed after
"Playing..." or "Track switched" and similar, so they look like a
sub-section of it, consistently with the metadata which starts with
space which makes it look like a sub-section of the "File tags" line.
Leave 2 spaces between track columns.
Make the lang options only as long as the longest language.
Place hls-bitrate within the same parentheses as the other data.
Replace the incomprehensible (*) (f) and [P] with textual descriptions
within []. Also place external there.
Stop converting Hz to kHz for consistency with other log messages, e.g.
AO: [pipewire] 48000Hz stereo 2ch floatp
Remove the space in "2 ch" so it doesn't look like 2 separate values (We
considered using mp_chmap_to_str(&s->codec->channels) but it prints
values like "unknown2").
Previously, using m_option_type_alias required that the alias have the
full name of the option value. This is limited if you are reusing the
same opts struct in different sub options. Fix this by add an additional
field to m_option to signal whether or not prefixes should be taken into
account for the alias option. Instead of blindly using whatever is
stored in opt->priv as the name, we can construct the desired option
name for either case (using the prefix or not).
It makes sense to allow the first part of the list. There are
warnings about excessive elements already. This also allows overriding
elements with the same label.
It fixes stack-overflow with keys that contains hundreds of splits. 100
is more than enough for any valid use of user-data, normally key
shouldn't contain more than a few splits.
Found by OSS-Fuzz.
Fuzzing expect deterministic behavior. While we don't use this random
generator for anything significant, still good to set the seed, in case
of future usage.
No need to reset mp_pass_perf which is only read when desc.len > 0.
This avoids zeroing >16384 uint64_t's every time it's called.
Profiling shows that this reduces CPU usage for frame rendering by ~4%.
Since d41f0a54b0, enabling a stream will
no longer perform a refresh seek, to fix issues with switching video
tracks. Additionally, 62e9a0c5f6 also
prevents refresh seek on track switching when it happens right after a
seek.
Unfortunately, when external audio files are loaded, preventing refresh
seeks can cause A-V sync issues. Since external tracks have separate demuxer
instances from the internal tracks, the demuxer instances from both
internal and external tracks are explicitly sought to the same pts when
seeking is performed. When enabling an external audio track for the first
time, the existing logic prevents refresh seek because no packets have ever
been read, so the track ends up not being sought. This means that switching
the track in the middle of playback results in a huge A-V desync.
To make it worse, unlike one demuxer instance with multiple tracks,
tracks from multiple demuxer instances are not synced in any meaningful
way beyond the separate explicit seeking. The only thing which keeps these
tracks synced is the generic A-V sync logic, which is unfit for such large
desync above. This means the audio is at the start position after the track
is switched, behind the video, so the audio is not considered ready, and
audio is continuously filtered sequentially until it is synced to the video.
While this is happening, the audio filtering exhausts all CPU resources.
There is also a case with cache enabled: if a seek causes some new data to
be cached, the demuxer is sought to the end of joined cache range.
If track is switched after this, the existing logic prevents a refresh seek,
so the demuxer is at a wrong position after the track is switched.
Fix this by allowing refresh seek for non-video streams, even when no packets
have been read yet or immediately after a seek.
Preselect and seek to the correct subtitle line when there is a
sub-delay.
Also slightly increase the offset without a video track else it
occasionally doesn't seek to the selected line with non-0 sub-delay and
no video. This now uses the same offset as sub/sd.h.
There is no need to compare sub-start now that we don't check for exact
matches with ffmpeg's timestamps. time-pos can always be used.
Comparing time-pos removes the need for the workaround of sub-start of
embedded subtitles being earlier than ffmpeg's timestamps, as time-pos
is always slightly after sub-start.
Removing this workaround also fixes a bug present since 4059d1832b,
which started comparing numerical values of timestamps instead of
strings to determine the preselected subtitle line, where the line after
the current one is preselected when sub-start is greater than ffmpeg's
timestamps because they have been rounded, e.g. sub-start 10.001 is >
than ffmpeg's 10.00.
This will also allow considering --sub-delay in the comparisons, as
comparing sub-start - sub-delay would preselect the wrong lines.
Since 995c47da9a, setting --mute=auto has
been equivalent to --mute=no. It was formally documented later in
79e20ff485. This is an old legacy relic
and the auto choice popping up during auto completion could be confusing
to users who aren't aware of the history. Remove it for good and convert
the option to a proper boolean.
Since 7fc4bac29f, playback-time and
time-pos will now always have exactly the same values. Both properties
are commonly used, so just make playback-time an alias for
time-pos and document it.