[Mplayer-cvslog] CVS: main mplayer.c,1.630,1.631 vobsub.c,1.24,1.25 vobsub.h,1.8,1.9

Arpi of Ize arpi at mplayerhq.hu
Mon Dec 23 02:55:01 CET 2002


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

Modified Files:
	mplayer.c vobsub.c vobsub.h 
Log Message:
Here is the patch to make vobsub subtitle use -slang option, I have not made a
new option for vobsub. Now mplayer will use the setting of slang first, and
then langidx from .idx file, if all failed, no sub.
patch by hephooey at fastmail.fm


Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.630
retrieving revision 1.631
diff -u -r1.630 -r1.631
--- mplayer.c	23 Dec 2002 01:37:41 -0000	1.630
+++ mplayer.c	23 Dec 2002 01:54:58 -0000	1.631
@@ -1039,6 +1039,7 @@
     if(vo_vobsub){
       sub_auto=0; // don't do autosub for textsubs if vobsub found
       inited_flags|=INITED_VOBSUB;
+      vobsub_set_from_lang(vo_vobsub, dvdsub_lang);
     }
 
 //============ Open & Sync STREAM --- fork cache2 ====================

Index: vobsub.c
===================================================================
RCS file: /cvsroot/mplayer/main/vobsub.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- vobsub.c	16 Nov 2002 03:04:33 -0000	1.24
+++ vobsub.c	23 Dec 2002 01:54:58 -0000	1.25
@@ -1151,6 +1151,25 @@
 }
 
 int
+vobsub_set_from_lang(void *vobhandle, unsigned char * lang)
+{
+    int i;
+    vobsub_t *vob= (vobsub_t *) vobhandle;
+    while(lang && strlen(lang) >= 2){
+      for(i=0; i < vob->spu_streams_size; i++)
+        if (vob->spu_streams[i].id)
+          if ((strncmp(vob->spu_streams[i].id, lang, 2)==0)){
+	    vobsub_id=i;
+	    mp_msg(MSGT_VOBSUB, MSGL_INFO, "Selected VOBSUB language: %d language: %s\n", i, vob->spu_streams[i].id);
+	    return;
+	  }
+      lang+=2;while (lang[0]==',' || lang[0]==' ') ++lang;
+    }
+    mp_msg(MSGT_VOBSUB, MSGL_WARN, "No matching VOBSUB languge found!\n");
+    return -1;
+}
+    
+int
 vobsub_get_packet(void *vobhandle, float pts,void** data, int* timestamp) {
   vobsub_t *vob = (vobsub_t *)vobhandle;
   unsigned int pts100 = 90000 * pts;

Index: vobsub.h
===================================================================
RCS file: /cvsroot/mplayer/main/vobsub.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- vobsub.h	17 Oct 2002 15:44:41 -0000	1.8
+++ vobsub.h	23 Dec 2002 01:54:58 -0000	1.9
@@ -13,6 +13,6 @@
 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);
 extern void vobsub_out_close(void *me);
-
+extern int vobsub_set_from_lang(void *vobhandle, unsigned char * lang);
 #endif /* MPLAYER_VOBSUB_H */
 




More information about the MPlayer-cvslog mailing list