]> git.sesse.net Git - vlc/commitdiff
Moved date_Decrement to libvlc core from dirac.
authorLaurent Aimar <fenrir@videolan.org>
Thu, 7 May 2009 21:28:57 +0000 (23:28 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Thu, 7 May 2009 22:28:09 +0000 (00:28 +0200)
include/vlc_mtime.h
modules/packetizer/dirac.c
src/libvlccore.sym
src/misc/mtime.c

index f3bb895d42fdbde9294c2c60d378f5889ddaf684..0a75dacdf964f4c3a19c47f709ff2ec6eaa6abec 100644 (file)
@@ -136,5 +136,6 @@ VLC_EXPORT( void,    date_Set,       ( date_t *, mtime_t ) );
 VLC_EXPORT( mtime_t, date_Get,       ( const date_t * ) );
 VLC_EXPORT( void,    date_Move,      ( date_t *, mtime_t ) );
 VLC_EXPORT( mtime_t, date_Increment, ( date_t *, uint32_t ) );
+VLC_EXPORT( mtime_t, date_Decrement, ( date_t *, uint32_t ) );
 VLC_EXPORT( uint64_t, NTPtime64,     ( void ) );
 #endif /* !__VLC_MTIME_ */
index b66659150b9f39d46df55c00644e66b900b1a57f..af3f50f2e2491b4df9eb2d4606a45f65b3385ca9 100644 (file)
@@ -266,26 +266,6 @@ static dirac_block_encap_t *dirac_GetBlockEncap( block_t *p_block )
  * General utility funcions
  */
 
-/* decrement a date. opposite to date_Increment */
-static mtime_t date_Decrement( date_t *p_date, uint32_t i_nb_samples )
-{
-    mtime_t i_dividend = (mtime_t)i_nb_samples * 1000000 * p_date->i_divider_den;
-    p_date->date -= i_dividend / p_date->i_divider_num;
-    unsigned u_rem_adjust = i_dividend % p_date->i_divider_num;
-
-    if( p_date->i_remainder < u_rem_adjust )
-    {
-        /* This is Bresenham algorithm. */
-        assert( p_date->i_remainder > -p_date->i_divider_num);
-        p_date->date -= 1;
-        p_date->i_remainder += p_date->i_divider_num;
-    }
-
-    p_date->i_remainder -= u_rem_adjust;
-
-    return p_date->date;
-}
-
 /**
  * given a chain of block_t, allocate and return an array containing
  * pointers to all the blocks. (Acts as a replacement for the old p_prev
index 91f2d79c08b063e1125eb9c73cf2b8168136f588..9f7c950c86b8fac2310905596d29888c1b006c3c 100644 (file)
@@ -74,6 +74,7 @@ config_StringEscape
 config_StringUnescape
 convert_xml_special_chars
 date_Change
+date_Decrement
 date_Get
 date_Increment
 date_Init
index 0dbb4df578308b38e6e3ff9487b0e9143f11853b..c735bdfcaafa6721488226f8ea347f9662ec142e 100644 (file)
@@ -536,6 +536,33 @@ mtime_t date_Increment( date_t *p_date, uint32_t i_nb_samples )
     return p_date->date;
 }
 
+/**
+ * Decrement the date and return the result, taking into account
+ * rounding errors.
+ *
+ * \param date to decrement
+ * \param decrementation in number of samples
+ * \return date value
+ */
+mtime_t date_Decrement( date_t *p_date, uint32_t i_nb_samples )
+{
+    mtime_t i_dividend = (mtime_t)i_nb_samples * 1000000 * p_date->i_divider_den;
+    p_date->date -= i_dividend / p_date->i_divider_num;
+    unsigned i_rem_adjust = i_dividend % p_date->i_divider_num;
+
+    if( p_date->i_remainder < i_rem_adjust )
+    {
+        /* This is Bresenham algorithm. */
+        assert( p_date->i_remainder > -p_date->i_divider_num);
+        p_date->date -= 1;
+        p_date->i_remainder += p_date->i_divider_num;
+    }
+
+    p_date->i_remainder -= i_rem_adjust;
+
+    return p_date->date;
+}
+
 #ifndef HAVE_GETTIMEOFDAY
 
 #ifdef WIN32