Commit f25ad01c authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

SSA on Windows: show a progress dialog during font rebuilding.

This is probably not enough to fix all the fontconfig issues.
parent bd3fab66
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <vlc_codec.h> #include <vlc_codec.h>
#include <vlc_osd.h> #include <vlc_osd.h>
#include <vlc_input.h> #include <vlc_input.h>
#include <vlc_dialog.h>
#include <ass/ass.h> #include <ass/ass.h>
...@@ -685,7 +686,12 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec ) ...@@ -685,7 +686,12 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
char *psz_font_dir = NULL; char *psz_font_dir = NULL;
#if defined(WIN32) #if defined(WIN32)
dialog_progress_bar_t *p_dialog = dialog_ProgressCreate( p_dec,
_("Building font cache"),
_( "Please wait while your font cache is rebuild.\n"
"This should take less than a minute." ), NULL );
/* This makes Windows build of VLC hang */ /* This makes Windows build of VLC hang */
const UINT uPath = GetSystemWindowsDirectoryW( NULL, 0 ); const UINT uPath = GetSystemWindowsDirectoryW( NULL, 0 );
if( uPath > 0 ) if( uPath > 0 )
...@@ -705,7 +711,6 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec ) ...@@ -705,7 +711,6 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
} }
} }
#endif #endif
if( !psz_font_dir ) if( !psz_font_dir )
psz_font_dir = config_GetCacheDir(); psz_font_dir = config_GetCacheDir();
...@@ -714,6 +719,9 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec ) ...@@ -714,6 +719,9 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
msg_Dbg( p_dec, "Setting libass fontdir: %s", psz_font_dir ); msg_Dbg( p_dec, "Setting libass fontdir: %s", psz_font_dir );
ass_set_fonts_dir( p_library, psz_font_dir ); ass_set_fonts_dir( p_library, psz_font_dir );
free( psz_font_dir ); free( psz_font_dir );
#ifdef WIN32
dialog_ProgressSet( p_dialog, NULL, 0.1 );
#endif
ass_set_extract_fonts( p_library, true ); ass_set_extract_fonts( p_library, true );
ass_set_style_overrides( p_library, NULL ); ass_set_style_overrides( p_library, NULL );
...@@ -732,8 +740,15 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec ) ...@@ -732,8 +740,15 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
const char *psz_font = NULL; /* We don't ship a default font with VLC */ const char *psz_font = NULL; /* We don't ship a default font with VLC */
const char *psz_family = "Arial"; /* Use Arial if we can't find anything more suitable */ const char *psz_family = "Arial"; /* Use Arial if we can't find anything more suitable */
#ifdef HAVE_FONTCONFIG #ifdef HAVE_FONTCONFIG
#ifdef WIN32
dialog_ProgressSet( p_dialog, NULL, 0.2 );
#endif
ass_set_fonts( p_renderer, psz_font, psz_family ); // setup default font/family ass_set_fonts( p_renderer, psz_font, psz_family ); // setup default font/family
#ifdef WIN32
dialog_ProgressSet( p_dialog, NULL, 1.0 );
#endif
#else #else
/* FIXME you HAVE to give him a font if no fontconfig */ /* FIXME you HAVE to give him a font if no fontconfig */
ass_set_fonts_nofc( p_renderer, psz_font, psz_family ); ass_set_fonts_nofc( p_renderer, psz_font, psz_family );
...@@ -746,6 +761,9 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec ) ...@@ -746,6 +761,9 @@ static ass_handle_t *AssHandleHold( decoder_t *p_dec )
/* */ /* */
vlc_mutex_unlock( &libass_lock ); vlc_mutex_unlock( &libass_lock );
#ifdef WIN32
dialog_ProgressDestroy( p_dialog );
#endif
return p_ass; return p_ass;
error: error:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment