Commit f1c5ba55 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove object message filtering from core

parent da803b04
...@@ -121,13 +121,6 @@ typedef void (*msg_callback_t) (msg_cb_data_t *, const msg_item_t *); ...@@ -121,13 +121,6 @@ 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 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 void msg_Unsubscribe( msg_subscription_t * );
/* Enable or disable a certain object debug messages */
VLC_API void msg_EnableObjectPrinting( vlc_object_t *, const char * psz_object );
#define msg_EnableObjectPrinting(a,b) msg_EnableObjectPrinting(VLC_OBJECT(a),b)
VLC_API void msg_DisableObjectPrinting( vlc_object_t *, const char * psz_object );
#define msg_DisableObjectPrinting(a,b) msg_DisableObjectPrinting(VLC_OBJECT(a),b)
/** /**
* @} * @}
*/ */
......
...@@ -661,30 +661,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, ...@@ -661,30 +661,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
/* /*
* Message queue options * Message queue options
*/ */
char * psz_verbose_objects = var_CreateGetNonEmptyString( p_libvlc, "verbose-objects" );
if( psz_verbose_objects )
{
char * psz_object, * iter = psz_verbose_objects;
while( (psz_object = strsep( &iter, "," )) )
{
switch( psz_object[0] )
{
printf("%s\n", psz_object+1);
case '+': msg_EnableObjectPrinting(p_libvlc, psz_object+1); break;
case '-': msg_DisableObjectPrinting(p_libvlc, psz_object+1); break;
default:
msg_Err( p_libvlc, "verbose-objects usage: \n"
"--verbose-objects=+printthatobject,"
"-dontprintthatone\n"
"(keyword 'all' to applies to all objects)");
free( psz_verbose_objects );
/* FIXME: leaks!!!! */
return VLC_EGENERIC;
}
}
free( psz_verbose_objects );
}
/* Last chance to set the verbosity. Once we start interfaces and other /* Last chance to set the verbosity. Once we start interfaces and other
* threads, verbosity becomes read-only. */ * threads, verbosity becomes read-only. */
var_Create( p_libvlc, "verbose", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); var_Create( p_libvlc, "verbose", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
......
...@@ -275,8 +275,6 @@ module_provides ...@@ -275,8 +275,6 @@ module_provides
module_unneed module_unneed
vlc_module_load vlc_module_load
vlc_module_unload vlc_module_unload
msg_DisableObjectPrinting
msg_EnableObjectPrinting
msg_Generic msg_Generic
msg_GenericVa msg_GenericVa
msg_Subscribe msg_Subscribe
......
...@@ -72,9 +72,6 @@ struct msg_bank_t ...@@ -72,9 +72,6 @@ struct msg_bank_t
/* Subscribers */ /* Subscribers */
int i_sub; int i_sub;
msg_subscription_t **pp_sub; msg_subscription_t **pp_sub;
vlc_dictionary_t enabled_objects; ///< Enabled objects
bool all_objects_enabled; ///< Should we print all objects?
}; };
/** /**
...@@ -86,50 +83,11 @@ msg_bank_t *msg_Create (void) ...@@ -86,50 +83,11 @@ msg_bank_t *msg_Create (void)
msg_bank_t *bank = malloc (sizeof (*bank)); msg_bank_t *bank = malloc (sizeof (*bank));
vlc_rwlock_init (&bank->lock); vlc_rwlock_init (&bank->lock);
vlc_dictionary_init (&bank->enabled_objects, 0);
bank->all_objects_enabled = true;
bank->i_sub = 0; bank->i_sub = 0;
bank->pp_sub = NULL; bank->pp_sub = NULL;
return bank; return bank;
} }
/**
* Object Printing selection
*/
static void const * kObjectPrintingEnabled = &kObjectPrintingEnabled;
static void const * kObjectPrintingDisabled = &kObjectPrintingDisabled;
#undef msg_EnableObjectPrinting
void msg_EnableObjectPrinting (vlc_object_t *obj, const char * psz_object)
{
msg_bank_t *bank = libvlc_bank (obj->p_libvlc);
vlc_rwlock_wrlock (&bank->lock);
if( !strcmp(psz_object, "all") )
bank->all_objects_enabled = true;
else
vlc_dictionary_insert (&bank->enabled_objects, psz_object,
(void *)kObjectPrintingEnabled);
vlc_rwlock_unlock (&bank->lock);
}
#undef msg_DisableObjectPrinting
void msg_DisableObjectPrinting (vlc_object_t *obj, const char * psz_object)
{
msg_bank_t *bank = libvlc_bank (obj->p_libvlc);
vlc_rwlock_wrlock (&bank->lock);
if( !strcmp(psz_object, "all") )
bank->all_objects_enabled = false;
else
vlc_dictionary_insert (&bank->enabled_objects, psz_object,
(void *)kObjectPrintingDisabled);
vlc_rwlock_unlock (&bank->lock);
}
/** /**
* Destroy the message queues * Destroy the message queues
* *
...@@ -142,8 +100,6 @@ void msg_Destroy (msg_bank_t *bank) ...@@ -142,8 +100,6 @@ void msg_Destroy (msg_bank_t *bank)
if (unlikely(bank->i_sub != 0)) if (unlikely(bank->i_sub != 0))
fputs ("stale interface subscribers (LibVLC might crash)\n", stderr); fputs ("stale interface subscribers (LibVLC might crash)\n", stderr);
vlc_dictionary_clear (&bank->enabled_objects, NULL, NULL);
vlc_rwlock_destroy (&bank->lock); vlc_rwlock_destroy (&bank->lock);
free (bank); free (bank);
} }
...@@ -325,19 +281,7 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type, const char *psz_module, ...@@ -325,19 +281,7 @@ void msg_GenericVa (vlc_object_t *p_this, int i_type, const char *psz_module,
for (int i = 0; i < bank->i_sub; i++) for (int i = 0; i < bank->i_sub; i++)
{ {
msg_subscription_t *sub = bank->pp_sub[i]; msg_subscription_t *sub = bank->pp_sub[i];
libvlc_priv_t *priv = libvlc_priv( sub->instance );
msg_bank_t *bank = priv->msg_bank;
void *val = vlc_dictionary_value_for_key( &bank->enabled_objects,
msg.psz_module );
if( val == kObjectPrintingDisabled ) continue;
if( val != kObjectPrintingEnabled ) /*if not allowed */
{
val = vlc_dictionary_value_for_key( &bank->enabled_objects,
msg.psz_object_type );
if( val == kObjectPrintingDisabled ) continue;
if( val == kObjectPrintingEnabled ); /* Allowed */
else if( !bank->all_objects_enabled ) continue;
}
sub->func (sub->opaque, &msg); sub->func (sub->opaque, &msg);
} }
vlc_rwlock_unlock (&bank->lock); vlc_rwlock_unlock (&bank->lock);
...@@ -368,26 +312,6 @@ static void PrintMsg ( vlc_object_t *p_this, const msg_item_t *p_item ) ...@@ -368,26 +312,6 @@ static void PrintMsg ( vlc_object_t *p_this, const msg_item_t *p_item )
if (priv->i_verbose < 0 || priv->i_verbose < (type - VLC_MSG_ERR)) if (priv->i_verbose < 0 || priv->i_verbose < (type - VLC_MSG_ERR))
return; return;
const char *objtype = p_item->psz_object_type;
msg_bank_t *bank = priv->msg_bank;
void * val = vlc_dictionary_value_for_key (&bank->enabled_objects,
p_item->psz_module);
if( val == kObjectPrintingDisabled )
return;
if( val == kObjectPrintingEnabled )
/* Allowed */;
else
{
val = vlc_dictionary_value_for_key (&bank->enabled_objects,
objtype);
if( val == kObjectPrintingDisabled )
return;
if( val == kObjectPrintingEnabled )
/* Allowed */;
else if( !bank->all_objects_enabled )
return;
}
/* Send the message to stderr */ /* Send the message to stderr */
FILE *stream = stderr; FILE *stream = stderr;
int canc = vlc_savecancel (); int canc = vlc_savecancel ();
...@@ -397,8 +321,8 @@ static void PrintMsg ( vlc_object_t *p_this, const msg_item_t *p_item ) ...@@ -397,8 +321,8 @@ static void PrintMsg ( vlc_object_t *p_this, const msg_item_t *p_item )
(void *)p_item->i_object_id); (void *)p_item->i_object_id);
if (p_item->psz_header != NULL) if (p_item->psz_header != NULL)
utf8_fprintf (stream, "[%s] ", p_item->psz_header); utf8_fprintf (stream, "[%s] ", p_item->psz_header);
utf8_fprintf (stream, "%s %s%s: ", p_item->psz_module, objtype, utf8_fprintf (stream, "%s %s%s: ", p_item->psz_module,
msgtype[type]); p_item->psz_object_type, msgtype[type]);
if (priv->b_color) if (priv->b_color)
fputs (msgcolor[type], stream); fputs (msgcolor[type], stream);
fputs (p_item->psz_msg, stream); fputs (p_item->psz_msg, stream);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment