summaryrefslogtreecommitdiffstats
path: root/player/sub.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-04-15 17:03:37 +0200
committerwm4 <wm4@nowhere>2020-04-15 17:04:00 +0200
commit6c02555397ca599a7ec9ea781e492631ecf1c7f2 (patch)
treeaaeaf1c14e7cdcbbfcbdc331e5b31d0cf040b9ff /player/sub.c
parentdae0652e19c568f578642993ad96531f56c5d259 (diff)
downloadmpv-6c02555397ca599a7ec9ea781e492631ecf1c7f2.tar.bz2
mpv-6c02555397ca599a7ec9ea781e492631ecf1c7f2.tar.xz
player: slightly improve use of secondary track selection limits
Apparently, this was a bit of a mess, which caused the bug fixed by commit ec7f2388af2df. Try to improve this, and only use track selection entries that exist.
Diffstat (limited to 'player/sub.c')
-rw-r--r--player/sub.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/player/sub.c b/player/sub.c
index 599430ac21..a40a6d5e9d 100644
--- a/player/sub.c
+++ b/player/sub.c
@@ -39,7 +39,7 @@
// 0: primary sub, 1: secondary sub, -1: not selected
static int get_order(struct MPContext *mpctx, struct track *track)
{
- for (int n = 0; n < NUM_PTRACKS; n++) {
+ for (int n = 0; n < num_ptracks[STREAM_SUB]; n++) {
if (mpctx->current_track[n][STREAM_SUB] == track)
return n;
}
@@ -129,7 +129,7 @@ static bool update_subtitle(struct MPContext *mpctx, double video_pts,
bool update_subtitles(struct MPContext *mpctx, double video_pts)
{
bool ok = true;
- for (int n = 0; n < NUM_PTRACKS; n++)
+ for (int n = 0; n < num_ptracks[STREAM_SUB]; n++)
ok &= update_subtitle(mpctx, video_pts, mpctx->current_track[n][STREAM_SUB]);
return ok;
}
@@ -201,6 +201,6 @@ void reinit_sub(struct MPContext *mpctx, struct track *track)
void reinit_sub_all(struct MPContext *mpctx)
{
- for (int n = 0; n < NUM_PTRACKS; n++)
+ for (int n = 0; n < num_ptracks[STREAM_SUB]; n++)
reinit_sub(mpctx, mpctx->current_track[n][STREAM_SUB]);
}