diff options
author | wm4 <wm4@nowhere> | 2014-11-12 19:19:16 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-11-12 19:30:59 +0100 |
commit | 41365313433875b0ac2f1fa0e6d14ffa4f5e4e8d (patch) | |
tree | 9e14faf39d8ec96e828c142b44eb72cef892b727 /video/mp_image.c | |
parent | 509997ec129dc68466dc14abfc5e3e1b26e1279e (diff) | |
download | mpv-41365313433875b0ac2f1fa0e6d14ffa4f5e4e8d.tar.bz2 mpv-41365313433875b0ac2f1fa0e6d14ffa4f5e4e8d.tar.xz |
video: move formatting of image parameters to separate function
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 21 |
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) |