summaryrefslogtreecommitdiffstats
path: root/video/mp_image.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/mp_image.c')
-rw-r--r--video/mp_image.c21
1 files changed, 21 insertions, 0 deletions
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)