diff mbox series

[FFmpeg-devel,RFC] lavu/log: Do not change the terminal background colour

Message ID CAB0OVGpTL_ZvaVh=OC5ibCgXrjRd3AJOZryXNCGH18kQVyG=Cg@mail.gmail.com
State New
Headers show
Series [FFmpeg-devel,RFC] lavu/log: Do not change the terminal background colour | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Carl Eugen Hoyos March 29, 2020, 3:19 p.m. UTC
Hi!

Attached patch fixes ticket #8587, not sure if we want this or not,
but I do not consider the missing encircled / blinking effect (that is
not used by our command line tools) an issue.

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos April 3, 2020, 7:50 p.m. UTC | #1
Am So., 29. März 2020 um 17:19 Uhr schrieb Carl Eugen Hoyos
<ceffmpeg@gmail.com>:

> Attached patch fixes ticket #8587, not sure if we want this or not,
> but I do not consider the missing encircled / blinking effect (that is
> not used by our command line tools) an issue.

Ping.

Carl Eugen
Carl Eugen Hoyos April 13, 2020, 5:40 p.m. UTC | #2
Am So., 29. März 2020 um 17:19 Uhr schrieb Carl Eugen Hoyos
<ceffmpeg@gmail.com>:

> Attached patch fixes ticket #8587, not sure if we want this or not,
> but I do not consider the missing encircled / blinking effect (that is
> not used by our command line tools) an issue.
>
> Please comment, Carl Eugen

Ping.

Carl Eugen
Michael Niedermayer May 27, 2020, 3:09 p.m. UTC | #3
On Sun, Mar 29, 2020 at 05:19:29PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes ticket #8587, not sure if we want this or not,
> but I do not consider the missing encircled / blinking effect (that is
> not used by our command line tools) an issue.
> 
> Please comment, Carl Eugen

> b14e07aba247cd696e0d9e3d718eb186f6cb555e  0001-lavu-log-Always-use-the-default-background-color.patch
> From 64eeec19197fe7726f3bb103417ae3277b1cd8f9 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> Date: Sun, 29 Mar 2020 14:32:38 +0200
> Subject: [PATCH] lavu/log: Always use the default background color.
> 
> Fixes ticket #8587.
> ---
>  libavutil/log.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)

I can confirm this fixes an issue with messed up background color in some
terminals (not all)
not sure if this fix is the best solution but i dont have a better
suggestion ATM either

[...]
diff mbox series

Patch

From 64eeec19197fe7726f3bb103417ae3277b1cd8f9 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Sun, 29 Mar 2020 14:32:38 +0200
Subject: [PATCH] lavu/log: Always use the default background color.

Fixes ticket #8587.
---
 libavutil/log.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libavutil/log.c b/libavutil/log.c
index 8d4945249e..352a2d9d2a 100644
--- a/libavutil/log.c
+++ b/libavutil/log.c
@@ -90,7 +90,7 @@  static HANDLE con;
 #else
 
 static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = {
-    [AV_LOG_PANIC  /8] =  52 << 16 | 196 << 8 | 0x41,
+    [AV_LOG_PANIC  /8] = 196 << 8 | 0x41,
     [AV_LOG_FATAL  /8] = 208 <<  8 | 0x41,
     [AV_LOG_ERROR  /8] = 196 <<  8 | 0x11,
     [AV_LOG_WARNING/8] = 226 <<  8 | 0x03,
@@ -196,8 +196,7 @@  static void ansi_fputs(int level, int tint, const char *str, int local_use_color
                 str);
     } else if (local_use_color == 256) {
         fprintf(stderr,
-                "\033[48;5;%"PRIu32"m\033[38;5;%"PRIu32"m%s\033[0m",
-                (color[level] >> 16) & 0xff,
+                "\033[49m\033[38;5;%"PRIu32"m%s\033[0m",
                 (color[level] >> 8) & 0xff,
                 str);
     } else
-- 
2.24.1