summaryrefslogtreecommitdiffstats
path: root/options/m_option.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-10-30 14:56:50 +0100
committerwm4 <wm4@nowhere>2017-10-30 15:32:24 +0100
commit694157e024e52e6fcb01cfd2e9c6d50b85f9621f (patch)
tree3b393b96fb8799381ce03b4fe63248983e903f2f /options/m_option.c
parent2d958dbf2bd918391f3b3f48fe131d3eb783463a (diff)
downloadmpv-694157e024e52e6fcb01cfd2e9c6d50b85f9621f.tar.bz2
mpv-694157e024e52e6fcb01cfd2e9c6d50b85f9621f.tar.xz
m_option: pretty print mpv_node for OSD
Somewhat useful for debugging. Unfortunately libass (or something else) strips leading whitespace, making it look slightly more ugly than necessary. Still an improvement.
Diffstat (limited to 'options/m_option.c')
-rw-r--r--options/m_option.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 00ea5d6d93..9472f3c870 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -3249,6 +3249,16 @@ static char *print_node(const m_option_t *opt, const void *val)
return t;
}
+static char *pretty_print_node(const m_option_t *opt, const void *val)
+{
+ char *t = talloc_strdup(NULL, "");
+ if (json_write_pretty(&t, &VAL(val)) < 0) {
+ talloc_free(t);
+ t = NULL;
+ }
+ return t;
+}
+
static void dup_node(void *ta_parent, struct mpv_node *node)
{
switch (node->format) {
@@ -3342,6 +3352,7 @@ const m_option_type_t m_option_type_node = {
.size = sizeof(struct mpv_node),
.parse = parse_node,
.print = print_node,
+ .pretty_print = pretty_print_node,
.copy = copy_node,
.free = free_node,
.set = node_set,