[vlc-commits] Remove object message filtering from core

Rémi Denis-Courmont git at videolan.org
Fri Aug 19 23:00:12 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Aug 19 20:47:49 2011 +0300| [f1c5ba552c3dc1fe6492e7e551f4aaf71f746e8e] | committer: Rémi Denis-Courmont

Remove object message filtering from core

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f1c5ba552c3dc1fe6492e7e551f4aaf71f746e8e
---

 include/vlc_messages.h |    7 ----
 src/libvlc.c           |   24 --------------
 src/libvlccore.sym     |    2 -
 src/misc/messages.c    |   82 ++----------------------------------------------
 4 files changed, 3 insertions(+), 112 deletions(-)

diff --git a/include/vlc_messages.h b/include/vlc_messages.h
index a7b4d29..fd19542 100644
--- a/include/vlc_messages.h
+++ b/include/vlc_messages.h
@@ -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 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)
-
-
 /**
  * @}
  */
diff --git a/src/libvlc.c b/src/libvlc.c
index 8acc696..91c86fa 100644
--- a/src/libvlc.c
+++ b/src/libvlc.c
@@ -661,30 +661,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     /*
      * 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
      * threads, verbosity becomes read-only. */
     var_Create( p_libvlc, "verbose", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 1079293..42c002d 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -275,8 +275,6 @@ module_provides
 module_unneed
 vlc_module_load
 vlc_module_unload
-msg_DisableObjectPrinting
-msg_EnableObjectPrinting
 msg_Generic
 msg_GenericVa
 msg_Subscribe
diff --git a/src/misc/messages.c b/src/misc/messages.c
index 782b2f6..b03d95c 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -72,9 +72,6 @@ struct msg_bank_t
     /* Subscribers */
     int i_sub;
     msg_subscription_t **pp_sub;
-
-    vlc_dictionary_t enabled_objects; ///< Enabled objects
-    bool all_objects_enabled; ///< Should we print all objects?
 };
 
 /**
@@ -86,51 +83,12 @@ msg_bank_t *msg_Create (void)
     msg_bank_t *bank = malloc (sizeof (*bank));
 
     vlc_rwlock_init (&bank->lock);
-    vlc_dictionary_init (&bank->enabled_objects, 0);
-    bank->all_objects_enabled = true;
-
     bank->i_sub = 0;
     bank->pp_sub = NULL;
-
     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
  *
  * This functions prints all messages remaining in the queues,
@@ -142,8 +100,6 @@ void msg_Destroy (msg_bank_t *bank)
     if (unlikely(bank->i_sub != 0))
         fputs ("stale interface subscribers (LibVLC might crash)\n", stderr);
 
-    vlc_dictionary_clear (&bank->enabled_objects, NULL, NULL);
-
     vlc_rwlock_destroy (&bank->lock);
     free (bank);
 }
@@ -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++)
     {
         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);
     }
     vlc_rwlock_unlock (&bank->lock);
@@ -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))
         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 */
     FILE *stream = stderr;
     int canc = vlc_savecancel ();
@@ -397,8 +321,8 @@ static void PrintMsg ( vlc_object_t *p_this, const msg_item_t *p_item )
             (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, objtype,
-                  msgtype[type]);
+    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);



More information about the vlc-commits mailing list