mirror of
https://github.com/mpv-player/mpv
synced 2025-02-01 20:52:05 +00:00
This patch adds the functionality to disable/enable subtitles while playing
a video. I mapped it to the input-keyword "sub_visibility". This keyword is mapped to the 'v' key on the keyboard. I tested the patch with old-fashioned subtitles, with freetype subtitles and DVD subtitles. Works fine. The patch also includes documentation updates. patch by Uwe.Reder@3SOFT.de git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7629 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
1b28b8a9c7
commit
ce587559f7
@ -1098,6 +1098,7 @@ TV tuner</B>.</P>
|
||||
<TR><TD></TD><TD>/ or *</TD><TD></TD><TD>decrease/increase volume</TD></TR>
|
||||
<TR><TD></TD><TD>f</TD><TD></TD><TD>toggle fullscreen</TD></TR>
|
||||
<TR><TD></TD><TD>o</TD><TD></TD><TD>toggle OSD: none / seek / seek+timer</TD></TR>
|
||||
<TR><TD></TD><TD>v</TD><TD></TD><TD>toggle subtitle visibility</TD></TR>
|
||||
<TR><TD></TD><TD>z or x</TD><TD></TD><TD>adjust subtitle delay by +/- 0.1 second</TD></TR>
|
||||
<TR><TD></TD><TD>r or t</TD><TD></TD><TD>adjust subtitle position</TD></TR>
|
||||
<TR><TD></TD><TD>HOME or END</TD><TD></TD><TD>go to next/previous playtree entry in the parent list</TD></TR>
|
||||
@ -1256,6 +1257,8 @@ ENTER pt_step 1 1
|
||||
<P>Set/Adjust video parameters. Val range from -100 to 100.</P></LI>
|
||||
<LI><B>frame_drop</B> [(int) type=-1]
|
||||
<P>Toggle/Set frame dropping mode.</P></LI>
|
||||
<LI><B>sub_visibility</B>
|
||||
<P>Toggle subtitle visibility.</P></LI>
|
||||
<LI><B>sub_pos</B> (int) val
|
||||
<P>Adjust subtitles position.</P></LI>
|
||||
<LI><B>vo_fullscreen</B>
|
||||
|
@ -2020,6 +2020,8 @@ decrease/increase panscan range
|
||||
toggle between OSD states: none / seek / seek+timer
|
||||
.IPs d
|
||||
toggle frame dropping
|
||||
.IPs v
|
||||
toggle subtitle visibility
|
||||
.IPs "z and x"
|
||||
adjust subtitle delay by +/\- 0.1 second
|
||||
.IPs "r and t"
|
||||
@ -2127,6 +2129,8 @@ Increase/decrease volume
|
||||
Set/Adjust video parameters.
|
||||
.IPs "frame_drop [type=<value>]"
|
||||
Toggle/Set frame dropping mode.
|
||||
.IPs "sub_visibility"
|
||||
Toggle subtitle visibility.
|
||||
.IPs "sub_pos <value>"
|
||||
Adjust subtitles position.
|
||||
.IPs vo_fullscreen
|
||||
|
@ -59,6 +59,7 @@ static mp_cmd_t mp_cmds[] = {
|
||||
{ MP_CMD_SATURATION, "saturation",1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_FRAMEDROPPING, "frame_drop",0, { { MP_CMD_ARG_INT,{-1} }, {-1,{0}} } },
|
||||
{ MP_CMD_SUB_POS, "sub_pos", 1, { {MP_CMD_ARG_INT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
|
||||
{ MP_CMD_SUB_VISIBILITY, "sub_visibility", 0, { {-1,{0}} } },
|
||||
#ifdef USE_TV
|
||||
{ MP_CMD_TV_STEP_CHANNEL, "tv_step_channel", 1, { { MP_CMD_ARG_INT ,{0}}, {-1,{0}} }},
|
||||
{ MP_CMD_TV_STEP_NORM, "tv_step_norm",0, { {-1,{0}} } },
|
||||
@ -221,6 +222,7 @@ static mp_cmd_bind_t def_cmd_binds[] = {
|
||||
{ { 'd', 0 }, "frame_drop" },
|
||||
{ { 'r', 0 }, "sub_pos -1" },
|
||||
{ { 't', 0 }, "sub_pos +1" },
|
||||
{ { 'v', 0 }, "sub_visibility" },
|
||||
#ifdef USE_TV
|
||||
{ { 'h', 0 }, "tv_step_channel 1" },
|
||||
{ { 'k', 0 }, "tv_step_channel -1" },
|
||||
|
@ -29,6 +29,7 @@
|
||||
#define MP_CMD_LOADLIST 27
|
||||
#define MP_CMD_VF_CHANGE_RECTANGLE 28
|
||||
#define MP_CMD_GAMMA 29
|
||||
#define MP_CMD_SUB_VISIBILITY 30
|
||||
|
||||
#define MP_CMD_GUI_EVENTS 5000
|
||||
#define MP_CMD_GUI_LOADFILE 5001
|
||||
|
@ -33,6 +33,7 @@ unsigned char* vo_osd_text=NULL;
|
||||
int sub_unicode=0;
|
||||
int sub_utf8=0;
|
||||
int sub_pos=100;
|
||||
int sub_visibility=1;
|
||||
|
||||
// return the real height of a char:
|
||||
static inline int get_height(int c,int h){
|
||||
@ -298,8 +299,8 @@ inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){
|
||||
int h,lasth;
|
||||
|
||||
obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE;
|
||||
|
||||
if(!vo_sub || !vo_font){
|
||||
|
||||
if(!vo_sub || !vo_font || !sub_visibility){
|
||||
obj->flags&=~OSDFLAG_VISIBLE;
|
||||
return;
|
||||
}
|
||||
@ -504,7 +505,7 @@ int vo_update_osd(int dxs,int dys){
|
||||
vo_update_text_progbar(obj,dxs,dys);
|
||||
break;
|
||||
case OSDTYPE_SPU:
|
||||
if(vo_spudec && spudec_visible(vo_spudec)){
|
||||
if(sub_visibility && vo_spudec && spudec_visible(vo_spudec)){
|
||||
vo_update_spudec_sub(obj, dxs, dys);
|
||||
obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED;
|
||||
}
|
||||
|
@ -97,6 +97,7 @@ extern int sub_utf8;
|
||||
extern char *sub_cp;
|
||||
#endif
|
||||
extern int sub_pos;
|
||||
extern int sub_visibility;
|
||||
|
||||
//extern void vo_draw_text_osd(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
|
||||
//extern void vo_draw_text_progbar(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride));
|
||||
|
12
mplayer.c
12
mplayer.c
@ -514,6 +514,7 @@ int osd_function=OSD_PLAY;
|
||||
int osd_last_pts=-303;
|
||||
int osd_show_av_delay = 0;
|
||||
int osd_show_sub_delay = 0;
|
||||
int osd_show_sub_visibility = 0;
|
||||
|
||||
int rtc_fd=-1;
|
||||
|
||||
@ -2193,6 +2194,13 @@ if (stream->type==STREAMTYPE_DVDNAV && dvd_nav_still)
|
||||
if(sub_pos <0) sub_pos=0;
|
||||
vo_osd_changed(OSDTYPE_SUBTITLE);
|
||||
} break;
|
||||
case MP_CMD_SUB_VISIBILITY:
|
||||
{
|
||||
sub_visibility=1-sub_visibility;
|
||||
osd_show_sub_visibility = 9; // show state of subtitle visibility in OSD
|
||||
vo_osd_changed(OSDTYPE_SUBTITLE);
|
||||
break;
|
||||
}
|
||||
case MP_CMD_SCREENSHOT :
|
||||
if(vo_config_count) video_out->control(VOCTRL_SCREENSHOT, NULL);
|
||||
break;
|
||||
@ -2557,6 +2565,10 @@ if(rel_seek_secs || abs_seek_pos){
|
||||
osd_show_dvd_nav_delay--;
|
||||
} else
|
||||
#endif
|
||||
if (osd_show_sub_visibility) {
|
||||
sprintf(osd_text_tmp, "Subtitles: %sabled", sub_visibility?"en":"dis");
|
||||
osd_show_sub_visibility--;
|
||||
} else
|
||||
if (osd_show_sub_delay) {
|
||||
sprintf(osd_text_tmp, "Sub delay: %d ms",(int)(sub_delay*1000));
|
||||
osd_show_sub_delay--;
|
||||
|
Loading…
Reference in New Issue
Block a user