Mercurial > mplayer.hg
annotate libvo/sub.c @ 28954:f4a3c2c39bdf
Older versions of <vdpau/vdpau.h> will fail during compilation.
author | cehoyos |
---|---|
date | Wed, 18 Mar 2009 09:17:15 +0000 |
parents | df67d03dde3b |
children | 0f1b5b68af32 |
rev | line source |
---|---|
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
1 /* |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
2 * This file is part of MPlayer. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
3 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
7 * (at your option) any later version. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
8 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
12 * GNU General Public License for more details. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
13 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28401
diff
changeset
|
17 */ |
5503 | 18 |
19 #include <stdio.h> | |
20 #include <stdlib.h> | |
7003
60a473935d7d
warning fixes by Sylvain Petreolle <spetreolle@yahoo.fr>
arpi
parents:
6190
diff
changeset
|
21 #include <string.h> |
218 | 22 |
4088 | 23 #include "config.h" |
28594
df67d03dde3b
Convert HAVE_MALLOC_H into a 0/1 definition, fixes the warning:
diego
parents:
28586
diff
changeset
|
24 #if HAVE_MALLOC_H |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7628
diff
changeset
|
25 #include <malloc.h> |
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7628
diff
changeset
|
26 #endif |
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7628
diff
changeset
|
27 |
21200 | 28 #include "stream/stream.h" |
29 #include "stream/stream_dvdnav.h" | |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
30 #define OSD_NAV_BOX_ALPHA 0x7f |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
31 |
23903 | 32 #include "stream/tv.h" |
24378 | 33 #include "osdep/timer.h" |
23903 | 34 |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
35 #include "mplayer.h" |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
36 #include "mp_msg.h" |
16923
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
37 #include "help_mp.h" |
4088 | 38 #include "video_out.h" |
5294 | 39 #include "font_load.h" |
218 | 40 #include "sub.h" |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13343
diff
changeset
|
41 #include "spudec.h" |
19366 | 42 #include "libavutil/common.h" |
202 | 43 |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
44 #define NEW_SPLITTING |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
45 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
46 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
47 // Structures needed for the new splitting algorithm. |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
48 // osd_text_t contains the single subtitle word. |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
49 // osd_text_p is used to mark the lines of subtitles |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
50 struct osd_text_t { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
51 int osd_kerning, //kerning with the previous word |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
52 osd_length, //orizontal length inside the bbox |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
53 text_length, //number of characters |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
54 *text; //characters |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
55 struct osd_text_t *prev, |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
56 *next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
57 }; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
58 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
59 struct osd_text_p { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
60 int value; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
61 struct osd_text_t *ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
62 struct osd_text_p *prev, |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
63 *next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
64 }; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
65 //^ |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
66 |
24046 | 67 char * sub_osd_names[]={ |
16923
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
68 MSGTR_VO_SUB_Seekbar, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
69 MSGTR_VO_SUB_Play, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
70 MSGTR_VO_SUB_Pause, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
71 MSGTR_VO_SUB_Stop, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
72 MSGTR_VO_SUB_Rewind, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
73 MSGTR_VO_SUB_Forward, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
74 MSGTR_VO_SUB_Clock, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
75 MSGTR_VO_SUB_Contrast, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
76 MSGTR_VO_SUB_Saturation, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
77 MSGTR_VO_SUB_Volume, |
a6a03ff1ddef
Added translatable messages for OSD localization to help/help_mp-en.h
ptt
parents:
16839
diff
changeset
|
78 MSGTR_VO_SUB_Brightness, |
23568 | 79 MSGTR_VO_SUB_Hue, |
80 MSGTR_VO_SUB_Balance | |
2498 | 81 }; |
24046 | 82 char * sub_osd_names_short[] ={ "", "|>", "||", "[]", "<<" , ">>", "", "", "", "", "", "", "" }; |
2498 | 83 |
213 | 84 //static int vo_font_loaded=-1; |
85 font_desc_t* vo_font=NULL; | |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
86 font_desc_t* sub_font=NULL; |
202 | 87 |
1991
dee4b2ea5e5b
add gui support to config scripts, and fixed some warning.
pontscho
parents:
1878
diff
changeset
|
88 unsigned char* vo_osd_text=NULL; |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
89 #ifdef CONFIG_TV_TELETEXT |
23903 | 90 void* vo_osd_teletext_page=NULL; |
91 int vo_osd_teletext_half = 0; | |
92 int vo_osd_teletext_mode=0; | |
93 int vo_osd_teletext_format=0; | |
94 int vo_osd_teletext_scale=0; | |
95 #endif | |
803
b25a887b6054
sub splitting patch applied by Vlada V.Dubsky@sh.cvut.cz
arpi_esp
parents:
726
diff
changeset
|
96 int sub_unicode=0; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
97 int sub_utf8=0; |
4773 | 98 int sub_pos=100; |
8583 | 99 int sub_width_p=100; |
16839
1b1b59b160ab
make bottom alignment the default since it's the only sane mode when sub_pos is near bottom (default)
rfelker
parents:
16838
diff
changeset
|
100 int sub_alignment=2; /* 0=top, 1=center, 2=bottom */ |
7628
d6608342591d
This patch adds the functionality to disable/enable subtitles while playing
arpi
parents:
7121
diff
changeset
|
101 int sub_visibility=1; |
8617
6ffbe7608013
Me: -sub-bg-* would be nicer. "Background" is usually shortened as "bg", not "bkg".
rathann
parents:
8601
diff
changeset
|
102 int sub_bg_color=0; /* subtitles background color */ |
6ffbe7608013
Me: -sub-bg-* would be nicer. "Background" is usually shortened as "bg", not "bkg".
rathann
parents:
8601
diff
changeset
|
103 int sub_bg_alpha=0; |
10263 | 104 int sub_justify=0; |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
25851
diff
changeset
|
105 #ifdef CONFIG_DVDNAV |
21219 | 106 static nav_highlight_t nav_hl; |
107 #endif | |
213 | 108 |
5664 | 109 // return the real height of a char: |
110 static inline int get_height(int c,int h){ | |
111 int font; | |
112 if ((font=vo_font->font[c])>=0) | |
113 if(h<vo_font->pic_a[font]->h) h=vo_font->pic_a[font]->h; | |
114 return h; | |
115 } | |
116 | |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
117 // renders char to a big per-object buffer where alpha and bitmap are separated |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
118 static void draw_alpha_buf(mp_osd_obj_t* obj, int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride) |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
119 { |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
120 int dststride = obj->stride; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
121 int dstskip = obj->stride-w; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
122 int srcskip = stride-w; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
123 int i, j; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
124 unsigned char *b = obj->bitmap_buffer + (y0-obj->bbox.y1)*dststride + (x0-obj->bbox.x1); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
125 unsigned char *a = obj->alpha_buffer + (y0-obj->bbox.y1)*dststride + (x0-obj->bbox.x1); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
126 unsigned char *bs = src; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
127 unsigned char *as = srca; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
128 |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
129 if (x0 < obj->bbox.x1 || x0+w > obj->bbox.x2 || y0 < obj->bbox.y1 || y0+h > obj->bbox.y2) { |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
130 fprintf(stderr, "osd text out of range: bbox [%d %d %d %d], txt [%d %d %d %d]\n", |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
131 obj->bbox.x1, obj->bbox.x2, obj->bbox.y1, obj->bbox.y2, |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
132 x0, x0+w, y0, y0+h); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
133 return; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
134 } |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
135 |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
136 for (i = 0; i < h; i++) { |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
137 for (j = 0; j < w; j++, b++, a++, bs++, as++) { |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
138 if (*b < *bs) *b = *bs; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
139 if (*as) { |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
140 if (*a == 0 || *a > *as) *a = *as; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
141 } |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
142 } |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
143 b+= dstskip; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
144 a+= dstskip; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
145 bs+= srcskip; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
146 as+= srcskip; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
147 } |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
148 } |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
149 |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
150 // allocates/enlarges the alpha/bitmap buffer |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
151 static void alloc_buf(mp_osd_obj_t* obj) |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
152 { |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
153 int len; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
154 if (obj->bbox.x2 < obj->bbox.x1) obj->bbox.x2 = obj->bbox.x1; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
155 if (obj->bbox.y2 < obj->bbox.y1) obj->bbox.y2 = obj->bbox.y1; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
156 obj->stride = ((obj->bbox.x2-obj->bbox.x1)+7)&(~7); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
157 len = obj->stride*(obj->bbox.y2-obj->bbox.y1); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
158 if (obj->allocated<len) { |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
159 obj->allocated = len; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
160 free(obj->bitmap_buffer); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
161 free(obj->alpha_buffer); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
162 obj->bitmap_buffer = (unsigned char *)memalign(16, len); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
163 obj->alpha_buffer = (unsigned char *)memalign(16, len); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
164 } |
8617
6ffbe7608013
Me: -sub-bg-* would be nicer. "Background" is usually shortened as "bg", not "bkg".
rathann
parents:
8601
diff
changeset
|
165 memset(obj->bitmap_buffer, sub_bg_color, len); |
6ffbe7608013
Me: -sub-bg-* would be nicer. "Background" is usually shortened as "bg", not "bkg".
rathann
parents:
8601
diff
changeset
|
166 memset(obj->alpha_buffer, sub_bg_alpha, len); |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
167 } |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
168 |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
169 // renders the buffer |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
170 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)){ |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
171 if (obj->allocated > 0) { |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
172 draw_alpha(obj->bbox.x1,obj->bbox.y1, |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
173 obj->bbox.x2-obj->bbox.x1, |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
174 obj->bbox.y2-obj->bbox.y1, |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
175 obj->bitmap_buffer, |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
176 obj->alpha_buffer, |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
177 obj->stride); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
178 } |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
179 } |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
180 |
21582
239f2c145b2f
Mark utf8_get_char parameter as const and fix a compiler warning
reimar
parents:
21581
diff
changeset
|
181 unsigned utf8_get_char(const char **str) { |
239f2c145b2f
Mark utf8_get_char parameter as const and fix a compiler warning
reimar
parents:
21581
diff
changeset
|
182 const uint8_t *strp = (const uint8_t *)*str; |
19366 | 183 unsigned c; |
184 GET_UTF8(c, *strp++, goto no_utf8;); | |
21582
239f2c145b2f
Mark utf8_get_char parameter as const and fix a compiler warning
reimar
parents:
21581
diff
changeset
|
185 *str = (const char *)strp; |
18717 | 186 return c; |
187 | |
188 no_utf8: | |
21582
239f2c145b2f
Mark utf8_get_char parameter as const and fix a compiler warning
reimar
parents:
21581
diff
changeset
|
189 strp = (const uint8_t *)*str; |
18717 | 190 c = *strp++; |
21582
239f2c145b2f
Mark utf8_get_char parameter as const and fix a compiler warning
reimar
parents:
21581
diff
changeset
|
191 *str = (const char *)strp; |
18717 | 192 return c; |
193 } | |
194 | |
5640 | 195 inline static void vo_update_text_osd(mp_osd_obj_t* obj,int dxs,int dys){ |
21582
239f2c145b2f
Mark utf8_get_char parameter as const and fix a compiler warning
reimar
parents:
21581
diff
changeset
|
196 const char *cp=vo_osd_text; |
5640 | 197 int x=20; |
5664 | 198 int h=0; |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
199 int font; |
5640 | 200 |
201 obj->bbox.x1=obj->x=x; | |
202 obj->bbox.y1=obj->y=10; | |
202 | 203 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
204 while (*cp){ |
18717 | 205 uint16_t c=utf8_get_char(&cp); |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
206 render_one_glyph(vo_font, c); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
207 x+=vo_font->width[c]+vo_font->charspace; |
5664 | 208 h=get_height(c,h); |
5640 | 209 } |
210 | |
5664 | 211 obj->bbox.x2=x-vo_font->charspace; |
212 obj->bbox.y2=obj->bbox.y1+h; | |
5640 | 213 obj->flags|=OSDFLAG_BBOX; |
214 | |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
215 alloc_buf(obj); |
5640 | 216 |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
217 cp=vo_osd_text; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
218 x = obj->x; |
5640 | 219 while (*cp){ |
18717 | 220 uint16_t c=utf8_get_char(&cp); |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
221 if ((font=vo_font->font[c])>=0) |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
222 draw_alpha_buf(obj,x,obj->y, |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
223 vo_font->width[c], |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
224 vo_font->pic_a[font]->h, |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
225 vo_font->pic_b[font]->bmp+vo_font->start[c], |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
226 vo_font->pic_a[font]->bmp+vo_font->start[c], |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
227 vo_font->pic_a[font]->w); |
213 | 228 x+=vo_font->width[c]+vo_font->charspace; |
229 } | |
218 | 230 } |
231 | |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
25851
diff
changeset
|
232 #ifdef CONFIG_DVDNAV |
21219 | 233 void osd_set_nav_box (uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey) { |
234 nav_hl.sx = sx; | |
235 nav_hl.sy = sy; | |
236 nav_hl.ex = ex; | |
237 nav_hl.ey = ey; | |
238 } | |
239 | |
28255
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
240 inline static void vo_update_nav (mp_osd_obj_t *obj, int dxs, int dys, int left_border, int top_border, |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
241 int right_border, int bottom_border, int orig_w, int orig_h) { |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
242 int len; |
28255
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
243 int sx = nav_hl.sx, sy = nav_hl.sy; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
244 int ex = nav_hl.ex, ey = nav_hl.ey; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
245 int scaled_w = dxs - left_border - right_border; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
246 int scaled_h = dys - top_border - bottom_border; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
247 if (scaled_w != orig_w) { |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
248 sx = sx * scaled_w / orig_w; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
249 ex = ex * scaled_w / orig_w; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
250 } |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
251 if (scaled_h != orig_h) { |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
252 sy = sy * scaled_h / orig_h; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
253 ey = ey * scaled_h / orig_h; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
254 } |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
255 sx += left_border; ex += left_border; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
256 sy += top_border; ey += top_border; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
257 sx = FFMIN(FFMAX(sx, 0), dxs); |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
258 ex = FFMIN(FFMAX(ex, 0), dxs); |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
259 sy = FFMIN(FFMAX(sy, 0), dys); |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
260 ey = FFMIN(FFMAX(ey, 0), dys); |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
261 |
28255
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
262 obj->bbox.x1 = obj->x = sx; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
263 obj->bbox.y1 = obj->y = sy; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
264 obj->bbox.x2 = ex; |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
265 obj->bbox.y2 = ey; |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
266 |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
267 alloc_buf (obj); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
268 len = obj->stride * (obj->bbox.y2 - obj->bbox.y1); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
269 memset (obj->bitmap_buffer, OSD_NAV_BOX_ALPHA, len); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
270 memset (obj->alpha_buffer, OSD_NAV_BOX_ALPHA, len); |
21364
d81ffbf9615f
EMISSINGBRAIN: No, OSD objects of size 0 sure are _not_ visible.
reimar
parents:
21219
diff
changeset
|
271 obj->flags |= OSDFLAG_BBOX | OSDFLAG_CHANGED; |
d81ffbf9615f
EMISSINGBRAIN: No, OSD objects of size 0 sure are _not_ visible.
reimar
parents:
21219
diff
changeset
|
272 if (obj->bbox.y2 > obj->bbox.y1 && obj->bbox.x2 > obj->bbox.x1) |
d81ffbf9615f
EMISSINGBRAIN: No, OSD objects of size 0 sure are _not_ visible.
reimar
parents:
21219
diff
changeset
|
273 obj->flags |= OSDFLAG_VISIBLE; |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
274 } |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
275 #endif |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
276 |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
277 #ifdef CONFIG_TV_TELETEXT |
23903 | 278 // renders char to a big per-object buffer where alpha and bitmap are separated |
279 static void tt_draw_alpha_buf(mp_osd_obj_t* obj, int x0,int y0, int w,int h, unsigned char* src, int stride,int fg,int bg,int alpha) | |
280 { | |
281 int dststride = obj->stride; | |
282 int dstskip = obj->stride-w; | |
283 int srcskip = stride-w; | |
284 int i, j; | |
285 unsigned char *b = obj->bitmap_buffer + (y0-obj->bbox.y1)*dststride + (x0-obj->bbox.x1); | |
286 unsigned char *a = obj->alpha_buffer + (y0-obj->bbox.y1)*dststride + (x0-obj->bbox.x1); | |
287 unsigned char *bs = src; | |
288 if (x0 < obj->bbox.x1 || x0+w > obj->bbox.x2 || y0 < obj->bbox.y1 || y0+h > obj->bbox.y2) { | |
289 mp_msg(MSGT_OSD,MSGL_ERR,"tt osd text out of range: bbox [%d %d %d %d], txt [%d %d %d %d]\n", | |
290 obj->bbox.x1, obj->bbox.x2, obj->bbox.y1, obj->bbox.y2, | |
291 x0, x0+w, y0, y0+h); | |
292 return; | |
293 } | |
294 for (i = 0; i < h; i++) { | |
295 for (j = 0; j < w; j++, b++, a++, bs++) { | |
296 *b=(fg-bg)*(*bs)/255+bg; | |
297 *a=alpha; | |
298 } | |
299 b+= dstskip; | |
300 a+= dstskip; | |
301 bs+= srcskip; | |
302 } | |
303 } | |
304 inline static void vo_update_text_teletext(mp_osd_obj_t *obj, int dxs, int dys) | |
305 { | |
24292
ca146808e926
Proper support for flashing chars in teletext pages.
voroshil
parents:
24046
diff
changeset
|
306 int h=0,w=0,i,j,font,flashon; |
23903 | 307 int wm,hm; |
308 int color; | |
309 int x,y,x0,y0; | |
310 int cols,rows; | |
311 int wm12; | |
312 int hm13; | |
313 int hm23; | |
314 int start_row,max_rows; | |
315 int b,ax[6],ay[6],aw[6],ah[6]; | |
316 tt_char tc; | |
317 tt_char* tdp=vo_osd_teletext_page; | |
318 unsigned char colors[8]={1,85,150,226,70,105,179,254}; | |
319 unsigned char* buf[9]; | |
320 | |
321 obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; | |
322 if (!tdp || !vo_osd_teletext_mode) { | |
323 obj->flags&=~OSDFLAG_VISIBLE; | |
324 return; | |
325 } | |
24292
ca146808e926
Proper support for flashing chars in teletext pages.
voroshil
parents:
24046
diff
changeset
|
326 flashon=(GetTimer()/1000000)%2; |
23903 | 327 switch(vo_osd_teletext_half){ |
328 case TT_ZOOM_TOP_HALF: | |
329 start_row=0; | |
330 max_rows=VBI_ROWS/2; | |
331 break; | |
332 case TT_ZOOM_BOTTOM_HALF: | |
333 start_row=VBI_ROWS/2; | |
334 max_rows=VBI_ROWS/2; | |
335 break; | |
336 default: | |
337 start_row=0; | |
338 max_rows=VBI_ROWS; | |
339 break; | |
340 } | |
341 wm=0; | |
342 for(i=start_row;i<max_rows;i++){ | |
343 for(j=0;j<VBI_COLUMNS;j++){ | |
344 tc=tdp[i*VBI_COLUMNS+j]; | |
345 if(!tc.ctl && !tc.gfx) | |
346 { | |
347 render_one_glyph(vo_font, tc.unicode); | |
348 if (wm<vo_font->width[tc.unicode]) | |
349 wm=vo_font->width[tc.unicode]; | |
350 } | |
351 } | |
352 } | |
353 | |
354 hm=vo_font->height+1; | |
355 wm=dxs*hm*max_rows/(dys*VBI_COLUMNS); | |
356 | |
357 //very simple teletext font auto scaling | |
358 if(!vo_osd_teletext_scale && hm*(max_rows+1)>dys){ | |
359 text_font_scale_factor*=1.0*(dys)/((max_rows+1)*hm); | |
360 force_load_font=1; | |
361 vo_osd_teletext_scale=text_font_scale_factor; | |
362 obj->flags&=~OSDFLAG_VISIBLE; | |
363 return; | |
364 } | |
365 | |
366 cols=dxs/wm; | |
367 rows=dys/hm; | |
368 | |
369 if(cols>VBI_COLUMNS) | |
370 cols=VBI_COLUMNS; | |
371 if(rows>max_rows) | |
372 rows=max_rows; | |
373 w=cols*wm-vo_font->charspace; | |
374 h=rows*hm-vo_font->charspace; | |
375 | |
376 if(w<dxs) | |
377 x0=(dxs-w)/2; | |
378 else | |
379 x0=0; | |
380 if(h<dys) | |
381 y0=(dys-h)/2; | |
382 else | |
383 y0=0; | |
384 | |
385 wm12=wm>>1; | |
386 hm13=(hm+1)/3; | |
387 hm23=hm13<<1; | |
388 | |
389 for(i=0;i<6;i+=2){ | |
390 ax[i+0]=0; | |
391 aw[i+0]=wm12; | |
392 | |
393 ax[i+1]=wm12; | |
394 aw[i+1]=wm-wm12; | |
395 } | |
396 | |
397 for(i=0;i<2;i++){ | |
398 ay[i+0]=0; | |
399 ah[i+0]=hm13; | |
400 | |
401 ay[i+2]=hm13; | |
402 ah[i+2]=hm-hm23; | |
403 | |
404 ay[i+4]=hm-hm13; | |
405 ah[i+4]=hm13; | |
406 } | |
407 | |
408 obj->x = 0; | |
409 obj->y = 0; | |
410 obj->bbox.x1 = x0; | |
411 obj->bbox.y1 = y0; | |
412 obj->bbox.x2 = x0+w; | |
413 obj->bbox.y2 = y0+h; | |
414 obj->flags |= OSDFLAG_BBOX; | |
415 alloc_buf(obj); | |
416 | |
417 for(i=0;i<9;i++) | |
418 buf[i]=malloc(wm*hm); | |
419 | |
420 //alpha | |
421 if(vo_osd_teletext_format==TT_FORMAT_OPAQUE ||vo_osd_teletext_format==TT_FORMAT_OPAQUE_INV) | |
422 color=1; | |
423 else | |
424 color=200; | |
425 memset(buf[8],color,wm*hm); | |
426 //colors | |
427 if(vo_osd_teletext_format==TT_FORMAT_OPAQUE ||vo_osd_teletext_format==TT_FORMAT_TRANSPARENT){ | |
428 for(i=0;i<8;i++){ | |
429 memset(buf[i],(unsigned char)(1.0*(255-color)*colors[i]/255),wm*hm); | |
430 } | |
431 }else{ | |
432 for(i=0;i<8;i++) | |
433 memset(buf[i],(unsigned char)(1.0*(255-color)*colors[7-i]/255),wm*hm); | |
434 } | |
435 | |
436 y=y0; | |
437 for(i=0;i<rows;i++){ | |
438 x=x0; | |
439 for(j=0;j<cols;j++){ | |
440 tc=tdp[(i+start_row)*VBI_COLUMNS+j]; | |
24344 | 441 if (tc.hidden) { x+=wm; continue;} |
24292
ca146808e926
Proper support for flashing chars in teletext pages.
voroshil
parents:
24046
diff
changeset
|
442 if(!tc.gfx || (tc.flh && !flashon)){ |
23903 | 443 /* Rendering one text character */ |
444 draw_alpha_buf(obj,x,y,wm,hm,buf[tc.bg],buf[8],wm); | |
445 if(tc.unicode!=0x20 && tc.unicode!=0x00 && !tc.ctl && | |
24292
ca146808e926
Proper support for flashing chars in teletext pages.
voroshil
parents:
24046
diff
changeset
|
446 (!tc.flh || flashon) && |
23903 | 447 (font=vo_font->font[tc.unicode])>=0 && y+hm<dys){ |
448 tt_draw_alpha_buf(obj,x,y,vo_font->width[tc.unicode],vo_font->height, | |
449 vo_font->pic_b[font]->bmp+vo_font->start[tc.unicode]-vo_font->charspace*vo_font->pic_a[font]->w, | |
450 vo_font->pic_b[font]->w, | |
451 buf[tc.fg][0],buf[tc.bg][0],buf[8][0]); | |
452 } | |
453 }else{ | |
454 /* | |
455 Rendering one graphics character | |
456 TODO: support for separated graphics symbols (where six rectangles does not touch each other) | |
457 | |
458 +--+ +--+ 87654321 | |
459 |01| |12| -------- | |
460 |10| <= |34| <= 00100110 <= 0x26 | |
461 |01| |56| | |
462 +--+ +--+ | |
463 | |
464 (0:wm/2) (wm/2:wm-wm/2) | |
465 | |
466 ********** *********** (0:hm/3) | |
467 *** **** **** **** | |
468 *** 1 **** **** 2 **** | |
469 *** **** **** **** | |
470 ********** *********** | |
471 ********** *********** | |
472 | |
473 ********** *********** (hm/3:hm-2*hm/3) | |
474 ********** *********** | |
475 *** **** **** **** | |
476 *** 3 **** **** 4 **** | |
477 *** **** **** **** | |
478 ********** *********** | |
479 ********** *********** | |
480 ********** *********** | |
481 | |
482 ********** *********** (hm-hm/3:hm/3) | |
483 *** **** **** **** | |
484 *** 5 **** **** 6 **** | |
485 *** **** **** **** | |
486 ********** *********** | |
487 ********** *********** | |
488 | |
489 */ | |
490 if(tc.gfx>1){ //separated gfx | |
491 for(b=0;b<6;b++){ | |
492 color=(tc.unicode>>b)&1?tc.fg:tc.bg; | |
493 draw_alpha_buf(obj,x+ax[b]+1,y+ay[b]+1,aw[b]-2,ah[b]-2,buf[color],buf[8],wm); | |
494 } | |
495 //separated gfx (background borders) | |
496 //vertical | |
497 draw_alpha_buf(obj,x ,y,1,hm,buf[tc.bg],buf[8],wm); | |
498 draw_alpha_buf(obj,x+ax[1]-1,y,2,hm,buf[tc.bg],buf[8],wm); | |
499 draw_alpha_buf(obj,x+ax[1]+aw[1]-1,y,wm-ax[1]-aw[1]+1,hm,buf[tc.bg],buf[8],wm); | |
500 //horizontal | |
501 draw_alpha_buf(obj,x,y ,wm,1,buf[tc.bg],buf[8],wm); | |
502 draw_alpha_buf(obj,x,y+ay[0]+ah[0]-1,wm,2,buf[tc.bg],buf[8],wm); | |
503 draw_alpha_buf(obj,x,y+ay[2]+ah[2]-1,wm,2,buf[tc.bg],buf[8],wm); | |
504 draw_alpha_buf(obj,x,y+ay[4]+ah[4]-1,wm,hm-ay[4]-ah[4]+1,buf[tc.bg],buf[8],wm); | |
505 }else{ | |
506 for(b=0;b<6;b++){ | |
507 color=(tc.unicode>>b)&1?tc.fg:tc.bg; | |
508 draw_alpha_buf(obj,x+ax[b],y+ay[b],aw[b],ah[b],buf[color],buf[8],wm); | |
509 } | |
510 } | |
511 } | |
512 x+=wm; | |
513 } | |
514 y+=hm; | |
515 } | |
516 for(i=0;i<9;i++) | |
517 free(buf[i]); | |
518 } | |
519 #endif | |
520 | |
218 | 521 int vo_osd_progbar_type=-1; |
1726 | 522 int vo_osd_progbar_value=100; // 0..256 |
523 | |
524 // if we have n=256 bars then OSD progbar looks like below | |
525 // | |
1878 | 526 // 0 1 2 3 ... 256 <= vo_osd_progbar_value |
527 // | | | | | | |
1726 | 528 // [ === === === ... === ] |
529 // | |
530 // the above schema is rescalled to n=elems bars | |
218 | 531 |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
532 inline static void vo_update_text_progbar(mp_osd_obj_t* obj,int dxs,int dys){ |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
533 |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
534 obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
535 |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
536 if(vo_osd_progbar_type<0 || !vo_font){ |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
537 obj->flags&=~OSDFLAG_VISIBLE; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
538 return; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
539 } |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
540 |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
541 render_one_glyph(vo_font, OSD_PB_START); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
542 render_one_glyph(vo_font, OSD_PB_END); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
543 render_one_glyph(vo_font, OSD_PB_0); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
544 render_one_glyph(vo_font, OSD_PB_1); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
545 render_one_glyph(vo_font, vo_osd_progbar_type); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
546 |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
547 // calculate bbox corners: |
5664 | 548 { int h=0; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
549 int y=(dys-vo_font->height)/2; |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
550 int delimw=vo_font->width[OSD_PB_START] |
1549 | 551 +vo_font->width[OSD_PB_END] |
552 +vo_font->charspace; | |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
553 int width=(2*dxs-3*delimw)/3; |
1549 | 554 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
|
555 int elems=width/charw; |
1549 | 556 int x=(dxs-elems*charw-delimw)/2; |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
557 int delta = 0; |
5664 | 558 h=get_height(OSD_PB_START,h); |
559 h=get_height(OSD_PB_END,h); | |
560 h=get_height(OSD_PB_0,h); | |
561 h=get_height(OSD_PB_1,h); | |
8422 | 562 if (vo_osd_progbar_type>0 && vo_font->font[vo_osd_progbar_type]>=0){ |
563 delta = vo_font->width[vo_osd_progbar_type]+vo_font->spacewidth; | |
564 delta = (x-delta > 0) ? delta : x; | |
565 h=get_height(vo_osd_progbar_type,h); | |
566 } | |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
567 obj->bbox.x1=obj->x=x; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
568 obj->bbox.y1=obj->y=y; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
569 obj->bbox.x2=x+width+delimw; |
5664 | 570 obj->bbox.y2=y+h; //vo_font->height; |
5640 | 571 obj->flags|=OSDFLAG_BBOX; |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
572 obj->params.progbar.elems=elems; |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
573 obj->bbox.x1-=delta; // space for an icon |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
574 } |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
575 |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
576 alloc_buf(obj); |
8794 | 577 |
578 { | |
579 int minw = vo_font->width[OSD_PB_START]+vo_font->width[OSD_PB_END]+vo_font->width[OSD_PB_0]; | |
580 if (vo_osd_progbar_type>0 && vo_font->font[vo_osd_progbar_type]>=0){ | |
581 minw += vo_font->width[vo_osd_progbar_type]+vo_font->charspace+vo_font->spacewidth; | |
582 } | |
583 if (obj->bbox.x2 - obj->bbox.x1 < minw) return; // space too small, don't render anything | |
584 } | |
585 | |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
586 // render it: |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
587 { unsigned char *s; |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
588 unsigned char *sa; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
589 int i,w,h,st,mark; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
590 int x=obj->x; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
591 int y=obj->y; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
592 int c,font; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
593 int charw=vo_font->width[OSD_PB_0]+vo_font->charspace; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
594 int elems=obj->params.progbar.elems; |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
595 |
1726 | 596 if (vo_osd_progbar_value<=0) |
597 mark=0; | |
1878 | 598 else { |
599 int ev=vo_osd_progbar_value*elems; | |
600 mark=ev>>8; | |
601 if (ev & 0xFF) mark++; | |
602 if (mark>elems) mark=elems; | |
603 } | |
604 | |
1727 | 605 |
218 | 606 // printf("osd.progbar width=%d xpos=%d\n",width,x); |
607 | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
608 c=vo_osd_progbar_type; |
1569
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
609 if(vo_osd_progbar_type>0 && (font=vo_font->font[c])>=0) { |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
610 int xp=x-vo_font->width[c]-vo_font->spacewidth; |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
611 draw_alpha_buf(obj,(xp<0?0:xp),y, |
218 | 612 vo_font->width[c], |
613 vo_font->pic_a[font]->h, | |
614 vo_font->pic_b[font]->bmp+vo_font->start[c], | |
615 vo_font->pic_a[font]->bmp+vo_font->start[c], | |
616 vo_font->pic_a[font]->w); | |
1569
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
617 } |
fcbfc99cf8e6
skip lines with negative y position if there is too many lines to display
atlka
parents:
1549
diff
changeset
|
618 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
619 c=OSD_PB_START; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
620 if ((font=vo_font->font[c])>=0) |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
621 draw_alpha_buf(obj,x,y, |
218 | 622 vo_font->width[c], |
623 vo_font->pic_a[font]->h, | |
624 vo_font->pic_b[font]->bmp+vo_font->start[c], | |
625 vo_font->pic_a[font]->bmp+vo_font->start[c], | |
626 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
|
627 x+=vo_font->width[c]+vo_font->charspace; |
218 | 628 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
629 c=OSD_PB_0; |
1602 | 630 if ((font=vo_font->font[c])>=0){ |
631 w=vo_font->width[c]; | |
632 h=vo_font->pic_a[font]->h; | |
633 s=vo_font->pic_b[font]->bmp+vo_font->start[c]; | |
634 sa=vo_font->pic_a[font]->bmp+vo_font->start[c]; | |
635 st=vo_font->pic_a[font]->w; | |
2204 | 636 if ((i=mark)) do { |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
637 draw_alpha_buf(obj,x,y,w,h,s,sa,st); |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
638 x+=charw; |
2204 | 639 } while(--i); |
1602 | 640 } |
202 | 641 |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
642 c=OSD_PB_1; |
1602 | 643 if ((font=vo_font->font[c])>=0){ |
644 w=vo_font->width[c]; | |
645 h=vo_font->pic_a[font]->h; | |
646 s =vo_font->pic_b[font]->bmp+vo_font->start[c]; | |
647 sa=vo_font->pic_a[font]->bmp+vo_font->start[c]; | |
648 st=vo_font->pic_a[font]->w; | |
2204 | 649 if ((i=elems-mark)) do { |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
650 draw_alpha_buf(obj,x,y,w,h,s,sa,st); |
1548
eee7951a23af
changes according to proper subfont bar positioning and char spaceing - sub.c
atlka
parents:
1524
diff
changeset
|
651 x+=charw; |
2204 | 652 } while(--i); |
1602 | 653 } |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
654 |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
655 c=OSD_PB_END; |
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
656 if ((font=vo_font->font[c])>=0) |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
657 draw_alpha_buf(obj,x,y, |
218 | 658 vo_font->width[c], |
659 vo_font->pic_a[font]->h, | |
660 vo_font->pic_b[font]->bmp+vo_font->start[c], | |
661 vo_font->pic_a[font]->bmp+vo_font->start[c], | |
662 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
|
663 // 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
|
664 |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
665 } |
218 | 666 // vo_osd_progbar_value=(vo_osd_progbar_value+1)&0xFF; |
667 | |
668 } | |
669 | |
254 | 670 subtitle* vo_sub=NULL; |
218 | 671 |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
672 inline static void vo_update_text_sub(mp_osd_obj_t* obj,int dxs,int dys){ |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
673 unsigned char *t; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
674 int c,i,j,l,x,y,font,prevc,counter; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
675 int k; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
676 int lastStripPosition; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
677 int xsize; |
5640 | 678 int xmin=dxs,xmax=0; |
1591 | 679 int h,lasth; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
680 int xtblc, utblc; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
681 |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
682 obj->flags|=OSDFLAG_CHANGED|OSDFLAG_VISIBLE; |
7628
d6608342591d
This patch adds the functionality to disable/enable subtitles while playing
arpi
parents:
7121
diff
changeset
|
683 |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
684 if(!vo_sub || !sub_font || !sub_visibility || (sub_font->font[40]<0)){ |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
685 obj->flags&=~OSDFLAG_VISIBLE; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
686 return; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
687 } |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
688 |
5664 | 689 obj->bbox.y2=obj->y=dys; |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
690 obj->params.subtitle.lines=0; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
691 |
1602 | 692 // too long lines divide into a smaller ones |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
693 i=k=lasth=0; |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
694 h=sub_font->height; |
1591 | 695 lastStripPosition=-1; |
696 l=vo_sub->lines; | |
697 | |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
698 { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
699 struct osd_text_t *osl, *cp_ott, *tmp_ott, *tmp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
700 struct osd_text_p *otp_sub = NULL, *otp_sub_tmp, // these are used to store the whole sub text osd |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
701 *otp, *tmp_otp, *pmt; // these are used to manage sub text osd coming from a single sub line |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
702 int *char_seq, char_position, xlimit = dxs * sub_width_p / 100, counter; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
703 |
2204 | 704 while (l) { |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
705 xsize = -sub_font->charspace; |
2204 | 706 l--; |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
707 t=vo_sub->text[i++]; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
708 char_position = 0; |
21581 | 709 char_seq = calloc(strlen(t), sizeof(int)); |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
710 |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
711 prevc = -1; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
712 |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
713 otp = NULL; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
714 osl = NULL; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
715 x = 1; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
716 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
717 // reading the subtitle words from vo_sub->text[] |
21580 | 718 while (*t) { |
719 if (sub_utf8) | |
720 c = utf8_get_char(&t); | |
721 else if ((c = *t++) >= 0x80 && sub_unicode) | |
722 c = (c<<8) + *t++; | |
1501
d40f2b686846
changes according to -utf8 option, draw_osd() function added
atlka
parents:
1109
diff
changeset
|
723 if (k==MAX_UCS){ |
21580 | 724 t += strlen(t); // end here |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
725 mp_msg(MSGT_OSD,MSGL_WARN,"\nMAX_UCS exceeded!\n"); |
1591 | 726 } |
2204 | 727 if (!c) c++; // avoid UCS 0 |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
728 render_one_glyph(sub_font, c); |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
729 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
730 if (c == ' ') { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
731 struct osd_text_t *tmp_ott = (struct osd_text_t *) calloc(1, sizeof(struct osd_text_t)); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
732 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
733 if (osl == NULL) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
734 osl = cp_ott = tmp_ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
735 } else { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
736 tmp_ott->prev = cp_ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
737 cp_ott->next = tmp_ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
738 tmp_ott->osd_kerning = |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
739 sub_font->charspace + sub_font->width[' ']; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
740 cp_ott = tmp_ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
741 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
742 tmp_ott->osd_length = xsize; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
743 tmp_ott->text_length = char_position; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
744 tmp_ott->text = (int *) malloc(char_position * sizeof(int)); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
745 for (counter = 0; counter < char_position; ++counter) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
746 tmp_ott->text[counter] = char_seq[counter]; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
747 char_position = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
748 xsize = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
749 prevc = c; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
750 } else { |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
751 int delta_xsize = sub_font->width[c] + sub_font->charspace + kerning(sub_font, prevc, c); |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
752 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
753 if (xsize + delta_xsize <= dxs) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
754 if (!x) x = 1; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
755 prevc = c; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
756 char_seq[char_position++] = c; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
757 xsize += delta_xsize; |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
758 if ((!suboverlap_enabled) && ((font = sub_font->font[c]) >= 0)) { |
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
759 if (sub_font->pic_a[font]->h > h) { |
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
760 h = sub_font->pic_a[font]->h; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
761 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
762 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
763 } else { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
764 if (x) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
765 mp_msg(MSGT_OSD, MSGL_WARN, "\nSubtitle word '%s' too long!\n", t); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
766 x = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
767 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
768 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
769 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
770 }// for len (all words from subtitle line read) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
771 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
772 // osl holds an ordered (as they appear in the lines) chain of the subtitle words |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
773 { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
774 struct osd_text_t *tmp_ott = (struct osd_text_t *) calloc(1, sizeof(struct osd_text_t)); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
775 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
776 if (osl == NULL) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
777 osl = cp_ott = tmp_ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
778 } else { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
779 tmp_ott->prev = cp_ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
780 cp_ott->next = tmp_ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
781 tmp_ott->osd_kerning = |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
782 sub_font->charspace + sub_font->width[' ']; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
783 cp_ott = tmp_ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
784 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
785 tmp_ott->osd_length = xsize; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
786 tmp_ott->text_length = char_position; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
787 tmp_ott->text = (int *) malloc(char_position * sizeof(int)); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
788 for (counter = 0; counter < char_position; ++counter) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
789 tmp_ott->text[counter] = char_seq[counter]; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
790 char_position = 0; |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
791 xsize = -sub_font->charspace; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
792 } |
18716 | 793 free(char_seq); |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
794 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
795 if (osl != NULL) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
796 int value = 0, exit = 0, minimum = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
797 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
798 // otp will contain the chain of the osd subtitle lines coming from the single vo_sub line. |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
799 otp = tmp_otp = (struct osd_text_p *) calloc(1, sizeof(struct osd_text_p)); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
800 tmp_otp->ott = osl; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
801 for (tmp_ott = tmp_otp->ott; exit == 0; ) { |
11297
b4c7de4cfbf2
prevent lockups on words which do not fit on the screen - temporary fix
henry
parents:
11201
diff
changeset
|
802 do { |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
803 value += tmp_ott->osd_kerning + tmp_ott->osd_length; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
804 tmp_ott = tmp_ott->next; |
11297
b4c7de4cfbf2
prevent lockups on words which do not fit on the screen - temporary fix
henry
parents:
11201
diff
changeset
|
805 } while ((tmp_ott != NULL) && (value + tmp_ott->osd_kerning + tmp_ott->osd_length <= xlimit)); |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
806 if (tmp_ott != NULL) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
807 struct osd_text_p *tmp = (struct osd_text_p *) calloc(1, sizeof(struct osd_text_p)); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
808 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
809 tmp_otp->value = value; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
810 tmp_otp->next = tmp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
811 tmp->prev = tmp_otp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
812 tmp_otp = tmp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
813 tmp_otp->ott = tmp_ott; |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
814 value = -2 * sub_font->charspace - sub_font->width[' ']; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
815 } else { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
816 tmp_otp->value = value; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
817 exit = 1; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
818 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
819 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
820 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
821 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
822 #ifdef NEW_SPLITTING |
24595 | 823 // minimum holds the 'sum of the differences in length among the lines', |
824 // a measure of the evenness of the lengths of the lines | |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
825 for (tmp_otp = otp; tmp_otp->next != NULL; tmp_otp = tmp_otp->next) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
826 pmt = tmp_otp->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
827 while (pmt != NULL) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
828 minimum += abs(tmp_otp->value - pmt->value); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
829 pmt = pmt->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
830 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
831 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
832 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
833 if (otp->next != NULL) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
834 int mem1, mem2; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
835 struct osd_text_p *mem, *hold; |
5640 | 836 |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
837 exit = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
838 // until the last word of a line can be moved to the beginning of following line |
24595 | 839 // reducing the 'sum of the differences in length among the lines', it is done |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
840 while (exit == 0) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
841 hold = NULL; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
842 exit = 1; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
843 for (tmp_otp = otp; tmp_otp->next != NULL; tmp_otp = tmp_otp->next) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
844 pmt = tmp_otp->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
845 for (tmp = tmp_otp->ott; tmp->next != pmt->ott; tmp = tmp->next); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
846 if (pmt->value + tmp->osd_length + pmt->ott->osd_kerning <= xlimit) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
847 mem1 = tmp_otp->value; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
848 mem2 = pmt->value; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
849 tmp_otp->value = mem1 - tmp->osd_length - tmp->osd_kerning; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
850 pmt->value = mem2 + tmp->osd_length + pmt->ott->osd_kerning; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
851 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
852 value = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
853 for (mem = otp; mem->next != NULL; mem = mem->next) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
854 pmt = mem->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
855 while (pmt != NULL) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
856 value += abs(mem->value - pmt->value); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
857 pmt = pmt->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
858 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
859 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
860 if (value < minimum) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
861 minimum = value; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
862 hold = tmp_otp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
863 exit = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
864 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
865 tmp_otp->value = mem1; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
866 tmp_otp->next->value = mem2; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
867 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
868 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
869 // merging |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
870 if (exit == 0) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
871 tmp_otp = hold; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
872 pmt = tmp_otp->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
873 for (tmp = tmp_otp->ott; tmp->next != pmt->ott; tmp = tmp->next); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
874 mem1 = tmp_otp->value; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
875 mem2 = pmt->value; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
876 tmp_otp->value = mem1 - tmp->osd_length - tmp->osd_kerning; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
877 pmt->value = mem2 + tmp->osd_length + pmt->ott->osd_kerning; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
878 pmt->ott = tmp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
879 }//~merging |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
880 }//~while(exit == 0) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
881 }//~if(otp->next!=NULL) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
882 #endif |
8534
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
883 |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
884 // adding otp (containing splitted lines) to otp chain |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
885 if (otp_sub == NULL) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
886 otp_sub = otp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
887 for (otp_sub_tmp = otp_sub; otp_sub_tmp->next != NULL; otp_sub_tmp = otp_sub_tmp->next); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
888 } else { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
889 //updating ott chain |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
890 tmp = otp_sub->ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
891 while (tmp->next != NULL) tmp = tmp->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
892 tmp->next = otp->ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
893 otp->ott->prev = tmp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
894 //attaching new subtitle line at the end |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
895 otp_sub_tmp->next = otp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
896 otp->prev = otp_sub_tmp; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
897 do |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
898 otp_sub_tmp = otp_sub_tmp->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
899 while (otp_sub_tmp->next != NULL); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
900 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
901 }//~ if(osl != NULL) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
902 } // while |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
903 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
904 // write lines into utbl |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
905 xtblc = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
906 utblc = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
907 obj->y = dys; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
908 obj->params.subtitle.lines = 0; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
909 for (tmp_otp = otp_sub; tmp_otp != NULL; tmp_otp = tmp_otp->next) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
910 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
911 if ((obj->params.subtitle.lines++) >= MAX_UCSLINES) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
912 break; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
913 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
914 if (h > obj->y) { // out of the screen so end parsing |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
915 obj->y -= lasth - sub_font->height; // correct the y position |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
916 break; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
917 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
918 xsize = tmp_otp->value; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
919 obj->params.subtitle.xtbl[xtblc++] = (dxs - xsize) / 2; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
920 if (xmin > (dxs - xsize) / 2) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
921 xmin = (dxs - xsize) / 2; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
922 if (xmax < (dxs + xsize) / 2) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
923 xmax = (dxs + xsize) / 2; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
924 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
925 tmp = (tmp_otp->next == NULL) ? NULL : tmp_otp->next->ott; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
926 for (tmp_ott = tmp_otp->ott; tmp_ott != tmp; tmp_ott = tmp_ott->next) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
927 for (counter = 0; counter < tmp_ott->text_length; ++counter) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
928 if (utblc > MAX_UCS) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
929 break; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
930 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
931 c = tmp_ott->text[counter]; |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
932 render_one_glyph(sub_font, c); |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
933 obj->params.subtitle.utbl[utblc++] = c; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
934 k++; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
935 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
936 obj->params.subtitle.utbl[utblc++] = ' '; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
937 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
938 obj->params.subtitle.utbl[utblc - 1] = 0; |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
939 obj->y -= sub_font->height; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
940 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
941 if(obj->params.subtitle.lines) |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
942 obj->y = dys - ((obj->params.subtitle.lines - 1) * sub_font->height + sub_font->pic_a[sub_font->font[40]]->h); |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
943 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
944 // free memory |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
945 if (otp_sub != NULL) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
946 for (tmp = otp_sub->ott; tmp->next != NULL; free(tmp->prev)) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
947 free(tmp->text); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
948 tmp = tmp->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
949 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
950 free(tmp->text); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
951 free(tmp); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
952 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
953 for(pmt = otp_sub; pmt->next != NULL; free(pmt->prev)) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
954 pmt = pmt->next; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
955 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
956 free(pmt); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
957 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
958 |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
959 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
960 /// vertical alignment |
8534
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
961 h = dys - obj->y; |
16838
fb79161e09f4
reverse incorrect sub alignment change, ok'd by diego
rfelker
parents:
16834
diff
changeset
|
962 if (sub_alignment == 2) |
8534
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
963 obj->y = dys * sub_pos / 100 - h; |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
964 else if (sub_alignment == 1) |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
965 obj->y = dys * sub_pos / 100 - h / 2; |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
966 else |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
967 obj->y = dys * sub_pos / 100; |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
968 |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
969 if (obj->y < 0) |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
970 obj->y = 0; |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
971 if (obj->y > dys - h) |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
972 obj->y = dys - h; |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
973 |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
974 obj->bbox.y2 = obj->y + h; |
922ce27eb683
This patch adds support for vertical subtitle alignment
arpi
parents:
8451
diff
changeset
|
975 |
5640 | 976 // calculate bbox: |
10263 | 977 if (sub_justify) xmin = 10; |
5640 | 978 obj->bbox.x1=xmin; |
979 obj->bbox.x2=xmax; | |
980 obj->bbox.y1=obj->y; | |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
981 // obj->bbox.y2=obj->y+obj->params.subtitle.lines*sub_font->height; |
5640 | 982 obj->flags|=OSDFLAG_BBOX; |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
983 |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
984 alloc_buf(obj); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
985 |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
986 y = obj->y; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
987 |
13343
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
988 obj->alignment = 0; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
989 switch(vo_sub->alignment) { |
13343
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
990 case SUB_ALIGNMENT_BOTTOMLEFT: |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
991 case SUB_ALIGNMENT_MIDDLELEFT: |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
992 case SUB_ALIGNMENT_TOPLEFT: |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
993 obj->alignment |= 0x1; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
994 break; |
13343
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
995 case SUB_ALIGNMENT_BOTTOMRIGHT: |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
996 case SUB_ALIGNMENT_MIDDLERIGHT: |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
997 case SUB_ALIGNMENT_TOPRIGHT: |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
998 obj->alignment |= 0x2; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
999 break; |
13343
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
1000 case SUB_ALIGNMENT_BOTTOMCENTER: |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
1001 case SUB_ALIGNMENT_MIDDLECENTER: |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
1002 case SUB_ALIGNMENT_TOPCENTER: |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1003 default: |
13343
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12794
diff
changeset
|
1004 obj->alignment |= 0x0; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1005 } |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1006 |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1007 i=j=0; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1008 if ((l = obj->params.subtitle.lines)) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1009 for(counter = dxs; i < l; ++i) |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1010 if (obj->params.subtitle.xtbl[i] < counter) counter = obj->params.subtitle.xtbl[i]; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1011 for (i = 0; i < l; ++i) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1012 switch (obj->alignment&0x3) { |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1013 case 1: |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1014 // left |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1015 x = counter; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1016 break; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1017 case 2: |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1018 // right |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1019 x = 2 * obj->params.subtitle.xtbl[i] - counter - ((obj->params.subtitle.xtbl[i] == counter) ? 0 : 1); |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1020 break; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1021 default: |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1022 //center |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1023 x = obj->params.subtitle.xtbl[i]; |
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1024 } |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1025 prevc = -1; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1026 while ((c=obj->params.subtitle.utbl[j++])){ |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1027 x += kerning(sub_font,prevc,c); |
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1028 if ((font=sub_font->font[c])>=0) |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1029 draw_alpha_buf(obj,x,y, |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1030 sub_font->width[c], |
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1031 sub_font->pic_a[font]->h+y<obj->dys ? sub_font->pic_a[font]->h : obj->dys-y, |
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1032 sub_font->pic_b[font]->bmp+sub_font->start[c], |
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1033 sub_font->pic_a[font]->bmp+sub_font->start[c], |
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1034 sub_font->pic_a[font]->w); |
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1035 x+=sub_font->width[c]+sub_font->charspace; |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1036 prevc = c; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1037 } |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1038 y+=sub_font->height; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
10263
diff
changeset
|
1039 } |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1040 } |
5640 | 1041 |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1042 } |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1043 |
6190
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1044 inline static void vo_update_spudec_sub(mp_osd_obj_t* obj, int dxs, int dys) |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1045 { |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1046 unsigned int bbox[4]; |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1047 spudec_calc_bbox(vo_spudec, dxs, dys, bbox); |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1048 obj->bbox.x1 = bbox[0]; |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1049 obj->bbox.x2 = bbox[1]; |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1050 obj->bbox.y1 = bbox[2]; |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1051 obj->bbox.y2 = bbox[3]; |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1052 obj->flags |= OSDFLAG_BBOX; |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1053 } |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1054 |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1055 inline static void vo_draw_spudec_sub(mp_osd_obj_t* obj, void (*draw_alpha)(int x0, int y0, int w, int h, unsigned char* src, unsigned char* srca, int stride)) |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1056 { |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1057 spudec_draw_scaled(vo_spudec, obj->dxs, obj->dys, draw_alpha); |
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1058 } |
218 | 1059 |
3034
24d3dca4e813
DVD sub patch by Kim Minh Kaplan <kmkaplan@selfoffice.com>
arpi
parents:
2498
diff
changeset
|
1060 void *vo_spudec=NULL; |
4081
9e581ab5e54b
Add vobsub support, suppress conditionnal on USE_DVDREAD.
kmkaplan
parents:
3180
diff
changeset
|
1061 void *vo_vobsub=NULL; |
3034
24d3dca4e813
DVD sub patch by Kim Minh Kaplan <kmkaplan@selfoffice.com>
arpi
parents:
2498
diff
changeset
|
1062 |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
1063 static int draw_alpha_init_flag=0; |
218 | 1064 |
28051 | 1065 void vo_draw_alpha_init(void); |
1109 | 1066 |
7067
b395b1240954
fix dxr3 subtitle handling and add some optimizations
pontscho
parents:
7003
diff
changeset
|
1067 mp_osd_obj_t* vo_osd_list=NULL; |
218 | 1068 |
18950 | 1069 static mp_osd_obj_t* new_osd_obj(int type){ |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1070 mp_osd_obj_t* osd=malloc(sizeof(mp_osd_obj_t)); |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1071 memset(osd,0,sizeof(mp_osd_obj_t)); |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1072 osd->next=vo_osd_list; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1073 vo_osd_list=osd; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1074 osd->type=type; |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1075 osd->alpha_buffer = NULL; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1076 osd->bitmap_buffer = NULL; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1077 osd->allocated = -1; |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1078 return osd; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1079 } |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1080 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
16923
diff
changeset
|
1081 void free_osd_list(void){ |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1082 mp_osd_obj_t* obj=vo_osd_list; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1083 while(obj){ |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1084 mp_osd_obj_t* next=obj->next; |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1085 if (obj->alpha_buffer) free(obj->alpha_buffer); |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1086 if (obj->bitmap_buffer) free(obj->bitmap_buffer); |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1087 free(obj); |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1088 obj=next; |
4081
9e581ab5e54b
Add vobsub support, suppress conditionnal on USE_DVDREAD.
kmkaplan
parents:
3180
diff
changeset
|
1089 } |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1090 vo_osd_list=NULL; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1091 } |
4081
9e581ab5e54b
Add vobsub support, suppress conditionnal on USE_DVDREAD.
kmkaplan
parents:
3180
diff
changeset
|
1092 |
15085
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1093 #define FONT_LOAD_DEFER 6 |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1094 |
28255
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1095 int vo_update_osd_ext(int dxs,int dys, int left_border, int top_border, |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1096 int right_border, int bottom_border, int orig_w, int orig_h){ |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1097 mp_osd_obj_t* obj=vo_osd_list; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1098 int chg=0; |
27393 | 1099 #ifdef CONFIG_FREETYPE |
15085
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1100 static int defer_counter = 0, prev_dxs = 0, prev_dys = 0; |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1101 #endif |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1102 |
27393 | 1103 #ifdef CONFIG_FREETYPE |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1104 // here is the right place to get screen dimensions |
15085
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1105 if (((dxs != vo_image_width) |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1106 && (subtitle_autoscale == 2 || subtitle_autoscale == 3)) |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1107 || ((dys != vo_image_height) |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1108 && (subtitle_autoscale == 1 || subtitle_autoscale == 3))) |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1109 { |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1110 // screen dimensions changed |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1111 // wait a while to avoid useless reloading of the font |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1112 if (dxs == prev_dxs || dys == prev_dys) { |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1113 defer_counter++; |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1114 } else { |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1115 prev_dxs = dxs; |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1116 prev_dys = dys; |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1117 defer_counter = 0; |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1118 } |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1119 if (defer_counter >= FONT_LOAD_DEFER) force_load_font = 1; |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1120 } |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1121 |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1122 if (force_load_font) { |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1123 force_load_font = 0; |
25851
9ebd00825df2
Allow independent scaling of vo_font and sub_font.
reimar
parents:
24595
diff
changeset
|
1124 load_font_ft(dxs, dys, &vo_font, font_name, osd_font_scale_factor); |
23742
93c871be0258
Use -font for subtitles when -subfont is not given, patch by kiriuja
zuxy
parents:
23573
diff
changeset
|
1125 if (sub_font_name) |
25851
9ebd00825df2
Allow independent scaling of vo_font and sub_font.
reimar
parents:
24595
diff
changeset
|
1126 load_font_ft(dxs, dys, &sub_font, sub_font_name, text_font_scale_factor); |
23742
93c871be0258
Use -font for subtitles when -subfont is not given, patch by kiriuja
zuxy
parents:
23573
diff
changeset
|
1127 else |
25851
9ebd00825df2
Allow independent scaling of vo_font and sub_font.
reimar
parents:
24595
diff
changeset
|
1128 load_font_ft(dxs, dys, &sub_font, font_name, text_font_scale_factor); |
15085
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1129 prev_dxs = dxs; |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1130 prev_dys = dys; |
1f8a1de5585c
defer loading of the font after display size change to avoid useless
henry
parents:
15078
diff
changeset
|
1131 defer_counter = 0; |
23338
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1132 } else { |
2a66d95355f0
add new -subfont option, that allows having a different font for OSD (controls and menu) and subtitles
ben
parents:
21582
diff
changeset
|
1133 if (!vo_font) |
25851
9ebd00825df2
Allow independent scaling of vo_font and sub_font.
reimar
parents:
24595
diff
changeset
|
1134 load_font_ft(dxs, dys, &vo_font, font_name, osd_font_scale_factor); |
24582 | 1135 if (!sub_font) { |
23742
93c871be0258
Use -font for subtitles when -subfont is not given, patch by kiriuja
zuxy
parents:
23573
diff
changeset
|
1136 if (sub_font_name) |
25851
9ebd00825df2
Allow independent scaling of vo_font and sub_font.
reimar
parents:
24595
diff
changeset
|
1137 load_font_ft(dxs, dys, &sub_font, sub_font_name, text_font_scale_factor); |
23742
93c871be0258
Use -font for subtitles when -subfont is not given, patch by kiriuja
zuxy
parents:
23573
diff
changeset
|
1138 else |
25851
9ebd00825df2
Allow independent scaling of vo_font and sub_font.
reimar
parents:
24595
diff
changeset
|
1139 load_font_ft(dxs, dys, &sub_font, font_name, text_font_scale_factor); |
24582 | 1140 } |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1141 } |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1142 #endif |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1143 |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1144 while(obj){ |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1145 if(dxs!=obj->dxs || dys!=obj->dys || obj->flags&OSDFLAG_FORCE_UPDATE){ |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1146 int vis=obj->flags&OSDFLAG_VISIBLE; |
5640 | 1147 obj->flags&=~OSDFLAG_BBOX; |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1148 switch(obj->type){ |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
25851
diff
changeset
|
1149 #ifdef CONFIG_DVDNAV |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
1150 case OSDTYPE_DVDNAV: |
28255
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1151 vo_update_nav(obj,dxs,dys, left_border, top_border, right_border, bottom_border, orig_w, orig_h); |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
1152 break; |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
1153 #endif |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1154 case OSDTYPE_SUBTITLE: |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1155 vo_update_text_sub(obj,dxs,dys); |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1156 break; |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
1157 #ifdef CONFIG_TV_TELETEXT |
23903 | 1158 case OSDTYPE_TELETEXT: |
1159 vo_update_text_teletext(obj,dxs,dys); | |
1160 break; | |
1161 #endif | |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1162 case OSDTYPE_PROGBAR: |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1163 vo_update_text_progbar(obj,dxs,dys); |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1164 break; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1165 case OSDTYPE_SPU: |
7628
d6608342591d
This patch adds the functionality to disable/enable subtitles while playing
arpi
parents:
7121
diff
changeset
|
1166 if(sub_visibility && vo_spudec && spudec_visible(vo_spudec)){ |
6190
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1167 vo_update_spudec_sub(obj, dxs, dys); |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1168 obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED; |
6190
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1169 } |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1170 else |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1171 obj->flags&=~OSDFLAG_VISIBLE; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1172 break; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1173 case OSDTYPE_OSD: |
5640 | 1174 if(vo_font && vo_osd_text && vo_osd_text[0]){ |
1175 vo_update_text_osd(obj,dxs,dys); // update bbox | |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1176 obj->flags|=OSDFLAG_VISIBLE|OSDFLAG_CHANGED; |
5640 | 1177 } else |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1178 obj->flags&=~OSDFLAG_VISIBLE; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1179 break; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1180 } |
5640 | 1181 // check bbox: |
1182 if(!(obj->flags&OSDFLAG_BBOX)){ | |
1183 // we don't know, so assume the whole screen changed :( | |
1184 obj->bbox.x1=obj->bbox.y1=0; | |
1185 obj->bbox.x2=dxs; | |
1186 obj->bbox.y2=dys; | |
1187 obj->flags|=OSDFLAG_BBOX; | |
5664 | 1188 } else { |
1189 // check bbox, reduce it if it's out of bounds (corners): | |
1190 if(obj->bbox.x1<0) obj->bbox.x1=0; | |
1191 if(obj->bbox.y1<0) obj->bbox.y1=0; | |
1192 if(obj->bbox.x2>dxs) obj->bbox.x2=dxs; | |
1193 if(obj->bbox.y2>dys) obj->bbox.y2=dys; | |
1194 if(obj->flags&OSDFLAG_VISIBLE) | |
1195 // debug: | |
1196 mp_msg(MSGT_OSD,MSGL_DBG2,"OSD update: %d;%d %dx%d \n", | |
5640 | 1197 obj->bbox.x1,obj->bbox.y1,obj->bbox.x2-obj->bbox.x1, |
1198 obj->bbox.y2-obj->bbox.y1); | |
1199 } | |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1200 // check if visibility changed: |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1201 if(vis != (obj->flags&OSDFLAG_VISIBLE) ) obj->flags|=OSDFLAG_CHANGED; |
5640 | 1202 // remove the cause of automatic update: |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1203 obj->dxs=dxs; obj->dys=dys; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1204 obj->flags&=~OSDFLAG_FORCE_UPDATE; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1205 } |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1206 if(obj->flags&OSDFLAG_CHANGED){ |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1207 chg|=1<<obj->type; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1208 mp_msg(MSGT_OSD,MSGL_DBG2,"OSD chg: %d V: %s pb:%d \n",obj->type,(obj->flags&OSDFLAG_VISIBLE)?"yes":"no",vo_osd_progbar_type); |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1209 } |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1210 obj=obj->next; |
4081
9e581ab5e54b
Add vobsub support, suppress conditionnal on USE_DVDREAD.
kmkaplan
parents:
3180
diff
changeset
|
1211 } |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1212 return chg; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1213 } |
4081
9e581ab5e54b
Add vobsub support, suppress conditionnal on USE_DVDREAD.
kmkaplan
parents:
3180
diff
changeset
|
1214 |
28255
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1215 int vo_update_osd(int dxs, int dys) { |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1216 return vo_update_osd_ext(dxs, dys, 0, 0, 0, 0, dxs, dys); |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1217 } |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1218 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
16923
diff
changeset
|
1219 void vo_init_osd(void){ |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
1220 if(!draw_alpha_init_flag){ |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
1221 draw_alpha_init_flag=1; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
1222 vo_draw_alpha_init(); |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
1223 } |
6110 | 1224 if(vo_osd_list) free_osd_list(); |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1225 // temp hack, should be moved to mplayer/mencoder later |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1226 new_osd_obj(OSDTYPE_OSD); |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1227 new_osd_obj(OSDTYPE_SUBTITLE); |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1228 new_osd_obj(OSDTYPE_PROGBAR); |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1229 new_osd_obj(OSDTYPE_SPU); |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
25851
diff
changeset
|
1230 #ifdef CONFIG_DVDNAV |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
1231 new_osd_obj(OSDTYPE_DVDNAV); |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
1232 #endif |
28586
7c20cc8fda01
The CONFIG_TV_TELETEXT preprocessor directive is defined/undefined,
diego
parents:
28446
diff
changeset
|
1233 #ifdef CONFIG_TV_TELETEXT |
23903 | 1234 new_osd_obj(OSDTYPE_TELETEXT); |
1235 #endif | |
27393 | 1236 #ifdef CONFIG_FREETYPE |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1237 force_load_font = 1; |
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1238 #endif |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1239 } |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
865
diff
changeset
|
1240 |
5642
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1241 int vo_osd_changed_flag=0; |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1242 |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1243 void vo_remove_text(int dxs,int dys,void (*remove)(int x0,int y0, int w,int h)){ |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1244 mp_osd_obj_t* obj=vo_osd_list; |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1245 vo_update_osd(dxs,dys); |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1246 while(obj){ |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1247 if(((obj->flags&OSDFLAG_CHANGED) || (obj->flags&OSDFLAG_VISIBLE)) && |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1248 (obj->flags&OSDFLAG_OLD_BBOX)){ |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1249 int w=obj->old_bbox.x2-obj->old_bbox.x1; |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1250 int h=obj->old_bbox.y2-obj->old_bbox.y1; |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1251 if(w>0 && h>0){ |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1252 vo_osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1253 remove(obj->old_bbox.x1,obj->old_bbox.y1,w,h); |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1254 } |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1255 // obj->flags&=~OSDFLAG_OLD_BBOX; |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1256 } |
5645 | 1257 obj=obj->next; |
5642
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1258 } |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1259 } |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1260 |
28255
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1261 void vo_draw_text_ext(int dxs, int dys, int left_border, int top_border, |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1262 int right_border, int bottom_border, int orig_w, int orig_h, |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1263 void (*draw_alpha)(int x0, int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride)) { |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1264 mp_osd_obj_t* obj=vo_osd_list; |
28255
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1265 vo_update_osd_ext(dxs, dys, left_border, top_border, right_border, bottom_border, orig_w, orig_h); |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1266 while(obj){ |
5642
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1267 if(obj->flags&OSDFLAG_VISIBLE){ |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1268 vo_osd_changed_flag=obj->flags&OSDFLAG_CHANGED; // temp hack |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1269 switch(obj->type){ |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1270 case OSDTYPE_SPU: |
6190
bd6748605681
Bounding box and partial update patch for vob/dvdsub by Hephooey.
atmos4
parents:
6110
diff
changeset
|
1271 vo_draw_spudec_sub(obj, draw_alpha); // FIXME |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1272 break; |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
25851
diff
changeset
|
1273 #ifdef CONFIG_DVDNAV |
21193
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
1274 case OSDTYPE_DVDNAV: |
a067e7e18b50
support for dvdnav menu buttons overlay as simple alpha boxes (rework from Otvos Attila's series of patches)
ben
parents:
19366
diff
changeset
|
1275 #endif |
27370
14c5017f40d2
Change a bunch of video/audio-output-specific preprocessor directives from
diego
parents:
27341
diff
changeset
|
1276 #ifdef CONFIG_TV_TELETEXT |
23903 | 1277 case OSDTYPE_TELETEXT: |
1278 #endif | |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1279 case OSDTYPE_OSD: |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1280 case OSDTYPE_SUBTITLE: |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1281 case OSDTYPE_PROGBAR: |
7121
6abc330b5b32
subtitle/osd cache - pre-render text to a buffer with alpha and bitmap separated
arpi
parents:
7067
diff
changeset
|
1282 vo_draw_text_from_buffer(obj,draw_alpha); |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1283 break; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1284 } |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1285 obj->old_bbox=obj->bbox; |
5642
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1286 obj->flags|=OSDFLAG_OLD_BBOX; |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1287 } |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1288 obj->flags&=~OSDFLAG_CHANGED; |
eb0cb6185e6c
osd: ok, now it's possible to do partial draw/clear of the buffer only if changed
arpi
parents:
5640
diff
changeset
|
1289 obj=obj->next; |
218 | 1290 } |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1291 } |
3034
24d3dca4e813
DVD sub patch by Kim Minh Kaplan <kmkaplan@selfoffice.com>
arpi
parents:
2498
diff
changeset
|
1292 |
28255
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1293 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)) { |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1294 vo_draw_text_ext(dxs, dys, 0, 0, 0, 0, dxs, dys, draw_alpha); |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1295 } |
aeefca2deed3
Change vo_draw_text to a vo_draw_text_ext function which draws DVD navigation
reimar
parents:
28051
diff
changeset
|
1296 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4773
diff
changeset
|
1297 static int vo_osd_changed_status = 0; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4773
diff
changeset
|
1298 |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4773
diff
changeset
|
1299 int vo_osd_changed(int new_value) |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4773
diff
changeset
|
1300 { |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1301 mp_osd_obj_t* obj=vo_osd_list; |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4773
diff
changeset
|
1302 int ret = vo_osd_changed_status; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4773
diff
changeset
|
1303 vo_osd_changed_status = new_value; |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1304 |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1305 while(obj){ |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1306 if(obj->type==new_value) obj->flags|=OSDFLAG_FORCE_UPDATE; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1307 obj=obj->next; |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1308 } |
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1309 |
4807
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4773
diff
changeset
|
1310 return ret; |
156482788caf
osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents:
4773
diff
changeset
|
1311 } |
5638
86663f1b9b00
new osd code, use osd objs to follow changes and do minimal updates
arpi
parents:
5503
diff
changeset
|
1312 |
5645 | 1313 // BBBBBBBBBBBB AAAAAAAAAAAAA BBBBBBBBBBB |
1314 // BBBBBBBBBBBB BBBBBBBBBBBBB | |
1315 // BBBBBBB | |
1316 | |
1317 // return TRUE if we have osd in the specified rectangular area: | |
1318 int vo_osd_check_range_update(int x1,int y1,int x2,int y2){ | |
1319 mp_osd_obj_t* obj=vo_osd_list; | |
1320 while(obj){ | |
1321 if(obj->flags&OSDFLAG_VISIBLE){ | |
1322 if( (obj->bbox.x1<=x2 && obj->bbox.x2>=x1) && | |
21364
d81ffbf9615f
EMISSINGBRAIN: No, OSD objects of size 0 sure are _not_ visible.
reimar
parents:
21219
diff
changeset
|
1323 (obj->bbox.y1<=y2 && obj->bbox.y2>=y1) && |
21443
862b3942429c
100l typo in 21380 disabled OSD with at least xvmc.
reimar
parents:
21364
diff
changeset
|
1324 obj->bbox.y2 > obj->bbox.y1 && obj->bbox.x2 > obj->bbox.x1 |
21364
d81ffbf9615f
EMISSINGBRAIN: No, OSD objects of size 0 sure are _not_ visible.
reimar
parents:
21219
diff
changeset
|
1325 ) return 1; |
5645 | 1326 } |
1327 obj=obj->next; | |
1328 } | |
1329 return 0; | |
1330 } |