]> git.sesse.net Git - vlc/commitdiff
* Added functions and hooks to display dates instead of off_t.
authorChristophe Massiot <massiot@videolan.org>
Thu, 22 Feb 2001 17:00:20 +0000 (17:00 +0000)
committerChristophe Massiot <massiot@videolan.org>
Thu, 22 Feb 2001 17:00:20 +0000 (17:00 +0000)
include/input_ext-intf.h
src/input/input_clock.c
src/input/input_ext-intf.c
src/input/input_programs.c

index bef94752d6cd5dd1558c8bb930aa8a8bceef619a..7a9b19ce77bc5f2060be53d3cd18926c391180a2 100644 (file)
@@ -4,7 +4,7 @@
  * control the pace of reading. 
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_ext-intf.h,v 1.25 2001/02/22 16:17:12 massiot Exp $
+ * $Id: input_ext-intf.h,v 1.26 2001/02/22 17:00:20 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -33,6 +33,8 @@
 #define REQUESTED_LPCM         3
 #define REQUESTED_NOAUDIO    255
 
+#define OFFSETTOTIME_MAX_SIZE       10
+
 /*****************************************************************************
  * es_descriptor_t: elementary stream descriptor
  *****************************************************************************
@@ -343,4 +345,4 @@ void input_SetStatus( struct input_thread_s *, int );
 void input_SetRate  ( struct input_thread_s *, int );
 void input_Seek     ( struct input_thread_s *, off_t );
 void input_DumpStream( struct input_thread_s * );
-
+char * input_OffsetToTime( struct input_thread_s *, char * psz_buffer, off_t );
index 72f3a21707990b8b91cbb37ccb6923117a0e39e4..1a7ef4357967fbe9156ded55fb714730b50c32c0 100644 (file)
@@ -2,7 +2,7 @@
  * input_clock.c: Clock/System date convertions, stream management
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_clock.c,v 1.6 2001/02/08 13:52:35 massiot Exp $
+ * $Id: input_clock.c,v 1.7 2001/02/22 17:00:20 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -119,8 +119,6 @@ static mtime_t ClockCurrent( input_thread_t * p_input,
 static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
                          mtime_t i_clock, mtime_t i_sysdate )
 {
-    intf_WarnMsg( 1, "Old ref: %lld/%lld, New ref: %lld/%lld", p_pgrm->cr_ref,
-              p_pgrm->sysdate_ref, i_clock, i_sysdate );
     p_pgrm->cr_ref = i_clock;
     p_pgrm->sysdate_ref = i_sysdate;
 }
index fd23e44aa751bd8cca7397a600deb1183d1ee0b1..db49b7bbd30b507c11417b439559e0148b7c0b50 100644 (file)
@@ -137,13 +137,91 @@ void input_SetRate( input_thread_t * p_input, int i_mode )
  *****************************************************************************/
 void input_Seek( input_thread_t * p_input, off_t i_position )
 {
+    char        psz_time1[OFFSETTOTIME_MAX_SIZE];
+    char        psz_time2[OFFSETTOTIME_MAX_SIZE];
+
     vlc_mutex_lock( &p_input->stream.stream_lock );
     p_input->stream.p_selected_area->i_seek = i_position;
 
-    intf_Msg( "input: seeking position %lld/%lld", i_position,
-                                    p_input->stream.p_selected_area->i_size );
+    intf_Msg( "input: seeking position %lld/%lld (%s/%s)", i_position,
+                    p_input->stream.p_selected_area->i_size,
+                    input_OffsetToTime( p_input, psz_time1, i_position ),
+                    input_OffsetToTime( p_input, psz_time2,
+                                p_input->stream.p_selected_area->i_size ) );
 
     vlc_cond_signal( &p_input->stream.stream_wait );
     vlc_mutex_unlock( &p_input->stream.stream_lock );
 }
 
