comparison libvo/sub.c @ 8601:7fe391d6c293

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>
author arpi
date Sat, 28 Dec 2002 13:41:02 +0000
parents 4c18c4e7f34e
children 6ffbe7608013
comparison
equal deleted inserted replaced
8600:54eac4cf587c 8601:7fe391d6c293
38 int sub_utf8=0; 38 int sub_utf8=0;
39 int sub_pos=100; 39 int sub_pos=100;
40 int sub_width_p=100; 40 int sub_width_p=100;
41 int sub_alignment=0; /* 0=top, 1=center, 2=bottom */ 41 int sub_alignment=0; /* 0=top, 1=center, 2=bottom */
42 int sub_visibility=1; 42 int sub_visibility=1;
43 int sub_bkg_color=0; /* subtitles background color */
44 int sub_bkg_alpha=0;
43 45
44 // return the real height of a char: 46 // return the real height of a char:
45 static inline int get_height(int c,int h){ 47 static inline int get_height(int c,int h){
46 int font; 48 int font;
47 if ((font=vo_font->font[c])>=0) 49 if ((font=vo_font->font[c])>=0)
95 free(obj->bitmap_buffer); 97 free(obj->bitmap_buffer);
96 free(obj->alpha_buffer); 98 free(obj->alpha_buffer);
97 obj->bitmap_buffer = (unsigned char *)memalign(16, len); 99 obj->bitmap_buffer = (unsigned char *)memalign(16, len);
98 obj->alpha_buffer = (unsigned char *)memalign(16, len); 100 obj->alpha_buffer = (unsigned char *)memalign(16, len);
99 } 101 }
100 memset(obj->bitmap_buffer, 0, len); 102 memset(obj->bitmap_buffer, sub_bkg_color, len);
101 memset(obj->alpha_buffer, 0, len); 103 memset(obj->alpha_buffer, sub_bkg_alpha, len);
102 } 104 }
103 105
104 // renders the buffer 106 // renders the buffer
105 inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){ 107 inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
106 if (obj->allocated > 0) { 108 if (obj->allocated > 0) {