Mercurial > mplayer.hg
changeset 7628:d6608342591d
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
author | arpi |
---|---|
date | Sun, 06 Oct 2002 17:40:51 +0000 |
parents | 382b28368402 |
children | 9068ed109341 |
files | DOCS/documentation.html DOCS/mplayer.1 input/input.c input/input.h libvo/sub.c libvo/sub.h mplayer.c |
diffstat | 7 files changed, 27 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/documentation.html Sun Oct 06 17:31:36 2002 +0000 +++ b/DOCS/documentation.html Sun Oct 06 17:40:51 2002 +0000 @@ -1098,6 +1098,7 @@ <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 @@ <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>
--- a/DOCS/mplayer.1 Sun Oct 06 17:31:36 2002 +0000 +++ b/DOCS/mplayer.1 Sun Oct 06 17:40:51 2002 +0000 @@ -2020,6 +2020,8 @@ 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 @@ 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
--- a/input/input.c Sun Oct 06 17:31:36 2002 +0000 +++ b/input/input.c Sun Oct 06 17:40:51 2002 +0000 @@ -59,6 +59,7 @@ { 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 @@ { { '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" },
--- a/input/input.h Sun Oct 06 17:31:36 2002 +0000 +++ b/input/input.h Sun Oct 06 17:40:51 2002 +0000 @@ -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
--- a/libvo/sub.c Sun Oct 06 17:31:36 2002 +0000 +++ b/libvo/sub.c Sun Oct 06 17:40:51 2002 +0000 @@ -33,6 +33,7 @@ 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 @@ 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 @@ 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; }
--- a/libvo/sub.h Sun Oct 06 17:31:36 2002 +0000 +++ b/libvo/sub.h Sun Oct 06 17:40:51 2002 +0000 @@ -97,6 +97,7 @@ 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));
--- a/mplayer.c Sun Oct 06 17:31:36 2002 +0000 +++ b/mplayer.c Sun Oct 06 17:40:51 2002 +0000 @@ -514,6 +514,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 rtc_fd=-1; @@ -2193,6 +2194,13 @@ 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 @@ 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--;