From: Sigmund Augdal Helberg Date: Mon, 5 May 2003 15:21:28 +0000 (+0000) Subject: implemented VLC_VAR_TIME using two ints X-Git-Tag: 0.6.0~382 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8d98b9f51b711f2cb45c13f4d2688bdb62522881;p=vlc implemented VLC_VAR_TIME using two ints --- diff --git a/include/vlc/vlc.h b/include/vlc/vlc.h index 7ff8604668..a431d00f7e 100644 --- a/include/vlc/vlc.h +++ b/include/vlc/vlc.h @@ -2,7 +2,7 @@ * vlc.h: global header for vlc ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: vlc.h,v 1.22 2003/01/28 02:03:32 sam Exp $ + * $Id: vlc.h,v 1.23 2003/05/05 15:21:28 sigmunau Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,6 +42,7 @@ typedef union void * p_address; vlc_object_t * p_object; vlc_list_t * p_list; + struct { int i_low, i_high; } time; /* Make sure the structure is at least 64bits */ struct { char a, b, c, d, e, f, g, h; } padding; diff --git a/src/misc/variables.c b/src/misc/variables.c index 91e6964a6c..ff32dfc54a 100644 --- a/src/misc/variables.c +++ b/src/misc/variables.c @@ -2,7 +2,7 @@ * variables.c: routines for object variables handling ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: variables.c,v 1.22 2003/05/04 22:42:18 gbazin Exp $ + * $Id: variables.c,v 1.23 2003/05/05 15:21:27 sigmunau Exp $ * * Authors: Samuel Hocevar * @@ -44,6 +44,13 @@ struct callback_entry_t *****************************************************************************/ static int CmpBool( vlc_value_t v, vlc_value_t w ) { return v.b_bool ? w.b_bool ? 0 : 1 : w.b_bool ? -1 : 0; } 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; } +static int CmpTime( vlc_value_t v, vlc_value_t w ) +{ + mtime_t v_time,w_time; + v_time = ( (mtime_t)v.time.i_high << 32 ) + v.time.i_low; + w_time = ( (mtime_t)w.time.i_high << 32 ) + w.time.i_low; + return v_time == w_time ? 0 : v_time > w_time ? 1 : -1; +} static int CmpString( vlc_value_t v, vlc_value_t w ) { return strcmp( v.psz_string, w.psz_string ); } static int CmpFloat( vlc_value_t v, vlc_value_t w ) { return v.f_float == w.f_float ? 0 : v.f_float > w.f_float ? 1 : -1; } static int CmpAddress( vlc_value_t v, vlc_value_t w ) { return v.p_address == w.p_address ? 0 : v.p_address > w.p_address ? 1 : -1; } @@ -226,7 +233,9 @@ int __var_Create( vlc_object_t *p_this, const char *psz_name, int i_type ) p_var->val.f_float = 0.0; break; case VLC_VAR_TIME: - /* FIXME: TODO */ + p_var->pf_cmp = CmpTime; + p_var->val.time.i_low = 0; + p_var->val.time.i_high = 0; break; case VLC_VAR_ADDRESS: p_var->pf_cmp = CmpAddress;