Get the libass provider working on Windows. Requires a valid fontconfig config file (currently not included).

Originally committed to SVN as r4730.
This commit is contained in:
Thomas Goyne 2010-08-10 05:50:14 +00:00
parent e7eba4c00d
commit c8851828cd
3 changed files with 14 additions and 1 deletions

View file

@ -136,6 +136,10 @@
#pragma comment(lib,"libfontconfig.lib") #pragma comment(lib,"libfontconfig.lib")
#endif #endif
#ifdef WITH_LIBASS
#pragma comment(lib, "libass.lib")
#endif
#endif // VisualC #endif // VisualC

View file

@ -63,7 +63,11 @@ extern "C" {
/// ///
static void msg_callback(int level, const char *fmt, va_list args, void *data) { static void msg_callback(int level, const char *fmt, va_list args, void *data) {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), fmt, args); #ifdef _WIN32
vsprintf_s(buf, sizeof(buf), fmt, args);
#else
vsnprintf(buf, sizeof(buf), fmt, args);
#endif
if (level < 2) // warning/error if (level < 2) // warning/error
LOG_I("subtitle/provider/libass") << buf; LOG_I("subtitle/provider/libass") << buf;
@ -105,6 +109,10 @@ LibassSubtitlesProvider::LibassSubtitlesProvider(std::string) {
config_dir = OSX_GetBundleResourcesDirectory(); config_dir = OSX_GetBundleResourcesDirectory();
snprintf(config_path, MAXPATHLEN, "%s/etc/fonts/fonts.conf", config_dir); snprintf(config_path, MAXPATHLEN, "%s/etc/fonts/fonts.conf", config_dir);
free(config_dir); free(config_dir);
#elif defined(_WIN32)
wxString config_file = StandardPaths::DecodePath(L"?user/fonts/fonts.conf");
char config_path[MAX_PATH];
strcpy_s(config_path, sizeof config_path, config_file.utf8_str());
#else #else
const char *config_path = NULL; const char *config_path = NULL;
#endif #endif

View file

@ -195,6 +195,7 @@ void VideoContext::SetVideo(const wxString &filename) {
hasSubtitles = MatroskaWrapper::HasSubtitles(filename); hasSubtitles = MatroskaWrapper::HasSubtitles(filename);
} }
provider->LoadSubtitles(grid->ass);
UpdateDisplays(true); UpdateDisplays(true);
} }
catch (agi::UserCancelException const&) { } catch (agi::UserCancelException const&) { }