summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/filter/af.c12
-rw-r--r--player/loadfile.c42
-rw-r--r--video/filter/vf.c40
-rw-r--r--video/out/gl_common.c6
4 files changed, 53 insertions, 47 deletions
diff --git a/audio/filter/af.c b/audio/filter/af.c
index c69077e93f..fe2dcdfb13 100644
--- a/audio/filter/af.c
+++ b/audio/filter/af.c
@@ -311,22 +311,22 @@ static void af_print_filter_chain(struct af_stream *s, struct af_instance *at,
struct af_instance *af = s->first;
while (af) {
- MP_MSG(s, msg_level, " [%s] ", af->info->name);
+ char b[128] = {0};
+ mp_snprintf_cat(b, sizeof(b), " [%s] ", af->info->name);
if (af->data) {
char *info = mp_audio_config_to_str(af->data);
- MP_MSG(s, msg_level, "%s", info);
+ mp_snprintf_cat(b, sizeof(b), "%s", info);
talloc_free(info);
}
if (af == at)
- MP_MSG(s, msg_level, " <-");
- MP_MSG(s, msg_level, "\n");
+ mp_snprintf_cat(b, sizeof(b), " <-");
+ MP_MSG(s, msg_level, "%s\n", b);
af = af->next;
}
- MP_MSG(s, msg_level, " [ao] ");
char *info = mp_audio_config_to_str(&s->output);
- MP_MSG(s, msg_level, "%s\n", info);
+ MP_MSG(s, msg_level, " [ao] %s\n", info);
talloc_free(info);
}
diff --git a/player/loadfile.c b/player/loadfile.c
index 08adcb615e..e2a1e6e145 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -184,42 +184,41 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
mpctx->initialized_flags &= ~INITIALIZED_PLAYBACK;
}
+#define APPEND(s, ...) mp_snprintf_cat(s, sizeof(s), __VA_ARGS__)
+
static void print_stream(struct MPContext *mpctx, struct track *t)
{
struct sh_stream *s = t->stream;
const char *tname = "?";
const char *selopt = "?";
const char *langopt = "?";
- const char *iid = NULL;
switch (t->type) {
case STREAM_VIDEO:
- tname = "Video"; selopt = "vid"; langopt = NULL; iid = "VID";
+ tname = "Video"; selopt = "vid"; langopt = NULL;
break;
case STREAM_AUDIO:
- tname = "Audio"; selopt = "aid"; langopt = "alang"; iid = "AID";
+ tname = "Audio"; selopt = "aid"; langopt = "alang";
break;
case STREAM_SUB:
- tname = "Subs"; selopt = "sid"; langopt = "slang"; iid = "SID";
+ tname = "Subs"; selopt = "sid"; langopt = "slang";
break;
}
- MP_INFO(mpctx, "[stream] %-5s %3s", tname, t->selected ? "(+)" : "");
- MP_INFO(mpctx, " --%s=%d", selopt, t->user_tid);
+ char b[2048] = {0};
+ APPEND(b, "[stream] %-5s %3s", tname, t->selected ? "(+)" : "");
+ APPEND(b, " --%s=%d", selopt, t->user_tid);
if (t->lang && langopt)
- MP_INFO(mpctx, " --%s=%s", langopt, t->lang);
+ APPEND(b, " --%s=%s", langopt, t->lang);
if (t->default_track)
- MP_INFO(mpctx, " (*)");
+ APPEND(b, " (*)");
if (t->attached_picture)
- MP_INFO(mpctx, " [P]");
+ APPEND(b, " [P]");
if (t->title)
- MP_INFO(mpctx, " '%s'", t->title);
+ APPEND(b, " '%s'", t->title);
const char *codec = s ? s->codec : NULL;
- MP_INFO(mpctx, " (%s)", codec ? codec : "<unknown>");
+ APPEND(b, " (%s)", codec ? codec : "<unknown>");
if (t->is_external)
- MP_INFO(mpctx, " (external)");
- MP_INFO(mpctx, "\n");
- // legacy compatibility
- if (!iid)
- return;
+ APPEND(b, " (external)");
+ MP_INFO(mpctx, "%s\n", b);
}
static void print_file_properties(struct MPContext *mpctx)
@@ -228,14 +227,15 @@ static void print_file_properties(struct MPContext *mpctx)
if (demuxer->num_editions > 1) {
for (int n = 0; n < demuxer->num_editions; n++) {
struct demux_edition *edition = &demuxer->editions[n];
- MP_INFO(mpctx, "[edition] %3s --edition=%d",
- n == demuxer->edition ? "(+)" : "", n);
+ char b[128] = {0};
+ APPEND(b, "[edition] %3s --edition=%d",
+ n == demuxer->edition ? "(+)" : "", n);
char *name = mp_tags_get_str(edition->metadata, "title");
if (name)
- MP_INFO(mpctx, " '%s'", name);
+ APPEND(b, " '%s'", name);
if (edition->default_edition)
- MP_INFO(mpctx, " (*)");
- MP_INFO(mpctx, "\n");
+ APPEND(b, " (*)");
+ MP_INFO(mpctx, "%s\n", b);
}
}
for (int t = 0; t < STREAM_TYPE_COUNT; t++) {
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);
}
}
diff --git a/video/out/gl_common.c b/video/out/gl_common.c
index f9af3f32af..dd90bee322 100644
--- a/video/out/gl_common.c
+++ b/video/out/gl_common.c
@@ -41,6 +41,7 @@
#include <assert.h>
#include "talloc.h"
#include "gl_common.h"
+#include "common/common.h"
#include "options/options.h"
#include "options/m_option.h"
@@ -120,11 +121,12 @@ static const struct feature features[] = {
static void list_features(int set, struct mp_log *log, int msgl, bool invert)
{
+ char b[128] = {0};
for (const struct feature *f = &features[0]; f->id; f++) {
if (invert == !(f->id & set))
- mp_msg(log, msgl, " [%s]", f->name);
+ mp_snprintf_cat(b, sizeof(b), " [%s]", f->name);
}
- mp_msg(log, msgl, "\n");
+ mp_msg(log, msgl, "%s\n", b);
}
// This guesses if the current GL context is a suspected software renderer.