Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
061e340c
Commit
061e340c
authored
Apr 26, 2013
by
Luca Barbato
Committed by
Michael Niedermayer
Apr 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: Factorize check_color_terminal() out
parent
4169d8f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
22 deletions
+25
-22
log.c
libavutil/log.c
+25
-22
No files found.
libavutil/log.c
View file @
061e340c
...
...
@@ -113,33 +113,36 @@ static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = {
#endif
static
int
use_color
=
-
1
;
static
void
c
olored_fputs
(
int
level
,
const
char
*
str
)
static
void
c
heck_color_terminal
(
void
)
{
if
(
!*
str
)
return
;
if
(
use_color
<
0
)
{
#if HAVE_SETCONSOLETEXTATTRIBUTE
CONSOLE_SCREEN_BUFFER_INFO
con_info
;
con
=
GetStdHandle
(
STD_ERROR_HANDLE
);
use_color
=
(
con
!=
INVALID_HANDLE_VALUE
)
&&
!
getenv
(
"NO_COLOR"
)
&&
!
getenv
(
"AV_LOG_FORCE_NOCOLOR"
);
if
(
use_color
)
{
GetConsoleScreenBufferInfo
(
con
,
&
con_info
);
attr_orig
=
con_info
.
wAttributes
;
background
=
attr_orig
&
0xF0
;
}
CONSOLE_SCREEN_BUFFER_INFO
con_info
;
con
=
GetStdHandle
(
STD_ERROR_HANDLE
);
use_color
=
(
con
!=
INVALID_HANDLE_VALUE
)
&&
!
getenv
(
"NO_COLOR"
)
&&
!
getenv
(
"AV_LOG_FORCE_NOCOLOR"
);
if
(
use_color
)
{
GetConsoleScreenBufferInfo
(
con
,
&
con_info
);
attr_orig
=
con_info
.
wAttributes
;
background
=
attr_orig
&
0xF0
;
}
#elif HAVE_ISATTY
use_color
=
!
getenv
(
"NO_COLOR"
)
&&
!
getenv
(
"AV_LOG_FORCE_NOCOLOR"
)
&&
(
getenv
(
"TERM"
)
&&
isatty
(
2
)
||
getenv
(
"AV_LOG_FORCE_COLOR"
));
if
(
getenv
(
"AV_LOG_FORCE_256COLOR"
))
use_color
*=
256
;
use_color
=
!
getenv
(
"NO_COLOR"
)
&&
!
getenv
(
"AV_LOG_FORCE_NOCOLOR"
)
&&
(
getenv
(
"TERM"
)
&&
isatty
(
2
)
||
getenv
(
"AV_LOG_FORCE_COLOR"
));
if
(
getenv
(
"AV_LOG_FORCE_256COLOR"
))
use_color
*=
256
;
#else
use_color
=
getenv
(
"AV_LOG_FORCE_COLOR"
)
&&
!
getenv
(
"NO_COLOR"
)
&&
!
getenv
(
"AV_LOG_FORCE_NOCOLOR"
);
use_color
=
getenv
(
"AV_LOG_FORCE_COLOR"
)
&&
!
getenv
(
"NO_COLOR"
)
&&
!
getenv
(
"AV_LOG_FORCE_NOCOLOR"
);
#endif
}
}
static
void
colored_fputs
(
int
level
,
const
char
*
str
)
{
if
(
!*
str
)
return
;
if
(
use_color
<
0
)
check_color_terminal
();
#if HAVE_SETCONSOLETEXTATTRIBUTE
if
(
use_color
&&
level
!=
AV_LOG_INFO
/
8
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment