[Mplayer-cvslog] CVS: main vobsub.h,1.7,1.8 vobsub.c,1.20,1.21 mplayer.c,1.595,1.596

Kim Minh Kaplan CVS kmkaplan at mplayerhq.hu
Thu Oct 17 17:44:44 CEST 2002


Update of /cvsroot/mplayer/main
In directory mail:/var/tmp.root/cvs-serv13225

Modified Files:
	vobsub.h vobsub.c mplayer.c 
Log Message:
Mplayer can switch between subtitles of different languages during
playing by press 'j', based on a patch by <hephooey at fastmail.fm>.


Index: vobsub.h
===================================================================
RCS file: /cvsroot/mplayer/main/vobsub.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- vobsub.h	28 Jul 2002 16:28:30 -0000	1.7
+++ vobsub.h	17 Oct 2002 15:44:41 -0000	1.8
@@ -7,6 +7,8 @@
 extern int vobsub_get_packet(void *vobhandle, float pts,void** data, int* timestamp);
 extern int vobsub_get_next_packet(void *vobhandle, void** data, int* timestamp);
 extern void vobsub_close(void *this);
+extern unsigned int vobsub_get_indexes_count(void * /* vobhandle */);
+extern char *vobsub_get_id(void * /* vobhandle */, unsigned int /* index */);
 
 extern void *vobsub_out_open(const char *basename, const unsigned int *palette, unsigned int orig_width, unsigned int orig_height, const char *id, unsigned int index);
 extern void vobsub_out_output(void *me, const unsigned char *packet, int len, double pts);

Index: vobsub.c
===================================================================
RCS file: /cvsroot/mplayer/main/vobsub.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- vobsub.c	20 Sep 2002 01:26:39 -0000	1.20
+++ vobsub.c	17 Oct 2002 15:44:41 -0000	1.21
@@ -1134,6 +1134,20 @@
     free(vob);
 }
 
+unsigned int
+vobsub_get_indexes_count(void *vobhandle)
+{
+    vobsub_t *vob = (vobsub_t *) vobhandle;
+    return vob->spu_streams_size;
+}
+
+char *
+vobsub_get_id(void *vobhandle, unsigned int index)
+{
+    vobsub_t *vob = (vobsub_t *) vobhandle;
+    return (index < vob->spu_streams_size) ? vob->spu_streams[index].id : NULL;
+}
+
 int
 vobsub_get_packet(void *vobhandle, float pts,void** data, int* timestamp) {
   vobsub_t *vob = (vobsub_t *)vobhandle;

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.595
retrieving revision 1.596
diff -u -r1.595 -r1.596
--- mplayer.c	16 Oct 2002 15:35:26 -0000	1.595
+++ mplayer.c	17 Oct 2002 15:44:41 -0000	1.596
@@ -517,6 +517,7 @@
 int osd_show_av_delay = 0;
 int osd_show_sub_delay = 0;
 int osd_show_sub_visibility = 0;
+int osd_show_vobsub_changed = 0;
 
 int rtc_fd=-1;
 
@@ -2207,6 +2208,18 @@
 	vo_osd_changed(OSDTYPE_SUBTITLE);
 	break;
     }
+    case MP_CMD_VOBSUB_LANG:
+    {
+	int new_id = vobsub_id + 1;
+	if (vobsub_id < 0)
+	    new_id = 0;
+	if ((unsigned int) new_id >= vobsub_get_indexes_count(vo_vobsub))
+	    new_id = -1;
+        if(new_id != vobsub_id)
+	    osd_show_vobsub_changed = 9;
+	vobsub_id = new_id;
+	break;
+    }
     case MP_CMD_SCREENSHOT :
       if(vo_config_count) video_out->control(VOCTRL_SCREENSHOT, NULL);
       break;
@@ -2574,6 +2587,13 @@
       if (osd_show_sub_visibility) {
 	  sprintf(osd_text_tmp, "Subtitles: %sabled", sub_visibility?"en":"dis");
 	  osd_show_sub_visibility--;
+      } else
+      if (osd_show_vobsub_changed) {
+	  const char *language = "none";
+	  if (vobsub_id >= 0)
+	      language = vobsub_get_id(vo_vobsub, (unsigned int) vobsub_id);
+	  sprintf(osd_text_tmp, "Subtitles: (%d) %s", vobsub_id, language ? language : "unknown");
+	  osd_show_vobsub_changed--;
       } else
       if (osd_show_sub_delay) {
 	  sprintf(osd_text_tmp, "Sub delay: %d ms",(int)(sub_delay*1000));




More information about the MPlayer-cvslog mailing list