VLC_EXPORT( msg_subscription_t*, msg_Subscribe, ( libvlc_int_t *, msg_callback_t, msg_cb_data_t * ) );
VLC_EXPORT( void, msg_Unsubscribe, ( msg_subscription_t * ) );
+VLC_EXPORT( void, msg_SubscriptionSetVerbosity, ( msg_subscription_t *, const int) );
/* Enable or disable a certain object debug messages */
VLC_EXPORT( void, msg_EnableObjectPrinting, ( vlc_object_t *, const char * psz_object ) );
static void const * kObjectPrintingEnabled = &kObjectPrintingEnabled;
static void const * kObjectPrintingDisabled = &kObjectPrintingDisabled;
+
#undef msg_EnableObjectPrinting
void msg_EnableObjectPrinting (vlc_object_t *obj, const char * psz_object)
{
libvlc_int_t *instance;
msg_callback_t func;
msg_cb_data_t *opaque;
+ int verbosity;
};
/**
sub->instance = instance;
sub->func = cb;
sub->opaque = opaque;
+ sub->verbosity = 2; /* by default, give all the messages */
msg_bank_t *bank = libvlc_bank (instance);
vlc_rwlock_wrlock (&bank->lock);
free (sub);
}
+void msg_SubscriptionSetVerbosity( msg_subscription_t *sub, const int i_verbosity )
+{
+ if( i_verbosity < 0 || i_verbosity > 2 ) return;
+
+ msg_bank_t *bank = libvlc_bank ( sub->instance );
+
+ vlc_rwlock_wrlock (&bank->lock);
+
+ sub->verbosity = i_verbosity;
+
+ vlc_rwlock_unlock (&bank->lock);
+}
/*****************************************************************************
* msg_*: print a message
*****************************************************************************
if( val == kObjectPrintingEnabled ); /* Allowed */
else if( !bank->all_objects_enabled ) continue;
}
+ switch( p_item->i_type )
+ {
+ case VLC_MSG_INFO:
+ case VLC_MSG_ERR:
+ if( sub->verbosity < 0 ) continue;
+ break;
+ case VLC_MSG_WARN:
+ if( sub->verbosity < 1 ) continue;
+ break;
+ case VLC_MSG_DBG:
+ if( sub->verbosity < 2 ) continue;
+ break;
+ }
sub->func (sub->opaque, p_item, 0);
}