changeset 7463:5515e19b9137 libavcodec

Add graceful error handling to avcodec_get_pix_fmt_name() and avcodec_get_pix_fmt().
author pross
date Sun, 03 Aug 2008 00:41:31 +0000
parents 5cbf11f56c02
children 2062bf984454
files imgconvert.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/imgconvert.c	Sat Aug 02 23:13:27 2008 +0000
+++ b/imgconvert.c	Sun Aug 03 00:41:31 2008 +0000
@@ -390,7 +390,7 @@
 const char *avcodec_get_pix_fmt_name(int pix_fmt)
 {
     if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB)
-        return "???";
+        return NULL;
     else
         return pix_fmt_info[pix_fmt].name;
 }
@@ -401,8 +401,8 @@
 
     for (i=0; i < PIX_FMT_NB; i++)
          if (!strcmp(pix_fmt_info[i].name, name))
-             break;
-    return i;
+             return i;
+    return PIX_FMT_NONE;
 }
 
 void avcodec_pix_fmt_string (char *buf, int buf_size, int pix_fmt)