Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
b3c55707
Commit
b3c55707
authored
Aug 19, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use same callback prototype for built-in logger as subscribers
parent
55af05f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
34 deletions
+50
-34
src/misc/messages.c
src/misc/messages.c
+50
-34
No files found.
src/misc/messages.c
View file @
b3c55707
...
...
@@ -51,11 +51,6 @@
#include <vlc_charset.h>
#include "../libvlc.h"
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
void
PrintMsg
(
vlc_object_t
*
,
const
msg_item_t
*
);
/**
* Store all data required by messages interfaces.
*/
...
...
@@ -134,6 +129,9 @@ void vlc_Log (vlc_object_t *obj, int type, const char *module,
va_end
(
args
);
}
static
void
PrintColorMsg
(
void
*
,
const
msg_item_t
*
);
static
void
PrintMsg
(
void
*
,
const
msg_item_t
*
);
/**
* Emit a log message. This function is the variable argument list equivalent
* to vlc_Log().
...
...
@@ -233,7 +231,13 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
break
;
}
PrintMsg
(
obj
,
&
msg
);
/* Pass message to subscribers */
libvlc_priv_t
*
priv
=
libvlc_priv
(
obj
->
p_libvlc
);
if
(
priv
->
b_color
)
PrintColorMsg
(
&
priv
->
i_verbose
,
&
msg
);
else
PrintMsg
(
&
priv
->
i_verbose
,
&
msg
);
vlc_rwlock_rdlock
(
&
msg_lock
);
for
(
msg_subscription_t
*
sub
=
msg_head
;
sub
!=
NULL
;
sub
=
sub
->
next
)
...
...
@@ -244,45 +248,57 @@ void vlc_vaLog (vlc_object_t *obj, int type, const char *module,
free
(
str
);
}
/*****************************************************************************
* PrintMsg: output a standard message item to stderr
*****************************************************************************
* Print a message to stderr, with colour formatting if needed.
*****************************************************************************/
static
void
PrintMsg
(
vlc_object_t
*
p_this
,
const
msg_item_t
*
p_item
)
static
const
char
msg_type
[
4
][
9
]
=
{
""
,
" error"
,
" warning"
,
" debug"
};
#define COL(x,y) "\033[" #x ";" #y "m"
#define RED COL(31,1)
#define GREEN COL(32,1)
#define YELLOW COL(0,33)
#define WHITE COL(0,1)
#define GRAY "\033[0m"
static
const
char
msg_color
[
4
][
8
]
=
{
WHITE
,
RED
,
YELLOW
,
GRAY
};
static
void
PrintColorMsg
(
void
*
d
,
const
msg_item_t
*
p_item
)
{
# define COL(x,y) "\033[" #x ";" #y "m"
# define RED COL(31,1)
# define GREEN COL(32,1)
# define YELLOW COL(0,33)
# define WHITE COL(0,1)
# define GRAY "\033[0m"
static
const
char
msgtype
[
4
][
9
]
=
{
""
,
" error"
,
" warning"
,
" debug"
};
static
const
char
msgcolor
[
4
][
8
]
=
{
WHITE
,
RED
,
YELLOW
,
GRAY
};
libvlc_priv_t
*
priv
=
libvlc_priv
(
p_this
->
p_libvlc
);
const
int
*
pverbose
=
d
;
FILE
*
stream
=
stderr
;
int
type
=
p_item
->
i_type
;
if
(
priv
->
i_verbose
<
0
||
priv
->
i_
verbose
<
(
type
-
VLC_MSG_ERR
))
if
(
*
pverbose
<
0
||
*
p
verbose
<
(
type
-
VLC_MSG_ERR
))
return
;
/* Send the message to stderr */
int
canc
=
vlc_savecancel
();
flockfile
(
stream
);
fprintf
(
stream
,
"["
GREEN
"%p"
GRAY
"] "
,
(
void
*
)
p_item
->
i_object_id
);
if
(
p_item
->
psz_header
!=
NULL
)
utf8_fprintf
(
stream
,
"[%s] "
,
p_item
->
psz_header
);
utf8_fprintf
(
stream
,
"%s %s%s: %s%s"
GRAY
"
\n
"
,
p_item
->
psz_module
,
p_item
->
psz_object_type
,
msg_type
[
type
],
msg_color
[
type
],
p_item
->
psz_msg
);
#if defined (WIN32) || defined (__OS2__)
fflush
(
stream
);
#endif
funlockfile
(
stream
);
vlc_restorecancel
(
canc
);
}
static
void
PrintMsg
(
void
*
d
,
const
msg_item_t
*
p_item
)
{
const
int
*
pverbose
=
d
;
FILE
*
stream
=
stderr
;
int
type
=
p_item
->
i_type
;
if
(
*
pverbose
<
0
||
*
pverbose
<
(
type
-
VLC_MSG_ERR
))
return
;
int
canc
=
vlc_savecancel
();
flockfile
(
stream
);
fprintf
(
stream
,
priv
->
b_color
?
"["
GREEN
"%p"
GRAY
"] "
:
"[%p] "
,
(
void
*
)
p_item
->
i_object_id
);
fprintf
(
stream
,
"[%p] "
,
(
void
*
)
p_item
->
i_object_id
);
if
(
p_item
->
psz_header
!=
NULL
)
utf8_fprintf
(
stream
,
"[%s] "
,
p_item
->
psz_header
);
utf8_fprintf
(
stream
,
"%s %s%s: "
,
p_item
->
psz_module
,
p_item
->
psz_object_type
,
msgtype
[
type
]);
if
(
priv
->
b_color
)
fputs
(
msgcolor
[
type
],
stream
);
fputs
(
p_item
->
psz_msg
,
stream
);
if
(
priv
->
b_color
)
fputs
(
GRAY
,
stream
);
putc_unlocked
(
'\n'
,
stream
);
utf8_fprintf
(
stream
,
"%s %s%s: %s
\n
"
,
p_item
->
psz_module
,
p_item
->
psz_object_type
,
msg_type
[
type
],
p_item
->
psz_msg
);
#if defined (WIN32) || defined (__OS2__)
fflush
(
stream
);
#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