* 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>
*
#define REQUESTED_LPCM 3
#define REQUESTED_NOAUDIO 255
+#define OFFSETTOTIME_MAX_SIZE 10
+
/*****************************************************************************
* es_descriptor_t: elementary stream descriptor
*****************************************************************************
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 );
* 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>
*
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;
}
*****************************************************************************/
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
+ }
+ }
+}
+
* 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>
*
}
-/*****************************************************************************
- * 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
*****************************************************************************/