Changeset 497b59e4fc525cca1fd422c0b5ece0672d4d8036
- Timestamp:
- 06/07/08 15:46:17
(5 months ago)
- Author:
- Pierre d'Herbemont <pdherbemont@videolan.org>
- git-committer:
- Pierre d'Herbemont <pdherbemont@videolan.org> 1215351977 +0200
- git-parent:
[1f4f0a78432bfe8f2aef0b119a181f2e05b3cd29]
- git-author:
- Pierre d'Herbemont <pdherbemont@videolan.org> 1215351923 +0200
- Message:
libvlc: Add a --verbose-objects option to select which objects should print their msg.
Sample usage:
--verbose-objects=+input,-all
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rfbb8255 |
r497b59e |
|
| 103 | 103 | VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t * ) ); |
|---|
| 104 | 104 | VLC_EXPORT( void, __msg_Unsubscribe, ( vlc_object_t *, msg_subscription_t * ) ); |
|---|
| | 105 | |
|---|
| | 106 | /* Enable or disable a certain object debug messages */ |
|---|
| | 107 | #define msg_EnableObjectPrinting(a,b) __msg_EnableObjectPrinting(VLC_OBJECT(a),b) |
|---|
| | 108 | #define msg_DisableObjectPrinting(a,b) __msg_DisableObjectPrinting(VLC_OBJECT(a),b) |
|---|
| | 109 | VLC_EXPORT( void, __msg_EnableObjectPrinting, ( vlc_object_t *, char * psz_object ) ); |
|---|
| | 110 | VLC_EXPORT( void, __msg_DisableObjectPrinting, ( vlc_object_t *, char * psz_object ) ); |
|---|
| 105 | 111 | |
|---|
| 106 | 112 | /** |
|---|
| r62ec225 |
r497b59e |
|
| 163 | 163 | "standard messages, 1=warnings, 2=debug).") |
|---|
| 164 | 164 | |
|---|
| | 165 | #define VERBOSE_OBJECTS_TEXT N_("Choose which objects should print debug " \ |
|---|
| | 166 | "message") |
|---|
| | 167 | #define VERBOSE_OBJECTS_LONGTEXT N_( \ |
|---|
| | 168 | "This is a ',' separated string, each objects should be prefixed by " \ |
|---|
| | 169 | "a '+' or a '-' to respectively enable or disable it. The keyword " \ |
|---|
| | 170 | "'all' refers to all objects. Note, you still need to use -vvv " \ |
|---|
| | 171 | "to actually display debug message.") |
|---|
| | 172 | |
|---|
| 165 | 173 | #define QUIET_TEXT N_("Be quiet") |
|---|
| 166 | 174 | #define QUIET_LONGTEXT N_( \ |
|---|
| … | … | |
| 1935 | 1943 | false ); |
|---|
| 1936 | 1944 | change_short('v'); |
|---|
| | 1945 | add_string( "verbose-objects", 0, NULL, VERBOSE_OBJECTS_TEXT, VERBOSE_OBJECTS_LONGTEXT, |
|---|
| | 1946 | false ); |
|---|
| 1937 | 1947 | add_bool( "quiet", 0, NULL, QUIET_TEXT, QUIET_LONGTEXT, true ); |
|---|
| 1938 | 1948 | change_short('q'); |
|---|
| rc7c7269 |
r497b59e |
|
| 634 | 634 | * Message queue options |
|---|
| 635 | 635 | */ |
|---|
| | 636 | char * psz_verbose_objects = config_GetPsz( p_libvlc, "verbose-objects" ); |
|---|
| | 637 | if( psz_verbose_objects ) |
|---|
| | 638 | { |
|---|
| | 639 | char * psz_object, * iter = psz_verbose_objects; |
|---|
| | 640 | while( (psz_object = strsep( &iter, "," )) ) |
|---|
| | 641 | { |
|---|
| | 642 | switch( psz_object[0] ) |
|---|
| | 643 | { |
|---|
| | 644 | printf("%s\n", psz_object+1); |
|---|
| | 645 | case '+': msg_EnableObjectPrinting(p_libvlc, psz_object+1); break; |
|---|
| | 646 | case '-': msg_DisableObjectPrinting(p_libvlc, psz_object+1); break; |
|---|
| | 647 | default: |
|---|
| | 648 | msg_Err( p_libvlc, "verbose-objects usage: \n" |
|---|
| | 649 | "--verbose-objects=+printthatobject," |
|---|
| | 650 | "-dontprintthatone\n" |
|---|
| | 651 | "(keyword 'all' to applies to all objects)\n"); |
|---|
| | 652 | free( psz_verbose_objects ); |
|---|
| | 653 | return VLC_EGENERIC; |
|---|
| | 654 | } |
|---|
| | 655 | } |
|---|
| | 656 | free( psz_verbose_objects ); |
|---|
| | 657 | } |
|---|
| 636 | 658 | |
|---|
| 637 | 659 | var_Create( p_libvlc, "verbose", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); |
|---|
| r9f82d86 |
r497b59e |
|
| 234 | 234 | int i_verbose; ///< info messages |
|---|
| 235 | 235 | bool b_color; ///< color messages? |
|---|
| | 236 | vlc_dictionary_t msg_enabled_objects; ///< Enabled objects |
|---|
| | 237 | bool msg_all_objects_enabled; ///< Should we print all objects? |
|---|
| 236 | 238 | |
|---|
| 237 | 239 | /* Timer stats */ |
|---|
| rd666030 |
r497b59e |
|
| 88 | 88 | vlc_mutex_init( &priv->msg_bank.lock ); |
|---|
| 89 | 89 | vlc_mutex_init( &QUEUE.lock ); |
|---|
| | 90 | vlc_dictionary_init( &priv->msg_enabled_objects, 0 ); |
|---|
| | 91 | priv->msg_all_objects_enabled = true; |
|---|
| | 92 | |
|---|
| 90 | 93 | QUEUE.b_overflow = false; |
|---|
| 91 | 94 | QUEUE.i_start = 0; |
|---|
| … | … | |
| 114 | 117 | } |
|---|
| 115 | 118 | |
|---|
| | 119 | |
|---|
| | 120 | /** |
|---|
| | 121 | * Object Printing selection |
|---|
| | 122 | */ |
|---|
| | 123 | static void const * kObjectPrintingEnabled = (void *) 1; |
|---|
| | 124 | static void const * kObjectPrintingDisabled = (void *) -1; |
|---|
| | 125 | |
|---|
| | 126 | void __msg_EnableObjectPrinting (vlc_object_t *p_this, char * psz_object) |
|---|
| | 127 | { |
|---|
| | 128 | libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc); |
|---|
| | 129 | vlc_mutex_lock( &QUEUE.lock ); |
|---|
| | 130 | if( !strcmp(psz_object, "all") ) |
|---|
| | 131 | priv->msg_all_objects_enabled = true; |
|---|
| | 132 | else |
|---|
| | 133 | vlc_dictionary_insert( &priv->msg_enabled_objects, psz_object, kObjectPrintingEnabled ); |
|---|
| | 134 | vlc_mutex_unlock( &QUEUE.lock ); |
|---|
| | 135 | } |
|---|
| | 136 | |
|---|
| | 137 | void __msg_DisableObjectPrinting (vlc_object_t *p_this, char * psz_object) |
|---|
| | 138 | { |
|---|
| | 139 | libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc); |
|---|
| | 140 | vlc_mutex_lock( &QUEUE.lock ); |
|---|
| | 141 | if( !strcmp(psz_object, "all") ) |
|---|
| | 142 | priv->msg_all_objects_enabled = false; |
|---|
| | 143 | else |
|---|
| | 144 | vlc_dictionary_insert( &priv->msg_enabled_objects, psz_object, kObjectPrintingDisabled ); |
|---|
| | 145 | vlc_mutex_unlock( &QUEUE.lock ); |
|---|
| | 146 | } |
|---|
| | 147 | |
|---|
| 116 | 148 | /** |
|---|
| 117 | 149 | * Destroy the message queues |
|---|
| … | … | |
| 133 | 165 | CloseHandle( QUEUE.logfile ); |
|---|
| 134 | 166 | #endif |
|---|
| | 167 | |
|---|
| | 168 | vlc_dictionary_clear( &priv->msg_enabled_objects ); |
|---|
| | 169 | |
|---|
| 135 | 170 | /* Destroy lock */ |
|---|
| 136 | 171 | vlc_mutex_destroy( &QUEUE.lock ); |
|---|
| … | … | |
| 547 | 582 | |
|---|
| 548 | 583 | psz_object = p_item->psz_object_type; |
|---|
| | 584 | void * val = vlc_dictionary_value_for_key( &priv->msg_enabled_objects, |
|---|
| | 585 | psz_object ); |
|---|
| | 586 | if( val == kObjectPrintingDisabled ) |
|---|
| | 587 | return; |
|---|
| | 588 | if( val == kObjectPrintingEnabled ) |
|---|
| | 589 | /* Allowed */; |
|---|
| | 590 | else if( !priv->msg_all_objects_enabled ) |
|---|
| | 591 | return; |
|---|
| 549 | 592 | |
|---|
| 550 | 593 | #ifdef UNDER_CE |
|---|