Changeset cdd517525b71b7b5390bfff52db183b09b00f7fe

Show
Ignore:
Timestamp:
05/10/08 11:57:12 (2 months ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1210413432 +0300
git-parent:

[80ddb522d75cca49a7337c62431709be670c9bdd]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1210413432 +0300
Message:

Remove message unused "queue" parameter

There is only one queue at the moment, and if someone wants multiple
queues, it's probably not a good idea to hard-code queues as integers.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_messages.h

    r80ddb52 rcdd5175  
    6767#define VLC_MSG_DBG   3 
    6868 
    69 #define MSG_QUEUE_NORMAL 0 
    70 #define MSG_QUEUE_HTTPD_ACCESS 1 
    71  
    7269/** 
    7370 * Used by interface plugins which subscribe to the message bank. 
     
    8582 * Prototypes 
    8683 *****************************************************************************/ 
    87 VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 5, 6 ) ); 
    88 VLC_EXPORT( void, __msg_GenericVa, ( vlc_object_t *, int, int, const char *, const char *, va_list args ) ); 
    89 #define msg_GenericVa(a, b, c, d, e,f) __msg_GenericVa(VLC_OBJECT(a), b, c, d, e,f
     84VLC_EXPORT( void, __msg_Generic, ( vlc_object_t *, int, const char *, const char *, ... ) ATTRIBUTE_FORMAT( 4, 5 ) ); 
     85VLC_EXPORT( void, __msg_GenericVa, ( vlc_object_t *, int, const char *, const char *, va_list args ) ); 
     86#define msg_GenericVa(a, b, c, d, e) __msg_GenericVa(VLC_OBJECT(a), b, c, d, e
    9087VLC_EXPORT( void, __msg_Info,    ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); 
    9188VLC_EXPORT( void, __msg_Err,     ( vlc_object_t *, const char *, ... ) ATTRIBUTE_FORMAT( 2, 3 ) ); 
     
    9491 
    9592#define msg_Info( p_this, ... ) \ 
    96       __msg_Generic( VLC_OBJECT(p_this), MSG_QUEUE_NORMAL, VLC_MSG_INFO, \ 
     93      __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_INFO, \ 
    9794                     MODULE_STRING, __VA_ARGS__ ) 
    9895#define msg_Err( p_this, ... ) \ 
    99       __msg_Generic( VLC_OBJECT(p_this), MSG_QUEUE_NORMAL, VLC_MSG_ERR, \ 
     96      __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_ERR, \ 
    10097                     MODULE_STRING, __VA_ARGS__ ) 
    10198#define msg_Warn( p_this, ... ) \ 
    102       __msg_Generic( VLC_OBJECT(p_this), MSG_QUEUE_NORMAL, VLC_MSG_WARN, \ 
     99      __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_WARN, \ 
    103100                     MODULE_STRING, __VA_ARGS__ ) 
    104101#define msg_Dbg( p_this, ... ) \ 
    105       __msg_Generic( VLC_OBJECT(p_this), MSG_QUEUE_NORMAL, VLC_MSG_DBG, \ 
     102      __msg_Generic( VLC_OBJECT(p_this), VLC_MSG_DBG, \ 
    106103                     MODULE_STRING, __VA_ARGS__ ) 
    107104 
    108 #define msg_Subscribe(a,b) __msg_Subscribe(VLC_OBJECT(a),b
     105#define msg_Subscribe(a) __msg_Subscribe(VLC_OBJECT(a)
    109106#define msg_Unsubscribe(a,b) __msg_Unsubscribe(VLC_OBJECT(a),b) 
    110 VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t *, int ) ); 
     107VLC_EXPORT( msg_subscription_t*, __msg_Subscribe, ( vlc_object_t * ) ); 
    111108VLC_EXPORT( void, __msg_Unsubscribe, ( vlc_object_t *, msg_subscription_t * ) ); 
    112109 
  • modules/codec/ffmpeg/ffmpeg.c

    r6300760 rcdd5175  
    448448    snprintf( psz_new_format, strlen(psz_format) + strlen(psz_item_name) 
    449449              + 18 + 5, "%s (%s@%p)", psz_format, p_avc->item_name(p_opaque), p_opaque ); 
    450     msg_GenericVa( p_this, MSG_QUEUE_NORMAL, i_vlc_level, 
     450    msg_GenericVa( p_this, i_vlc_level, 
    451451                    MODULE_STRING, psz_new_format, va ); 
    452452    free( psz_new_format ); 
  • modules/demux/mkv.cpp

    r27d483e rcdd5175  
    504504    psz_foo2[ 4 * i_level + 1 ] = ' '; 
    505505    strcpy( &psz_foo2[ 4 * i_level + 2 ], psz_format ); 
    506     __msg_GenericVa( VLC_OBJECT(&demuxer), MSG_QUEUE_NORMAL, VLC_MSG_DBG, "mkv", psz_foo2, args ); 
     506    __msg_GenericVa( VLC_OBJECT(&demuxer),VLC_MSG_DBG, "mkv", psz_foo2, args ); 
    507507    free( psz_foo2 ); 
    508508    va_end( args ); 
  • modules/gui/beos/MessagesWindow.cpp

    r6c52c72 rcdd5175  
    127127    SetSizeLimits( 400, 2000, 200, 2000 ); 
    128128 
    129     p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); 
     129    p_sub = msg_Subscribe( p_intf ); 
    130130  
    131131    BRect rect, textRect; 
  • modules/gui/macosx/intf.m

    r3ad6ea9 rcdd5175  
    108108 
    109109    p_intf->p_sys->o_sendport = [[NSPort port] retain]; 
    110     p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); 
     110    p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); 
    111111    p_intf->b_play = true; 
    112112    p_intf->pf_run = Run; 
  • modules/gui/ncurses.c

    r2c73e8c rcdd5175  
    257257    p_sys->i_box_plidx = 0; 
    258258    p_sys->i_box_bidx = 0; 
    259     p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); 
     259    p_sys->p_sub = msg_Subscribe( p_intf ); 
    260260    p_sys->b_color = var_CreateGetBool( p_intf, "color" ); 
    261261    p_sys->b_color_started = false; 
  • modules/gui/qt4/qt4.cpp

    r27d483e rcdd5175  
    234234 
    235235    p_intf->p_sys->p_playlist = pl_Yield( p_intf ); 
    236     p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); 
     236    p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); 
    237237 
    238238    /* We support play on start */ 
  • modules/gui/skins2/src/skin_main.cpp

    r27d483e rcdd5175  
    9696 
    9797    // Suscribe to messages bank 
    98     p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); 
     98    p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); 
    9999 
    100100    p_intf->p_sys->p_input = NULL; 
  • modules/gui/wince/wince.cpp

    r27d483e rcdd5175  
    117117 
    118118    // Suscribe to messages bank 
    119     p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); 
     119    p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); 
    120120 
    121121    // Misc init 
  • modules/gui/wxwidgets/wxwidgets.cpp

    r27d483e rcdd5175  
    200200    p_intf->pf_run = Run; 
    201201 
    202     p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL ); 
     202    p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); 
    203203 
    204204    /* Initialize wxWidgets thread */ 
  • modules/misc/logger.c

    r27d483e rcdd5175  
    292292    } 
    293293 
    294     p_intf->p_sys->p_sub = msg_Subscribe( p_intf , MSG_QUEUE_NORMAL ); 
     294    p_intf->p_sys->p_sub = msg_Subscribe( p_intf ); 
    295295    p_intf->pf_run = Run; 
    296296 
  • modules/misc/lua/vlc.h

    r6300760 rcdd5175  
    6565    va_list ap; 
    6666    va_start( ap, ppz_fmt ); 
    67     __msg_GenericVa( ( vlc_object_t *)p_this, MSG_QUEUE_NORMAL, 
    68                       VLC_MSG_DBG, MODULE_STRING, 
     67    __msg_GenericVa( ( vlc_object_t *)p_this, VLC_MSG_DBG, MODULE_STRING, 
    6968                      ppz_fmt, ap ); 
    7069    va_end( ap ); 
  • src/control/log.c

    rc452d07 rcdd5175  
    7070 
    7171    p_log->p_instance = p_instance; 
    72     p_log->p_messages = msg_Subscribe(p_instance->p_libvlc_int, MSG_QUEUE_NORMAL); 
     72    p_log->p_messages = msg_Subscribe(p_instance->p_libvlc_int); 
    7373 
    7474    if( !p_log->p_messages ) 
  • src/libvlc.h

    r80ddb52 rcdd5175  
    6464 */ 
    6565 
    66 #define NB_QUEUES 2 
    67  
    6866typedef struct msg_queue_t 
    6967{ 
    70     int                     i_id; 
    71  
    7268    /** Message queue lock */ 
    7369    vlc_mutex_t             lock; 
     
    9591{ 
    9692    vlc_mutex_t             lock; 
    97     msg_queue_t             queues[NB_QUEUES]
     93    msg_queue_t             queue
    9894} msg_bank_t; 
    9995 
  • src/misc/messages.c

    r80ddb52 rcdd5175  
    6767#endif 
    6868 
    69 #define QUEUE(i) priv->msg_bank.queues[i] 
     69#define QUEUE priv->msg_bank.queue 
    7070#define LOCK_BANK vlc_mutex_lock( &priv->msg_bank.lock ); 
    7171#define UNLOCK_BANK vlc_mutex_unlock( &priv->msg_bank.lock ); 
     
    7474 * Local prototypes 
    7575 *****************************************************************************/ 
    76 static void QueueMsg ( vlc_object_t *, int, int , const char *, 
     76static void QueueMsg ( vlc_object_t *, int, const char *, 
    7777                       const char *, va_list ); 
    7878static void FlushMsg ( msg_queue_t * ); 
     
    8787    libvlc_priv_t *priv = libvlc_priv (p_libvlc); 
    8888    vlc_mutex_init( &priv->msg_bank.lock ); 
    89  
    90     for( int i = 0; i < 2; i++ ) 
    91     { 
    92          vlc_mutex_init( &QUEUE(i).lock ); 
    93          QUEUE(i).b_overflow = false; 
    94          QUEUE(i).i_id = i; 
    95          QUEUE(i).i_start = 0; 
    96          QUEUE(i).i_stop = 0; 
    97          QUEUE(i).i_sub = 0; 
    98          QUEUE(i).pp_sub = 0; 
    99     } 
     89    vlc_mutex_init( &QUEUE.lock ); 
     90    QUEUE.b_overflow = false; 
     91    QUEUE.i_start = 0; 
     92    QUEUE.i_stop = 0; 
     93    QUEUE.i_sub = 0; 
     94    QUEUE.pp_sub = 0; 
    10095 
    10196#ifdef UNDER_CE 
    102     QUEUE(MSG_QUEUE_NORMAL).logfile = 
     97    QUEUE.logfile = 
    10398        CreateFile( L"vlc-log.txt", GENERIC_WRITE, 
    10499                    FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, 
    105100                    CREATE_ALWAYS, 0, NULL ); 
    106     SetFilePointer( QUEUE(MSG_QUEUE_NORMAL).logfile, 0, NULL, FILE_END ); 
     101    SetFilePointer( QUEUE.logfile, 0, NULL, FILE_END ); 
    107102#endif 
    108103} 
     
    114109{ 
    115110    libvlc_priv_t *priv = libvlc_priv (p_libvlc); 
    116  
    117     for( int i = 0 ; i < NB_QUEUES ; i++ ) 
    118     { 
    119         vlc_mutex_lock( &QUEUE(i).lock ); 
    120         FlushMsg( &QUEUE(i) ); 
    121         vlc_mutex_unlock( &QUEUE(i).lock ); 
    122     } 
     111    vlc_mutex_lock( &QUEUE.lock ); 
     112    FlushMsg( &QUEUE ); 
     113    vlc_mutex_unlock( &QUEUE.lock ); 
    123114} 
    124115 
     
    134125    libvlc_priv_t *priv = libvlc_priv (p_libvlc); 
    135126 
    136     for( int i = NB_QUEUES -1 ; i >= 0;  i-- ) 
    137     { 
    138         if( QUEUE(i).i_sub ) 
    139             msg_Err( p_libvlc, "stale interface subscribers" ); 
    140  
    141         FlushMsg( &QUEUE(i) ); 
     127    if( QUEUE.i_sub ) 
     128        msg_Err( p_libvlc, "stale interface subscribers" ); 
     129 
     130    FlushMsg( &QUEUE ); 
    142131 
    143132#ifdef UNDER_CE 
    144         if( i == MSG_QUEUE_NORMAL ) 
    145             CloseHandle( QUEUE(MSG_QUEUE_NORMAL).logfile ); 
    146 #endif 
    147         /* Destroy lock */ 
    148         vlc_mutex_destroy( &QUEUE(i).lock ); 
    149     } 
     133    CloseHandle( QUEUE.logfile ); 
     134#endif 
     135    /* Destroy lock */ 
     136    vlc_mutex_destroy( &QUEUE.lock ); 
    150137    vlc_mutex_destroy( &priv->msg_bank.lock); 
    151138} 
     
    154141 * Subscribe to a message queue. 
    155142 */ 
    156 msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this, int i
     143msg_subscription_t *__msg_Subscribe( vlc_object_t *p_this
    157144{ 
    158145    libvlc_priv_t *priv = libvlc_priv (p_this->p_libvlc); 
     
    162149        return NULL; 
    163150 
    164     assert( i < NB_QUEUES ); 
    165  
    166151    LOCK_BANK; 
    167     vlc_mutex_lock( &QUEUE(i).lock ); 
    168  
    169     TAB_APPEND( QUEUE(i).i_sub, QUEUE(i).pp_sub, p_sub ); 
    170  
    171     p_sub->i_start = QUEUE(i).i_start; 
    172     p_sub->pi_stop = &QUEUE(i).i_stop; 
    173     p_sub->p_msg   = QUEUE(i).msg; 
    174     p_sub->p_lock  = &QUEUE(i).lock; 
    175  
    176     vlc_mutex_unlock( &QUEUE(i).lock ); 
     152    vlc_mutex_lock( &QUEUE.lock ); 
     153 
     154    TAB_APPEND( QUEUE.i_sub, QUEUE.pp_sub, p_sub ); 
     155 
     156    p_sub->i_start = QUEUE.i_start; 
     157    p_sub->pi_stop = &QUEUE.i_stop; 
     158    p_sub->p_msg   = QUEUE.msg; 
     159    p_sub->p_lock  = &QUEUE.lock; 
     160 
     161    vlc_mutex_unlock( &QUEUE.lock ); 
    177162    UNLOCK_BANK; 
    178163 
     
    188173 
    189174    LOCK_BANK; 
    190     for( int i = 0 ; i< NB_QUEUES ; i++ ) 
    191     { 
    192         vlc_mutex_lock( &QUEUE(i).lock ); 
    193         for( int j = 0 ; j< QUEUE(i).i_sub ; j++ ) 
    194         { 
    195             if( QUEUE(i).pp_sub[j] == p_sub ) 
    196             { 
    197                 REMOVE_ELEM( QUEUE(i).pp_sub, QUEUE(i).i_sub, j ); 
    198                 free( p_sub ); 
    199             } 
    200         } 
    201         vlc_mutex_unlock( & QUEUE(i).lock ); 
    202     } 
     175    vlc_mutex_lock( &QUEUE.lock ); 
     176    for( int j = 0 ; j< QUEUE.i_sub ; j++ ) 
     177    { 
     178        if( QUEUE.pp_sub[j] == p_sub ) 
     179        { 
     180            REMOVE_ELEM( QUEUE.pp_sub, QUEUE.i_sub, j ); 
     181            free( p_sub ); 
     182        } 
     183    } 
     184    vlc_mutex_unlock( &QUEUE.lock ); 
    203185    UNLOCK_BANK; 
    204186} 
     
    209191 * These functions queue a message for later printing. 
    210192 *****************************************************************************/ 
    211 void __msg_Generic( vlc_object_t *p_this, int i_queue, int i_type, 
    212                     const char *psz_module, 
     193void __msg_Generic( vlc_object_t *p_this, int i_type, const char *psz_module, 
    213194                    const char *psz_format, ... ) 
    214195{ 
     
    216197 
    217198    va_start( args, psz_format ); 
    218     QueueMsg( p_this, i_queue, i_type, psz_module, psz_format, args ); 
     199    QueueMsg( p_this, i_type, psz_module, psz_format, args ); 
    219200    va_end( args ); 
    220201} 
    221202 
    222 void __msg_GenericVa( vlc_object_t *p_this, int i_queue, 
    223                       int i_type, const char *psz_module, 
     203void __msg_GenericVa( vlc_object_t *p_this, int i_type, const char *psz_module, 
    224204                      const char *psz_format, va_list args ) 
    225205{ 
    226     QueueMsg( p_this, i_queue, i_type, psz_module, psz_format, args ); 
     206    QueueMsg( p_this, i_type, psz_module, psz_format, args ); 
    227207} 
    228208 
     
    233213        va_list args; \ 
    234214        va_start( args, psz_format ); \ 
    235         QueueMsg( p_this,MSG_QUEUE_NORMAL, FN_TYPE, "unknown", \ 
    236                   psz_format, args ); \ 
     215        QueueMsg( p_this, FN_TYPE, "unknown", psz_format, args ); \ 
    237216        va_end( args ); \ 
    238217    } \ 
     
    265244 * a warning. 
    266245 */ 
    267 static void QueueMsg( vlc_object_t *p_this, int i_queue, int i_type, 
    268                       const char *psz_module, 
     246static void QueueMsg( vlc_object_t *p_this, int i_type, const char *psz_module, 
    269247                      const char *psz_format, va_list _args ) 
    270248{ 
     
    411389#endif 
    412390 
    413     assert( i_queue < NB_QUEUES ); 
    414391    LOCK_BANK; 
    415     p_queue = &QUEUE(i_queue)
     392    p_queue = &QUEUE
    416393    vlc_mutex_lock( &p_queue->lock ); 
    417394 
     
    440417            p_queue->b_overflow = true; 
    441418 
    442             if( p_queue->i_id == MSG_QUEUE_NORMAL ) 
    443             { 
    444                /* Put the overflow message in the queue */ 
    445                 p_item = p_queue->msg + p_queue->i_stop; 
    446                 p_queue->i_stop = (p_queue->i_stop + 1) % VLC_MSG_QSIZE; 
    447  
    448                 p_item->i_type =        VLC_MSG_WARN; 
    449                 p_item->i_object_id =   p_this->i_object_id; 
    450                 p_item->psz_object_type = p_this->psz_object_type; 
    451                 p_item->psz_module =    strdup( "message" ); 
    452                 p_item->psz_msg =       strdup( "message queue overflowed" ); 
    453                 p_item->psz_header =    NULL; 
    454  
    455                PrintMsg( p_this, p_item ); 
    456                /* We print from a dummy item */ 
    457                p_item = &item; 
    458             } 
     419            /* Put the overflow message in the queue */ 
     420            p_item = p_queue->msg + p_queue->i_stop; 
     421            p_queue->i_stop = (p_queue->i_stop + 1) % VLC_MSG_QSIZE; 
     422 
     423            p_item->i_type =        VLC_MSG_WARN; 
     424            p_item->i_object_id =   p_this->i_object_id; 
     425            p_item->psz_object_type = p_this->psz_object_type; 
     426            p_item->psz_module =    strdup( "message" ); 
     427            p_item->psz_msg =       strdup( "message queue overflowed" ); 
     428            p_item->psz_header =    NULL; 
     429 
     430            PrintMsg( p_this, p_item ); 
     431            /* We print from a dummy item */ 
     432            p_item = &item; 
    459433        } 
    460434    } 
     
    475449    p_item->psz_header =    psz_header; 
    476450 
    477     if( p_queue->i_id == MSG_QUEUE_NORMAL ) 
    478         PrintMsg( p_this, p_item ); 
     451    PrintMsg( p_this, p_item ); 
    479452 
    480453    if( p_queue->b_overflow ) 
     
    576549 
    577550#ifdef UNDER_CE 
    578 #   define CE_WRITE(str) WriteFile( QUEUE(MSG_QUEUE_NORMAL).logfile, \ 
     551#   define CE_WRITE(str) WriteFile( QUEUE.logfile, \ 
    579552                                    str, strlen(str), &i_dummy, NULL ); 
    580553    CE_WRITE( p_item->psz_module ); 
     
    585558    CE_WRITE( p_item->psz_msg ); 
    586559    CE_WRITE( "\r\n" ); 
    587     FlushFileBuffers( QUEUE(MSG_QUEUE_NORMAL).logfile ); 
     560    FlushFileBuffers( QUEUE.logfile ); 
    588561 
    589562#else