[FFmpeg-devel] [PATCH 3/3] log: color prefixes according to their source.

Clément Bœsch ubitux at gmail.com
Fri Jun 1 08:02:32 CEST 2012


On Mon, May 28, 2012 at 12:53:29PM +0200, Michael Niedermayer wrote:
> The use of cyan is droped from the levels to avoid confusion
> magenta/cyan/blue is used for muxer/codec/filter layer
> 
> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  libavutil/log.c |   58 +++++++++++++++++++++++++++++++++++++++++++------------
>  1 file changed, 46 insertions(+), 12 deletions(-)
> 
> diff --git a/libavutil/log.c b/libavutil/log.c
> index e62f11c..22f2364 100644
> --- a/libavutil/log.c
> +++ b/libavutil/log.c
> @@ -34,13 +34,17 @@ static int flags;
>  
>  #if defined(_WIN32) && !defined(__MINGW32CE__)
>  #include <windows.h>
> -static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 11 };
> +static const uint8_t color[] = { 12, 12, 12, 14, 7, 10, 10,
> +                                  3, 11,  5, 13, 1,  9
> +};
>  static int16_t background, attr_orig;
>  static HANDLE con;
>  #define set_color(x)  SetConsoleTextAttribute(con, background | color[x])
>  #define reset_color() SetConsoleTextAttribute(con, attr_orig)
>  #else
> -static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x06 };
> +static const uint8_t color[] = { 0x41, 0x41, 0x11, 0x03, 9, 0x02, 0x02,
> +                                 0x06, 0x16, 0x05, 0x15, 0x04, 0x14
> +};


This is going more and more crazy… I think we should explicit a little
this, like:

    static const uint8_t color[AV_LOG_NB_COLOR] = {
        [AV_LOG_COLOR...] = AV_LOG_COLOR_...,
        ...
    }

Overall, it looks fine, though the mis-alignment of the [foobar @ 0x...]
is more visible now (because of the color highlighting them); but this is
not really a problem. Another free bikeshed: without any bright/bold
color, it looks a bit sad though now (see attached), but not really a
problem either; we can change all these colors anytime.

[...]

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffcolors.png
Type: image/png
Size: 60711 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120601/cc1541aa/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120601/cc1541aa/attachment.asc>


More information about the ffmpeg-devel mailing list