Changeset 5f151d5106880ffccb0641f3eabdeee93ad34de0

Show
Ignore:
Timestamp:
02/11/03 13:22:45 (5 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1067775765 +0000
git-parent:

[faf9b659a939847862216ea3d80dd7e3c7b6f47e]

git-author:
Gildas Bazin <gbazin@videolan.org> 1067775765 +0000
Message:

* src/audio_output/input.c: on-the-fly visualization changes.
* modules/gui/wxwindows/menus.cpp: added a visualization entry.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/wxwindows/menus.cpp

    r6fc5b53 r5f151d5  
    33 ***************************************************************************** 
    44 * Copyright (C) 2000-2001 VideoLAN 
    5  * $Id: menus.cpp,v 1.23 2003/10/19 23:38:09 gbazin Exp $ 
     5 * $Id: menus.cpp,v 1.24 2003/11/02 12:22:45 gbazin Exp $ 
    66 * 
    77 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    123123        ppsz_varnames[i] = "audio-channels"; 
    124124        pi_objects[i++] = p_object->i_object_id; 
     125        ppsz_varnames[i] = "visual"; 
     126        pi_objects[i++] = p_object->i_object_id; 
    125127        vlc_object_release( p_object ); 
    126128    } 
     
    220222#define MAX_AUDIO_ITEMS 10 
    221223 
    222     vlc_object_t *p_object
     224    vlc_object_t *p_object1, *p_object2
    223225    char *ppsz_varnames[MAX_AUDIO_ITEMS]; 
    224226    int pi_objects[MAX_AUDIO_ITEMS]; 
     
    228230    memset( pi_objects, 0, MAX_AUDIO_ITEMS * sizeof(int) ); 
    229231 
    230     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_AOUT, 
    231                                                 FIND_ANYWHERE ); 
    232     if( p_object != NULL ) 
     232    p_object1 = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_AOUT, 
     233                                                FIND_ANYWHERE ); 
     234    if( p_object1 != NULL ) 
    233235    { 
    234236        ppsz_varnames[i] = "audio-device"; 
    235         pi_objects[i++] = p_object->i_object_id; 
     237        pi_objects[i++] = p_object1->i_object_id; 
    236238        ppsz_varnames[i] = "audio-channels"; 
    237         pi_objects[i++] = p_object->i_object_id; 
    238         vlc_object_release( p_object ); 
    239     } 
    240  
    241     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT, 
    242                                                 FIND_ANYWHERE ); 
    243     if( p_object != NULL ) 
     239        pi_objects[i++] = p_object1->i_object_id; 
     240    } 
     241 
     242    p_object2 = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT, 
     243                                                 FIND_ANYWHERE ); 
     244    if( p_object2 != NULL ) 
    244245    { 
    245246        ppsz_varnames[i] = "audio-es"; 
    246         pi_objects[i++] = p_object->i_object_id; 
    247         vlc_object_release( p_object ); 
     247        pi_objects[i++] = p_object2->i_object_id; 
     248        vlc_object_release( p_object2 ); 
     249    } 
     250 
     251    if( p_object1 != NULL ) 
     252    { 
     253        ppsz_varnames[i] = "visual"; 
     254        pi_objects[i++] = p_object1->i_object_id; 
     255        vlc_object_release( p_object1 ); 
    248256    } 
    249257 
  • src/audio_output/input.c

    rfaf9b65 r5f151d5  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: input.c,v 1.39 2003/11/02 06:33:49 hartman Exp $ 
     5 * $Id: input.c,v 1.40 2003/11/02 12:22:45 gbazin Exp $ 
    66 * 
    77 * Authors: Christophe Massiot <massiot@via.ecp.fr> 
     
    7676 
    7777    /* Now add user filters */ 
    78     if( ( psz_filters = config_GetPsz( p_aout , "audio-filter" ) ) ) 
     78    if( var_Type( p_aout, "visual" ) == 0 ) 
     79    { 
     80        var_Create( p_aout, "visual", VLC_VAR_STRING | VLC_VAR_HASCHOICE ); 
     81        text.psz_string = _("Visualizations"); 
     82        var_Change( p_aout, "visual", VLC_VAR_SETTEXT, &text, NULL ); 
     83        val.psz_string = ""; text.psz_string = _("Disable"); 
     84        var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
     85        val.psz_string = "random"; text.psz_string = _("Random"); 
     86        var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
     87        val.psz_string = "scope"; text.psz_string = _("Scope"); 
     88        var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
     89        val.psz_string = "spectrum"; text.psz_string = _("Spectrum"); 
     90        var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
     91        val.psz_string = "goom"; text.psz_string = _("Goom"); 
     92        var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
     93        if( var_Get( p_aout, "effect-list", &val ) == VLC_SUCCESS ) 
     94        { 
     95            var_Set( p_aout, "visual", val ); 
     96            if( val.psz_string ) free( val.psz_string ); 
     97        } 
     98        var_AddCallback( p_aout, "visual", VisualizationCallback, NULL ); 
     99    } 
     100 
     101    if( var_Type( p_aout, "audio-filter" ) == 0 ) 
     102    { 
     103        var_Create( p_aout, "audio-filter", 
     104                    VLC_VAR_STRING | VLC_VAR_DOINHERIT ); 
     105        text.psz_string = _("Audio filters"); 
     106        var_Change( p_aout, "audio-filter", VLC_VAR_SETTEXT, &text, NULL ); 
     107    } 
     108 
     109    var_Get( p_aout, "audio-filter", &val ); 
     110    psz_filters = val.psz_string; 
     111    if( psz_filters && *psz_filters ) 
    79112    { 
    80113        char *psz_parser = psz_filters; 
     
    152185            psz_parser = psz_next; 
    153186        } 
    154         free( psz_filters ); 
    155     } 
    156      
    157     var_Create( p_aout, "visual", VLC_VAR_STRING | VLC_VAR_HASCHOICE ); 
    158     text.psz_string = _("Visualizations"); 
    159     var_Change( p_aout, "visual", VLC_VAR_SETTEXT, &text, NULL ); 
    160     val.psz_string = ""; text.psz_string = _("Disable"); 
    161     var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
    162     val.psz_string = "random"; text.psz_string = _("Random"); 
    163     var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
    164     val.psz_string = "scope"; text.psz_string = _("Scope"); 
    165     var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
    166     val.psz_string = "spectrum"; text.psz_string = _("Spectrum"); 
    167     var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
    168     val.psz_string = "goom"; text.psz_string = _("Goom"); 
    169     var_Change( p_aout, "visual", VLC_VAR_ADDCHOICE, &val, &text ); 
    170     if( var_Get( p_aout, "effect-list", &val ) == VLC_SUCCESS ) 
    171     { 
    172         var_Set( p_aout, "visual", val ); 
    173     } 
    174     var_AddCallback( p_aout, "visual", VisualizationCallback, NULL ); 
    175  
    176  
    177     var_Create( p_aout, "audio-filter", VLC_VAR_STRING ); 
    178     text.psz_string = _("Audio filters"); 
    179     var_Change( p_aout, "audio-filter", VLC_VAR_SETTEXT, &text, NULL ); 
    180     var_Change( p_aout, "audio-filter", VLC_VAR_INHERITVALUE, &val, NULL ); 
    181     if( var_Get( p_aout, "audio-filter", &val ) == VLC_SUCCESS ) 
    182     { 
    183         var_Set( p_aout, "audio-filter", val ); 
    184     } 
    185     //var_AddCallback( p_aout, "audio-filter", AudioFilterCallback, NULL ); 
     187    } 
     188    if( psz_filters ) free( psz_filters ); 
    186189 
    187190    /* Prepare hints for the buffer allocator. */ 
     
    214217                                         p_input->i_nb_filters ); 
    215218            aout_FifoDestroy( p_aout, &p_input->fifo ); 
     219            var_Destroy( p_aout, "visual" ); 
    216220            p_input->b_error = 1; 
    217221 
     
    424428} 
    425429 
    426  
    427430static int VisualizationCallback( vlc_object_t *p_this, char const *psz_cmd, 
    428431                       vlc_value_t oldval, vlc_value_t newval, void *p_data ) 
    429432{ 
    430433    aout_instance_t *p_aout = (aout_instance_t *)p_this; 
    431     input_thread_t *p_input; 
    432434    vlc_value_t val; 
    433      
    434435    char *psz_mode = newval.psz_string; 
    435436    char *psz_filter; 
    436     unsigned int  i; 
    437  
    438     psz_filter = config_GetPsz( p_aout, "audio-filter" )
     437 
     438    var_Get( p_aout, "audio-filter", &val ); 
     439    psz_filter = val.psz_string
    439440 
    440441    if( !psz_mode || !*psz_mode ) 
    441442    { 
    442         config_PutPsz( p_aout, "audio-filter", "" ); 
     443        val.psz_string = ""; 
     444        var_Set( p_aout, "audio-filter", val ); 
    443445    } 
    444446    else 
     
    446448        if( !psz_filter || !*psz_filter ) 
    447449        { 
    448             config_PutPsz( p_aout, "audio-filter", "visual" ); 
     450            val.psz_string = "visual"; 
     451            var_Set( p_aout, "audio-filter", val ); 
    449452        } 
    450453        else 
     
    455458                strcat( psz_filter, ",visual" ); 
    456459            } 
    457             config_PutPsz( p_aout, "audio-filter", psz_filter ); 
    458         } 
    459     } 
    460      
     460            val.psz_string = psz_filter; 
     461            var_Set( p_aout, "audio-filter", val ); 
     462        } 
     463    } 
     464 
    461465    if( psz_mode && *psz_mode ) 
    462466    { 
    463         config_PutPsz( p_aout, "effect-list", psz_mode ); 
     467        vlc_value_t val; 
     468        val.psz_string = psz_mode; 
     469        var_Create( p_aout, "effect-list", VLC_VAR_STRING ); 
     470        var_Set( p_aout, "effect-list", val); 
    464471    } 
    465472 
    466473    if( psz_filter ) free( psz_filter ); 
     474 
     475    aout_Restart( p_aout ); 
    467476 
    468477    return VLC_SUCCESS;