Gentoo Archives: gentoo-commits

From: "Alexis Ballier (aballier)" <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo commit in src/patchsets/vlc/1.0.1: 500_all_codec-libass-avoid-possible-segfault.patch 510_all_Improved-pre-blending-in-ssa-decoder.patch 520_all_libass-rename-types-to-match-upstream.patch series
Date: Fri, 28 Aug 2009 20:15:47
Message-Id: E1Mfow3-0007a6-6J@stork.gentoo.org
1 aballier 09/08/25 05:51:11
2
3 Modified: series
4 Added: 500_all_codec-libass-avoid-possible-segfault.patch
5 510_all_Improved-pre-blending-in-ssa-decoder.patch
6 520_all_libass-rename-types-to-match-upstream.patch
7 Log:
8 backport fixes from 1.0-bugfix branch for libass 0.9.7
9
10 Revision Changes Path
11 1.3 src/patchsets/vlc/1.0.1/series
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/vlc/1.0.1/series?rev=1.3&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/vlc/1.0.1/series?rev=1.3&content-type=text/plain
15 diff : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/vlc/1.0.1/series?r1=1.2&r2=1.3
16
17 Index: series
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo/src/patchsets/vlc/1.0.1/series,v
20 retrieving revision 1.2
21 retrieving revision 1.3
22 diff -u -r1.2 -r1.3
23 --- series 21 Aug 2009 11:36:25 -0000 1.2
24 +++ series 25 Aug 2009 05:51:10 -0000 1.3
25 @@ -4,3 +4,6 @@
26 300_all_pic.patch
27 310_all_mmx_pic.patch
28 320_all_disable_media_list_player_tests.patch
29 +500_all_codec-libass-avoid-possible-segfault.patch
30 +510_all_Improved-pre-blending-in-ssa-decoder.patch
31 +520_all_libass-rename-types-to-match-upstream.patch
32
33
34
35 1.1 src/patchsets/vlc/1.0.1/500_all_codec-libass-avoid-possible-segfault.patch
36
37 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/vlc/1.0.1/500_all_codec-libass-avoid-possible-segfault.patch?rev=1.1&view=markup
38 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/vlc/1.0.1/500_all_codec-libass-avoid-possible-segfault.patch?rev=1.1&content-type=text/plain
39
40 Index: 500_all_codec-libass-avoid-possible-segfault.patch
41 ===================================================================
42 From 03212d87b4b8ff5a09c80106d1e21e15a9869586 Mon Sep 17 00:00:00 2001
43 From: Anthony Loiseau <thannoy@×××××××××××××××××.com>
44 Date: Tue, 28 Jul 2009 16:46:54 +0200
45 Subject: [PATCH 1/3] codec/libass: avoid possible segfault
46 MIME-Version: 1.0
47 Content-Type: text/plain; charset=UTF-8
48 Content-Transfer-Encoding: 8bit
49
50 dialog_ProgressCreate can return NULL. For this case,
51 only deal with the result if it is not NULL.
52
53 Signed-off-by: Rémi Duraffort <ivoire@××××××××.org>
54 (cherry picked from commit 29e7fc71082c08aec51d438b3d8564e25526b2d1)
55
56 Signed-off-by: Rémi Duraffort <ivoire@××××××××.org>
57 ---
58 modules/codec/libass.c | 12 ++++++++----
59 1 files changed, 8 insertions(+), 4 deletions(-)
60
61 Index: vlc-1.0.1/modules/codec/libass.c
62 ===================================================================
63 --- vlc-1.0.1.orig/modules/codec/libass.c
64 +++ vlc-1.0.1/modules/codec/libass.c
65 @@ -731,7 +731,8 @@ static ass_handle_t *AssHandleHold( deco
66 ass_set_fonts_dir( p_library, psz_font_dir );
67 free( psz_font_dir );
68 #ifdef WIN32
69 - dialog_ProgressSet( p_dialog, NULL, 0.1 );
70 + if( p_dialog )
71 + dialog_ProgressSet( p_dialog, NULL, 0.1 );
72 #endif
73
74 ass_set_extract_fonts( p_library, true );
75 @@ -754,7 +755,8 @@ static ass_handle_t *AssHandleHold( deco
76
77 #ifdef HAVE_FONTCONFIG
78 #ifdef WIN32
79 - dialog_ProgressSet( p_dialog, NULL, 0.2 );
80 + if( p_dialog )
81 + dialog_ProgressSet( p_dialog, NULL, 0.2 );
82 #endif
83 #if defined( LIBASS_VERSION ) && LIBASS_VERSION >= 0x00907000
84 ass_set_fonts( p_renderer, psz_font, psz_family, true, NULL, 1 ); // setup default font/family
85 @@ -762,7 +764,8 @@ static ass_handle_t *AssHandleHold( deco
86 ass_set_fonts( p_renderer, psz_font, psz_family ); // setup default font/family
87 #endif
88 #ifdef WIN32
89 - dialog_ProgressSet( p_dialog, NULL, 1.0 );
90 + if( p_dialog )
91 + dialog_ProgressSet( p_dialog, NULL, 1.0 );
92 #endif
93 #else
94 /* FIXME you HAVE to give him a font if no fontconfig */
95 @@ -781,7 +784,8 @@ static ass_handle_t *AssHandleHold( deco
96 /* */
97 vlc_mutex_unlock( &libass_lock );
98 #ifdef WIN32
99 - dialog_ProgressDestroy( p_dialog );
100 + if( p_dialog )
101 + dialog_ProgressDestroy( p_dialog );
102 #endif
103 return p_ass;
104
105
106
107
108 1.1 src/patchsets/vlc/1.0.1/510_all_Improved-pre-blending-in-ssa-decoder.patch
109
110 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/vlc/1.0.1/510_all_Improved-pre-blending-in-ssa-decoder.patch?rev=1.1&view=markup
111 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/vlc/1.0.1/510_all_Improved-pre-blending-in-ssa-decoder.patch?rev=1.1&content-type=text/plain
112
113 Index: 510_all_Improved-pre-blending-in-ssa-decoder.patch
114 ===================================================================
115 From 80b56ee54500d8755c60f3c75477214c79fd0936 Mon Sep 17 00:00:00 2001
116 From: Laurent Aimar <fenrir@××××××××.org>
117 Date: Sun, 26 Jul 2009 23:26:13 +0200
118 Subject: [PATCH 2/3] Improved pre-blending in ssa decoder.
119 (cherry picked from commit 6456512fc613075a6f9d8638457044c8a4636783)
120
121 ---
122 modules/codec/libass.c | 35 +++++++++++++++++++++++++----------
123 1 files changed, 25 insertions(+), 10 deletions(-)
124
125 Index: vlc-1.0.1/modules/codec/libass.c
126 ===================================================================
127 --- vlc-1.0.1.orig/modules/codec/libass.c
128 +++ vlc-1.0.1/modules/codec/libass.c
129 @@ -591,26 +591,41 @@ static void RegionDraw( subpicture_regio
130 p_img->dst_y < i_y || p_img->dst_y + p_img->h > i_y + i_height )
131 continue;
132
133 - const int r = (p_img->color >> 24)&0xff;
134 - const int g = (p_img->color >> 16)&0xff;
135 - const int b = (p_img->color >> 8)&0xff;
136 - const int a = (p_img->color )&0xff;
137 + const unsigned r = (p_img->color >> 24)&0xff;
138 + const unsigned g = (p_img->color >> 16)&0xff;
139 + const unsigned b = (p_img->color >> 8)&0xff;
140 + const unsigned a = (p_img->color )&0xff;
141 int x, y;
142
143 for( y = 0; y < p_img->h; y++ )
144 {
145 for( x = 0; x < p_img->w; x++ )
146 {
147 - const int alpha = p_img->bitmap[y*p_img->stride+x];
148 - const int an = (255 - a) * alpha / 255;
149 + const unsigned alpha = p_img->bitmap[y*p_img->stride+x];
150 + const unsigned an = (255 - a) * alpha / 255;
151
152 uint8_t *p_rgba = &p->p_pixels[(y+p_img->dst_y-i_y) * p->i_pitch + 4 * (x+p_img->dst_x-i_x)];
153 + const unsigned ao = p_rgba[3];
154
155 /* Native endianness, but RGBA ordering */
156 - p_rgba[0] = ( p_rgba[0] * (255-an) + r * an ) / 255;
157 - p_rgba[1] = ( p_rgba[1] * (255-an) + g * an ) / 255;
158 - p_rgba[2] = ( p_rgba[2] * (255-an) + b * an ) / 255;
159 - p_rgba[3] = 255 - ( 255 - p_rgba[3] ) * ( 255 - an ) / 255;
160 + if( ao == 0 )
161 + {
162 + /* Optimized but the else{} will produce the same result */
163 + p_rgba[0] = r;
164 + p_rgba[1] = g;
165 + p_rgba[2] = b;
166 + p_rgba[3] = an;
167 + }
168 + else
169 + {
170 + p_rgba[3] = 255 - ( 255 - p_rgba[3] ) * ( 255 - an ) / 255;
171 + if( p_rgba[3] != 0 )
172 + {
173 + p_rgba[0] = ( p_rgba[0] * ao * (255-an) / 255 + r * an ) / p_rgba[3];
174 + p_rgba[1] = ( p_rgba[1] * ao * (255-an) / 255 + g * an ) / p_rgba[3];
175 + p_rgba[2] = ( p_rgba[2] * ao * (255-an) / 255 + b * an ) / p_rgba[3];
176 + }
177 + }
178 }
179 }
180 }
181
182
183
184 1.1 src/patchsets/vlc/1.0.1/520_all_libass-rename-types-to-match-upstream.patch
185
186 file : http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/vlc/1.0.1/520_all_libass-rename-types-to-match-upstream.patch?rev=1.1&view=markup
187 plain: http://sources.gentoo.org/viewcvs.py/gentoo/src/patchsets/vlc/1.0.1/520_all_libass-rename-types-to-match-upstream.patch?rev=1.1&content-type=text/plain
188
189 Index: 520_all_libass-rename-types-to-match-upstream.patch
190 ===================================================================
191 From 5eeb2ea4d498043eb73bcc040ad234d85c901f0f Mon Sep 17 00:00:00 2001
192 From: Grigori Goronzy <greg@blackbox>
193 Date: Thu, 6 Aug 2009 23:53:38 +0200
194 Subject: [PATCH 3/3] libass: rename types to match upstream
195
196 Rename types and add compatibility macro for old libass versions.
197
198 Signed-off-by: Laurent Aimar <fenrir@××××××××.org>
199 Signed-off-by: Jean-Baptiste Kempf <jb@××××××××.org>
200
201 Cherry-picked from e8189268e1b1099611657b67800cf10454936af9
202 ---
203 modules/codec/libass.c | 43 +++++++++++++++++++++++++------------------
204 1 files changed, 25 insertions(+), 18 deletions(-)
205
206 Index: vlc-1.0.1/modules/codec/libass.c
207 ===================================================================
208 --- vlc-1.0.1.orig/modules/codec/libass.c
209 +++ vlc-1.0.1/modules/codec/libass.c
210 @@ -48,6 +48,14 @@
211 # include <vlc_charset.h>
212 #endif
213
214 +/* Compatibility with old libass */
215 +#if !defined(LIBASS_VERSION) || LIBASS_VERSION < 0x00907010
216 +# define ASS_Renderer ass_renderer_t
217 +# define ASS_Library ass_library_t
218 +# define ASS_Track ass_track_t
219 +# define ASS_Image ass_image_t
220 +#endif
221 +
222 /*****************************************************************************
223 * Module descriptor
224 *****************************************************************************/
225 @@ -73,13 +81,13 @@ static void UpdateRegions( spu_t *,
226 subpicture_t *, const video_format_t *, mtime_t );
227
228 /* Yes libass sux with threads */
229 -typedef struct
230 +typedef struct
231 {
232 vlc_object_t *p_libvlc;
233
234 int i_refcount;
235 - ass_library_t *p_library;
236 - ass_renderer_t *p_renderer;
237 + ASS_Library *p_library;
238 + ASS_Renderer *p_renderer;
239 video_format_t fmt;
240 } ass_handle_t;
241 static ass_handle_t *AssHandleHold( decoder_t *p_dec );
242 @@ -98,7 +106,7 @@ struct decoder_sys_t
243 ass_handle_t *p_ass;
244
245 /* */
246 - ass_track_t *p_track;
247 + ASS_Track *p_track;
248
249 /* */
250 subpicture_t *p_spu_final;
251 @@ -122,9 +130,9 @@ typedef struct
252 int y1;
253 } rectangle_t;
254
255 -static int BuildRegions( spu_t *p_spu, rectangle_t *p_region, int i_max_region, ass_image_t *p_img_list, int i_width, int i_height );
256 +static int BuildRegions( spu_t *p_spu, rectangle_t *p_region, int i_max_region, ASS_Image *p_img_list, int i_width, int i_height );
257 static void SubpictureReleaseRegions( spu_t *p_spu, subpicture_t *p_subpic );
258 -static void RegionDraw( subpicture_region_t *p_region, ass_image_t *p_img );
259 +static void RegionDraw( subpicture_region_t *p_region, ASS_Image *p_img );
260
261 static vlc_mutex_t libass_lock = VLC_STATIC_MUTEX;
262
263 @@ -137,7 +145,7 @@ static int Create( vlc_object_t *p_this
264 {
265 decoder_t *p_dec = (decoder_t *)p_this;
266 decoder_sys_t *p_sys;
267 - ass_track_t *p_track;
268 + ASS_Track *p_track;
269
270 if( p_dec->fmt_in.i_codec != VLC_FOURCC('s','s','a',' ') )
271 return VLC_EGENERIC;
272 @@ -361,8 +369,8 @@ static void UpdateRegions( spu_t *p_spu,
273 /* */
274 const mtime_t i_stream_date = p_subpic->p_sys->i_pts + (i_ts - p_subpic->i_start);
275 int i_changed;
276 - ass_image_t *p_img = ass_render_frame( p_ass->p_renderer, p_sys->p_track,
277 - i_stream_date/1000, &i_changed );
278 + ASS_Image *p_img = ass_render_frame( p_ass->p_renderer, p_sys->p_track,
279 + i_stream_date/1000, &i_changed );
280
281 if( !i_changed && !b_fmt_changed &&
282 (p_img != NULL) == (p_subpic->p_region != NULL) )
283 @@ -430,7 +438,7 @@ static rectangle_t r_create( int x0, int
284 rectangle_t r = { x0, y0, x1, y1 };
285 return r;
286 }
287 -static rectangle_t r_img( const ass_image_t *p_img )
288 +static rectangle_t r_img( const ASS_Image *p_img )
289 {
290 return r_create( p_img->dst_x, p_img->dst_y, p_img->dst_x+p_img->w, p_img->dst_y+p_img->h );
291 }
292 @@ -451,9 +459,9 @@ static bool r_overlap( const rectangle_t
293 __MAX(a->y0-i_dy, b->y0) < __MIN( a->y1+i_dy, b->y1 );
294 }
295
296 -static int BuildRegions( spu_t *p_spu, rectangle_t *p_region, int i_max_region, ass_image_t *p_img_list, int i_width, int i_height )
297 +static int BuildRegions( spu_t *p_spu, rectangle_t *p_region, int i_max_region, ASS_Image *p_img_list, int i_width, int i_height )
298 {
299 - ass_image_t *p_tmp;
300 + ASS_Image *p_tmp;
301 int i_count;
302
303 VLC_UNUSED(p_spu);
304 @@ -467,7 +475,7 @@ static int BuildRegions( spu_t *p_spu, r
305 if( i_count <= 0 )
306 return 0;
307
308 - ass_image_t **pp_img = calloc( i_count, sizeof(*pp_img) );
309 + ASS_Image **pp_img = calloc( i_count, sizeof(*pp_img) );
310 if( !pp_img )
311 return 0;
312
313 @@ -500,7 +508,7 @@ static int BuildRegions( spu_t *p_spu, r
314 b_ok = false;
315 for( n = 0; n < i_count; n++ )
316 {
317 - ass_image_t *p_img = pp_img[n];
318 + ASS_Image *p_img = pp_img[n];
319 if( !p_img )
320 continue;
321 rectangle_t r = r_img( p_img );
322 @@ -576,7 +584,7 @@ static int BuildRegions( spu_t *p_spu, r
323 return i_region;
324 }
325
326 -static void RegionDraw( subpicture_region_t *p_region, ass_image_t *p_img )
327 +static void RegionDraw( subpicture_region_t *p_region, ASS_Image *p_img )
328 {
329 const plane_t *p = &p_region->p_picture->p[0];
330 const int i_x = p_region->i_x;
331 @@ -655,8 +663,8 @@ static ass_handle_t *AssHandleHold( deco
332 vlc_mutex_lock( &libass_lock );
333
334 ass_handle_t *p_ass = NULL;
335 - ass_library_t *p_library = NULL;
336 - ass_renderer_t *p_renderer = NULL;
337 + ASS_Library *p_library = NULL;
338 + ASS_Renderer *p_renderer = NULL;
339 vlc_value_t val;
340
341 var_Create( p_dec->p_libvlc, "libass-handle", VLC_VAR_ADDRESS );
342 @@ -836,4 +844,3 @@ static void AssHandleRelease( ass_handle
343 vlc_mutex_unlock( &libass_lock );
344 free( p_ass );
345 }
346 -