This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 40bb61c0d440af15567b65692f1bc28e54c9bb47
Author:     Kacper Michajłow <[email protected]>
AuthorDate: Tue Aug 11 16:21:21 2026 +0200
Commit:     Kacper Michajłow <[email protected]>
CommitDate: Wed Aug 12 17:21:06 2026 +0200

    avutil/log: use the ANSI color table in ansi_fputs() on Windows
    
    ansi_fputs() is reachable on Windows when stderr is not a console
    or with forced color. Use real ANSI color table in this cases, otherwise
    wrong values are used from Windows codes.
    
    Signed-off-by: Kacper Michajłow <[email protected]>
---
 libavutil/log.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/libavutil/log.c b/libavutil/log.c
index b5d3e46d6c..11193eb238 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -62,7 +62,7 @@ static atomic_int av_log_flags = 0;
 #define NB_LEVELS 8
 #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
 #include <windows.h>
-static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
+static const uint8_t win_color[16 + AV_CLASS_CATEGORY_NB] = {
     [AV_LOG_PANIC  /8] = 12,
     [AV_LOG_FATAL  /8] = 12,
     [AV_LOG_ERROR  /8] = 12,
@@ -93,7 +93,7 @@ static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = {
 
 static int16_t background, attr_orig;
 static HANDLE con;
-#else
+#endif
 
 static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = {
     [AV_LOG_PANIC  /8] =  52 << 16 | 196 << 8 | 0x41,
@@ -124,7 +124,6 @@ static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = {
     [16+AV_CLASS_CATEGORY_DEVICE_INPUT        ] = 207 << 8 | 0x05,
 };
 
-#endif
 static int use_color = -1;
 
 #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
@@ -226,7 +225,7 @@ static void colored_fputs(int level, int tint, const char 
*str)
 #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
     if (con != INVALID_HANDLE_VALUE) {
         if (local_use_color)
-            SetConsoleTextAttribute(con, background | color[level]);
+            SetConsoleTextAttribute(con, background | win_color[level]);
         win_console_puts(str);
         if (local_use_color)
             SetConsoleTextAttribute(con, attr_orig);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to