diff options
author | Uoti Urpala <uau@mplayer2.org> | 2011-06-26 01:04:53 +0300 |
---|---|---|
committer | Uoti Urpala <uau@mplayer2.org> | 2011-06-26 06:27:50 +0300 |
commit | 949626ee4608792ae7a4b2fe0a97cb593a9c3132 (patch) | |
tree | 74fe10d1aaeb4a85c03a883f3f9d6fc4a7cd3642 | |
parent | a8b11797d86546c894b88ed55a46558dfa972324 (diff) | |
download | mpv-949626ee4608792ae7a4b2fe0a97cb593a9c3132.tar.bz2 mpv-949626ee4608792ae7a4b2fe0a97cb593a9c3132.tar.xz |
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).
-rw-r--r-- | fmt-conversion.c | 13 |
1 files 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 <libavutil/pixdesc.h> #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; } |