]> git.sesse.net Git - vlc/commitdiff
Add more uses of msecstotimestr. Remove OFFSETTOTIME_MAX_SIZE -
authorRocky Bernstein <rocky@videolan.org>
Wed, 3 Dec 2003 13:27:51 +0000 (13:27 +0000)
committerRocky Bernstein <rocky@videolan.org>
Wed, 3 Dec 2003 13:27:51 +0000 (13:27 +0000)
Use MSTRTIME_MAX_SIZE instead.

include/input_ext-intf.h
modules/gui/gtk/display.c
modules/gui/wxwindows/timer.cpp
src/input/input_ext-intf.c
src/misc/mtime.c

index adb0441d5724353bef85cf0c8894e585a6f6ee37..04d522307e2cb63162b6154b6c3591dd09e175a3 100644 (file)
@@ -3,8 +3,8 @@
  * This header provides structures to read the stream descriptors and
  * control the pace of reading.
  *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.101 2003/11/29 18:36:13 massiot Exp $
+ * Copyright (C) 1999, 2000, 2003 VideoLAN
+ * $Id: input_ext-intf.h,v 1.102 2003/12/03 13:27:51 rocky Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -38,8 +38,6 @@
 #define REQUESTED_DTS          4
 #define REQUESTED_NOAUDIO    255
 
-#define OFFSETTOTIME_MAX_SIZE       10
-
 /*****************************************************************************
  * es_descriptor_t: elementary stream descriptor
  *****************************************************************************
index 42abf49e8b0422a16411eeda4c1fe87f6bbe596b..780738e773323f758177c331d4c6d8616283858a 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * display.c: Gtk+ tools for main interface
  *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: display.c,v 1.11 2003/08/03 23:11:21 gbazin Exp $
+ * Copyright (C) 1999, 2000, 2003 VideoLAN
+ * $Id: display.c,v 1.12 2003/12/03 13:27:51 rocky Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -63,7 +63,7 @@ void E_(GtkDisplayDate)( GtkAdjustment *p_adj )
     if( p_intf->p_sys->p_input )
     {
 #define p_area p_intf->p_sys->p_input->stream.p_selected_area
-        char psz_time[ OFFSETTOTIME_MAX_SIZE ];
+        char psz_time[ MSTRTIME_MAX_SIZE ];
 
         gtk_frame_set_label( GTK_FRAME( p_intf->p_sys->p_slider_frame ),
                         input_OffsetToTime( p_intf->p_sys->p_input, psz_time,
index 18ad154b6ded0889ea8197e33b06c2d7210d906b..85f831016c3dda82f99ea61c9f43edce40fc181b 100644 (file)
@@ -2,7 +2,7 @@
  * timer.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2003 VideoLAN
- * $Id: timer.cpp,v 1.35 2003/11/23 22:29:27 ipkiss Exp $
+ * $Id: timer.cpp,v 1.36 2003/12/03 13:27:51 rocky Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -184,7 +184,7 @@ void Timer::Notify()
                 if( p_intf->p_sys->b_slider_free )
                 {
                     vlc_value_t pos;
-                    char psz_time[ OFFSETTOTIME_MAX_SIZE ];
+                    char psz_time[ MSTRTIME_MAX_SIZE ];
                     vlc_value_t time;
                     mtime_t i_seconds;
 
@@ -201,11 +201,7 @@ void Timer::Notify()
                         var_Get( p_intf->p_sys->p_input, "time", &time );
                         i_seconds = time.i_time / 1000000;
 
-                        snprintf( psz_time, OFFSETTOTIME_MAX_SIZE,
-                                  "%d:%02d:%02d",
-                                  (int) (i_seconds / (60 * 60)),
-                                  (int) (i_seconds / 60 % 60),
-                                  (int) (i_seconds % 60) );
+                        secstotimestr ( psz_time, i_seconds );
 
                         p_main_interface->slider_box->SetLabel( wxU(psz_time) );
                     }
index 3356087a47c057332d0b8a63479e3e70a9476178..307541e10e3d791e6ef3025ebb7a9fe26e42a72b 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * input_ext-intf.c: services to the interface
  *****************************************************************************
- * Copyright (C) 1998-2001 VideoLAN
- * $Id: input_ext-intf.c,v 1.52 2003/11/24 00:39:02 fenrir Exp $
+ * Copyright (C) 1998-2001,2003 VideoLAN
+ * $Id: input_ext-intf.c,v 1.53 2003/12/03 13:27:51 rocky Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -197,8 +197,8 @@ void __input_Seek( vlc_object_t * p_this, off_t i_position, int i_whence )
 {
     input_thread_t *p_input;
 
-    char psz_time1[OFFSETTOTIME_MAX_SIZE];
-    char psz_time2[OFFSETTOTIME_MAX_SIZE];
+    char psz_time1[MSTRTIME_MAX_SIZE];
+    char psz_time2[MSTRTIME_MAX_SIZE];
 
     p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT );
 
@@ -308,11 +308,7 @@ char * input_OffsetToTime( input_thread_t * p_input, char * psz_buffer,
     if( p_input->stream.i_mux_rate )
     {
         i_seconds = i_offset / 50 / p_input->stream.i_mux_rate;
-        snprintf( psz_buffer, OFFSETTOTIME_MAX_SIZE, "%d:%02d:%02d",
-                 (int) (i_seconds / (60 * 60)),
-                 (int) (i_seconds / 60 % 60),
-                 (int) (i_seconds % 60) );
-        return( psz_buffer );
+       return secstotimestr( psz_buffer, i_seconds );
     }
     else
     {
@@ -330,8 +326,8 @@ char * input_OffsetToTime( input_thread_t * p_input, char * psz_buffer,
  *****************************************************************************/
 void input_DumpStream( input_thread_t * p_input )
 {
-    char psz_time1[OFFSETTOTIME_MAX_SIZE];
-    char psz_time2[OFFSETTOTIME_MAX_SIZE];
+    char psz_time1[MSTRTIME_MAX_SIZE];
+    char psz_time2[MSTRTIME_MAX_SIZE];
     unsigned int i, j;
 
 #define S   p_input->stream
index 34db7a83b33119ebae74fcecc78a4ce05e50773b..8c4711b6ac4138e47c86c011347d4b28a216bcb9 100644 (file)
@@ -1,9 +1,9 @@
 /*****************************************************************************
- * mtime.c: high rezolution time management functions
+ * mtime.c: high resolution time management functions
  * Functions are prototyped in mtime.h.
  *****************************************************************************
- * Copyright (C) 1998-2001 VideoLAN
- * $Id: mtime.c,v 1.37 2003/12/02 01:54:30 rocky Exp $
+ * Copyright (C) 1998-2001, 2003 VideoLAN
+ * $Id: mtime.c,v 1.38 2003/12/03 13:27:51 rocky Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -103,11 +103,12 @@ char *mstrtime( char *psz_buffer, mtime_t date )
  * \param psz_buffer should be a buffer at least MSTRTIME_MAX_SIZE characters
  * \return psz_buffer is returned so this can be used as printf parameter.
  */
-char *secstotimestr( char *psz_buffer, int secs )
+char *secstotimestr( char *psz_buffer, int i_seconds )
 {
   snprintf( psz_buffer, MSTRTIME_MAX_SIZE, "%d:%2.2d:%2.2d",
-           (int) (secs / 3600), (int)(( secs % 3600 ) / 60), 
-           (int)(secs % 60) );
+           (int) (i_seconds / (60 *60)), 
+           (int) ((i_seconds / 60) % 60), 
+           (int) (i_seconds % 60) );
   return( psz_buffer );
 }