mirror of
https://github.com/mpv-player/mpv
synced 2025-02-21 15:27:00 +00:00
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
This commit is contained in:
parent
f820293e0c
commit
43ef114abe
20
mplayer.c
20
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--;
|
||||
|
14
vobsub.c
14
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;
|
||||
|
2
vobsub.h
2
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);
|
||||
|
Loading…
Reference in New Issue
Block a user