Commit e1be96f2 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove time variable type

The time type had become effectively identical to the integer type when
the integer type got extended to 64-bits.
parent b1763920
...@@ -341,7 +341,6 @@ typedef union ...@@ -341,7 +341,6 @@ typedef union
char * psz_string; char * psz_string;
void * p_address; void * p_address;
vlc_list_t * p_list; vlc_list_t * p_list;
mtime_t i_time;
struct { int32_t x; int32_t y; } coords; struct { int32_t x; int32_t y; } coords;
} vlc_value_t; } vlc_value_t;
......
...@@ -56,7 +56,6 @@ ...@@ -56,7 +56,6 @@
#define VLC_VAR_STRING 0x0040 #define VLC_VAR_STRING 0x0040
#define VLC_VAR_VARIABLE 0x0044 #define VLC_VAR_VARIABLE 0x0044
#define VLC_VAR_FLOAT 0x0050 #define VLC_VAR_FLOAT 0x0050
#define VLC_VAR_TIME 0x0060
#define VLC_VAR_ADDRESS 0x0070 #define VLC_VAR_ADDRESS 0x0070
#define VLC_VAR_COORDS 0x00A0 #define VLC_VAR_COORDS 0x00A0
/**@}*/ /**@}*/
...@@ -225,20 +224,6 @@ static inline int var_SetBool( vlc_object_t *p_obj, const char *psz_name, bool b ...@@ -225,20 +224,6 @@ static inline int var_SetBool( vlc_object_t *p_obj, const char *psz_name, bool b
return var_SetChecked( p_obj, psz_name, VLC_VAR_BOOL, val ); return var_SetChecked( p_obj, psz_name, VLC_VAR_BOOL, val );
} }
/**
* Set the value of a time variable
*
* \param p_obj The object that holds the variable
* \param psz_name The name of the variable
* \param i The new time value of this variable
*/
static inline int var_SetTime( vlc_object_t *p_obj, const char *psz_name, int64_t i )
{
vlc_value_t val;
val.i_time = i;
return var_SetChecked( p_obj, psz_name, VLC_VAR_TIME, val );
}
static inline int var_SetCoords( vlc_object_t *obj, const char *name, static inline int var_SetCoords( vlc_object_t *obj, const char *name,
int32_t x, int32_t y ) int32_t x, int32_t y )
{ {
...@@ -294,7 +279,6 @@ int var_SetAddress( vlc_object_t *p_obj, const char *psz_name, void *ptr ) ...@@ -294,7 +279,6 @@ int var_SetAddress( vlc_object_t *p_obj, const char *psz_name, void *ptr )
#define var_SetInteger(a,b,c) var_SetInteger( VLC_OBJECT(a),b,c) #define var_SetInteger(a,b,c) var_SetInteger( VLC_OBJECT(a),b,c)
#define var_SetBool(a,b,c) var_SetBool( VLC_OBJECT(a),b,c) #define var_SetBool(a,b,c) var_SetBool( VLC_OBJECT(a),b,c)
#define var_SetTime(a,b,c) var_SetTime( VLC_OBJECT(a),b,c)
#define var_SetFloat(a,b,c) var_SetFloat( VLC_OBJECT(a),b,c) #define var_SetFloat(a,b,c) var_SetFloat( VLC_OBJECT(a),b,c)
#define var_SetString(a,b,c) var_SetString( VLC_OBJECT(a),b,c) #define var_SetString(a,b,c) var_SetString( VLC_OBJECT(a),b,c)
#define var_SetAddress(o, n, p) var_SetAddress(VLC_OBJECT(o), n, p) #define var_SetAddress(o, n, p) var_SetAddress(VLC_OBJECT(o), n, p)
...@@ -333,22 +317,6 @@ static inline bool var_GetBool( vlc_object_t *p_obj, const char *psz_name ) ...@@ -333,22 +317,6 @@ static inline bool var_GetBool( vlc_object_t *p_obj, const char *psz_name )
return false; return false;
} }
/**
* Get a time value
*
* \param p_obj The object that holds the variable
* \param psz_name The name of the variable
*/
VLC_USED
static inline int64_t var_GetTime( vlc_object_t *p_obj, const char *psz_name )
{
vlc_value_t val; val.i_time = 0L;
if( !var_GetChecked( p_obj, psz_name, VLC_VAR_TIME, &val ) )
return val.i_time;
else
return 0;
}
static inline void var_GetCoords( vlc_object_t *obj, const char *name, static inline void var_GetCoords( vlc_object_t *obj, const char *name,
int32_t *px, int32_t *py ) int32_t *px, int32_t *py )
{ {
...@@ -496,19 +464,6 @@ static inline bool var_CreateGetBool( vlc_object_t *p_obj, const char *psz_name ...@@ -496,19 +464,6 @@ static inline bool var_CreateGetBool( vlc_object_t *p_obj, const char *psz_name
return var_GetBool( p_obj, psz_name ); return var_GetBool( p_obj, psz_name );
} }
/**
* Create a time variable with inherit and get its value.
*
* \param p_obj The object that holds the variable
* \param psz_name The name of the variable
*/
VLC_USED
static inline int64_t var_CreateGetTime( vlc_object_t *p_obj, const char *psz_name )
{
var_Create( p_obj, psz_name, VLC_VAR_TIME | VLC_VAR_DOINHERIT );
return var_GetTime( p_obj, psz_name );
}
/** /**
* Create a float variable with inherit and get its value. * Create a float variable with inherit and get its value.
* *
...@@ -560,7 +515,6 @@ static inline void *var_CreateGetAddress( vlc_object_t *p_obj, ...@@ -560,7 +515,6 @@ static inline void *var_CreateGetAddress( vlc_object_t *p_obj,
#define var_CreateGetInteger(a,b) var_CreateGetInteger( VLC_OBJECT(a),b) #define var_CreateGetInteger(a,b) var_CreateGetInteger( VLC_OBJECT(a),b)
#define var_CreateGetBool(a,b) var_CreateGetBool( VLC_OBJECT(a),b) #define var_CreateGetBool(a,b) var_CreateGetBool( VLC_OBJECT(a),b)
#define var_CreateGetTime(a,b) var_CreateGetTime( VLC_OBJECT(a),b)
#define var_CreateGetFloat(a,b) var_CreateGetFloat( VLC_OBJECT(a),b) #define var_CreateGetFloat(a,b) var_CreateGetFloat( VLC_OBJECT(a),b)
#define var_CreateGetString(a,b) var_CreateGetString( VLC_OBJECT(a),b) #define var_CreateGetString(a,b) var_CreateGetString( VLC_OBJECT(a),b)
#define var_CreateGetNonEmptyString(a,b) var_CreateGetNonEmptyString( VLC_OBJECT(a),b) #define var_CreateGetNonEmptyString(a,b) var_CreateGetNonEmptyString( VLC_OBJECT(a),b)
...@@ -594,20 +548,6 @@ static inline bool var_CreateGetBoolCommand( vlc_object_t *p_obj, const char *ps ...@@ -594,20 +548,6 @@ static inline bool var_CreateGetBoolCommand( vlc_object_t *p_obj, const char *ps
return var_GetBool( p_obj, psz_name ); return var_GetBool( p_obj, psz_name );
} }
/**
* Create a time command variable with inherit and get its value.
*
* \param p_obj The object that holds the variable
* \param psz_name The name of the variable
*/
VLC_USED
static inline int64_t var_CreateGetTimeCommand( vlc_object_t *p_obj, const char *psz_name )
{
var_Create( p_obj, psz_name, VLC_VAR_TIME | VLC_VAR_DOINHERIT
| VLC_VAR_ISCOMMAND );
return var_GetTime( p_obj, psz_name );
}
/** /**
* Create a float command variable with inherit and get its value. * Create a float command variable with inherit and get its value.
* *
...@@ -648,7 +588,6 @@ static inline char *var_CreateGetNonEmptyStringCommand( vlc_object_t *p_obj, ...@@ -648,7 +588,6 @@ static inline char *var_CreateGetNonEmptyStringCommand( vlc_object_t *p_obj,
#define var_CreateGetIntegerCommand(a,b) var_CreateGetIntegerCommand( VLC_OBJECT(a),b) #define var_CreateGetIntegerCommand(a,b) var_CreateGetIntegerCommand( VLC_OBJECT(a),b)
#define var_CreateGetBoolCommand(a,b) var_CreateGetBoolCommand( VLC_OBJECT(a),b) #define var_CreateGetBoolCommand(a,b) var_CreateGetBoolCommand( VLC_OBJECT(a),b)
#define var_CreateGetTimeCommand(a,b) var_CreateGetTimeCommand( VLC_OBJECT(a),b)
#define var_CreateGetFloatCommand(a,b) var_CreateGetFloatCommand( VLC_OBJECT(a),b) #define var_CreateGetFloatCommand(a,b) var_CreateGetFloatCommand( VLC_OBJECT(a),b)
#define var_CreateGetStringCommand(a,b) var_CreateGetStringCommand( VLC_OBJECT(a),b) #define var_CreateGetStringCommand(a,b) var_CreateGetStringCommand( VLC_OBJECT(a),b)
#define var_CreateGetNonEmptyStringCommand(a,b) var_CreateGetNonEmptyStringCommand( VLC_OBJECT(a),b) #define var_CreateGetNonEmptyStringCommand(a,b) var_CreateGetNonEmptyStringCommand( VLC_OBJECT(a),b)
...@@ -723,17 +662,6 @@ static inline char *var_InheritString( vlc_object_t *obj, const char *name ) ...@@ -723,17 +662,6 @@ static inline char *var_InheritString( vlc_object_t *obj, const char *name )
} }
#define var_InheritString(o, n) var_InheritString(VLC_OBJECT(o), n) #define var_InheritString(o, n) var_InheritString(VLC_OBJECT(o), n)
VLC_USED
static inline mtime_t var_InheritTime( vlc_object_t *obj, const char *name )
{
vlc_value_t val;
if( var_Inherit( obj, name, VLC_VAR_TIME, &val ) )
val.i_time = 0;
return val.i_time;
}
#define var_InheritTime(o, n) var_InheritTime(VLC_OBJECT(o), n)
VLC_USED VLC_USED
static inline void *var_InheritAddress( vlc_object_t *obj, const char *name ) static inline void *var_InheritAddress( vlc_object_t *obj, const char *name )
{ {
...@@ -750,7 +678,6 @@ VLC_API int var_InheritURational( vlc_object_t *, unsigned *num, unsigned *den, ...@@ -750,7 +678,6 @@ VLC_API int var_InheritURational( vlc_object_t *, unsigned *num, unsigned *den,
#define var_GetInteger(a,b) var_GetInteger( VLC_OBJECT(a),b) #define var_GetInteger(a,b) var_GetInteger( VLC_OBJECT(a),b)
#define var_GetBool(a,b) var_GetBool( VLC_OBJECT(a),b) #define var_GetBool(a,b) var_GetBool( VLC_OBJECT(a),b)
#define var_GetTime(a,b) var_GetTime( VLC_OBJECT(a),b)
#define var_GetFloat(a,b) var_GetFloat( VLC_OBJECT(a),b) #define var_GetFloat(a,b) var_GetFloat( VLC_OBJECT(a),b)
#define var_GetString(a,b) var_GetString( VLC_OBJECT(a),b) #define var_GetString(a,b) var_GetString( VLC_OBJECT(a),b)
#define var_GetNonEmptyString(a,b) var_GetNonEmptyString( VLC_OBJECT(a),b) #define var_GetNonEmptyString(a,b) var_GetNonEmptyString( VLC_OBJECT(a),b)
......
...@@ -64,10 +64,6 @@ static int vlclua_pushvalue( lua_State *L, int i_type, vlc_value_t val, bool b_e ...@@ -64,10 +64,6 @@ static int vlclua_pushvalue( lua_State *L, int i_type, vlc_value_t val, bool b_e
case VLC_VAR_FLOAT: case VLC_VAR_FLOAT:
lua_pushnumber( L, val.f_float ); lua_pushnumber( L, val.f_float );
break; break;
case VLC_VAR_TIME:
/* FIXME? (we're losing some precision, but does it really matter?) */
lua_pushnumber( L, ((double)val.i_time)/1000000. );
break;
case VLC_VAR_ADDRESS: case VLC_VAR_ADDRESS:
vlclua_error( L ); vlclua_error( L );
break; break;
...@@ -110,12 +106,6 @@ static int vlclua_tovalue( lua_State *L, int i_type, vlc_value_t *val ) ...@@ -110,12 +106,6 @@ static int vlclua_tovalue( lua_State *L, int i_type, vlc_value_t *val )
case VLC_VAR_FLOAT: case VLC_VAR_FLOAT:
val->f_float = luaL_checknumber( L, -1 ); val->f_float = luaL_checknumber( L, -1 );
break; break;
case VLC_VAR_TIME:
{
double f = luaL_checknumber( L, -1 );
val->i_time = (int64_t)(f*1000000.);
}
break;
case VLC_VAR_ADDRESS: case VLC_VAR_ADDRESS:
vlclua_error( L ); vlclua_error( L );
break; break;
......
...@@ -122,11 +122,6 @@ static int CmpInt( vlc_value_t v, vlc_value_t w ) ...@@ -122,11 +122,6 @@ static int CmpInt( vlc_value_t v, vlc_value_t w )
return v.i_int == w.i_int ? 0 : v.i_int > w.i_int ? 1 : -1; return v.i_int == w.i_int ? 0 : v.i_int > w.i_int ? 1 : -1;
} }
static int CmpTime( vlc_value_t v, vlc_value_t w )
{
return v.i_time == w.i_time ? 0 : v.i_time > w.i_time ? 1 : -1;
}
static int CmpString( vlc_value_t v, vlc_value_t w ) static int CmpString( vlc_value_t v, vlc_value_t w )
{ {
if( !v.psz_string ) if( !v.psz_string )
...@@ -156,7 +151,6 @@ bool_ops = { CmpBool, DupDummy, FreeDummy, }, ...@@ -156,7 +151,6 @@ bool_ops = { CmpBool, DupDummy, FreeDummy, },
float_ops = { CmpFloat, DupDummy, FreeDummy, }, float_ops = { CmpFloat, DupDummy, FreeDummy, },
int_ops = { CmpInt, DupDummy, FreeDummy, }, int_ops = { CmpInt, DupDummy, FreeDummy, },
string_ops = { CmpString, DupString, FreeString, }, string_ops = { CmpString, DupString, FreeString, },
time_ops = { CmpTime, DupDummy, FreeDummy, },
coords_ops = { NULL, DupDummy, FreeDummy, }; coords_ops = { NULL, DupDummy, FreeDummy, };
/***************************************************************************** /*****************************************************************************
...@@ -270,10 +264,6 @@ int var_Create( vlc_object_t *p_this, const char *psz_name, int i_type ) ...@@ -270,10 +264,6 @@ int var_Create( vlc_object_t *p_this, const char *psz_name, int i_type )
p_var->ops = &float_ops; p_var->ops = &float_ops;
p_var->val.f_float = 0.0; p_var->val.f_float = 0.0;
break; break;
case VLC_VAR_TIME:
p_var->ops = &time_ops;
p_var->val.i_time = 0;
break;
case VLC_VAR_COORDS: case VLC_VAR_COORDS:
p_var->ops = &coords_ops; p_var->ops = &coords_ops;
p_var->val.coords.x = p_var->val.coords.y = 0; p_var->val.coords.x = p_var->val.coords.y = 0;
...@@ -1267,9 +1257,6 @@ static void CheckValue ( variable_t *p_var, vlc_value_t *p_val ) ...@@ -1267,9 +1257,6 @@ static void CheckValue ( variable_t *p_var, vlc_value_t *p_val )
p_val->f_float = p_var->max.f_float; p_val->f_float = p_var->max.f_float;
} }
break; break;
case VLC_VAR_TIME:
/* FIXME: TODO */
break;
} }
} }
...@@ -1492,7 +1479,6 @@ static void DumpVariable(const void *data, const VISIT which, const int depth) ...@@ -1492,7 +1479,6 @@ static void DumpVariable(const void *data, const VISIT which, const int depth)
case VLC_VAR_STRING: typename = "string"; break; case VLC_VAR_STRING: typename = "string"; break;
case VLC_VAR_VARIABLE: typename = "variable"; break; case VLC_VAR_VARIABLE: typename = "variable"; break;
case VLC_VAR_FLOAT: typename = "float"; break; case VLC_VAR_FLOAT: typename = "float"; break;
case VLC_VAR_TIME: typename = "time"; break;
case VLC_VAR_COORDS: typename = "coordinates"; break; case VLC_VAR_COORDS: typename = "coordinates"; break;
case VLC_VAR_ADDRESS: typename = "address"; break; case VLC_VAR_ADDRESS: typename = "address"; break;
default: typename = "unknown"; break; default: typename = "unknown"; break;
...@@ -1525,9 +1511,6 @@ static void DumpVariable(const void *data, const VISIT which, const int depth) ...@@ -1525,9 +1511,6 @@ static void DumpVariable(const void *data, const VISIT which, const int depth)
case VLC_VAR_FLOAT: case VLC_VAR_FLOAT:
printf(": %f", var->val.f_float ); printf(": %f", var->val.f_float );
break; break;
case VLC_VAR_TIME:
printf(": %"PRId64, var->val.i_time);
break;
case VLC_VAR_COORDS: case VLC_VAR_COORDS:
printf(": %"PRId32"x%"PRId32, printf(": %"PRId32"x%"PRId32,
var->val.coords.x, var->val.coords.y); var->val.coords.x, var->val.coords.y);
......
...@@ -81,25 +81,6 @@ static void test_booleans( libvlc_int_t *p_libvlc ) ...@@ -81,25 +81,6 @@ static void test_booleans( libvlc_int_t *p_libvlc )
var_Destroy( p_libvlc, psz_var_name[i] ); var_Destroy( p_libvlc, psz_var_name[i] );
} }
static void test_times( libvlc_int_t *p_libvlc )
{
int i;
for( i = 0; i < i_var_count; i++ )
var_Create( p_libvlc, psz_var_name[i], VLC_VAR_TIME );
for( i = 0; i < i_var_count; i++ )
{
var_value[i].i_time = rand();
var_SetTime( p_libvlc, psz_var_name[i], var_value[i].i_time );
}
for( i = 0; i < i_var_count; i++ )
assert( var_GetTime( p_libvlc, psz_var_name[i] ) == var_value[i].i_time );
for( i = 0; i < i_var_count; i++ )
var_Destroy( p_libvlc, psz_var_name[i] );
}
static void test_floats( libvlc_int_t *p_libvlc ) static void test_floats( libvlc_int_t *p_libvlc )
{ {
int i; int i;
...@@ -412,9 +393,6 @@ static void test_variables( libvlc_instance_t *p_vlc ) ...@@ -412,9 +393,6 @@ static void test_variables( libvlc_instance_t *p_vlc )
log( "Testing for booleans\n" ); log( "Testing for booleans\n" );
test_booleans( p_libvlc ); test_booleans( p_libvlc );
log( "Testing for times\n" );
test_times( p_libvlc );
log( "Testing for floats\n" ); log( "Testing for floats\n" );
test_floats( p_libvlc ); test_floats( p_libvlc );
......
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