summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-07-13 13:34:58 +0200
committerwm4 <wm4@nowhere>2015-07-13 13:34:58 +0200
commit57efe9089cf51587d24686b98b319812e4c9ce23 (patch)
tree8c79a8aa60f67f7112506c096a313c024fcf1ce4 /player
parent0d35c78a6cf4a155ec32ccc07ce7ec80bf1e4318 (diff)
downloadmpv-57efe9089cf51587d24686b98b319812e4c9ce23.tar.bz2
mpv-57efe9089cf51587d24686b98b319812e4c9ce23.tar.xz
player: extend --hls-bitrate option
Fixes #2116.
Diffstat (limited to 'player')
-rw-r--r--player/loadfile.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index dfcb4a547e..6f5d29d3c8 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -454,10 +454,16 @@ static bool compare_track(struct track *t1, struct track *t2, char **langs,
return t1->default_track;
if (t1->attached_picture != t2->attached_picture)
return !t1->attached_picture;
- if (t1->stream && t2->stream && opts->hls_bitrate) {
- int d = t1->stream->hls_bitrate - t2->stream->hls_bitrate;
- if (d)
- return opts->hls_bitrate == 1 ? d < 0 : d > 0;
+ if (t1->stream && t2->stream && opts->hls_bitrate >= 0 &&
+ t1->stream->hls_bitrate != t2->stream->hls_bitrate)
+ {
+ bool t1_ok = t1->stream->hls_bitrate <= opts->hls_bitrate;
+ bool t2_ok = t2->stream->hls_bitrate <= opts->hls_bitrate;
+ if (t1_ok != t2_ok)
+ return t1_ok;
+ if (t1_ok && t2_ok)
+ return t1->stream->hls_bitrate > t2->stream->hls_bitrate;
+ return t1->stream->hls_bitrate < t2->stream->hls_bitrate;
}
return t1->user_tid <= t2->user_tid;
}