diff options
author | 2002-10-06 17:40:51 +0000 | |
---|---|---|
committer | 2002-10-06 17:40:51 +0000 | |
commit | ce587559f7906aca349894164d8dc22419866949 (patch) | |
tree | 5d6ef5fc1bf3280a068532af8e5d3f0831c50ee7 | |
parent | 1b28b8a9c7aeb47ced6631fa8bd906bcd7ac7cae (diff) |
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
-rw-r--r-- | DOCS/documentation.html | 3 | ||||
-rw-r--r-- | DOCS/mplayer.1 | 4 | ||||
-rw-r--r-- | input/input.c | 2 | ||||
-rw-r--r-- | input/input.h | 1 | ||||
-rw-r--r-- | libvo/sub.c | 7 | ||||
-rw-r--r-- | libvo/sub.h | 1 | ||||
-rw-r--r-- | mplayer.c | 12 |
7 files changed, 27 insertions, 3 deletions
diff --git a/DOCS/documentation.html b/DOCS/documentation.html index 3f6afbc097..654ecd205d 100644 --- a/DOCS/documentation.html +++ b/DOCS/documentation.html @@ -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> diff --git a/DOCS/mplayer.1 b/DOCS/mplayer.1 index 50bdd73d4d..8875ec4e84 100644 --- a/DOCS/mplayer.1 +++ b/DOCS/mplayer.1 @@ -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 diff --git a/input/input.c b/input/input.c index a126045bb6..073e6544a9 100644 --- a/input/input.c +++ b/input/input.c @@ -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" }, diff --git a/input/input.h b/input/input.h index f98a6ec43a..98b3cc0347 100644 --- a/input/input.h +++ b/input/input.h @@ -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 diff --git a/libvo/sub.c b/libvo/sub.c index 797f5fb08d..90dd6c6869 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -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; } diff --git a/libvo/sub.h b/libvo/sub.h index 33fc278cbb..5646535f42 100644 --- a/libvo/sub.h +++ b/libvo/sub.h @@ -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)); @@ -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--; |