1
mirror of https://github.com/mpv-player/mpv synced 2024-10-02 16:25:33 +02:00

player: do not fall back to a default track with explicit selections

Consider e.g. --aid=2 with a file that has only 1 track. Then it would
fall back to selecting track 1. Stop doing this. If no matching track is
found, this will not select any track now.

Note that the fingerprint stuff (track_layout_hash in the source)
prevents softens the impact of this change. Without the fingerprint,
playing a dual-audio file with the second track selected, and then a
single-audio file, would play the second file without audio. But the
fingerprint resets it due to differences in the track list.

Try to exhaustively document this and tricky interactions between the
other features. What a damn mess, I think it's simply cursed. Of course
it's still my fault.

See: #7608
This commit is contained in:
wm4 2020-04-13 15:55:51 +02:00
parent e1e714ccc3
commit f6c81047fa
2 changed files with 20 additions and 0 deletions

View File

@ -76,6 +76,24 @@ Track Selection
before mpv 0.33.0, the user's track selection parameters are clobbered
in certain situations.
Also since mpv 0.33.0, trying to select a track by number will strictly
select this track. Before this change, trying to select a track which
did not exist would fall back to track default selection at playback
initialization. The new behavior is more consistent.
Setting a track selection property at runtime, and then playing a new
file might reset the track selection to defaults, if the fingerprint
of the track list of the new file is different.
Be aware of tricky combinations of all of all of the above: for example,
``mpv --aid=2 file_with_2_audio_tracks.mkv file_with_1_audio_track.mkv``
would first play the correct track, and the second file without audio.
If you then go back the first file, its first audio track will be played,
and the second file is played with audio. If you do the same thing again
but instead of using ``--aid=2`` you run ``set aid 2`` while the file is
playing, then changing to the second file will play its audio track.
This is because runtime selection enables the fingerprint heuristic.
Most likely this is not the end.
``--sid=<ID|auto|no>``

View File

@ -522,6 +522,8 @@ struct track *select_default_track(struct MPContext *mpctx, int order,
continue;
if (track->user_tid == tid)
return track;
if (tid >= 0)
continue;
if (track->no_auto_select)
continue;
if (duplicate_track(mpctx, order, type, track))