Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
fad10ee5
Commit
fad10ee5
authored
Aug 19, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix namespace, remove useless variable and clean up msg_* functions()
parent
9ffae683
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
63 deletions
+58
-63
include/vlc_messages.h
include/vlc_messages.h
+11
-13
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+2
-2
modules/gui/ncurses.c
modules/gui/ncurses.c
+2
-2
modules/gui/qt4/dialogs/messages.cpp
modules/gui/qt4/dialogs/messages.cpp
+2
-2
modules/gui/skins2/src/skin_main.cpp
modules/gui/skins2/src/skin_main.cpp
+2
-2
modules/misc/logger.c
modules/misc/logger.c
+2
-2
src/control/log.c
src/control/log.c
+2
-2
src/libvlccore.sym
src/libvlccore.sym
+4
-4
src/misc/messages.c
src/misc/messages.c
+31
-34
No files found.
include/vlc_messages.h
View file @
fad10ee5
...
...
@@ -93,22 +93,20 @@ typedef struct msg_subscription_t msg_subscription_t;
/*****************************************************************************
* Prototypes
*****************************************************************************/
VLC_API
void
msg_Generic
(
vlc_object_t
*
,
int
,
const
char
*
,
const
char
*
,
...
)
VLC_FORMAT
(
4
,
5
);
VLC_API
void
msg_GenericVa
(
vlc_object_t
*
,
int
,
const
char
*
,
const
char
*
,
va_list
args
);
#define msg_GenericVa(a, b, c, d, e) msg_GenericVa(VLC_OBJECT(a), b, c, d, e)
VLC_API
void
vlc_Log
(
vlc_object_t
*
,
int
,
const
char
*
,
const
char
*
,
...)
VLC_FORMAT
(
4
,
5
);
VLC_API
void
vlc_vaLog
(
vlc_object_t
*
,
int
,
const
char
*
,
const
char
*
,
va_list
);
#define msg_GenericVa(a, b, c, d, e) vlc_vaLog(VLC_OBJECT(a), b, c, d, e)
#define msg_Info( p_this, ... ) \
msg_Generic( VLC_OBJECT(p_this), VLC_MSG_INFO, \
MODULE_STRING, __VA_ARGS__ )
vlc_Log( VLC_OBJECT(p_this), VLC_MSG_INFO, MODULE_STRING, __VA_ARGS__ )
#define msg_Err( p_this, ... ) \
msg_Generic( VLC_OBJECT(p_this), VLC_MSG_ERR, \
MODULE_STRING, __VA_ARGS__ )
vlc_Log( VLC_OBJECT(p_this), VLC_MSG_ERR, MODULE_STRING, __VA_ARGS__ )
#define msg_Warn( p_this, ... ) \
msg_Generic( VLC_OBJECT(p_this), VLC_MSG_WARN, \
MODULE_STRING, __VA_ARGS__ )
vlc_Log( VLC_OBJECT(p_this), VLC_MSG_WARN, MODULE_STRING, __VA_ARGS__ )
#define msg_Dbg( p_this, ... ) \
msg_Generic( VLC_OBJECT(p_this), VLC_MSG_DBG, \
MODULE_STRING, __VA_ARGS__ )
vlc_Log( VLC_OBJECT(p_this), VLC_MSG_DBG, MODULE_STRING, __VA_ARGS__ )
typedef
struct
msg_cb_data_t
msg_cb_data_t
;
...
...
@@ -118,8 +116,8 @@ typedef struct msg_cb_data_t msg_cb_data_t;
*/
typedef
void
(
*
msg_callback_t
)
(
msg_cb_data_t
*
,
const
msg_item_t
*
);
VLC_API
msg_subscription_t
*
msg_Subscribe
(
libvlc_int_t
*
,
msg_callback_t
,
msg_cb_data_t
*
)
VLC_USED
;
VLC_API
void
msg_Unsubscribe
(
msg_subscription_t
*
);
VLC_API
msg_subscription_t
*
vlc_Subscribe
(
msg_callback_t
,
msg_cb_data_t
*
)
VLC_USED
;
VLC_API
void
vlc_Unsubscribe
(
msg_subscription_t
*
);
/**
* @}
...
...
modules/gui/macosx/intf.m
View file @
fad10ee5
...
...
@@ -102,7 +102,7 @@ int OpenIntf ( vlc_object_t *p_this )
memset
(
p_intf
->
p_sys
,
0
,
sizeof
(
*
p_intf
->
p_sys
)
);
/* subscribe to LibVLCCore's messages */
p_intf
->
p_sys
->
p_sub
=
msg_Subscribe
(
p_intf
->
p_libvlc
,
MsgCallback
,
NULL
);
p_intf
->
p_sys
->
p_sub
=
vlc_Subscribe
(
MsgCallback
,
NULL
);
p_intf
->
pf_run
=
Run
;
p_intf
->
b_should_run_on_first_thread
=
true
;
...
...
@@ -721,7 +721,7 @@ static VLCMain *_o_sharedMainInstance = nil;
[
o_mainwindow
release
];
/* unsubscribe from libvlc's debug messages */
msg
_Unsubscribe
(
p_intf
->
p_sys
->
p_sub
);
vlc
_Unsubscribe
(
p_intf
->
p_sys
->
p_sub
);
[
o_msg_arr
removeAllObjects
];
[
o_msg_arr
release
];
...
...
modules/gui/ncurses.c
View file @
fad10ee5
...
...
@@ -1901,7 +1901,7 @@ static int Open(vlc_object_t *p_this)
memset
(
p_sys
->
msgs
,
0
,
sizeof
p_sys
->
msgs
);
p_sys
->
i_msgs
=
0
;
p_sys
->
i_verbosity
=
var_InheritInteger
(
p_intf
,
"verbose"
);
p_sys
->
p_sub
=
msg_Subscribe
(
p_intf
->
p_libvlc
,
MsgCallback
,
msg_cb_data
);
p_sys
->
p_sub
=
vlc_Subscribe
(
MsgCallback
,
msg_cb_data
);
p_sys
->
i_box_type
=
BOX_PLAYLIST
;
p_sys
->
b_plidx_follow
=
true
;
...
...
@@ -1956,7 +1956,7 @@ static void Close(vlc_object_t *p_this)
endwin
();
/* Close the ncurses interface */
msg
_Unsubscribe
(
p_sys
->
p_sub
);
vlc
_Unsubscribe
(
p_sys
->
p_sub
);
vlc_mutex_destroy
(
&
p_sys
->
msg_lock
);
vlc_mutex_destroy
(
&
p_sys
->
pl_lock
);
for
(
unsigned
i
=
0
;
i
<
sizeof
p_sys
->
msgs
/
sizeof
*
p_sys
->
msgs
;
i
++
)
...
...
modules/gui/qt4/dialogs/messages.cpp
View file @
fad10ee5
...
...
@@ -128,13 +128,13 @@ MessagesDialog::MessagesDialog( intf_thread_t *_p_intf)
/* Hook up to LibVLC messaging */
cbData
=
new
msg_cb_data_t
;
cbData
->
self
=
this
;
sub
=
msg_Subscribe
(
p_intf
->
p_libvlc
,
MsgCallback
,
cbData
);
sub
=
vlc_Subscribe
(
MsgCallback
,
cbData
);
}
MessagesDialog
::~
MessagesDialog
()
{
writeSettings
(
"Messages"
);
msg
_Unsubscribe
(
sub
);
vlc
_Unsubscribe
(
sub
);
delete
cbData
;
};
...
...
modules/gui/skins2/src/skin_main.cpp
View file @
fad10ee5
...
...
@@ -83,7 +83,7 @@ static int Open( vlc_object_t *p_this )
// Suscribe to messages bank
#if 0
p_intf->p_sys->p_sub =
msg
_Subscribe( p_intf );
p_intf->p_sys->p_sub =
vlc
_Subscribe( p_intf );
#endif
p_intf
->
p_sys
->
p_input
=
NULL
;
...
...
@@ -152,7 +152,7 @@ static void Close( vlc_object_t *p_this )
// Unsubscribe from messages bank
#if 0
msg
_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
vlc
_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
#endif
// Destroy structure
...
...
modules/misc/logger.c
View file @
fad10ee5
...
...
@@ -322,7 +322,7 @@ static int Open( vlc_object_t *p_this )
#endif
}
p_sys
->
p_sub
=
msg_Subscribe
(
p_intf
->
p_libvlc
,
Overflow
,
&
p_sys
->
msg
);
p_sys
->
p_sub
=
vlc_Subscribe
(
Overflow
,
&
p_sys
->
msg
);
return
0
;
}
...
...
@@ -337,7 +337,7 @@ static void Close( vlc_object_t *p_this )
/* Flush the queue and unsubscribe from the message queue */
/* FIXME: flush */
msg
_Unsubscribe
(
p_sys
->
p_sub
);
vlc
_Unsubscribe
(
p_sys
->
p_sub
);
switch
(
p_sys
->
msg
.
i_mode
)
{
...
...
src/control/log.c
View file @
fad10ee5
...
...
@@ -100,7 +100,7 @@ libvlc_log_t *libvlc_log_open( libvlc_instance_t *p_instance )
vlc_spin_init
(
&
p_log
->
data
.
lock
);
p_log
->
data
.
count
=
0
;
p_log
->
data
.
verbosity
=
p_instance
->
verbosity
;
p_log
->
p_messages
=
msg_Subscribe
(
p_instance
->
p_libvlc_int
,
handler
,
&
p_log
->
data
);
p_log
->
p_messages
=
vlc_Subscribe
(
handler
,
&
p_log
->
data
);
if
(
!
p_log
->
p_messages
)
{
...
...
@@ -119,7 +119,7 @@ void libvlc_log_close( libvlc_log_t *p_log )
return
;
assert
(
p_log
->
p_messages
);
msg
_Unsubscribe
(
p_log
->
p_messages
);
vlc
_Unsubscribe
(
p_log
->
p_messages
);
libvlc_release
(
p_log
->
p_instance
);
libvlc_log_clear
(
p_log
);
vlc_spin_destroy
(
&
p_log
->
data
.
lock
);
...
...
src/libvlccore.sym
View file @
fad10ee5
...
...
@@ -275,10 +275,10 @@ module_provides
module_unneed
vlc_module_load
vlc_module_unload
msg_Generic
msg_GenericVa
msg
_Subscribe
msg
_Unsubscribe
vlc_Log
vlc_vaLog
vlc
_Subscribe
vlc
_Unsubscribe
msleep
mstrtime
mwait
...
...
src/misc/messages.c
View file @
fad10ee5
...
...
@@ -78,8 +78,7 @@ struct msg_subscription_t
* @param opaque data for the callback function
* @return a subscription pointer, or NULL in case of failure
*/
msg_subscription_t
*
msg_Subscribe
(
libvlc_int_t
*
instance
,
msg_callback_t
cb
,
msg_cb_data_t
*
opaque
)
msg_subscription_t
*
vlc_Subscribe
(
msg_callback_t
cb
,
msg_cb_data_t
*
opaque
)
{
msg_subscription_t
*
sub
=
malloc
(
sizeof
(
*
sub
));
if
(
sub
==
NULL
)
...
...
@@ -101,7 +100,7 @@ msg_subscription_t *msg_Subscribe (libvlc_int_t *instance, msg_callback_t cb,
* Unsubscribe from the message queue.
* This function waits for the message callback to return if needed.
*/
void
msg
_Unsubscribe
(
msg_subscription_t
*
sub
)
void
vlc
_Unsubscribe
(
msg_subscription_t
*
sub
)
{
vlc_rwlock_wrlock
(
&
msg_lock
);
if
(
sub
->
next
!=
NULL
)
...
...
@@ -117,36 +116,34 @@ void msg_Unsubscribe (msg_subscription_t *sub)
free
(
sub
);
}
/*****************************************************************************
* msg_*: print a message
*****************************************************************************
* These functions queue a message for later printing.
*****************************************************************************/
void
msg_Generic
(
vlc_object_t
*
p_this
,
int
i_type
,
const
char
*
psz_module
,
const
char
*
psz_format
,
...
)
/**
* Emit a log message.
* \param obj VLC object emitting the message
* \param type VLC_MSG_* message type (info, error, warning or debug)
* \param module name of module from which the message come
* (normally MODULE_STRING)
* \param format printf-like message format
*/
void
vlc_Log
(
vlc_object_t
*
obj
,
int
type
,
const
char
*
module
,
const
char
*
format
,
...
)
{
va_list
args
;
va_start
(
args
,
psz_format
);
msg_GenericVa
(
p_this
,
i_type
,
psz_module
,
psz_
format
,
args
);
va_end
(
args
);
va_start
(
args
,
format
);
vlc_vaLog
(
obj
,
type
,
module
,
format
,
args
);
va_end
(
args
);
}
#undef msg_GenericVa
/**
* Add a message to a queue
*
* This function provides basic functionnalities to other msg_* functions.
* It adds a message to a queue (after having printed all stored messages if it
* is full). If the message can't be converted to string in memory, it issues
* a warning.
* Emit a log message. This function is the variable argument list equivalent
* to vlc_Log().
*/
void
msg_GenericVa
(
vlc_object_t
*
p_this
,
int
i_type
,
const
char
*
psz_
module
,
const
char
*
psz_
format
,
va_list
args
)
void
vlc_vaLog
(
vlc_object_t
*
obj
,
int
type
,
const
char
*
module
,
const
char
*
format
,
va_list
args
)
{
assert
(
p_this
);
assert
(
obj
!=
NULL
);
if
(
p_this
->
i_flags
&
OBJECT_FLAGS_QUIET
)
if
(
obj
->
i_flags
&
OBJECT_FLAGS_QUIET
)
return
;
/* C locale to get error messages in English in the logs */
...
...
@@ -155,10 +152,10 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type, const char *psz_module,
#ifndef __GLIBC__
/* Expand %m to strerror(errno) - only once */
char
buf
[
strlen
(
psz_format
)
+
2001
],
*
ptr
;
strcpy
(
buf
,
psz_format
);
char
buf
[
strlen
(
format
)
+
2001
],
*
ptr
;
strcpy
(
buf
,
format
);
ptr
=
(
char
*
)
buf
;
psz_
format
=
(
const
char
*
)
buf
;
format
=
(
const
char
*
)
buf
;
for
(
;;
)
{
...
...
@@ -213,7 +210,7 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type, const char *psz_module,
static
const
char
nomemstr
[]
=
"<not enough memory to format message>"
;
char
*
str
;
if
(
unlikely
(
vasprintf
(
&
str
,
psz_
format
,
args
)
==
-
1
))
if
(
unlikely
(
vasprintf
(
&
str
,
format
,
args
)
==
-
1
))
str
=
(
char
*
)
nomemstr
;
uselocale
(
locale
);
...
...
@@ -222,21 +219,21 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type, const char *psz_module,
/* Fill message information fields */
msg_item_t
msg
;
msg
.
i_type
=
i_
type
;
msg
.
i_object_id
=
(
uintptr_t
)
p_this
;
msg
.
psz_object_type
=
p_this
->
psz_object_type
;
msg
.
psz_module
=
psz_
module
;
msg
.
i_type
=
type
;
msg
.
i_object_id
=
(
uintptr_t
)
obj
;
msg
.
psz_object_type
=
obj
->
psz_object_type
;
msg
.
psz_module
=
module
;
msg
.
psz_msg
=
str
;
msg
.
psz_header
=
NULL
;
for
(
vlc_object_t
*
o
=
p_this
;
o
!=
NULL
;
o
=
o
->
p_parent
)
for
(
vlc_object_t
*
o
=
obj
;
o
!=
NULL
;
o
=
o
->
p_parent
)
if
(
o
->
psz_header
!=
NULL
)
{
msg
.
psz_header
=
o
->
psz_header
;
break
;
}
PrintMsg
(
p_this
,
&
msg
);
PrintMsg
(
obj
,
&
msg
);
vlc_rwlock_rdlock
(
&
msg_lock
);
for
(
msg_subscription_t
*
sub
=
msg_head
;
sub
!=
NULL
;
sub
=
sub
->
next
)
...
...
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