summaryrefslogtreecommitdiffstats
path: root/video/out/placebo/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/placebo/utils.c')
-rw-r--r--video/out/placebo/utils.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/video/out/placebo/utils.c b/video/out/placebo/utils.c
index 616914c27b..dae9b14761 100644
--- a/video/out/placebo/utils.c
+++ b/video/out/placebo/utils.c
@@ -1,6 +1,8 @@
#include "common/common.h"
#include "utils.h"
+#include <libplacebo/utils/dolbyvision.h>
+
static const int pl_log_to_msg_lev[PL_LOG_ALL+1] = {
[PL_LOG_FATAL] = MSGL_FATAL,
[PL_LOG_ERR] = MSGL_ERR,
@@ -23,7 +25,7 @@ static const enum pl_log_level msg_lev_to_pl_log[MSGL_MAX+1] = {
};
// translates log levels while probing
-static const enum pl_log_level probing_map(enum pl_log_level level)
+static enum pl_log_level probing_map(enum pl_log_level level)
{
switch (level) {
case PL_LOG_FATAL:
@@ -42,19 +44,30 @@ static void log_cb(void *priv, enum pl_log_level level, const char *msg)
mp_msg(log, pl_log_to_msg_lev[level], "%s\n", msg);
}
+static int determine_pl_log_level(struct mp_log *log)
+{
+ int log_level = mp_msg_level(log);
+ return log_level == -1 ? PL_LOG_NONE : msg_lev_to_pl_log[log_level];
+}
+
static void log_cb_probing(void *priv, enum pl_log_level level, const char *msg)
{
struct mp_log *log = priv;
mp_msg(log, pl_log_to_msg_lev[probing_map(level)], "%s\n", msg);
}
-void mppl_ctx_set_log(struct pl_context *ctx, struct mp_log *log, bool probing)
+pl_log mppl_log_create(void *tactx, struct mp_log *log)
{
- assert(log);
-
- pl_context_update(ctx, &(struct pl_context_params) {
- .log_cb = probing ? log_cb_probing : log_cb,
- .log_level = msg_lev_to_pl_log[mp_msg_level(log)],
- .log_priv = log,
+ return pl_log_create(PL_API_VER, &(struct pl_log_params) {
+ .log_cb = log_cb,
+ .log_level = determine_pl_log_level(log),
+ .log_priv = mp_log_new(tactx, log, "libplacebo"),
});
}
+
+void mppl_log_set_probing(pl_log log, bool probing)
+{
+ struct pl_log_params params = log->params;
+ params.log_cb = probing ? log_cb_probing : log_cb;
+ pl_log_update(log, &params);
+}