changeset 23807:f4f7dd84188b

Make sure all demuxer subtitles can be selected with 'j', even if this leaves "holes" (allows to select subtitles that do not exist). Fixes subtitle switching with http://samples.mplayerhq.hu/sub/NeroMP4/unsupported-embedded-subs-2.mp4
author reimar
date Thu, 19 Jul 2007 17:14:49 +0000
parents 0a38ad149c5c
children f689ce781c5d
files mplayer.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mplayer.c	Thu Jul 19 13:52:39 2007 +0000
+++ b/mplayer.c	Thu Jul 19 17:14:49 2007 +0000
@@ -3011,11 +3011,13 @@
 
 if (mpctx->stream->type != STREAMTYPE_DVD && mpctx->stream->type != STREAMTYPE_DVDNAV) {
   int i;
+  int maxid = -1;
   // setup global sub numbering
   mpctx->global_sub_indices[SUB_SOURCE_DEMUX] = mpctx->global_sub_size; // the global # of the first demux-specific sub.
   for (i = 0; i < MAX_S_STREAMS; i++)
     if (mpctx->demuxer->s_streams[i])
-      mpctx->global_sub_size++;
+      maxid = FFMAX(maxid, ((sh_sub_t *)mpctx->demuxer->s_streams[i])->sid);
+  mpctx->global_sub_size += maxid + 1;
 }
 if (mpctx->global_sub_size <= dvdsub_id) mpctx->global_sub_size = dvdsub_id + 1;