summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--video/filter/vf.c23
-rw-r--r--video/mp_image.c21
-rw-r--r--video/mp_image.h4
3 files changed, 27 insertions, 21 deletions
diff --git a/video/filter/vf.c b/video/filter/vf.c
index 8fd2da5e88..bf3f73c0e6 100644
--- a/video/filter/vf.c
+++ b/video/filter/vf.c
@@ -230,25 +230,6 @@ static int vf_default_query_format(struct vf_instance *vf, unsigned int fmt)
return vf_next_query_format(vf, fmt);
}
-static void fmt_cat(char *b, size_t bs, struct mp_image_params *p)
-{
- if (p && p->imgfmt) {
- mp_snprintf_cat(b, bs, "%dx%d", p->w, p->h);
- if (p->w != p->d_w || p->h != p->d_h)
- 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_snprintf_cat(b, bs, " out=%s", mp_csp_levels_names[p->outputlevels]);
- if (p->rotate)
- mp_snprintf_cat(b, bs, " rot=%d", p->rotate);
- } else {
- mp_snprintf_cat(b, bs, "???");
- }
-}
-
void vf_print_filter_chain(struct vf_chain *c, int msglevel,
struct vf_instance *vf)
{
@@ -257,13 +238,13 @@ void vf_print_filter_chain(struct vf_chain *c, int msglevel,
char b[128] = {0};
- fmt_cat(b, sizeof(b), &c->input_params);
+ mp_snprintf_cat(b, sizeof(b), "%s", mp_image_params_to_str(&c->input_params));
mp_msg(c->log, msglevel, " [vd] %s\n", b);
for (vf_instance_t *f = c->first; f; f = f->next) {
b[0] = '\0';
mp_snprintf_cat(b, sizeof(b), " [%s] ", f->info->name);
- fmt_cat(b, sizeof(b), &f->fmt_out);
+ mp_snprintf_cat(b, sizeof(b), "%s", mp_image_params_to_str(&f->fmt_out));
if (f->autoinserted)
mp_snprintf_cat(b, sizeof(b), " [a]");
if (f == vf)
diff --git a/video/mp_image.c b/video/mp_image.c
index 1ba7a4ee2c..d041b9e385 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -455,6 +455,27 @@ void mp_image_vflip(struct mp_image *img)
}
}
+char *mp_image_params_to_str_buf(char *b, size_t bs,
+ const struct mp_image_params *p)
+{
+ if (p && p->imgfmt) {
+ snprintf(b, bs, "%dx%d", p->w, p->h);
+ if (p->w != p->d_w || p->h != p->d_h)
+ 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_snprintf_cat(b, bs, " out=%s", mp_csp_levels_names[p->outputlevels]);
+ if (p->rotate)
+ mp_snprintf_cat(b, bs, " rot=%d", p->rotate);
+ } else {
+ snprintf(b, bs, "???");
+ }
+ return b;
+}
+
// Return whether the image parameters are valid.
// Some non-essential fields are allowed to be unset (like colorspace flags).
bool mp_image_params_valid(const struct mp_image_params *p)
diff --git a/video/mp_image.h b/video/mp_image.h
index 9cdc7fdf77..feedd24174 100644
--- a/video/mp_image.h
+++ b/video/mp_image.h
@@ -142,6 +142,10 @@ struct mp_image *mp_image_new_external_ref(struct mp_image *img, void *arg,
void mp_image_params_guess_csp(struct mp_image_params *params);
+char *mp_image_params_to_str_buf(char *b, size_t bs,
+ const struct mp_image_params *p);
+#define mp_image_params_to_str(p) mp_image_params_to_str_buf((char[64]){0}, 64, p)
+
bool mp_image_params_valid(const struct mp_image_params *p);
bool mp_image_params_equal(const struct mp_image_params *p1,
const struct mp_image_params *p2);