changeset 24022:4d576e0ed40b

When a new subtitle stream becomes available check if it is the one that was requested by the user and set up sub->id and sub->sh accordingly. Fixes -slang and -sid with DVD subtitles (basically only 'j' during playback could make them show). This was broken by r23786.
author reimar
date Thu, 09 Aug 2007 10:26:00 +0000
parents 8434aae12d7c
children 1ac62a61ea56
files libmpdemux/demuxer.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Wed Aug 08 23:33:34 2007 +0000
+++ b/libmpdemux/demuxer.c	Thu Aug 09 10:26:00 2007 +0000
@@ -209,6 +209,8 @@
   return d;
 }
 
+extern int dvdsub_id;
+
 sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid) {
   if (id > MAX_S_STREAMS - 1 || id < 0) {
     mp_msg(MSGT_DEMUXER,MSGL_WARN,"Requested sub stream id overflow (%d > %d)\n",
@@ -222,6 +224,10 @@
     demuxer->s_streams[id] = sh;
     sh->sid = sid;
     mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SUBTITLE_ID=%d\n", sid);
+    if (dvdsub_id == id) {
+      demuxer->sub->id = id;
+      demuxer->sub->sh = sh;
+    }
   }
   return demuxer->s_streams[id];
 }