annotate libvo/sub.c @ 1550:39119eb74363

*** empty log message ***
author zybi
date Thu, 16 Aug 2001 11:42:10 +0000
parents 787c053b314c
children fcbfc99cf8e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
1
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
2 #include "sub.h"
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
3
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
4 //static int vo_font_loaded=-1;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
5 font_desc_t* vo_font=NULL;
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
6
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
7 unsigned char* vo_osd_text="00:00:00";
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
8 int sub_unicode=0;
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
9 int sub_utf8=0;
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
10
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
11 inline static 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)){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
12 unsigned char *cp=vo_osd_text;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
13 int c;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
14 int font;
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
15 int y=10;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
16 int x=20;
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
17
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
18 while (*cp){
1549
787c053b314c minor changes in sub.c
atlka
parents: 1548
diff changeset
19 c=*cp++;
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
20 if ((font=vo_font->font[c])>=0)
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
21 draw_alpha(x,y,
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
22 vo_font->width[c],
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
23 vo_font->pic_a[font]->h,
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
24 vo_font->pic_b[font]->bmp+vo_font->start[c],
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
25 vo_font->pic_a[font]->bmp+vo_font->start[c],
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
26 vo_font->pic_a[font]->w);
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
27 x+=vo_font->width[c]+vo_font->charspace;
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
28 }
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
29
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
30 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
31
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
32 int vo_osd_progbar_type=-1;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
33 int vo_osd_progbar_value=100; // 0..255
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
34
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
35 inline static 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)){
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
36 int i;
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
37 int y=(dys-vo_font->height)/2;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
38 int c,font;
1548
eee7951a23af changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents: 1524
diff changeset
39 int delimw=vo_font->width[OSD_PB_START]
1549
787c053b314c minor changes in sub.c
atlka
parents: 1548
diff changeset
40 +vo_font->width[OSD_PB_END]
787c053b314c minor changes in sub.c
atlka
parents: 1548
diff changeset
41 +vo_font->charspace;
1548
eee7951a23af changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents: 1524
diff changeset
42 int width=(2*dxs-3*delimw)/3;
1549
787c053b314c minor changes in sub.c
atlka
parents: 1548
diff changeset
43 int charw=vo_font->width[OSD_PB_0]+vo_font->charspace;
1548
eee7951a23af changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents: 1524
diff changeset
44 int elems=width/charw;
1549
787c053b314c minor changes in sub.c
atlka
parents: 1548
diff changeset
45 int x=(dxs-elems*charw-delimw)/2;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
46 int mark=(vo_osd_progbar_value*(elems+1))>>8;
1548
eee7951a23af changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents: 1524
diff changeset
47
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
48 // printf("osd.progbar width=%d xpos=%d\n",width,x);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
49
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
50 c=vo_osd_progbar_type;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
51 if(vo_osd_progbar_type>0 && (font=vo_font->font[c])>=0)
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
52 draw_alpha(x-vo_font->width[c]-vo_font->spacewidth,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
53 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
54 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
55 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
56 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
57 vo_font->pic_a[font]->w);
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
58
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
59 c=OSD_PB_START;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
60 if ((font=vo_font->font[c])>=0)
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
61 draw_alpha(x,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
62 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
63 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
64 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
65 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
66 vo_font->pic_a[font]->w);
1548
eee7951a23af changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents: 1524
diff changeset
67 x+=vo_font->width[c]+vo_font->charspace;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
68
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
69 c=OSD_PB_0;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
70 if ((font=vo_font->font[c])>=0)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
71 for (i=mark;i--;){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
72 draw_alpha(x,y,
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
73 vo_font->width[c],
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
74 vo_font->pic_a[font]->h,
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
75 vo_font->pic_b[font]->bmp+vo_font->start[c],
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
76 vo_font->pic_a[font]->bmp+vo_font->start[c],
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
77 vo_font->pic_a[font]->w);
1548
eee7951a23af changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents: 1524
diff changeset
78 x+=charw;
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
79 }
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
80
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
81 c=OSD_PB_1;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
82 if ((font=vo_font->font[c])>=0)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
83 for (i=elems-mark;i--;){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
84 draw_alpha(x,y,
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
85 vo_font->width[c],
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
86 vo_font->pic_a[font]->h,
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
87 vo_font->pic_b[font]->bmp+vo_font->start[c],
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
88 vo_font->pic_a[font]->bmp+vo_font->start[c],
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
89 vo_font->pic_a[font]->w);
1548
eee7951a23af changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents: 1524
diff changeset
90 x+=charw;
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
91 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
92
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
93 c=OSD_PB_END;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
94 if ((font=vo_font->font[c])>=0)
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
95 draw_alpha(x,y,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
96 vo_font->width[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
97 vo_font->pic_a[font]->h,
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
98 vo_font->pic_b[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
99 vo_font->pic_a[font]->bmp+vo_font->start[c],
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
100 vo_font->pic_a[font]->w);
1548
eee7951a23af changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents: 1524
diff changeset
101 // x+=vo_font->width[c]+vo_font->charspace;
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
102
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
103
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
104 // vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF;
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
105
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
106 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
107
254
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
108 subtitle* vo_sub=NULL;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
109
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
110 #define MAX_UCS 1600
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
111 #define MAX_UCSLINES 16
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
112
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
113 inline static void vo_draw_text_sub(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
114 static int utbl[MAX_UCS+1];
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
115 static int xtbl[MAX_UCSLINES];
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
116 static int lines;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
117 static subtitle *memsub=NULL;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
118 static int memy;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
119 static int memdxs;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
120 static int memdys;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
121 unsigned char *t;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
122 int i;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
123 int j;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
124 int k;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
125 int l;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
126 int x;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
127 int y;
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
128
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
129 int c;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
130 int len;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
131 int line;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
132 int font;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
133 int lastStripPosition;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
134 int xsize;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
135 int lastxsize;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
136 int lastk;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
137
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
138 if ((memsub!=vo_sub)||(memdxs!=dxs)||(memdys!=dys)){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
139 memsub=vo_sub;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
140 memdxs=dxs;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
141 memdys=dys;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
142
1524
1c8f80aeecdb segfault fixed
arpi
parents: 1504
diff changeset
143 memy=dys-vo_font->height/2;
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
144
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
145 // too long lines divide into smaller ones
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
146 i=k=lines=0; l=vo_sub->lines;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
147 while (l--){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
148 t=vo_sub->text[i++];
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
149 len=strlen(t)-1;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
150 xsize=lastxsize=-vo_font->charspace;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
151 lastStripPosition=-1;
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
152
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
153 for (j=0;j<=len;j++){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
154 if ((c=t[j])>=0x80){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
155 if (sub_unicode)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
156 c = (c<<8) + t[++j];
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
157 else
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
158 if (sub_utf8){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
159 if ((c & 0xe0) == 0xc0) /* 2 bytes U+00080..U+0007FF*/
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
160 c = (c & 0x1f)<<6 | (t[++j] & 0x3f);
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
161 else if((c & 0xf0) == 0xe0)/* 3 bytes U+00800..U+00FFFF*/
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
162 c = ((c & 0x0f)<<6 |
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
163 (t[++j] & 0x3f))<<6 | (t[++j] & 0x3f);
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
164 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
165 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
166 if (k==MAX_UCS){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
167 utbl[k]=l=0;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
168 break;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
169 } else
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
170 utbl[k++]=c;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
171 if (c==' '){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
172 lastk=k;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
173 lastStripPosition=j;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
174 lastxsize=xsize;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
175 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
176 xsize+=vo_font->width[c]+vo_font->charspace;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
177 if (dxs<xsize && lastStripPosition>0){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
178 j=lastStripPosition;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
179 k=lastk;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
180 } else if (j==len){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
181 lastxsize=xsize;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
182 } else
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
183 continue;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
184 utbl[k++]=0;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
185 xtbl[lines++]=(dxs-lastxsize)/2;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
186 if (lines==MAX_UCSLINES||k>MAX_UCS){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
187 l=0;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
188 break;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
189 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
190 memy-=vo_font->height;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
191 xsize=lastxsize=-vo_font->charspace;
803
b25a887b6054 sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents: 726
diff changeset
192 }
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
193 }
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
194 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
195
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
196 y = memy;
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
197
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
198 k=i=0; l=lines;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
199 while (l--){
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
200 x = xtbl[i++];
1524
1c8f80aeecdb segfault fixed
arpi
parents: 1504
diff changeset
201 if(y<dys)
1503
1af1f37efd67 libvo/sub.c corrections
atlka
parents: 1502
diff changeset
202 while ((c=utbl[k++])){
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
203 if (x>=0 && x+vo_font->width[c]<=dxs)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
204 if ((font=vo_font->font[c])>=0)
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
205 draw_alpha(x,y,
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
206 vo_font->width[c],
1524
1c8f80aeecdb segfault fixed
arpi
parents: 1504
diff changeset
207 // vo_font->pic_a[font]->h,
1c8f80aeecdb segfault fixed
arpi
parents: 1504
diff changeset
208 (y+vo_font->pic_a[font]->h<=dys)?vo_font->pic_a[font]->h:dys-y,
1501
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
209 vo_font->pic_b[font]->bmp+vo_font->start[c],
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
210 vo_font->pic_a[font]->bmp+vo_font->start[c],
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
211 vo_font->pic_a[font]->w);
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
212 x+=vo_font->width[c]+vo_font->charspace;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
213 }
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
214 y+=vo_font->height;
d40f2b686846 changes according to -utf8 option, draw_osd() function added
atlka
parents: 1109
diff changeset
215 }
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
216 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
217
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
218 static int draw_alpha_init_flag=0;
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
219
1109
a013b2124f05 -Wall like fixes
al3x
parents: 947
diff changeset
220 extern void vo_draw_alpha_init();
a013b2124f05 -Wall like fixes
al3x
parents: 947
diff changeset
221
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
222 void vo_draw_text(int dxs,int dys,void (*draw_alpha)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
223
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
224 if(!vo_font) return; // no font
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
225
947
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
226 if(!draw_alpha_init_flag){
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
227 draw_alpha_init_flag=1;
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
228 vo_draw_alpha_init();
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
229 }
76fd9463b9d3 FAST_OSD option to disable font outline antialiasing
arpi_esp
parents: 865
diff changeset
230
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
231 if(vo_osd_text){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
232 vo_draw_text_osd(dxs,dys,draw_alpha);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
233 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
234
254
57f0156416e3 use subreader's sub struct
arpi_esp
parents: 218
diff changeset
235 if(vo_sub){
218
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
236 vo_draw_text_sub(dxs,dys,draw_alpha);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
237 }
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
238
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
239 if(vo_osd_progbar_type>=0){
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
240 vo_draw_text_progbar(dxs,dys,draw_alpha);
fbfc2077ba72 sub/osd interface changes
arpi_esp
parents: 213
diff changeset
241 }
213
6ec8f6ab6cb1 subtitle+OSD font support
arpi_esp
parents: 202
diff changeset
242
202
6ad0715dfac8 grey+alpha rendering support (for .sub)
arpi_esp
parents:
diff changeset
243 }