+/*****************************************************************************
+ * input_OffsetToTime : converts an off_t value to a time indicator, using
+ *                      mux_rate
+ *****************************************************************************
+ * BEWARE : this function assumes that you already own the lock on
+ * p_input->stream.stream_lock
+ *****************************************************************************/
+char * input_OffsetToTime( input_thread_t * p_input, char * psz_buffer,
+                           off_t i_offset )
+{
+    mtime_t         i_seconds;
+
+    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 );
+    }
+    else
+    {
+        /* Divide by zero is not my friend. */
+        sprintf( psz_buffer, "NA" );
+        return( psz_buffer );
+    }
+}
+
+/*****************************************************************************
+ * input_DumpStream: dumps the contents of a stream descriptor
+ *****************************************************************************
+ * BEWARE : this function assumes that you already own the lock on
+ * p_input->stream.stream_lock
+ *****************************************************************************/
+void input_DumpStream( input_thread_t * p_input )
+{
+    int         i, j;
+    char        psz_time1[OFFSETTOTIME_MAX_SIZE];
+    char        psz_time2[OFFSETTOTIME_MAX_SIZE];
+
+#define S   p_input->stream
+    intf_Msg( "input info: Dumping stream ID 0x%x", S.i_stream_id );
+    if( S.b_seekable )
+        intf_Msg( "input info: seekable stream, position: %lld/%lld (%s/%s)",
+                  S.p_selected_area->i_tell, S.p_selected_area->i_size,
+                  input_OffsetToTime( p_input, psz_time1,
+                                      S.p_selected_area->i_tell ),
+                  input_OffsetToTime( p_input, psz_time2,
+                                      S.p_selected_area->i_size ) );
+    else
+        intf_Msg( "input info: %s", S.b_pace_control ? "pace controlled" :
+                  "pace un-controlled" );
+#undef S
+    for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
+    {
+#define P   p_input->stream.pp_programs[i]
+        intf_Msg( "input info: Dumping program 0x%x, version %d (%s)",
+                  P->i_number, P->i_version,
+                  P->b_is_ok ? "complete" : "partial" );
+#undef P
+        for( j = 0; j < p_input->stream.pp_programs[i]->i_es_number; j++ )
+        {
+#define ES  p_input->stream.pp_programs[i]->pp_es[j]
+            intf_Msg( "input info: ES 0x%x, stream 0x%x, type 0x%x, %s",
+                      ES->i_id, ES->i_stream_id, ES->i_type,
+                      ES->p_decoder_fifo != NULL ? "selected" : "not selected");
+#undef ES
+        }
+    }
+}
+
index f486078e56bfa4a16b0fe622833c9a80e3741b01..081e31ed78791ddc2c333f52c963ca091c3e17c4 100644 (file)
@@ -2,7 +2,7 @@
  * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: input_programs.c,v 1.35 2001/02/22 16:17:12 massiot Exp $
+ * $Id: input_programs.c,v 1.36 2001/02/22 17:00:20 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -473,39 +473,6 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es )
     
 }
 
-/*****************************************************************************
- * input_DumpStream: dumps the contents of a stream descriptor
- *****************************************************************************/
-void input_DumpStream( input_thread_t * p_input )
-{
-    int i, j;
-#define S   p_input->stream
-    intf_Msg( "input info: Dumping stream ID 0x%x", S.i_stream_id );
-    if( S.b_seekable )
-        intf_Msg( "input info: seekable stream, position: %lld/%lld",
-                  S.p_selected_area->i_tell, S.p_selected_area->i_size );
-    else
-        intf_Msg( "input info: %s", S.b_pace_control ? "pace controlled" :
-                  "pace un-controlled" );
-#undef S
-    for( i = 0; i < p_input->stream.i_pgrm_number; i++ )
-    {
-#define P   p_input->stream.pp_programs[i]
-        intf_Msg( "input info: Dumping program 0x%x, version %d (%s)",
-                  P->i_number, P->i_version,
-                  P->b_is_ok ? "complete" : "partial" );
-#undef P
-        for( j = 0; j < p_input->stream.pp_programs[i]->i_es_number; j++ )
-        {
-#define ES  p_input->stream.pp_programs[i]->pp_es[j]
-            intf_Msg( "input info: ES 0x%x, stream 0x%x, type 0x%x, %s",
-                      ES->i_id, ES->i_stream_id, ES->i_type,
-                      ES->p_decoder_fifo != NULL ? "selected" : "not selected");
-#undef ES
-        }
-    }
-}
-
 /*****************************************************************************
  * InitDecConfig: initializes a decoder_config_t
  *****************************************************************************/