Changeset b5b7e051fdc5b5d830fdf49c702e9c199548469d
- Timestamp:
- 05/07/08 18:53:30
(2 months ago)
- Author:
- Rafaël Carré <funman@videolan.org>
- git-committer:
- Rafaël Carré <funman@videolan.org> 1210179210 +0200
- git-parent:
[75f050b3c60cf51ca70de494b8a9e3b7f7b12e02]
- git-author:
- Rafaël Carré <funman@videolan.org> 1210179202 +0200
- Message:
Fix detection of ending of FontBuilder? thread
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| red57b5b |
rb5b7e05 |
|
| 91 | 91 | static char *FontConfig_Select( FcConfig *, const char *, |
|---|
| 92 | 92 | bool, bool, int * ); |
|---|
| 93 | | static int CheckIfFontBuildComplete( filter_t *p_filter ); |
|---|
| | 93 | static int BuildDone( vlc_object_t*, const char *, vlc_value_t, vlc_value_t, |
|---|
| | 94 | void* ); |
|---|
| 94 | 95 | #endif |
|---|
| 95 | 96 | static line_desc_t *NewLine( int ); |
|---|
| … | … | |
| 391 | 392 | var_Create( p_fontbuilder, "build-done", VLC_VAR_BOOL ); |
|---|
| 392 | 393 | var_SetBool( p_fontbuilder, "build-done", false ); |
|---|
| | 394 | var_AddCallback( p_fontbuilder, "build-done", BuildDone, p_sys ); |
|---|
| 393 | 395 | |
|---|
| 394 | 396 | if( vlc_thread_create( p_fontbuilder, |
|---|
| … | … | |
| 472 | 474 | |
|---|
| 473 | 475 | #ifdef HAVE_FONTCONFIG |
|---|
| | 476 | vlc_mutex_t *lock = var_AcquireMutex( "fontbuilder" ); |
|---|
| | 477 | vlc_object_t *p_fontbuilder = vlc_object_find_name( p_filter->p_libvlc, |
|---|
| | 478 | "fontlist builder", FIND_CHILD ); |
|---|
| | 479 | if( p_fontbuilder ) |
|---|
| | 480 | { |
|---|
| | 481 | var_DelCallback( p_fontbuilder, "build-done", BuildDone, p_sys ); |
|---|
| | 482 | vlc_object_release( p_fontbuilder ); |
|---|
| | 483 | } |
|---|
| | 484 | vlc_mutex_unlock( lock ); |
|---|
| | 485 | |
|---|
| 474 | 486 | vlc_mutex_destroy( &p_sys->fontconfig_lock ); |
|---|
| 475 | 487 | |
|---|
| … | … | |
| 518 | 530 | |
|---|
| 519 | 531 | lock = var_AcquireMutex( "fontbuilder" ); |
|---|
| | 532 | |
|---|
| 520 | 533 | var_SetBool( p_this, "build-done", true ); |
|---|
| 521 | 534 | |
|---|
| … | … | |
| 2188 | 2201 | } |
|---|
| 2189 | 2202 | |
|---|
| 2190 | | static int CheckIfFontBuildComplete( filter_t *p_filter ) |
|---|
| 2191 | | { |
|---|
| 2192 | | filter_sys_t *p_sys = p_filter->p_sys; |
|---|
| 2193 | | vlc_object_t *p_fb = vlc_object_find_name( p_filter->p_libvlc, |
|---|
| 2194 | | "fontlist builder", |
|---|
| 2195 | | FIND_CHILD ); |
|---|
| 2196 | | if( p_fb ) |
|---|
| 2197 | | { |
|---|
| 2198 | | vlc_mutex_t *lock = var_AcquireMutex( "fontbuilder" ); |
|---|
| 2199 | | vlc_value_t val; |
|---|
| 2200 | | |
|---|
| 2201 | | if( VLC_SUCCESS == var_Get( p_fb, "build-done", &val )) |
|---|
| 2202 | | { |
|---|
| 2203 | | p_sys->b_fontconfig_ok = val.b_bool; |
|---|
| 2204 | | |
|---|
| 2205 | | if( p_sys->b_fontconfig_ok ) |
|---|
| 2206 | | { |
|---|
| 2207 | | FcInit(); |
|---|
| 2208 | | p_sys->p_fontconfig = FcConfigGetCurrent(); |
|---|
| 2209 | | } |
|---|
| 2210 | | else |
|---|
| 2211 | | msg_Dbg( p_filter, "Font Build still not complete" ); |
|---|
| 2212 | | } |
|---|
| 2213 | | vlc_mutex_unlock( lock ); |
|---|
| 2214 | | vlc_object_release( p_fb ); |
|---|
| 2215 | | |
|---|
| 2216 | | return VLC_SUCCESS; |
|---|
| 2217 | | } |
|---|
| 2218 | | return VLC_EGENERIC; |
|---|
| | 2203 | static int BuildDone( vlc_object_t *p_this, const char *psz_var, |
|---|
| | 2204 | vlc_value_t oldval, vlc_value_t newval, void *param ) |
|---|
| | 2205 | { |
|---|
| | 2206 | (void)p_this; |
|---|
| | 2207 | (void)psz_var; |
|---|
| | 2208 | (void)oldval; |
|---|
| | 2209 | ((filter_sys_t*)param)->b_fontconfig_ok = newval.b_bool; |
|---|
| | 2210 | assert( newval.b_bool ); |
|---|
| | 2211 | return VLC_SUCCESS; |
|---|
| 2219 | 2212 | } |
|---|
| 2220 | 2213 | |
|---|
| … | … | |
| 2434 | 2427 | /* Look for a match amongst our attachments first */ |
|---|
| 2435 | 2428 | CheckForEmbeddedFont( p_sys, &p_face, p_style ); |
|---|
| 2436 | | |
|---|
| 2437 | | if( !p_sys->b_fontconfig_ok ) |
|---|
| 2438 | | { |
|---|
| 2439 | | if( VLC_EGENERIC == CheckIfFontBuildComplete( p_filter )) |
|---|
| 2440 | | msg_Err( p_filter, "Can't find FontBuilder thread!" ); |
|---|
| 2441 | | } |
|---|
| 2442 | 2429 | |
|---|
| 2443 | 2430 | if( ! p_face && p_sys->b_fontconfig_ok ) |
|---|