summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2020-01-21 14:47:57 +0200
committerMartin Storsjö <martin@martin.st>2020-01-23 18:30:09 +0200
commit63418e374fcf265bd4a8e79a655bacc96671a726 (patch)
tree53b6a3f8fae0ad5a4ee485fc1b8bf25a48b6596d /libavutil
parente3fb9af6f1353f30855eaa1cbd5befaf06e303b8 (diff)
downloadffmpeg-63418e374fcf265bd4a8e79a655bacc96671a726.tar.gz
configure: Check for GetStdHandle in addition to SetConsoleTextAttribute
SetConsoleTextAttribute used to be unavailable for Windows Store apps, but is available to them now. But GetStdHandle still is unavailable, thus make sure to check for both functions before using code that requires both. Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/log.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavutil/log.c b/libavutil/log.c
index c3e65f0470..0a7b169bc0 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -55,7 +55,7 @@ static int av_log_level = AV_LOG_INFO;
static int flags;
#define NB_LEVELS 8
-#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE
+#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
#include <windows.h>
static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
[AV_LOG_PANIC /8] = 12,
@@ -122,7 +122,7 @@ static int use_color = -1;
static void check_color_terminal(void)
{
-#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE
+#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
CONSOLE_SCREEN_BUFFER_INFO con_info;
con = GetStdHandle(STD_ERROR_HANDLE);
use_color = (con != INVALID_HANDLE_VALUE) && !getenv("NO_COLOR") &&
@@ -157,7 +157,7 @@ static void colored_fputs(int level, int tint, const char *str)
if (level == AV_LOG_INFO/8) local_use_color = 0;
else local_use_color = use_color;
-#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE
+#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
if (local_use_color)
SetConsoleTextAttribute(con, background | color[level]);
fputs(str, stderr);