diff options
author | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-28 13:41:02 +0000 |
---|---|---|
committer | arpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-12-28 13:41:02 +0000 |
commit | 17c39c4e5794ecf8771e218e40843ad211f2ae71 (patch) | |
tree | d6ecd57a19af50eb134dc6c660bed6b2369dc324 | |
parent | 288868f16a20ce9d5f3586f5a6442c7b4005e7ff (diff) | |
download | mpv-17c39c4e5794ecf8771e218e40843ad211f2ae71.tar.bz2 mpv-17c39c4e5794ecf8771e218e40843ad211f2ae71.tar.xz |
The following patch adds two new command line options:
-sub-bkg-color n
-sub-bkg-alpha n
They control the color and alpha value used to initialize the subtitles and OSD BBOX.
With this you can have subtitles inside a traslucent rectangle.
This is useful when a movie already have "hardcoded" subtitles and you
want to overwrite them with rendered subtitles avoiding too much confusion.
patch by Salvador Eduardo Tropea <salvador@inti.gov.ar>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8602 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | DOCS/mplayer.1 | 10 | ||||
-rw-r--r-- | cfg-common.h | 2 | ||||
-rw-r--r-- | libvo/sub.c | 6 | ||||
-rw-r--r-- | libvo/sub.h | 2 |
4 files changed, 18 insertions, 2 deletions
diff --git a/DOCS/mplayer.1 b/DOCS/mplayer.1 index e35bd47def..6bd9bc4b06 100644 --- a/DOCS/mplayer.1 +++ b/DOCS/mplayer.1 @@ -824,6 +824,16 @@ Selects Hungarian and falls back to English if Hungarian is not available. .B \-sub <subtitle\ file> Use/\:display this subtitle file. .TP +.B \-sub-bkg-alpha <0-255> +Specify the alpha channel value for subtitles and OSD backgrounds. +Big values means more transparent. The 0 value is an exception and means +completly transparent. +.TP +.B \-sub-bkg-color <0-255> +Specify the color value for subtitles and OSD backgrounds. +Currently subtitles are grayscale so this value is equivalente to the +intensity of the color. The 255 value means white and 0 black. +.TP .B \-subcc \ Display DVD Closed Caption (CC) subtitles. These are NOT the VOB subtitles, these are special ASCII subtitles for the diff --git a/cfg-common.h b/cfg-common.h index f514e7bfab..b31841fd46 100644 --- a/cfg-common.h +++ b/cfg-common.h @@ -181,6 +181,8 @@ // enable Closed Captioning display {"subcc", &subcc_enabled, CONF_TYPE_FLAG, 0, 0, 1, NULL}, {"nooverlapsub", &suboverlap_enabled, CONF_TYPE_FLAG, 0, 0, 0, NULL}, + {"sub-bkg-color", &sub_bkg_color, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL}, + {"sub-bkg-alpha", &sub_bkg_alpha, CONF_TYPE_INT, CONF_RANGE, 0, 255, NULL}, #endif #ifdef USE_OSD {"font", &font_name, CONF_TYPE_STRING, 0, 0, 0, NULL}, diff --git a/libvo/sub.c b/libvo/sub.c index 09dd3cf1d1..a7a2ec1b7b 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -40,6 +40,8 @@ int sub_pos=100; int sub_width_p=100; int sub_alignment=0; /* 0=top, 1=center, 2=bottom */ int sub_visibility=1; +int sub_bkg_color=0; /* subtitles background color */ +int sub_bkg_alpha=0; // return the real height of a char: static inline int get_height(int c,int h){ @@ -97,8 +99,8 @@ static void alloc_buf(mp_osd_obj_t* obj) obj->bitmap_buffer = (unsigned char *)memalign(16, len); obj->alpha_buffer = (unsigned char *)memalign(16, len); } - memset(obj->bitmap_buffer, 0, len); - memset(obj->alpha_buffer, 0, len); + memset(obj->bitmap_buffer, sub_bkg_color, len); + memset(obj->alpha_buffer, sub_bkg_alpha, len); } // renders the buffer diff --git a/libvo/sub.h b/libvo/sub.h index 66be2a280f..6e69c4c2e1 100644 --- a/libvo/sub.h +++ b/libvo/sub.h @@ -101,6 +101,8 @@ extern int sub_width_p; extern int sub_alignment; extern int sub_visibility; extern int suboverlap_enabled; +extern int sub_bkg_color; /* subtitles background color */ +extern int sub_bkg_alpha; //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)); |