[x264-devel] Fix restoring of console title on Windows with ffms indexing

Jason Garrett-Glaser git at videolan.org
Thu Mar 24 06:38:34 CET 2011


x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Wed Mar 23 20:59:41 2011 -0700| [d5ba9edc78f7538d0d212c0712e4197521474160] | committer: Jason Garrett-Glaser

Fix restoring of console title on Windows with ffms indexing

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

 x264.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/x264.c b/x264.c
index 92695ab..1c551f8 100644
--- a/x264.c
+++ b/x264.c
@@ -74,6 +74,8 @@ static void sigint_handler( int a )
     b_ctrl_c = 1;
 }
 
+static char UNUSED originalCTitle[200] = "";
+
 typedef struct {
     int b_progress;
     int i_seek;
@@ -262,6 +264,8 @@ int main( int argc, char **argv )
     _setmode(_fileno(stdout), _O_BINARY);
 #endif
 
+    GetConsoleTitle( originalCTitle, sizeof(originalCTitle) );
+
     /* Parse command line */
     if( parse( argc, argv, &param, &opt ) < 0 )
         ret = -1;
@@ -284,6 +288,8 @@ int main( int argc, char **argv )
     if( opt.qpfile )
         fclose( opt.qpfile );
 
+    SetConsoleTitle( originalCTitle );
+
     return ret;
 }
 
@@ -1644,9 +1650,6 @@ static int encode( x264_param_t *param, cli_opt_t *opt )
     double  duration;
     double  pulldown_pts = 0;
     int     retval = 0;
-    char    UNUSED originalCTitle[200] = "";
-
-    GetConsoleTitle( originalCTitle, sizeof(originalCTitle) );
 
     opt->b_progress &= param->i_log_level < X264_LOG_DEBUG;
 
@@ -1805,7 +1808,5 @@ fail:
                  (double) i_file * 8 / ( 1000 * duration ) );
     }
 
-    SetConsoleTitle( originalCTitle );
-
     return retval;
 }



More information about the x264-devel mailing list