Commit 7d38f3f9 authored by Christophe Massiot's avatar Christophe Massiot

* Added functions and hooks to display dates instead of off_t.

parent 99bbcdcb
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* control the pace of reading. * control the pace of reading.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#define REQUESTED_LPCM 3 #define REQUESTED_LPCM 3
#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
***************************************************************************** *****************************************************************************
...@@ -343,4 +345,4 @@ void input_SetStatus( struct input_thread_s *, int ); ...@@ -343,4 +345,4 @@ void input_SetStatus( struct input_thread_s *, int );
void input_SetRate ( struct input_thread_s *, int ); void input_SetRate ( struct input_thread_s *, int );
void input_Seek ( struct input_thread_s *, off_t ); void input_Seek ( struct input_thread_s *, off_t );
void input_DumpStream( struct input_thread_s * ); void input_DumpStream( struct input_thread_s * );
char * input_OffsetToTime( struct input_thread_s *, char * psz_buffer, off_t );
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_clock.c: Clock/System date convertions, stream management * input_clock.c: Clock/System date convertions, stream management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -119,8 +119,6 @@ static mtime_t ClockCurrent( input_thread_t * p_input, ...@@ -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, static void ClockNewRef( input_thread_t * p_input, pgrm_descriptor_t * p_pgrm,
mtime_t i_clock, mtime_t i_sysdate ) 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->cr_ref = i_clock;
p_pgrm->sysdate_ref = i_sysdate; p_pgrm->sysdate_ref = i_sysdate;
} }
......
...@@ -137,13 +137,91 @@ void input_SetRate( input_thread_t * p_input, int i_mode ) ...@@ -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 ) 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 ); vlc_mutex_lock( &p_input->stream.stream_lock );
p_input->stream.p_selected_area->i_seek = i_position; p_input->stream.p_selected_area->i_seek = i_position;
intf_Msg( "input: seeking position %lld/%lld", i_position, intf_Msg( "input: seeking position %lld/%lld (%s/%s)", i_position,
p_input->stream.p_selected_area->i_size ); 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_cond_signal( &p_input->stream.stream_wait );
vlc_mutex_unlock( &p_input->stream.stream_lock ); 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
}
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* input_programs.c: es_descriptor_t, pgrm_descriptor_t management * input_programs.c: es_descriptor_t, pgrm_descriptor_t management
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Christophe Massiot <massiot@via.ecp.fr>
* *
...@@ -473,39 +473,6 @@ void input_DelES( input_thread_t * p_input, es_descriptor_t * p_es ) ...@@ -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 * InitDecConfig: initializes a decoder_config_t
*****************************************************************************/ *****************************************************************************/
......
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