summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-23 01:54:58 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-23 01:54:58 +0000
commit8457972ae4c384f274d36c9f1bf4debb7256af23 (patch)
treeb8890bf9bb543fd2abe4baf9273e02eca34f2114
parent725ff339e7093f11e1da39156cf7266dd6582f09 (diff)
downloadmpv-8457972ae4c384f274d36c9f1bf4debb7256af23.tar.bz2
mpv-8457972ae4c384f274d36c9f1bf4debb7256af23.tar.xz
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@fastmail.fm git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8536 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--mplayer.c1
-rw-r--r--vobsub.c19
-rw-r--r--vobsub.h2
3 files changed, 21 insertions, 1 deletions
diff --git a/mplayer.c b/mplayer.c
index e516316ec8..333909356e 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1039,6 +1039,7 @@ if(!use_stdin && !slave_mode){
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 ====================
diff --git a/vobsub.c b/vobsub.c
index a162229cae..1be1edcd35 100644
--- a/vobsub.c
+++ b/vobsub.c
@@ -1151,6 +1151,25 @@ vobsub_get_id(void *vobhandle, unsigned int index)
}
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;
diff --git a/vobsub.h b/vobsub.h
index 9d7e8fbc30..e9bf1ca51c 100644
--- a/vobsub.h
+++ b/vobsub.h
@@ -13,6 +13,6 @@ 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);
extern void vobsub_out_close(void *me);
-
+extern int vobsub_set_from_lang(void *vobhandle, unsigned char * lang);
#endif /* MPLAYER_VOBSUB_H */