[Mplayer-cvslog] CVS: main mplayer.c,1.775,1.776

Moritz Bunkus CVS syncmail at mplayerhq.hu
Tue Aug 24 22:58:31 CEST 2004


CVS change done by Moritz Bunkus CVS

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

Modified Files:
	mplayer.c 
Log Message:
Support for subtitle switching in Matroska.

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.775
retrieving revision 1.776
diff -u -r1.775 -r1.776
--- mplayer.c	24 Aug 2004 19:36:16 -0000	1.775
+++ mplayer.c	24 Aug 2004 20:58:29 -0000	1.776
@@ -1590,7 +1590,7 @@
 demux_info_print(demuxer);
 
 //================== Read SUBTITLES (DVD & TEXT) ==========================
-if(vo_spudec==NULL && sh_video && stream->type==STREAMTYPE_DVD){
+if(vo_spudec==NULL && sh_video && (stream->type==STREAMTYPE_DVD || demuxer->type==DEMUXER_TYPE_MATROSKA)){
 
 if (spudec_ifo) {
   unsigned int palette[16], width, height;
@@ -3178,6 +3178,35 @@
 	d_dvdsub->id = demux_ogg_sub_id(new_id);
     }
 #endif
+#ifdef HAVE_MATROSKA
+    if (d_dvdsub && demuxer->type == DEMUXER_TYPE_MATROSKA) {
+      int new_id = dvdsub_id + 1;
+      if (dvdsub_id < 0)
+        new_id = 0;
+      if ((unsigned int) new_id >= demux_mkv_num_subs(demuxer))
+        new_id = -1;
+      if (new_id != dvdsub_id)
+        osd_show_vobsub_changed = sh_video->fps;
+      dvdsub_id = new_id;
+      d_dvdsub->id = demux_mkv_change_subs(demuxer, new_id);
+      if (d_dvdsub->id >= 0 && ((mkv_sh_sub_t *)d_dvdsub->sh)->type == 'v') {
+        mkv_sh_sub_t *mkv_sh_sub = (mkv_sh_sub_t *)d_dvdsub->sh;
+        if (vo_spudec != NULL)
+          spudec_free(vo_spudec);
+        vo_spudec =
+          spudec_new_scaled_vobsub(mkv_sh_sub->palette, mkv_sh_sub->colors,
+                                   mkv_sh_sub->custom_colors,
+                                   mkv_sh_sub->width,
+                                   mkv_sh_sub->height);
+        if (!forced_subs_only)
+          forced_subs_only = mkv_sh_sub->forced_subs_only;
+        if (vo_spudec) {
+          spudec_set_forced_subs_only(vo_spudec, forced_subs_only);
+          inited_flags |= INITED_SPUDEC;
+        }
+      }
+    }
+#endif
         break;
     case MP_CMD_SUB_FORCED_ONLY:
       if (vo_spudec) {




More information about the MPlayer-cvslog mailing list