]> git.sesse.net Git - x264/commitdiff
Fix crash in --fullhelp when compiled against recent ffmpeg
authorAnton Mitrofanov <BugMaster@narod.ru>
Wed, 7 Dec 2011 15:14:52 +0000 (19:14 +0400)
committerFiona Glaser <fiona@x264.com>
Thu, 8 Dec 2011 00:37:50 +0000 (16:37 -0800)
Don't assume all pixel formats have a description.

x264.c

diff --git a/x264.c b/x264.c
index 2378a3fccc29abee6609cf0dabdb3ee0fd0b20e6..dea17ceb74361b2e6062b88893220fc71b1720df 100644 (file)
--- a/x264.c
+++ b/x264.c
@@ -350,19 +350,22 @@ static void print_csp_names( int longhelp )
     size_t line_len = strlen( INDENT );
     for( enum PixelFormat i = PIX_FMT_NONE+1; i < PIX_FMT_NB; i++ )
     {
-        const char *pfname = av_pix_fmt_descriptors[i].name;
-        size_t name_len = strlen( pfname );
-        if( line_len + name_len > (80 - strlen( ", " )) )
+        const char *pfname = av_get_pix_fmt_name( i );
+        if( pfname )
         {
-            printf( "\n" INDENT );
-            line_len = strlen( INDENT );
-        }
-        printf( "%s", pfname );
-        line_len += name_len;
-        if( i+1 < PIX_FMT_NB )
-        {
-            printf( ", " );
-            line_len += 2;
+            size_t name_len = strlen( pfname );
+            if( line_len + name_len > (80 - strlen( ", " )) )
+            {
+                printf( "\n" INDENT );
+                line_len = strlen( INDENT );
+            }
+            printf( "%s", pfname );
+            line_len += name_len;
+            if( i+1 < PIX_FMT_NB )
+            {
+                printf( ", " );
+                line_len += 2;
+            }
         }
     }
 #endif