From 6c02555397ca599a7ec9ea781e492631ecf1c7f2 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 15 Apr 2020 17:03:37 +0200 Subject: 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. --- player/core.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'player/core.h') diff --git a/player/core.h b/player/core.h index a13fa2852b..bbd3f5ce33 100644 --- a/player/core.h +++ b/player/core.h @@ -232,7 +232,10 @@ enum playback_status { const char *mp_status_str(enum playback_status st); -#define NUM_PTRACKS 2 +extern const int num_ptracks[STREAM_TYPE_COUNT]; + +// Maximum of all num_ptracks[] values. +#define MAX_PTRACKS 2 typedef struct MPContext { bool initialized; @@ -309,9 +312,9 @@ typedef struct MPContext { char *track_layout_hash; // Selected tracks. NULL if no track selected. - // There can be NUM_PTRACKS of the same STREAM_TYPE selected at once. + // There can be num_ptracks[type] of the same STREAM_TYPE selected at once. // Currently, this is used for the secondary subtitle track only. - struct track *current_track[NUM_PTRACKS][STREAM_TYPE_COUNT]; + struct track *current_track[MAX_PTRACKS][STREAM_TYPE_COUNT]; struct mp_filter *filter_root; -- cgit v1.2.3