Commit cb2ce817 authored by Rocky Bernstein's avatar Rocky Bernstein

Add more uses of msecstotimestr. Remove OFFSETTOTIME_MAX_SIZE -

Use MSTRTIME_MAX_SIZE instead.
parent 2ded9ac0
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* This header provides structures to read the stream descriptors and * This header provides structures to read the stream descriptors and
* control the pace of reading. * control the pace of reading.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000, 2003 VideoLAN
* $Id: input_ext-intf.h,v 1.101 2003/11/29 18:36:13 massiot Exp $ * $Id: input_ext-intf.h,v 1.102 2003/12/03 13:27:51 rocky Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -38,8 +38,6 @@ ...@@ -38,8 +38,6 @@
#define REQUESTED_DTS 4 #define REQUESTED_DTS 4
#define REQUESTED_NOAUDIO 255 #define REQUESTED_NOAUDIO 255
#define OFFSETTOTIME_MAX_SIZE 10
/***************************************************************************** /*****************************************************************************
* es_descriptor_t: elementary stream descriptor * es_descriptor_t: elementary stream descriptor
***************************************************************************** *****************************************************************************
......
/***************************************************************************** /*****************************************************************************
* display.c: Gtk+ tools for main interface * display.c: Gtk+ tools for main interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000, 2003 VideoLAN
* $Id: display.c,v 1.11 2003/08/03 23:11:21 gbazin Exp $ * $Id: display.c,v 1.12 2003/12/03 13:27:51 rocky Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* Stphane Borel <stef@via.ecp.fr> * Stphane Borel <stef@via.ecp.fr>
...@@ -63,7 +63,7 @@ void E_(GtkDisplayDate)( GtkAdjustment *p_adj ) ...@@ -63,7 +63,7 @@ void E_(GtkDisplayDate)( GtkAdjustment *p_adj )
if( p_intf->p_sys->p_input ) if( p_intf->p_sys->p_input )
{ {
#define p_area p_intf->p_sys->p_input->stream.p_selected_area #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 ), gtk_frame_set_label( GTK_FRAME( p_intf->p_sys->p_slider_frame ),
input_OffsetToTime( p_intf->p_sys->p_input, psz_time, input_OffsetToTime( p_intf->p_sys->p_input, psz_time,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc * timer.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2003 VideoLAN * 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> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -184,7 +184,7 @@ void Timer::Notify() ...@@ -184,7 +184,7 @@ void Timer::Notify()
if( p_intf->p_sys->b_slider_free ) if( p_intf->p_sys->b_slider_free )
{ {
vlc_value_t pos; vlc_value_t pos;
char psz_time[ OFFSETTOTIME_MAX_SIZE ]; char psz_time[ MSTRTIME_MAX_SIZE ];
vlc_value_t time; vlc_value_t time;
mtime_t i_seconds; mtime_t i_seconds;
...@@ -201,11 +201,7 @@ void Timer::Notify() ...@@ -201,11 +201,7 @@ void Timer::Notify()
var_Get( p_intf->p_sys->p_input, "time", &time ); var_Get( p_intf->p_sys->p_input, "time", &time );
i_seconds = time.i_time / 1000000; i_seconds = time.i_time / 1000000;
snprintf( psz_time, OFFSETTOTIME_MAX_SIZE, secstotimestr ( psz_time, i_seconds );
"%d:%02d:%02d",
(int) (i_seconds / (60 * 60)),
(int) (i_seconds / 60 % 60),
(int) (i_seconds % 60) );
p_main_interface->slider_box->SetLabel( wxU(psz_time) ); p_main_interface->slider_box->SetLabel( wxU(psz_time) );
} }
......
/***************************************************************************** /*****************************************************************************
* input_ext-intf.c: services to the interface * input_ext-intf.c: services to the interface
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001,2003 VideoLAN
* $Id: input_ext-intf.c,v 1.52 2003/11/24 00:39:02 fenrir Exp $ * $Id: input_ext-intf.c,v 1.53 2003/12/03 13:27:51 rocky Exp $
* *
* Authors: Christophe Massiot <massiot@via.ecp.fr> * 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 ) ...@@ -197,8 +197,8 @@ void __input_Seek( vlc_object_t * p_this, off_t i_position, int i_whence )
{ {
input_thread_t *p_input; input_thread_t *p_input;
char psz_time1[OFFSETTOTIME_MAX_SIZE]; char psz_time1[MSTRTIME_MAX_SIZE];
char psz_time2[OFFSETTOTIME_MAX_SIZE]; char psz_time2[MSTRTIME_MAX_SIZE];
p_input = vlc_object_find( p_this, VLC_OBJECT_INPUT, FIND_PARENT ); 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, ...@@ -308,11 +308,7 @@ char * input_OffsetToTime( input_thread_t * p_input, char * psz_buffer,
if( p_input->stream.i_mux_rate ) if( p_input->stream.i_mux_rate )
{ {
i_seconds = i_offset / 50 / 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", return secstotimestr( psz_buffer, i_seconds );
(int) (i_seconds / (60 * 60)),
(int) (i_seconds / 60 % 60),
(int) (i_seconds % 60) );
return( psz_buffer );
} }
else else
{ {
...@@ -330,8 +326,8 @@ char * input_OffsetToTime( input_thread_t * p_input, char * psz_buffer, ...@@ -330,8 +326,8 @@ char * input_OffsetToTime( input_thread_t * p_input, char * psz_buffer,
*****************************************************************************/ *****************************************************************************/
void input_DumpStream( input_thread_t * p_input ) void input_DumpStream( input_thread_t * p_input )
{ {
char psz_time1[OFFSETTOTIME_MAX_SIZE]; char psz_time1[MSTRTIME_MAX_SIZE];
char psz_time2[OFFSETTOTIME_MAX_SIZE]; char psz_time2[MSTRTIME_MAX_SIZE];
unsigned int i, j; unsigned int i, j;
#define S p_input->stream #define S p_input->stream
......
/***************************************************************************** /*****************************************************************************
* mtime.c: high rezolution time management functions * mtime.c: high resolution time management functions
* Functions are prototyped in mtime.h. * Functions are prototyped in mtime.h.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998-2001 VideoLAN * Copyright (C) 1998-2001, 2003 VideoLAN
* $Id: mtime.c,v 1.37 2003/12/02 01:54:30 rocky Exp $ * $Id: mtime.c,v 1.38 2003/12/03 13:27:51 rocky Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
...@@ -103,11 +103,12 @@ char *mstrtime( char *psz_buffer, mtime_t date ) ...@@ -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 * \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. * \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", snprintf( psz_buffer, MSTRTIME_MAX_SIZE, "%d:%2.2d:%2.2d",
(int) (secs / 3600), (int)(( secs % 3600 ) / 60), (int) (i_seconds / (60 *60)),
(int)(secs % 60) ); (int) ((i_seconds / 60) % 60),
(int) (i_seconds % 60) );
return( psz_buffer ); return( psz_buffer );
} }
......
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