mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-10-24 02:09:03 +03:00
avutil/log: match Windows warning yellow on a pipe
On Windows the console paints warnings with attribute 14 (bright yellow). The 8-color ANSI path used for a pipe emitted 0;33. Use intensity 1 for AV_LOG_WARNING on Windows so the piped color matches the console. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Reinhard Nißl <rnissl@gmx.de>
This commit is contained in:
@@ -189,11 +189,17 @@ static void check_color_terminal(void)
|
||||
static void ansi_fputs(int level, int tint, const char *str, int local_use_color)
|
||||
{
|
||||
if (local_use_color == 1) {
|
||||
uint32_t intensity = (color[level] >> 4) & 15;
|
||||
uint32_t fg = color[level] & 15;
|
||||
#if defined(_WIN32)
|
||||
/* Piped stderr is 8-color ANSI. Linux keeps 0;33m; Windows console
|
||||
* already uses win_color 14 (bright yellow), so match that here. */
|
||||
if (level == AV_LOG_WARNING / 8)
|
||||
intensity = 1;
|
||||
#endif
|
||||
fprintf(stderr,
|
||||
"\033[%"PRIu32";3%"PRIu32"m%s\033[0m",
|
||||
(color[level] >> 4) & 15,
|
||||
color[level] & 15,
|
||||
str);
|
||||
intensity, fg, str);
|
||||
} else if (tint && use_color == 256) {
|
||||
fprintf(stderr,
|
||||
"\033[48;5;%"PRIu32"m\033[38;5;%dm%s\033[0m",
|
||||
|
||||
Reference in New Issue
Block a user