From 949626ee4608792ae7a4b2fe0a97cb593a9c3132 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sun, 26 Jun 2011 01:04:53 +0300 Subject: [PATCH] fmt-conversion.c: print name of any unrecognized pixfmt Change the error message about unrecognized pixfmt values to include the symbolic name of the pixfmt (available from libavutil). --- fmt-conversion.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fmt-conversion.c b/fmt-conversion.c index 9e881009e4..e17ba05eaf 100644 --- a/fmt-conversion.c +++ b/fmt-conversion.c @@ -18,6 +18,7 @@ #include "mp_msg.h" #include "libavutil/avutil.h" +#include #include "libmpcodecs/img_format.h" #include "fmt-conversion.h" @@ -114,12 +115,18 @@ enum PixelFormat imgfmt2pixfmt(int fmt) int pixfmt2imgfmt(enum PixelFormat pix_fmt) { int i; - int fmt; for (i = 0; conversion_map[i].pix_fmt != PIX_FMT_NONE; i++) if (conversion_map[i].pix_fmt == pix_fmt) break; - fmt = conversion_map[i].fmt; - if (!fmt) + int fmt = conversion_map[i].fmt; + if (!fmt) { +#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(51, 2, 0) + const char *fmtname = av_get_pix_fmt_name(pix_fmt); + mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported PixelFormat %s (%d)\n", + fmtname ? fmtname : "INVALID", pix_fmt); +#else mp_msg(MSGT_GLOBAL, MSGL_ERR, "Unsupported PixelFormat %i\n", pix_fmt); +#endif + } return fmt; } -- 2.11.4.GIT