player/loadfile: prefer non-image when selecting video track

This fixes `ytdl_hook`, which would start playback with the thumbnail
track selected. This issue occurs because the thumbnail track is added
first. If the main track is not marked as default afterward, which it
isn't for single streams, the first track (the image track) would be
selected.

In general, if a non-image track is available, it should be preferred.
This commit is contained in:
Kacper Michajłow 2024-11-21 17:45:10 +01:00
parent 7f49806cf4
commit 3e10309b62
1 changed files with 2 additions and 0 deletions

View File

@ -491,6 +491,8 @@ static bool compare_track(struct track *t1, struct track *t2, char **langs, bool
return l1 > l2; return l1 > l2;
if (t1->attached_picture != t2->attached_picture) if (t1->attached_picture != t2->attached_picture)
return !t1->attached_picture; return !t1->attached_picture;
if (t1->image != t2->image)
return !t1->image;
if (t1->stream && t2->stream && opts->hls_bitrate >= 0 && if (t1->stream && t2->stream && opts->hls_bitrate >= 0 &&
t1->stream->hls_bitrate != t2->stream->hls_bitrate) t1->stream->hls_bitrate != t2->stream->hls_bitrate)
{ {