Mercurial > mplayer.hg
changeset 7780:9806d65986e4
Mplayer can switch between subtitles of different languages during
playing by press 'j', based on a patch by <hephooey@fastmail.fm>.
author | kmkaplan |
---|---|
date | Thu, 17 Oct 2002 15:44:41 +0000 |
parents | f3166c864e9e |
children | 2263b7200fdd |
files | mplayer.c vobsub.c vobsub.h |
diffstat | 3 files changed, 36 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mplayer.c Thu Oct 17 15:41:20 2002 +0000 +++ b/mplayer.c Thu Oct 17 15:44:41 2002 +0000 @@ -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; @@ -2575,6 +2588,13 @@ 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--;
--- a/vobsub.c Thu Oct 17 15:41:20 2002 +0000 +++ b/vobsub.c Thu Oct 17 15:44:41 2002 +0000 @@ -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;
--- a/vobsub.h Thu Oct 17 15:41:20 2002 +0000 +++ b/vobsub.h Thu Oct 17 15:44:41 2002 +0000 @@ -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);