Changeset 11e021963b2c291a6fc699b2591dea009511662a

Show
Ignore:
Timestamp:
28/10/02 14:25:56 (6 years ago)
Author:
Sam Hocevar <sam@videolan.org>
git-committer:
Sam Hocevar <sam@videolan.org> 1035811556 +0000
git-parent:

[3f3c092f45240447e1cda25dc71c62a2ac13e85b]

git-author:
Sam Hocevar <sam@videolan.org> 1035811556 +0000
Message:
  • ./Makefile.am: fixed missing build dependencies for the Mozilla plugin.
  • ./src/misc/variables.c: implemented min/max and steps for integer and
    float variables.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Makefile.am

    r003f74f r11e0219  
    466466mozilla_plugin_DATA = $(LIBRARIES_mozilla) 
    467467mozilla_plugindir = $(libdir)/mozilla/plugins 
    468 $(LIBRARIES_mozilla): $(mozilla_libplugin_a_OBJECTS) $(L_builtin_pic) 
     468$(LIBRARIES_mozilla): $(mozilla_libplugin_a_OBJECTS) \ 
     469                      $(mozilla_libplugin_a_DEPENDENCIES) \ 
     470                      $(L_builtin_pic) 
    469471    $(CXXLINK) -o $@ $(mozilla_libplugin_a_OBJECTS) $(DATA_npvlc_rc) \ 
    470472        lib/libvlc_pic.a $(L_builtin_pic) -shared $(LDFLAGS) \ 
  • doc/fortunes.txt

    r65c2915 r11e0219  
    328328  -- #videolan 
    329329% 
     330<Dnumgis> I just listened through an entire ogg/vorbis file with vlc with no 
     331          audible problem whatsoever 
     332<Dnumgis> but I don't get the time of the stream 
     333<Dnumgis> gibalou: why don't I get the time? 
     334<sam> because time does not exist 
     335<sam> as Kant stated, our mind structures our perceptions so that we know a  
     336      priori that time is like a mathematical line, rendering time as a form  
     337      of conscious experience 
     338<gibalou> Dnumgis: a few things are left to be implemented, like seeking,  
     339          stream length display, etc... 
     340<sam> or you can listen to gibalou's dull explanation 
     341 
     342  -- #videolan 
     343% 
  • include/variables.h

    rce7d29b r11e0219  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: variables.h,v 1.5 2002/10/17 13:15:30 sam Exp $ 
     5 * $Id: variables.h,v 1.6 2002/10/28 13:25:56 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    4141    int          i_usage; 
    4242 
     43    /* Set to TRUE if the variable has min/max/step values */ 
     44    vlc_bool_t   b_min, b_max, b_step; 
     45    vlc_value_t  min, max, step; 
     46 
     47    /* Set to TRUE if the variable is a choice variable */ 
     48    vlc_bool_t   b_select; 
     49    vlc_value_t *p_choice; 
     50 
    4351    /* Set to TRUE if the variable is in a callback */ 
    4452    vlc_bool_t   b_incallback; 
     
    6472 
    6573/***************************************************************************** 
     74 * Variable actions 
     75 *****************************************************************************/ 
     76#define VLC_VAR_SETMIN        0x0010 
     77#define VLC_VAR_SETMAX        0x0011 
     78#define VLC_VAR_SETSTEP       0x0012 
     79 
     80#define VLC_VAR_SETCHOICE     0x0020 
     81#define VLC_VAR_ADDCHOICE     0x0021 
     82#define VLC_VAR_DELCHOICE     0x0022 
     83 
     84/***************************************************************************** 
    6685 * Prototypes 
    6786 *****************************************************************************/ 
    6887VLC_EXPORT( int, __var_Create, ( vlc_object_t *, const char *, int ) ); 
    6988VLC_EXPORT( int, __var_Destroy, ( vlc_object_t *, const char * ) ); 
     89 
     90VLC_EXPORT( int, __var_Change, ( vlc_object_t *, const char *, int, vlc_value_t * ) ); 
    7091 
    7192VLC_EXPORT( int, __var_Type, ( vlc_object_t *, const char * ) ); 
     
    7596#define var_Create(a,b,c) __var_Create( VLC_OBJECT(a), b, c ) 
    7697#define var_Destroy(a,b) __var_Destroy( VLC_OBJECT(a), b ) 
     98 
     99#define var_Change(a,b,c,d) __var_Change( VLC_OBJECT(a), b, c, d ) 
    77100 
    78101#define var_Type(a,b) __var_Type( VLC_OBJECT(a), b ) 
  • src/misc/variables.c

    rce7d29b r11e0219  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: variables.c,v 1.8 2002/10/17 13:15:31 sam Exp $ 
     5 * $Id: variables.c,v 1.9 2002/10/28 13:25:56 sam Exp $ 
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    5050static int LookupInner    ( variable_t *, int, u32 ); 
    5151 
     52static void CheckValue    ( variable_t *, vlc_value_t * ); 
     53 
    5254/***************************************************************************** 
    5355 * var_Create: initialize a vlc variable 
     
    108110    p_var->i_usage = 1; 
    109111 
     112    p_var->b_min = VLC_FALSE; 
     113    p_var->b_max = VLC_FALSE; 
     114    p_var->b_step = VLC_FALSE; 
     115    p_var->b_select = VLC_FALSE; 
     116    p_var->p_choice = NULL; 
    110117    p_var->b_incallback = VLC_FALSE; 
    111118 
     
    218225 
    219226/***************************************************************************** 
     227 * var_Change: perform an action on a variable 
     228 ***************************************************************************** 
     229 *  
     230 *****************************************************************************/ 
     231int __var_Change( vlc_object_t *p_this, const char *psz_name, 
     232                  int i_action, vlc_value_t *p_val ) 
     233{ 
     234    int i_var; 
     235    variable_t *p_var; 
     236 
     237    vlc_mutex_lock( &p_this->var_lock ); 
     238 
     239    i_var = Lookup( p_this->p_vars, p_this->i_vars, psz_name ); 
     240 
     241    if( i_var < 0 ) 
     242    { 
     243        vlc_mutex_unlock( &p_this->var_lock ); 
     244        return VLC_ENOVAR; 
     245    } 
     246 
     247    p_var = &p_this->p_vars[i_var]; 
     248 
     249    switch( i_action ) 
     250    { 
     251        case VLC_VAR_SETMIN: 
     252            p_var->b_min = VLC_TRUE; 
     253            p_var->min = *p_val; 
     254            CheckValue( p_var, &p_var->val ); 
     255            break; 
     256        case VLC_VAR_SETMAX: 
     257            p_var->b_max = VLC_TRUE; 
     258            p_var->max = *p_val; 
     259            CheckValue( p_var, &p_var->val ); 
     260            break; 
     261        case VLC_VAR_SETSTEP: 
     262            p_var->b_step = VLC_TRUE; 
     263            p_var->step = *p_val; 
     264            CheckValue( p_var, &p_var->val ); 
     265            break; 
     266 
     267        case VLC_VAR_SETCHOICE: 
     268            p_var->b_select = VLC_TRUE; 
     269            break; 
     270 
     271        default: 
     272            break; 
     273    } 
     274 
     275    vlc_mutex_unlock( &p_this->var_lock ); 
     276 
     277    return VLC_SUCCESS; 
     278} 
     279 
     280/***************************************************************************** 
    220281 * var_Type: request a variable's type, 0 if not found 
    221282 ***************************************************************************** 
     
    277338    /* Backup needed stuff */ 
    278339    oldval = p_var->val; 
     340 
     341    /* Check boundaries */ 
     342    CheckValue( p_var, &val ); 
    279343 
    280344    /* Deal with callbacks. Tell we're in a callback, release the lock, 
     
    696760} 
    697761 
     762/***************************************************************************** 
     763 * CheckValue: check that a value is valid 
     764 ***************************************************************************** 
     765 * This function checks p_val's value against p_var's limitations such as 
     766 * minimal and maximal value, step, in-list position, and changes p_val if 
     767 * necessary. 
     768 *****************************************************************************/ 
     769static void CheckValue ( variable_t *p_var, vlc_value_t *p_val ) 
     770{ 
     771    switch( p_var->i_type ) 
     772    { 
     773        case VLC_VAR_INTEGER: 
     774            if( p_var->b_step && p_var->step.i_int 
     775                              && (p_val->i_int % p_var->step.i_int) ) 
     776            { 
     777                p_val->i_int = (p_val->i_int + (p_var->step.i_int / 2)) 
     778                               / p_var->step.i_int * p_var->step.i_int; 
     779            } 
     780            if( p_var->b_min && p_val->i_int < p_var->min.i_int ) 
     781            { 
     782                p_val->i_int = p_var->min.i_int; 
     783            } 
     784            if( p_var->b_max && p_val->i_int > p_var->max.i_int ) 
     785            { 
     786                p_val->i_int = p_var->max.i_int; 
     787            } 
     788            break; 
     789        case VLC_VAR_FLOAT: 
     790            if( p_var->b_step && p_var->step.f_float ) 
     791            { 
     792                float f_round = p_var->step.f_float * (float)(int)( 0.5 + 
     793                                        p_val->f_float / p_var->step.f_float ); 
     794                if( p_val->f_float != f_round ) 
     795                { 
     796                    p_val->f_float = f_round; 
     797                } 
     798            } 
     799            if( p_var->b_min && p_val->f_float < p_var->min.f_float ) 
     800            { 
     801                p_val->f_float = p_var->min.f_float; 
     802            } 
     803            if( p_var->b_max && p_val->f_float > p_var->max.f_float ) 
     804            { 
     805                p_val->f_float = p_var->max.f_float; 
     806            } 
     807            break; 
     808        case VLC_VAR_TIME: 
     809            /* TODO */ 
     810            break; 
     811    } 
     812} 
     813