aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar kmkaplan <kmkaplan@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-17 15:44:41 +0000
committerGravatar kmkaplan <kmkaplan@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-17 15:44:41 +0000
commit43ef114abe41a1d76db1054ea214556c8f561608 (patch)
tree6a2806621eb3ec289dac2d5a9c038c2106328040
parentf820293e0c1a6ad6855de28a490a91497bb2ebcc (diff)
Mplayer can switch between subtitles of different languages during
playing by press 'j', based on a patch by <hephooey@fastmail.fm>. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7781 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--mplayer.c20
-rw-r--r--vobsub.c14
-rw-r--r--vobsub.h2
3 files changed, 36 insertions, 0 deletions
diff --git a/mplayer.c b/mplayer.c
index bb3500ecc9..8390141274 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -517,6 +517,7 @@ int osd_last_pts=-303;
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 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
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;
@@ -2575,6 +2588,13 @@ if(rel_seek_secs || abs_seek_pos){
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));
osd_show_sub_delay--;
diff --git a/vobsub.c b/vobsub.c
index f6037d139e..0ba6cc010c 100644
--- a/vobsub.c
+++ b/vobsub.c
@@ -1134,6 +1134,20 @@ vobsub_close(void *this)
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;
diff --git a/vobsub.h b/vobsub.h
index f5a401b30c..9d7e8fbc30 100644
--- a/vobsub.h
+++ b/vobsub.h
@@ -7,6 +7,8 @@ extern int vobsub_parse_ifo(void* this, const char *const name, unsigned int *pa
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);