[x264-devel] Fix crash in --fullhelp when compiled against recent ffmpeg

Anton Mitrofanov git at videolan.org
Mon Jan 16 02:11:52 CET 2012


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Wed Dec  7 19:14:52 2011 +0400| [c291a9d09263708e9d9f02e28f8442fdbe46bb06] | committer: Jason Garrett-Glaser

Fix crash in --fullhelp when compiled against recent ffmpeg
Don't assume all pixel formats have a description.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=c291a9d09263708e9d9f02e28f8442fdbe46bb06
---

 x264.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/x264.c b/x264.c
index 54359c6..35b1f10 100644
--- 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



More information about the x264-devel mailing list