summaryrefslogtreecommitdiffstats
path: root/video/filter
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-07-13 20:12:13 +0200
committerwm4 <wm4@nowhere>2014-07-13 20:12:13 +0200
commit417ffa8b40f1754f3062fe42db2842131babec72 (patch)
tree91494348b5b8efaf6f051009ce5628b7a3083339 /video/filter
parentd54d21cbd5fdcb3004b55f1779e87b23a3d4a6ea (diff)
downloadmpv-417ffa8b40f1754f3062fe42db2842131babec72.tar.bz2
mpv-417ffa8b40f1754f3062fe42db2842131babec72.tar.xz
Remove some mp_msg calls with no trailing \n
The final goal is all mp_msg calls produce complete lines. We want this because otherwise, race conditions could corrupt the terminal output, and it's inconvenient for the client API too. This commit works towards this goal. There's still code that has this not fixed yet, though.
Diffstat (limited to 'video/filter')
-rw-r--r--video/filter/vf.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c
index f187f7f2bd..785fb9b908 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -26,6 +26,7 @@
#include "config.h"
+#include "common/common.h"
#include "common/global.h"
#include "common/msg.h"
#include "options/m_option.h"
@@ -223,22 +224,22 @@ static int vf_default_query_format(struct vf_instance *vf, unsigned int fmt)
return vf_next_query_format(vf, fmt);
}
-static void print_fmt(struct mp_log *log, int msglevel, struct mp_image_params *p)
+static void fmt_cat(char *b, size_t bs, struct mp_image_params *p)
{
if (p && p->imgfmt) {
- mp_msg(log, msglevel, "%dx%d", p->w, p->h);
+ mp_snprintf_cat(b, bs, "%dx%d", p->w, p->h);
if (p->w != p->d_w || p->h != p->d_h)
- mp_msg(log, msglevel, "->%dx%d", p->d_w, p->d_h);
- mp_msg(log, msglevel, " %s", mp_imgfmt_to_name(p->imgfmt));
- mp_msg(log, msglevel, " %s/%s", mp_csp_names[p->colorspace],
- mp_csp_levels_names[p->colorlevels]);
- mp_msg(log, msglevel, " CL=%d", (int)p->chroma_location);
+ mp_snprintf_cat(b, bs, "->%dx%d", p->d_w, p->d_h);
+ mp_snprintf_cat(b, bs, " %s", mp_imgfmt_to_name(p->imgfmt));
+ mp_snprintf_cat(b, bs, " %s/%s", mp_csp_names[p->colorspace],
+ mp_csp_levels_names[p->colorlevels]);
+ mp_snprintf_cat(b, bs, " CL=%d", (int)p->chroma_location);
if (p->outputlevels)
- mp_msg(log, msglevel, " out=%s", mp_csp_levels_names[p->outputlevels]);
+ mp_snprintf_cat(b, bs, " out=%s", mp_csp_levels_names[p->outputlevels]);
if (p->rotate)
- mp_msg(log, msglevel, " rot=%d", p->rotate);
+ mp_snprintf_cat(b, bs, " rot=%d", p->rotate);
} else {
- mp_msg(log, msglevel, "???");
+ mp_snprintf_cat(b, bs, "???");
}
}
@@ -248,17 +249,20 @@ void vf_print_filter_chain(struct vf_chain *c, int msglevel,
if (!mp_msg_test(c->log, msglevel))
return;
- mp_msg(c->log, msglevel, " [vd] ");
- print_fmt(c->log, msglevel, &c->input_params);
- mp_msg(c->log, msglevel, "\n");
+ char b[128] = {0};
+
+ fmt_cat(b, sizeof(b), &c->input_params);
+ mp_msg(c->log, msglevel, " [vd] %s\n", b);
+
for (vf_instance_t *f = c->first; f; f = f->next) {
- mp_msg(c->log, msglevel, " [%s] ", f->info->name);
- print_fmt(c->log, msglevel, &f->fmt_out);
+ b[0] = '\0';
+ mp_snprintf_cat(b, sizeof(b), " [%s] ", f->info->name);
+ fmt_cat(b, sizeof(b), &f->fmt_out);
if (f->autoinserted)
- mp_msg(c->log, msglevel, " [a]");
+ mp_snprintf_cat(b, sizeof(b), " [a]");
if (f == vf)
- mp_msg(c->log, msglevel, " <---");
- mp_msg(c->log, msglevel, "\n");
+ mp_snprintf_cat(b, sizeof(b), " <---");
+ mp_msg(c->log, msglevel, "%s\n", b);
}
}