summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-18 18:58:36 +0200
committerwm4 <wm4@nowhere>2014-05-18 19:21:39 +0200
commit537ac1a15fbc02619ebe8c7b97823d06937c8107 (patch)
treea01632430d92ab42e64248119a48f9168f0bb090 /player
parentcaa939aa91157937759a8be54f9c794d05fd0120 (diff)
downloadmpv-537ac1a15fbc02619ebe8c7b97823d06937c8107.tar.bz2
mpv-537ac1a15fbc02619ebe8c7b97823d06937c8107.tar.xz
client API: add mpv_load_config_file()
This is probably a good idea, because it would make it easier for software embedding mpv to configure the mpv parts, without requiring the host program to provide explicit mechanisms for this (other than calling mpv_load_config_file()).
Diffstat (limited to 'player')
-rw-r--r--player/client.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/player/client.c b/player/client.c
index 580eebaddb..85a9b0fa9a 100644
--- a/player/client.c
+++ b/player/client.c
@@ -27,6 +27,8 @@
#include "options/m_config.h"
#include "options/m_option.h"
#include "options/m_property.h"
+#include "options/path.h"
+#include "options/parse_configfile.h"
#include "osdep/threads.h"
#include "osdep/timer.h"
#include "osdep/io.h"
@@ -1221,6 +1223,19 @@ static bool gen_property_change_event(struct mpv_handle *ctx)
return false;
}
+int mpv_load_config_file(mpv_handle *ctx, const char *filename)
+{
+ int flags = ctx->mpctx->initialized ? M_SETOPT_RUNTIME : 0;
+ lock_core(ctx);
+ int r = m_config_parse_config_file(ctx->mpctx->mconfig, filename, NULL, flags);
+ unlock_core(ctx);
+ if (r == 0)
+ return MPV_ERROR_INVALID_PARAMETER;
+ if (r < 0)
+ return MPV_ERROR_OPTION_ERROR;
+ return 0;
+}
+
int mpv_request_log_messages(mpv_handle *ctx, const char *min_level)
{
int level = -1;