summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-12-21 20:45:19 +0100
committerwm4 <wm4@nowhere>2013-12-21 21:43:17 +0100
commitad2199128da4a689be374e92aab57ac2c9fa76b9 (patch)
treee59647846141017a5ef1da3a3b0961b95cfbc5e6 /sub
parent232b8de095b0ad493f7aa83e900e861bcb11f52a (diff)
downloadmpv-ad2199128da4a689be374e92aab57ac2c9fa76b9.tar.bz2
mpv-ad2199128da4a689be374e92aab57ac2c9fa76b9.tar.xz
path lookup functions: mp_msg conversions
There's a single mp_msg() in path.c, but all path lookup functions seem to depend on it, so we get a rat-tail of stuff we have to change. This is probably a good thing though, because we can have the path lookup functions also access options, so we could allow overriding the default config path, or ignore the MPV_HOME environment variable, and such things. Also take the chance to consistently add talloc_ctx parameters to the path lookup functions. Also, this change causes a big mess on configfiles.c. It's the same issue: everything suddenly needs a (different) context argument. Make it less wild by providing a mp_load_auto_profiles() function, which isolates most of it to configfiles.c.
Diffstat (limited to 'sub')
-rw-r--r--sub/ass_mp.c18
-rw-r--r--sub/find_subfiles.c2
2 files changed, 9 insertions, 11 deletions
diff --git a/sub/ass_mp.c b/sub/ass_mp.c
index 39737824a2..e77ce298dd 100644
--- a/sub/ass_mp.c
+++ b/sub/ass_mp.c
@@ -153,20 +153,18 @@ void mp_ass_configure(ASS_Renderer *priv, struct MPOpts *opts,
void mp_ass_configure_fonts(ASS_Renderer *priv, struct osd_style_opts *opts,
struct mpv_global *global, struct mp_log *log)
{
- char *default_font = mp_find_user_config_file("subfont.ttf");
- char *config = mp_find_config_file("fonts.conf");
+ void *tmp = talloc_new(NULL);
+ char *default_font = mp_find_user_config_file(tmp, global, "subfont.ttf");
+ char *config = mp_find_config_file(tmp, global, "fonts.conf");
- if (default_font && !mp_path_exists(default_font)) {
- talloc_free(default_font);
+ if (default_font && !mp_path_exists(default_font))
default_font = NULL;
- }
- mp_msg(MSGT_ASS, MSGL_V, "Setting up fonts...\n");
+ mp_verbose(log, "Setting up fonts...\n");
ass_set_fonts(priv, default_font, opts->font, 1, config, 1);
- mp_msg(MSGT_ASS, MSGL_V, "Done.\n");
+ mp_verbose(log, "Done.\n");
- talloc_free(default_font);
- talloc_free(config);
+ talloc_free(tmp);
}
void mp_ass_render_frame(ASS_Renderer *renderer, ASS_Track *track, double time,
@@ -228,7 +226,7 @@ static void message_callback(int level, const char *format, va_list va, void *ct
ASS_Library *mp_ass_init(struct mpv_global *global, struct mp_log *log)
{
- char *path = mp_find_user_config_file("fonts");
+ char *path = mp_find_user_config_file(NULL, global, "fonts");
ASS_Library *priv = ass_library_init();
if (!priv)
abort();
diff --git a/sub/find_subfiles.c b/sub/find_subfiles.c
index 84b7cd1bfe..e5577c3912 100644
--- a/sub/find_subfiles.c
+++ b/sub/find_subfiles.c
@@ -237,7 +237,7 @@ struct subfn *find_text_subtitles(struct mpv_global *global, const char *fname)
}
// Load subtitles in ~/.mpv/sub limiting sub fuzziness
- char *mp_subdir = mp_find_user_config_file("sub/");
+ char *mp_subdir = mp_find_user_config_file(NULL, global, "sub/");
if (mp_subdir)
append_dir_subtitles(global, &slist, &n, bstr0(mp_subdir), fname, 1);
talloc_free(mp_subdir);