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
bad8feb5
Commit
bad8feb5
authored
Jan 28, 2020
by
Marton Balint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/log: factorize ansi_fputs
Signed-off-by:
Marton Balint
<
cus@passwd.hu
>
parent
2b496c90
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
18 deletions
+23
-18
log.c
libavutil/log.c
+23
-18
No files found.
libavutil/log.c
View file @
bad8feb5
...
...
@@ -143,25 +143,8 @@ static void check_color_terminal(void)
#endif
}
static
void
colored_fputs
(
int
level
,
int
tint
,
const
char
*
st
r
)
static
void
ansi_fputs
(
int
level
,
int
tint
,
const
char
*
str
,
int
local_use_colo
r
)
{
int
local_use_color
;
if
(
!*
str
)
return
;
if
(
use_color
<
0
)
check_color_terminal
();
if
(
level
==
AV_LOG_INFO
/
8
)
local_use_color
=
0
;
else
local_use_color
=
use_color
;
#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
if
(
local_use_color
)
SetConsoleTextAttribute
(
con
,
background
|
color
[
level
]);
fputs
(
str
,
stderr
);
if
(
local_use_color
)
SetConsoleTextAttribute
(
con
,
attr_orig
);
#else
if
(
local_use_color
==
1
)
{
fprintf
(
stderr
,
"
\033
[%"
PRIu32
";3%"
PRIu32
"m%s
\033
[0m"
,
...
...
@@ -182,6 +165,28 @@ static void colored_fputs(int level, int tint, const char *str)
str
);
}
else
fputs
(
str
,
stderr
);
}
static
void
colored_fputs
(
int
level
,
int
tint
,
const
char
*
str
)
{
int
local_use_color
;
if
(
!*
str
)
return
;
if
(
use_color
<
0
)
check_color_terminal
();
if
(
level
==
AV_LOG_INFO
/
8
)
local_use_color
=
0
;
else
local_use_color
=
use_color
;
#if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE
if
(
local_use_color
)
SetConsoleTextAttribute
(
con
,
background
|
color
[
level
]);
fputs
(
str
,
stderr
);
if
(
local_use_color
)
SetConsoleTextAttribute
(
con
,
attr_orig
);
#else
ansi_fputs
(
level
,
tint
,
str
,
local_use_color
);
#endif
}
...
...
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