]> git.sesse.net Git - vlc/commitdiff
* ./Makefile.am: fixed missing build dependencies for the Mozilla plugin.
authorSam Hocevar <sam@videolan.org>
Mon, 28 Oct 2002 13:25:56 +0000 (13:25 +0000)
committerSam Hocevar <sam@videolan.org>
Mon, 28 Oct 2002 13:25:56 +0000 (13:25 +0000)
  * ./src/misc/variables.c: implemented min/max and steps for integer and
    float variables.

Makefile.am
doc/fortunes.txt
include/variables.h
src/misc/variables.c

index 52351af8a3abdadcf338a081659e796aaea78bb4..be681e002ae326221708209861d1798ec8b6a8f1 100644 (file)
@@ -465,7 +465,9 @@ $(SOURCES_mozilla): mozilla/vlcintf.h
 
 mozilla_plugin_DATA = $(LIBRARIES_mozilla)
 mozilla_plugindir = $(libdir)/mozilla/plugins
-$(LIBRARIES_mozilla): $(mozilla_libplugin_a_OBJECTS) $(L_builtin_pic)
+$(LIBRARIES_mozilla): $(mozilla_libplugin_a_OBJECTS) \
+                      $(mozilla_libplugin_a_DEPENDENCIES) \
+                      $(L_builtin_pic)
        $(CXXLINK) -o $@ $(mozilla_libplugin_a_OBJECTS) $(DATA_npvlc_rc) \
                lib/libvlc_pic.a $(L_builtin_pic) -shared $(LDFLAGS) \
                $(LDFLAGS_vlc) $(LDFLAGS_mozilla) $(LDFLAGS_builtin_pic)
index b0d551e586267bf484c1c80654bca16761c36a87..07790ade3174138cb922d2c04b83b226be3122dc 100644 (file)
@@ -328,3 +328,17 @@ the Boston strangler is to the woman home alone.
 
   -- #videolan
 %
+<Dnumgis> I just listened through an entire ogg/vorbis file with vlc with no
+          audible problem whatsoever
+<Dnumgis> but I don't get the time of the stream
+<Dnumgis> gibalou: why don't I get the time?
+<sam> because time does not exist
+<sam> as Kant stated, our mind structures our perceptions so that we know a 
+      priori that time is like a mathematical line, rendering time as a form 
+      of conscious experience
+<gibalou> Dnumgis: a few things are left to be implemented, like seeking, 
+          stream length display, etc...
+<sam> or you can listen to gibalou's dull explanation
+
+  -- #videolan
+%
index f2ba2ec817d77466793796dcfcd39771bda77035..491422e9a099fae088a774172edc409014e9e4ac 100644 (file)
@@ -2,7 +2,7 @@
  * variables.h: variables handling
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: variables.h,v 1.5 2002/10/17 13:15:30 sam Exp $
+ * $Id: variables.h,v 1.6 2002/10/28 13:25:56 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -40,6 +40,14 @@ struct variable_t
     /* Creation count: we only destroy the variable if it reaches 0 */
     int          i_usage;
 
+    /* Set to TRUE if the variable has min/max/step values */
+    vlc_bool_t   b_min, b_max, b_step;
+    vlc_value_t  min, max, step;
+
+    /* Set to TRUE if the variable is a choice variable */
+    vlc_bool_t   b_select;
+    vlc_value_t *p_choice;
+
     /* Set to TRUE if the variable is in a callback */
     vlc_bool_t   b_incallback;
 
@@ -62,12 +70,25 @@ struct variable_t
 #define VLC_VAR_COMMAND   0x0700
 #define VLC_VAR_MUTEX     0x0800
 
+/*****************************************************************************
+ * Variable actions
+ *****************************************************************************/
+#define VLC_VAR_SETMIN        0x0010
+#define VLC_VAR_SETMAX        0x0011
+#define VLC_VAR_SETSTEP       0x0012
+
+#define VLC_VAR_SETCHOICE     0x0020
+#define VLC_VAR_ADDCHOICE     0x0021
+#define VLC_VAR_DELCHOICE     0x0022
+
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
 VLC_EXPORT( int, __var_Create, ( vlc_object_t *, const char *, int ) );
 VLC_EXPORT( int, __var_Destroy, ( vlc_object_t *, const char * ) );
 
+VLC_EXPORT( int, __var_Change, ( vlc_object_t *, const char *, int, vlc_value_t * ) );
+
 VLC_EXPORT( int, __var_Type, ( vlc_object_t *, const char * ) );
 VLC_EXPORT( int, __var_Set, ( vlc_object_t *, const char *, vlc_value_t ) );
 VLC_EXPORT( int, __var_Get, ( vlc_object_t *, const char *, vlc_value_t * ) );
@@ -75,6 +96,8 @@ VLC_EXPORT( int, __var_Get, ( vlc_object_t *, const char *, vlc_value_t * ) );
 #define var_Create(a,b,c) __var_Create( VLC_OBJECT(a), b, c )
 #define var_Destroy(a,b) __var_Destroy( VLC_OBJECT(a), b )
 
+#define var_Change(a,b,c,d) __var_Change( VLC_OBJECT(a), b, c, d )
+
 #define var_Type(a,b) __var_Type( VLC_OBJECT(a), b )
 #define var_Set(a,b,c) __var_Set( VLC_OBJECT(a), b, c )
 #define var_Get(a,b,c) __var_Get( VLC_OBJECT(a), b, c )
