Changeset 11e021963b2c291a6fc699b2591dea009511662a
- Timestamp:
- 28/10/02 14:25:56 (6 years ago)
- git-parent:
- Files:
-
- Makefile.am (modified) (1 diff)
- doc/fortunes.txt (modified) (1 diff)
- include/variables.h (modified) (4 diffs)
- src/misc/variables.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Makefile.am
r003f74f r11e0219 466 466 mozilla_plugin_DATA = $(LIBRARIES_mozilla) 467 467 mozilla_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) 469 471 $(CXXLINK) -o $@ $(mozilla_libplugin_a_OBJECTS) $(DATA_npvlc_rc) \ 470 472 lib/libvlc_pic.a $(L_builtin_pic) -shared $(LDFLAGS) \ doc/fortunes.txt
r65c2915 r11e0219 328 328 -- #videolan 329 329 % 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 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: variables.h,v 1. 5 2002/10/17 13:15:30sam Exp $5 * $Id: variables.h,v 1.6 2002/10/28 13:25:56 sam Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 41 41 int i_usage; 42 42 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 43 51 /* Set to TRUE if the variable is in a callback */ 44 52 vlc_bool_t b_incallback; … … 64 72 65 73 /***************************************************************************** 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 /***************************************************************************** 66 85 * Prototypes 67 86 *****************************************************************************/ 68 87 VLC_EXPORT( int, __var_Create, ( vlc_object_t *, const char *, int ) ); 69 88 VLC_EXPORT( int, __var_Destroy, ( vlc_object_t *, const char * ) ); 89 90 VLC_EXPORT( int, __var_Change, ( vlc_object_t *, const char *, int, vlc_value_t * ) ); 70 91 71 92 VLC_EXPORT( int, __var_Type, ( vlc_object_t *, const char * ) ); … … 75 96 #define var_Create(a,b,c) __var_Create( VLC_OBJECT(a), b, c ) 76 97 #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 ) 77 100 78 101 #define var_Type(a,b) __var_Type( VLC_OBJECT(a), b ) src/misc/variables.c
rce7d29b r11e0219 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: variables.c,v 1. 8 2002/10/17 13:15:31sam Exp $5 * $Id: variables.c,v 1.9 2002/10/28 13:25:56 sam Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 50 50 static int LookupInner ( variable_t *, int, u32 ); 51 51 52 static void CheckValue ( variable_t *, vlc_value_t * ); 53 52 54 /***************************************************************************** 53 55 * var_Create: initialize a vlc variable … … 108 110 p_var->i_usage = 1; 109 111 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; 110 117 p_var->b_incallback = VLC_FALSE; 111 118 … … 218 225 219 226 /***************************************************************************** 227 * var_Change: perform an action on a variable 228 ***************************************************************************** 229 * 230 *****************************************************************************/ 231 int __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 /***************************************************************************** 220 281 * var_Type: request a variable's type, 0 if not found 221 282 ***************************************************************************** … … 277 338 /* Backup needed stuff */ 278 339 oldval = p_var->val; 340 341 /* Check boundaries */ 342 CheckValue( p_var, &val ); 279 343 280 344 /* Deal with callbacks. Tell we're in a callback, release the lock, … … 696 760 } 697 761 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 *****************************************************************************/ 769 static 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
