[FFmpeg-cvslog] r14513 - trunk/libavcodec/imgconvert.c

pross subversion
Sun Aug 3 02:41:32 CEST 2008


Author: pross
Date: Sun Aug  3 02:41:31 2008
New Revision: 14513

Log:
Add graceful error handling to avcodec_get_pix_fmt_name() and avcodec_get_pix_fmt().


Modified:
   trunk/libavcodec/imgconvert.c

Modified: trunk/libavcodec/imgconvert.c
==============================================================================
--- trunk/libavcodec/imgconvert.c	(original)
+++ trunk/libavcodec/imgconvert.c	Sun Aug  3 02:41:31 2008
@@ -390,7 +390,7 @@ void avcodec_get_chroma_sub_sample(int p
 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 @@ enum PixelFormat avcodec_get_pix_fmt(con
 
     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)




More information about the ffmpeg-cvslog mailing list