[x265] [PATCH] cli: save and restore console title before and after encoding

Xinyue Lu maillist at 7086.in
Mon Mar 30 13:46:04 CEST 2015


It will save the console title on start and restore it on exit.

# HG changeset patch
# User Xinyue Lu <i at 7086.in>
# Date 1427713970 25200
#      Mon Mar 30 04:12:50 2015 -0700
# Branch Yuuki
# Node ID 7c31ea0490e2700a3d32a618a3e6d5e81807eb3f
# Parent  22a312799bb033d40a66fc83a1ac7af192ce2420
cli: save and restore console title before and after encoding

diff -r 22a312799bb0 -r 7c31ea0490e2 source/x265.cpp
--- a/source/x265.cpp Fri Mar 27 22:59:30 2015 -0500
+++ b/source/x265.cpp Mon Mar 30 04:12:50 2015 -0700
@@ -47,8 +47,10 @@
 #include <ostream>
 #include <fstream>

+#define CONSOLE_TITLE_SIZE 200
 #ifdef _WIN32
 #include <windows.h>
+static char orgConsoleTitle[CONSOLE_TITLE_SIZE] = "";
 #else
 #define GetConsoleTitle(t, n)
 #define SetConsoleTitle(t)
@@ -464,6 +466,8 @@
     PROFILE_INIT();
     THREAD_NAME("API", 0);

+    GetConsoleTitle(orgConsoleTitle, CONSOLE_TITLE_SIZE);
+
     x265_param *param = x265_param_alloc();
     CLIOptions cliopt;

@@ -635,6 +639,8 @@

     X265_FREE(errorBuf);

+    SetConsoleTitle(orgConsoleTitle);
+
 #if HAVE_VLD
     assert(VLDReportLeaks() == 0);
 #endif


More information about the x265-devel mailing list