[x264-devel] Windows: restore previous console title after encoding
Jason Garrett-Glaser
git at videolan.org
Mon Feb 7 06:31:32 CET 2011
x264 | branch: master | Jason Garrett-Glaser <jason at x264.com> | Sat Feb 5 01:16:49 2011 -0800| [e6f00af6ec59d63fac489594121d6cb3a0e98569] | committer: Jason Garrett-Glaser
Windows: restore previous console title after encoding
MSDN docs claim that SetConsoleTitle's effect is reverted when the process terminates, but this doesn't always work properly.
Accordingly, manually revert the console title at the end of encoding.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=e6f00af6ec59d63fac489594121d6cb3a0e98569
---
x264.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/x264.c b/x264.c
index 6b4375e..f6542a2 100644
--- a/x264.c
+++ b/x264.c
@@ -45,6 +45,7 @@
#ifdef _WIN32
#include <windows.h>
#else
+#define GetConsoleTitle(t,n)
#define SetConsoleTitle(t)
#endif
@@ -1640,6 +1641,9 @@ 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;
i_update_interval = param->i_frame_total ? x264_clip3( param->i_frame_total / 1000, 1, 10 ) : 10;
@@ -1798,5 +1802,7 @@ fail:
(double) i_file * 8 / ( 1000 * duration ) );
}
+ SetConsoleTitle( originalCTitle );
+
return retval;
}
More information about the x264-devel
mailing list