]> git.sesse.net Git - vlc/commitdiff
implemented VLC_VAR_TIME using two ints
authorSigmund Augdal Helberg <sigmunau@videolan.org>
Mon, 5 May 2003 15:21:28 +0000 (15:21 +0000)
committerSigmund Augdal Helberg <sigmunau@videolan.org>
Mon, 5 May 2003 15:21:28 +0000 (15:21 +0000)
include/vlc/vlc.h
src/misc/variables.c

index 7ff86046680936cf49d2af1941add1c6f322c2a0..a431d00f7e279b1419298262fd524d8698185dba 100644 (file)
@@ -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;
index 91e6964a6c776994cf873551f1551cd2e3002519..ff32dfc54afdb343cec1f0176c4d72c09e3daf8b 100644 (file)
@@ -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 <sam@zoy.org>
  *
@@ -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;