index 1b499151a6b243b9da6884dd7ab35c10726d6319..17110173066a30f6a61b0da5438f5d312317c281 100644 (file)
@@ -2,7 +2,7 @@
  * variables.c: routines for object variables handling
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: variables.c,v 1.8 2002/10/17 13:15:31 sam Exp $
+ * $Id: variables.c,v 1.9 2002/10/28 13:25:56 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -49,6 +49,8 @@ static int InsertInner    ( variable_t *, int, u32 );
 static int Lookup         ( variable_t *, int, const char * );
 static int LookupInner    ( variable_t *, int, u32 );
 
+static void CheckValue    ( variable_t *, vlc_value_t * );
+
 /*****************************************************************************
  * var_Create: initialize a vlc variable
  *****************************************************************************
@@ -107,6 +109,11 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
 
     p_var->i_usage = 1;
 
+    p_var->b_min = VLC_FALSE;
+    p_var->b_max = VLC_FALSE;
+    p_var->b_step = VLC_FALSE;
+    p_var->b_select = VLC_FALSE;
+    p_var->p_choice = NULL;
     p_var->b_incallback = VLC_FALSE;
 
     p_var->i_entries = 0;
@@ -216,6 +223,60 @@ int __var_Destroy( vlc_object_t *p_this, const char *psz_name )
     return VLC_SUCCESS;
 }
 
+/*****************************************************************************
+ * var_Change: perform an action on a variable
+ *****************************************************************************
+ * 
+ *****************************************************************************/
+int __var_Change( vlc_object_t *p_this, const char *psz_name,
+                  int i_action, vlc_value_t *p_val )
+{
+    int i_var;
+    variable_t *p_var;
+
+    vlc_mutex_lock( &p_this->var_lock );
+
+    i_var = Lookup( p_this->p_vars, p_this->i_vars, psz_name );
+
+    if( i_var < 0 )
+    {
+        vlc_mutex_unlock( &p_this->var_lock );
+        return VLC_ENOVAR;
+    }
+
+    p_var = &p_this->p_vars[i_var];
+
+    switch( i_action )
+    {
+        case VLC_VAR_SETMIN:
+            p_var->b_min = VLC_TRUE;
+            p_var->min = *p_val;
+            CheckValue( p_var, &p_var->val );
+            break;
+        case VLC_VAR_SETMAX:
+            p_var->b_max = VLC_TRUE;
+            p_var->max = *p_val;
+            CheckValue( p_var, &p_var->val );
+            break;
+        case VLC_VAR_SETSTEP:
+            p_var->b_step = VLC_TRUE;
+            p_var->step = *p_val;
+            CheckValue( p_var, &p_var->val );
+            break;
+
+        case VLC_VAR_SETCHOICE:
+            p_var->b_select = VLC_TRUE;
+            break;
+
+        default:
+            break;
+    }
+
+    vlc_mutex_unlock( &p_this->var_lock );
+
+    return VLC_SUCCESS;
+}
+
 /*****************************************************************************
  * var_Type: request a variable's type, 0 if not found
  *****************************************************************************
@@ -277,6 +338,9 @@ int __var_Set( vlc_object_t *p_this, const char *psz_name, vlc_value_t val )
     /* Backup needed stuff */
     oldval = p_var->val;
 
+    /* Check boundaries */
+    CheckValue( p_var, &val );
+
     /* Deal with callbacks. Tell we're in a callback, release the lock,
      * call stored functions, retake the lock. */
     if( p_var->i_entries )
@@ -695,3 +759,55 @@ static int LookupInner( variable_t *p_vars, int i_count, u32 i_hash )
     return i_middle;
 }
 
+/*****************************************************************************
+ * CheckValue: check that a value is valid
+ *****************************************************************************
+ * This function checks p_val's value against p_var's limitations such as
+ * minimal and maximal value, step, in-list position, and changes p_val if
+ * necessary.
+ *****************************************************************************/
+static void CheckValue ( variable_t *p_var, vlc_value_t *p_val )
+{
+    switch( p_var->i_type )
+    {
+        case VLC_VAR_INTEGER:
+            if( p_var->b_step && p_var->step.i_int
+                              && (p_val->i_int % p_var->step.i_int) )
+            {
+                p_val->i_int = (p_val->i_int + (p_var->step.i_int / 2))
+                               / p_var->step.i_int * p_var->step.i_int;
+            }
+            if( p_var->b_min && p_val->i_int < p_var->min.i_int )
+            {
+                p_val->i_int = p_var->min.i_int;
+            }
+            if( p_var->b_max && p_val->i_int > p_var->max.i_int )
+            {
+                p_val->i_int = p_var->max.i_int;
+            }
+            break;
+        case VLC_VAR_FLOAT:
+            if( p_var->b_step && p_var->step.f_float )
+            {
+                float f_round = p_var->step.f_float * (float)(int)( 0.5 +
+                                        p_val->f_float / p_var->step.f_float );
+                if( p_val->f_float != f_round )
+                {
+                    p_val->f_float = f_round;
+                }
+            }
+            if( p_var->b_min && p_val->f_float < p_var->min.f_float )
+            {
+                p_val->f_float = p_var->min.f_float;
+            }
+            if( p_var->b_max && p_val->f_float > p_var->max.f_float )
+            {
+                p_val->f_float = p_var->max.f_float;
+            }
+            break;
+        case VLC_VAR_TIME:
+            /* TODO */
+            break;
+    }
+}
+