[Mplayer-cvslog] CVS: main/libmpdemux demux_mkv.c, 1.25, 1.26 demux_ogg.c, 1.56, 1.57

Joey Parrish CVS syncmail at mplayerhq.hu
Tue Sep 28 15:51:23 CEST 2004


CVS change done by Joey Parrish CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv9840/libmpdemux

Modified Files:
	demux_mkv.c demux_ogg.c 
Log Message:
fix sub_select fiasco with global sub numbering.  now multiple sub sources can be managed in essentially one list.


Index: demux_mkv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- demux_mkv.c	21 Sep 2004 18:02:33 -0000	1.25
+++ demux_mkv.c	28 Sep 2004 13:51:20 -0000	1.26
@@ -227,6 +227,7 @@
 /* for e.g. "-slang ger" */
 extern char *dvdsub_lang;
 extern char *audio_lang;
+extern int dvdsub_id;
 
 
 static mkv_track_t *
@@ -2043,6 +2044,24 @@
 
 void demux_mkv_seek (demuxer_t *demuxer, float rel_seek_secs, int flags);
 
+/** \brief Given a matroska track number, find the subtitle number that mplayer would ask for.
+ *  \param d The demuxer for which the subtitle id should be returned.
+ *  \param num The matroska track number we are looking up.
+ */
+static int demux_mkv_sub_reverse_id(mkv_demuxer_t *d, int num)
+{
+  int i, id;
+  
+  for (i=0, id=0; i < d->num_tracks; i++)
+    if (d->tracks[i] != NULL && d->tracks[i]->type == MATROSKA_TRACK_SUBTITLE) {
+      if (d->tracks[i]->tnum == num)
+        return id;
+      id++;
+    }
+  
+  return -1;
+}
+
 int
 demux_mkv_open (demuxer_t *demuxer)
 {
@@ -2256,6 +2275,7 @@
           {
             mp_msg (MSGT_DEMUX, MSGL_INFO,
                     "[mkv] Will display subtitle track %u\n", track->tnum);
+	    dvdsub_id = demux_mkv_sub_reverse_id(mkv_d, track->tnum);
             demuxer->sub->id = track->tnum;
           }
   else

Index: demux_ogg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_ogg.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- demux_ogg.c	24 Aug 2004 21:20:24 -0000	1.56
+++ demux_ogg.c	28 Sep 2004 13:51:20 -0000	1.57
@@ -146,6 +146,7 @@
 extern int index_mode;
 
 extern char *dvdsub_lang, *audio_lang;
+extern int dvdsub_id;
 
 //-------- subtitle support - should be moved to decoder layer, and queue
 //                          - subtitles up in demuxer buffer...
@@ -444,6 +445,7 @@
       if (os->text && d->sub->id == -1 && demux_ogg_check_lang(val, dvdsub_lang))
       {
 	d->sub->id = id;
+	dvdsub_id = index;
         mp_msg(MSGT_DEMUX, MSGL_V, "Ogg demuxer: Displaying subtitle stream id %d which matched -slang %s\n", id, val);
       }
       else




More information about the MPlayer-cvslog mailing list