diff options
author | kmkaplan <kmkaplan@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-17 15:44:41 +0000 |
---|---|---|
committer | kmkaplan <kmkaplan@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-17 15:44:41 +0000 |
commit | 43ef114abe41a1d76db1054ea214556c8f561608 (patch) | |
tree | 6a2806621eb3ec289dac2d5a9c038c2106328040 | |
parent | f820293e0c1a6ad6855de28a490a91497bb2ebcc (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.c | 20 | ||||
-rw-r--r-- | vobsub.c | 14 | ||||
-rw-r--r-- | vobsub.h | 2 |
3 files changed, 36 insertions, 0 deletions
@@ -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--; @@ -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; @@ -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); |