Commit 11e02196 authored by Sam Hocevar's avatar Sam Hocevar

* ./Makefile.am: fixed missing build dependencies for the Mozilla plugin.

  * ./src/misc/variables.c: implemented min/max and steps for integer and
    float variables.
parent 3f3c092f
...@@ -465,7 +465,9 @@ $(SOURCES_mozilla): mozilla/vlcintf.h ...@@ -465,7 +465,9 @@ $(SOURCES_mozilla): mozilla/vlcintf.h
mozilla_plugin_DATA = $(LIBRARIES_mozilla) mozilla_plugin_DATA = $(LIBRARIES_mozilla)
mozilla_plugindir = $(libdir)/mozilla/plugins 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) \ $(CXXLINK) -o $@ $(mozilla_libplugin_a_OBJECTS) $(DATA_npvlc_rc) \
lib/libvlc_pic.a $(L_builtin_pic) -shared $(LDFLAGS) \ lib/libvlc_pic.a $(L_builtin_pic) -shared $(LDFLAGS) \
$(LDFLAGS_vlc) $(LDFLAGS_mozilla) $(LDFLAGS_builtin_pic) $(LDFLAGS_vlc) $(LDFLAGS_mozilla) $(LDFLAGS_builtin_pic)
......
...@@ -328,3 +328,17 @@ the Boston strangler is to the woman home alone. ...@@ -328,3 +328,17 @@ the Boston strangler is to the woman home alone.
-- #videolan -- #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
%
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variables.h: variables handling * variables.h: variables handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -40,6 +40,14 @@ struct variable_t ...@@ -40,6 +40,14 @@ struct variable_t
/* Creation count: we only destroy the variable if it reaches 0 */ /* Creation count: we only destroy the variable if it reaches 0 */
int i_usage; 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 */ /* Set to TRUE if the variable is in a callback */
vlc_bool_t b_incallback; vlc_bool_t b_incallback;
...@@ -62,12 +70,25 @@ struct variable_t ...@@ -62,12 +70,25 @@ struct variable_t
#define VLC_VAR_COMMAND 0x0700 #define VLC_VAR_COMMAND 0x0700
#define VLC_VAR_MUTEX 0x0800 #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 * Prototypes
*****************************************************************************/ *****************************************************************************/
VLC_EXPORT( int, __var_Create, ( vlc_object_t *, const char *, int ) ); 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_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_Type, ( vlc_object_t *, const char * ) );
VLC_EXPORT( int, __var_Set, ( vlc_object_t *, const char *, vlc_value_t ) ); 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 * ) ); 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 * ) ); ...@@ -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_Create(a,b,c) __var_Create( VLC_OBJECT(a), b, c )
#define var_Destroy(a,b) __var_Destroy( VLC_OBJECT(a), b ) #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_Type(a,b) __var_Type( VLC_OBJECT(a), b )
#define var_Set(a,b,c) __var_Set( VLC_OBJECT(a), b, c ) #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 ) #define var_Get(a,b,c) __var_Get( VLC_OBJECT(a), b, c )
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* variables.c: routines for object variables handling * variables.c: routines for object variables handling
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -49,6 +49,8 @@ static int InsertInner ( variable_t *, int, u32 ); ...@@ -49,6 +49,8 @@ static int InsertInner ( variable_t *, int, u32 );
static int Lookup ( variable_t *, int, const char * ); static int Lookup ( variable_t *, int, const char * );
static int LookupInner ( variable_t *, int, u32 ); static int LookupInner ( variable_t *, int, u32 );
static void CheckValue ( variable_t *, vlc_value_t * );
/***************************************************************************** /*****************************************************************************
* var_Create: initialize a vlc variable * 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 ) ...@@ -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->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->b_incallback = VLC_FALSE;
p_var->i_entries = 0; p_var->i_entries = 0;
...@@ -216,6 +223,60 @@ int __var_Destroy( vlc_object_t *p_this, const char *psz_name ) ...@@ -216,6 +223,60 @@ int __var_Destroy( vlc_object_t *p_this, const char *psz_name )
return VLC_SUCCESS; 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 * 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 ) ...@@ -277,6 +338,9 @@ int __var_Set( vlc_object_t *p_this, const char *psz_name, vlc_value_t val )
/* Backup needed stuff */ /* Backup needed stuff */
oldval = p_var->val; oldval = p_var->val;
/* Check boundaries */
CheckValue( p_var, &val );
/* Deal with callbacks. Tell we're in a callback, release the lock, /* Deal with callbacks. Tell we're in a callback, release the lock,
* call stored functions, retake the lock. */ * call stored functions, retake the lock. */
if( p_var->i_entries ) if( p_var->i_entries )
...@@ -695,3 +759,55 @@ static int LookupInner( variable_t *p_vars, int i_count, u32 i_hash ) ...@@ -695,3 +759,55 @@ static int LookupInner( variable_t *p_vars, int i_count, u32 i_hash )
return i_middle; 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;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment