[vlc-devel] commit: libvlc log: stop abusing internal i_verbosity ( Rémi Denis-Courmont )
git version control
git at videolan.org
Tue Feb 10 18:55:26 CET 2009
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Feb 10 19:55:01 2009 +0200| [7bdcd022287f5f99e68ea6f422edbee6cfc54e62] | committer: Rémi Denis-Courmont
libvlc log: stop abusing internal i_verbosity
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7bdcd022287f5f99e68ea6f422edbee6cfc54e62
---
src/control/core.c | 1 +
src/control/libvlc_internal.h | 1 +
src/control/log.c | 25 +++++++++++--------------
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/src/control/core.c b/src/control/core.c
index adf8428..f475f44 100644
--- a/src/control/core.c
+++ b/src/control/core.c
@@ -136,6 +136,7 @@ libvlc_instance_t * libvlc_new( int argc, const char *const *argv,
p_new->p_vlm = NULL;
p_new->b_playlist_locked = 0;
p_new->ref_count = 1;
+ p_new->verbosity = 1;
p_new->p_callback_list = NULL;
vlc_mutex_init(&p_new->instance_lock);
vlc_mutex_init(&p_new->event_callback_lock);
diff --git a/src/control/libvlc_internal.h b/src/control/libvlc_internal.h
index 9509735..d54b437 100644
--- a/src/control/libvlc_internal.h
+++ b/src/control/libvlc_internal.h
@@ -65,6 +65,7 @@ struct libvlc_instance_t
vlm_t *p_vlm;
int b_playlist_locked;
unsigned ref_count;
+ int verbosity;
vlc_mutex_t instance_lock;
vlc_mutex_t event_callback_lock;
struct libvlc_callback_entry_list_t *p_callback_list;
diff --git a/src/control/log.c b/src/control/log.c
index 96ef452..8986eea 100644
--- a/src/control/log.c
+++ b/src/control/log.c
@@ -23,7 +23,6 @@
*****************************************************************************/
#include "libvlc_internal.h"
-#include "../libvlc.h"
#include <vlc/libvlc.h>
#include <assert.h>
@@ -42,10 +41,14 @@ struct msg_cb_data_t
vlc_spinlock_t lock;
msg_item_t *items[VLC_MSG_QSIZE];
unsigned count;
+ int verbosity;
};
static void handler( msg_cb_data_t *d, msg_item_t *p_item, unsigned i_drop )
{
+ if (p_item->i_type > d->verbosity)
+ return;
+
vlc_spin_lock (&d->lock);
if (d->count < VLC_MSG_QSIZE)
{
@@ -72,23 +75,16 @@ struct libvlc_log_iterator_t
unsigned libvlc_get_log_verbosity( const libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
{
- if( p_instance )
- {
- libvlc_priv_t *p_priv = libvlc_priv( p_instance->p_libvlc_int );
- return p_priv->i_verbose;
- }
- RAISEZERO("Invalid VLC instance!");
+ assert( p_instance );
+ (void)p_e;
+ return p_instance->verbosity;
}
void libvlc_set_log_verbosity( libvlc_instance_t *p_instance, unsigned level, libvlc_exception_t *p_e )
{
- if( p_instance )
- {
- libvlc_priv_t *p_priv = libvlc_priv( p_instance->p_libvlc_int );
- p_priv->i_verbose = level;
- }
- else
- RAISEVOID("Invalid VLC instance!");
+ assert( p_instance );
+ (void)p_e;
+ p_instance->verbosity = level;
}
libvlc_log_t *libvlc_log_open( libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
@@ -99,6 +95,7 @@ libvlc_log_t *libvlc_log_open( libvlc_instance_t *p_instance, libvlc_exception_t
if( !p_log ) RAISENULL( "Out of memory" );
p_log->p_instance = p_instance;
+ p_log->data.verbosity = p_instance->verbosity;
p_log->p_messages = msg_Subscribe(p_instance->p_libvlc_int, handler, &p_log->data);
if( !p_log->p_messages )
More information about the vlc-devel
mailing list