Commit 04db84cd authored by Steve Lhomme's avatar Steve Lhomme Committed by Rémi Denis-Courmont

modules: replace use of 1000000 on time values by CLOCK_FREQ

Modified-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
Signed-off-by: Rémi Denis-Courmont's avatarRémi Denis-Courmont <remi@remlab.net>
parent 4a604f31
......@@ -1488,7 +1488,7 @@ static void DateTimeManage( cam_t * p_cam, int i_session_id )
(date_time_t *)p_cam->p_sessions[i_session_id - 1].p_sys;
if ( p_date->i_interval
&& mdate() > p_date->i_last + (mtime_t)p_date->i_interval * 1000000 )
&& mdate() > p_date->i_last + (mtime_t)p_date->i_interval * CLOCK_FREQ )
{
DateTimeSend( p_cam, i_session_id );
}
......
......@@ -545,7 +545,7 @@ static int InitAudio( demux_t *p_demux )
p_sys->i_next_adate = START_DATE;
p_sys->i_ablock_size = p_sys->i_sample_rate * 4 * p_sys->i_frame_rate_base / p_sys->i_frame_rate;
p_sys->i_aincr = 1000000. * p_sys->i_ablock_size / p_sys->i_sample_rate / 4;
p_sys->i_aincr = 1000000 * p_sys->i_ablock_size / (p_sys->i_sample_rate * 4);
return VLC_SUCCESS;
}
......@@ -632,7 +632,7 @@ static int HandleAudio( demux_t *p_demux, const uint8_t *p_buffer )
p_block->i_dts = p_block->i_pts
= p_sys->i_next_adate + (mtime_t)p_audio->i_delay
* INT64_C(1000000) / p_sys->i_sample_rate;
* CLOCK_FREQ / p_sys->i_sample_rate;
p_block->i_length = p_sys->i_aincr;
es_out_Send( p_demux->out, p_audio->p_es, p_block );
}
......
......@@ -428,7 +428,7 @@ static int StartDecode( demux_t *p_demux )
char *psz_parser;
p_sys->i_next_date = START_DATE;
p_sys->i_incr = 1000000 * p_sys->i_frame_rate_base / p_sys->i_frame_rate;
p_sys->i_incr = CLOCK_FREQ * p_sys->i_frame_rate_base / p_sys->i_frame_rate;
p_sys->i_block_size = p_sys->i_width * p_sys->i_height * 3 / 2
+ sizeof(struct block_extension_t);
if( NewFrame( p_demux ) != VLC_SUCCESS )
......@@ -931,7 +931,7 @@ static int DecodeAudio( demux_t *p_demux, sdi_audio_t *p_audio )
if( unlikely( !p_block ) )
return VLC_ENOMEM;
p_block->i_dts = p_block->i_pts = p_sys->i_next_date
+ (mtime_t)p_audio->i_delay * INT64_C(1000000) / p_audio->i_rate;
+ (mtime_t)p_audio->i_delay * CLOCK_FREQ / p_audio->i_rate;
p_output = (int16_t *)p_block->p_buffer;
if ( p_audio->i_left_samples == p_audio->i_nb_samples &&
......
......@@ -1518,7 +1518,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
pi64 = va_arg( args, int64_t * );
if( p_sys->f_npt > 0 )
{
*pi64 = (int64_t)(p_sys->f_npt * 1000000.);
*pi64 = (int64_t)(p_sys->f_npt * CLOCK_FREQ);
return VLC_SUCCESS;
}
return VLC_EGENERIC;
......@@ -1527,7 +1527,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
pi64 = va_arg( args, int64_t * );
if( p_sys->f_npt_length > 0 )
{
double d_length = p_sys->f_npt_length * 1000000.0;
double d_length = p_sys->f_npt_length * CLOCK_FREQ;
if( d_length >= INT64_MAX )
*pi64 = INT64_MAX;
else
......@@ -1929,7 +1929,7 @@ static void StreamRead( void *p_private, unsigned int i_size,
//msg_Dbg( p_demux, "pts: %d", pts.tv_sec );
int64_t i_pts = (int64_t)pts.tv_sec * INT64_C(1000000) +
int64_t i_pts = (int64_t)pts.tv_sec * CLOCK_FREQ +
(int64_t)pts.tv_usec;
/* XXX Beurk beurk beurk Avoid having negative value XXX */
......
......@@ -320,7 +320,7 @@ static block_t* GrabAudio( demux_t *p_demux )
/* Timestamp */
p_block->i_pts = p_block->i_dts =
mdate() - INT64_C(1000000) * (mtime_t)i_correct /
mdate() - CLOCK_FREQ * (mtime_t)i_correct /
2 / ( p_sys->b_stereo ? 2 : 1) / p_sys->i_sample_rate;
return p_block;
......
......@@ -434,7 +434,7 @@ static int Open( vlc_object_t *p_this )
p_sys->f_fps = var_InheritFloat( p_demux, CFG_PREFIX "fps" );
if ( p_sys->f_fps <= 0 ) p_sys->f_fps = 1.0;
p_sys->i_frame_interval = 1000000 / p_sys->f_fps;
p_sys->i_frame_interval = CLOCK_FREQ / p_sys->f_fps;
#if FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR < 2
freerdp_channels_global_init();
......
......@@ -155,7 +155,7 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM;
p_sys->f_fps = var_CreateGetFloat( p_demux, "screen-fps" );
p_sys->i_incr = 1000000 / p_sys->f_fps;;
p_sys->i_incr = CLOCK_FREQ / p_sys->f_fps;;
p_sys->i_next_date = 0;
#ifdef SCREEN_SUBSCREEN
......
......@@ -224,7 +224,7 @@ static block_t *CaptureBlockNew( demux_t *p_demux )
(int)p_sys->fmt.video.i_height :
p_data->i_fragment_size;
p_sys->f_fps *= (p_sys->fmt.video.i_height/p_data->i_fragment_size);
p_sys->i_incr = 1000000 / p_sys->f_fps;
p_sys->i_incr = CLOCK_FREQ / p_sys->f_fps;
p_data->i_fragment = 0;
p_data->p_block = 0;
}
......
......@@ -396,7 +396,7 @@ static int Open( vlc_object_t *p_this )
p_sys->f_fps = var_InheritFloat( p_demux, CFG_PREFIX "fps" );
if ( p_sys->f_fps <= 0 ) p_sys->f_fps = 1.0;
p_sys->i_frame_interval = 1000000 / p_sys->f_fps ;
p_sys->i_frame_interval = CLOCK_FREQ / p_sys->f_fps ;
char *psz_chroma = var_InheritString( p_demux, CFG_PREFIX "chroma" );
vlc_fourcc_t i_chroma = vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_chroma );
......
......@@ -112,7 +112,7 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
p_out_buf->i_buffer = i_out_nb * framesize;
p_out_buf->i_pts = p_in_buf->i_pts;
p_out_buf->i_length = p_out_buf->i_nb_samples *
1000000 / p_filter->fmt_out.audio.i_rate;
CLOCK_FREQ / p_filter->fmt_out.audio.i_rate;
while( i_out_nb )
{
......
......@@ -2124,7 +2124,7 @@ static void encode_page_composition( encoder_t *p_enc, bs_t *s,
if( p_subpic && !p_subpic->b_ephemer &&
( p_subpic->i_stop > p_subpic->i_start ) )
{
i_timeout = (p_subpic->i_stop - p_subpic->i_start) / 1000000;
i_timeout = (p_subpic->i_stop - p_subpic->i_start) / CLOCK_FREQ;
}
bs_write( s, 8, i_timeout ); /* Timeout */
......
......@@ -771,7 +771,7 @@ EncoderWriteCallback( const FLAC__StreamEncoder *encoder,
p_sys->i_samples_delay -= samples;
p_block->i_length = (mtime_t)1000000 *
p_block->i_length = CLOCK_FREQ *
(mtime_t)samples / (mtime_t)p_enc->fmt_in.audio.i_rate;
/* Update pts */
......@@ -881,7 +881,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
if( unlikely( !p_aout_buf ) ) return NULL;
p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
CLOCK_FREQ * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
p_sys->i_samples_delay += p_aout_buf->i_nb_samples;
......
......@@ -228,7 +228,7 @@ static block_t *EncodeFrame( encoder_t *p_enc, block_t *p_block )
block_t *p_chain = NULL;
unsigned int i_samples = p_block->i_buffer >> 2 /* s16l stereo */;
mtime_t start_date = p_block->i_pts;
start_date -= (mtime_t)i_samples * (mtime_t)1000000 / (mtime_t)p_enc->fmt_out.audio.i_rate;
start_date -= (mtime_t)i_samples * CLOCK_FREQ / (mtime_t)p_enc->fmt_out.audio.i_rate;
VLC_UNUSED(p_enc);
......@@ -260,7 +260,7 @@ static block_t *EncodeFrame( encoder_t *p_enc, block_t *p_block )
memcpy( p_mp3_block->p_buffer, buf, written );
/* date management */
p_mp3_block->i_length = p_sys->samples_per_frame * 1000000 /
p_mp3_block->i_length = p_sys->samples_per_frame * CLOCK_FREQ /
p_enc->fmt_out.audio.i_rate;
start_date += p_mp3_block->i_length;
......
......@@ -1105,7 +1105,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
int i_samples_delay = p_sys->i_samples_delay;
mtime_t i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
CLOCK_FREQ * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
p_sys->i_samples_delay += i_samples;
......@@ -1164,7 +1164,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
p_block = block_Alloc( i_out );
memcpy( p_block->p_buffer, p_sys->p_buffer_out, i_out );
p_block->i_length = (mtime_t)1000000 *
p_block->i_length = CLOCK_FREQ *
(mtime_t)p_sys->i_frame_length * p_sys->header.frames_per_packet /
(mtime_t)p_enc->fmt_in.audio.i_rate;
......
......@@ -248,10 +248,10 @@ static void GroupApplyStyle(stl_sg_t *p_group, uint8_t code)
static int64_t ParseTimeCode(const uint8_t *data, double fps)
{
return INT64_C(1000000) * (data[0] * 3600 +
data[1] * 60 +
data[2] * 1 +
data[3] / fps);
return CLOCK_FREQ * (data[0] * 3600 +
data[1] * 60 +
data[2] * 1 +
data[3] / fps);
}
static void ClearTeletextStyles(stl_sg_t *p_group)
......
......@@ -407,7 +407,7 @@ void decoder_SynchroNewPicture( decoder_synchro_t * p_synchro, int i_coding_type
int i_repeat_field, mtime_t next_pts,
mtime_t next_dts, bool b_low_delay )
{
mtime_t period = 1000000 * 1001 / p_synchro->i_frame_rate;
mtime_t period = CLOCK_FREQ * 1001 / p_synchro->i_frame_rate;
#if 0
mtime_t now = mdate();
#endif
......
......@@ -301,7 +301,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
int i_nb_samples = p_aout_buf->i_nb_samples;
p_sys->i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_nb_samples /
CLOCK_FREQ * (mtime_t)p_sys->i_nb_samples /
(mtime_t)p_enc->fmt_out.audio.i_rate;
while ( p_sys->i_nb_samples + i_nb_samples >= MPEG_FRAME_SIZE )
......
......@@ -901,7 +901,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
if( unlikely( !p_aout_buf ) ) return NULL;
mtime_t i_pts = p_aout_buf->i_pts -
(mtime_t)1000000 * (mtime_t)p_sys->i_samples_delay /
CLOCK_FREQ * (mtime_t)p_sys->i_samples_delay /
(mtime_t)p_enc->fmt_in.audio.i_rate;
p_sys->i_samples_delay += p_aout_buf->i_nb_samples;
......@@ -940,7 +940,7 @@ static block_t *Encode( encoder_t *p_enc, block_t *p_aout_buf )
i_samples = ( p_sys->i_last_block_size + i_block_size ) >> 2;
p_sys->i_last_block_size = i_block_size;
p_block->i_length = (mtime_t)1000000 *
p_block->i_length = CLOCK_FREQ *
(mtime_t)i_samples / (mtime_t)p_enc->fmt_in.audio.i_rate;
p_block->i_dts = p_block->i_pts = i_pts;
......
......@@ -1160,7 +1160,7 @@ static void print_playlist( intf_thread_t *p_intf, playlist_item_t *p_item, int
{
if( p_item->pp_children[i]->p_input->i_duration != -1 )
{
secstotimestr( psz_buffer, p_item->pp_children[i]->p_input->i_duration / 1000000 );
secstotimestr( psz_buffer, p_item->pp_children[i]->p_input->i_duration / CLOCK_FREQ );
msg_rc( "|%*s- %s (%s)", 2 * i_level, "", p_item->pp_children[i]->p_input->psz_name, psz_buffer );
}
else
......
......@@ -251,7 +251,7 @@ static int Demux( demux_t *p_demux )
p_block->i_dts =
p_block->i_pts = VLC_TS_0 + p_sys->i_time;
p_sys->i_time += (int64_t)1000000 *
p_sys->i_time += CLOCK_FREQ *
p_block->i_buffer /
p_sys->i_ssnd_fsize /
p_sys->fmt.audio.i_rate;
......@@ -307,7 +307,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
return VLC_EGENERIC;
}
p_sys->i_time = (int64_t)1000000 * i_frame / p_sys->fmt.audio.i_rate;
p_sys->i_time = CLOCK_FREQ * i_frame / p_sys->fmt.audio.i_rate;
return VLC_SUCCESS;
}
return VLC_EGENERIC;
......@@ -325,7 +325,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
pi64 = va_arg( args, int64_t * );
if( p_sys->i_ssnd_start < i_end )
{
*pi64 = (int64_t)1000000 * ( i_end - p_sys->i_ssnd_start ) / p_sys->i_ssnd_fsize / p_sys->fmt.audio.i_rate;
*pi64 = CLOCK_FREQ * ( i_end - p_sys->i_ssnd_start ) / p_sys->i_ssnd_fsize / p_sys->fmt.audio.i_rate;
return VLC_SUCCESS;
}
return VLC_EGENERIC;
......
......@@ -356,7 +356,7 @@ static int SeekIndex( demux_t *p_demux, mtime_t i_date, float f_pos )
asf_object_index_t *p_index;
msg_Dbg( p_demux, "seek with index: %i seconds, position %f",
i_date >= 0 ? (int)(i_date/1000000) : -1, f_pos );
i_date >= 0 ? (int)(i_date/CLOCK_FREQ) : -1, f_pos );
if( i_date < 0 )
i_date = p_sys->i_length * f_pos;
......
......@@ -288,7 +288,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_frame_size += p_sys->fmt.audio.i_blockalign - mod;
}
}
p_sys->i_frame_length = (mtime_t)1000000 *
p_sys->i_frame_length = CLOCK_FREQ *
(mtime_t)i_samples /
(mtime_t)p_sys->fmt.audio.i_rate;
......
......@@ -684,7 +684,7 @@ int avformat_OpenDemux( vlc_object_t *p_this )
EnsureUTF8( s->psz_name );
msg_Dbg( p_demux, " - chapter %d: %s", i, s->psz_name );
}
s->i_time_offset = p_sys->ic->chapters[i]->start * 1000000 *
s->i_time_offset = p_sys->ic->chapters[i]->start * CLOCK_FREQ *
p_sys->ic->chapters[i]->time_base.num /
p_sys->ic->chapters[i]->time_base.den -
(i_start_time != -1 ? i_start_time : 0 );
......@@ -1023,7 +1023,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_LENGTH:
pi64 = va_arg( args, int64_t * );
if( p_sys->ic->duration != (int64_t)AV_NOPTS_VALUE )
*pi64 = p_sys->ic->duration * 1000000 / AV_TIME_BASE;
*pi64 = p_sys->ic->duration * CLOCK_FREQ / AV_TIME_BASE;
else
*pi64 = 0;
return VLC_SUCCESS;
......@@ -1036,7 +1036,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_SET_TIME:
{
i64 = va_arg( args, int64_t );
i64 = i64 *AV_TIME_BASE / 1000000 + i_start_time;
i64 = i64 * AV_TIME_BASE / CLOCK_FREQ + i_start_time;
msg_Warn( p_demux, "DEMUX_SET_TIME: %"PRId64, i64 );
......@@ -1150,7 +1150,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return VLC_EGENERIC;
i64 = p_sys->p_title->seekpoint[i_seekpoint]->i_time_offset *
AV_TIME_BASE / 1000000 + i_start_time;
AV_TIME_BASE / CLOCK_FREQ + i_start_time;
msg_Warn( p_demux, "DEMUX_SET_SEEKPOINT: %"PRId64, i64 );
......
......@@ -1040,7 +1040,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_SET_TIME:
i64 = va_arg( args, int64_t );
i_sample = i64 * p_sys->fmt.audio.i_rate / INT64_C( 1000000 );
i_sample = i64 * p_sys->fmt.audio.i_rate / CLOCK_FREQ;
if( SetSpanWithSample( p_demux, &position, i_sample ))
return VLC_EGENERIC;
p_sys->position = position;
......
......@@ -120,7 +120,7 @@ static int Demux( demux_t *p_demux )
mtime_t i_date;
mtime_t i_delta;
i_delta = INT64_C(1000000) / CDG_FRAME_RATE;
i_delta = CLOCK_FREQ / CDG_FRAME_RATE;
p_block = vlc_stream_Block( p_demux->s, CDG_FRAME_SIZE );
if( p_block == NULL )
......@@ -159,7 +159,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( !i_ret && ( i_query == DEMUX_SET_POSITION || i_query == DEMUX_SET_TIME ) )
{
date_Set( &p_sys->pts, vlc_stream_Tell( p_demux->s ) / CDG_FRAME_SIZE *
INT64_C(1000000) / CDG_FRAME_RATE );
CLOCK_FREQ / CDG_FRAME_RATE );
if ( i_old_offset > vlc_stream_Tell( p_demux->s ) )
i_ret = vlc_stream_Seek( p_demux->s, 0 );
else
......
......@@ -1077,7 +1077,7 @@ void matroska_segment_c::EnsureDuration()
}
}
i_duration = ( i_last_timecode - cluster->GlobalTimecode() ) / INT64_C(1000000);
i_duration = ( i_last_timecode - cluster->GlobalTimecode() ) / CLOCK_FREQ;
msg_Dbg( &sys.demuxer, " extracted Duration=%" PRId64, i_duration );
}
......
......@@ -331,7 +331,7 @@ static int Demux( demux_t *p_demux )
{
if( p_block_out->i_pts == VLC_TS_INVALID &&
p_block_out->i_dts == VLC_TS_INVALID )
p_block_out->i_dts = VLC_TS_0 + p_sys->i_pts + 1000000 / p_sys->f_fps;
p_block_out->i_dts = VLC_TS_0 + p_sys->i_pts + CLOCK_FREQ / p_sys->f_fps;
if( p_block_out->i_dts != VLC_TS_INVALID )
p_sys->i_pts = p_block_out->i_dts - VLC_TS_0;
}
......@@ -351,7 +351,7 @@ static int Demux( demux_t *p_demux )
}
/* Re-estimate bitrate */
if( p_sys->b_estimate_bitrate && p_sys->i_pts > INT64_C(500000) )
p_sys->i_bitrate_avg = 8*INT64_C(1000000)*p_sys->i_bytes/(p_sys->i_pts-1);
p_sys->i_bitrate_avg = 8*1000000*p_sys->i_bytes/(p_sys->i_pts-1);
p_sys->i_bytes += p_block_out->i_buffer;
......
......@@ -394,7 +394,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
pi64 = va_arg( args, int64_t * );
if( p_sys->i_mux_rate > 0 )
{
*pi64 = (int64_t)1000000 * ( stream_Size( p_demux->s ) / 50 ) / p_sys->i_mux_rate;
*pi64 = CLOCK_FREQ * ( stream_Size( p_demux->s ) / 50 ) / p_sys->i_mux_rate;
return VLC_SUCCESS;
}
*pi64 = 0;
......
......@@ -843,7 +843,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( p_sys->i_length > 0 && p_sys->i_pcr != VLC_TS_INVALID )
{
*pf = (double) p_sys->i_pcr /
(double) ( p_sys->i_length * (mtime_t)1000000 );
(double) ( p_sys->i_length * CLOCK_FREQ );
}
else if( stream_Size( p_demux->s ) > 0 )
{
......
......@@ -111,7 +111,7 @@ static bool ParseTime(xml_reader_t *p_xml_reader, mtime_t* pi_result )
i_subresult = i_subresult * 10;
i_subfractions++;
}
i_result = i_result * 1000000;
i_result = i_result * CLOCK_FREQ;
if( i_subfractions != -1)
i_result += i_subresult;
......@@ -296,13 +296,13 @@ static void ProcessEntry( int *pi_n_entry, xml_reader_t *p_xml_reader,
i_options = 0;
if( i_start )
{
if( asprintf( ppsz_options, ":start-time=%d" ,(int) i_start/1000000 ) != -1)
if( asprintf( ppsz_options, ":start-time=%d" ,(int) i_start/CLOCK_FREQ ) != -1)
i_options++;
}
if( i_duration)
{
if( asprintf( ppsz_options + i_options, ":stop-time=%d",
(int) (i_start+i_duration)/1000000 ) != -1)
(int) (i_start+i_duration)/CLOCK_FREQ ) != -1)
i_options++;
}
......
......@@ -255,7 +255,7 @@ static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems )
FREENULL( psz_artist );
parseEXTINF( psz_parse, &psz_artist, &psz_name, &i_parsed_duration );
if( i_parsed_duration >= 0 )
i_duration = i_parsed_duration * INT64_C(1000000);
i_duration = i_parsed_duration * CLOCK_FREQ;
if( psz_name )
psz_name = pf_dup( psz_name );
if( psz_artist )
......@@ -341,7 +341,7 @@ static int ReadDir( stream_t *p_demux, input_item_node_t *p_subitems )
FREENULL( psz_artist );
FREENULL( psz_album_art );
i_parsed_duration = 0;
i_duration = -1;
i_duration = VLC_TS_INVALID;
b_cleanup = false;
}
......
......@@ -381,9 +381,9 @@ static mtime_t strTimeToMTime( const char *psz )
switch( sscanf( psz, "%u:%u:%u", &h, &m, &s ) )
{
case 3:
return (mtime_t)( ( h*60 + m )*60 + s ) * 1000000;
return (mtime_t)( ( h*60 + m )*60 + s ) * CLOCK_FREQ;
case 2:
return (mtime_t)( h*60 + m ) * 1000000;
return (mtime_t)( h*60 + m ) * CLOCK_FREQ;
default:
return -1;
}
......
......@@ -333,7 +333,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
pi64 = va_arg( args, int64_t * );
if( p_sys->i_mux_rate > 0 )
{
*pi64 = (int64_t)1000000 * ( stream_Size( p_demux->s ) / 50 ) / p_sys->i_mux_rate;
*pi64 = CLOCK_FREQ * ( stream_Size( p_demux->s ) / 50 ) / p_sys->i_mux_rate;
return VLC_SUCCESS;
}
*pi64 = 0;
......
......@@ -288,7 +288,7 @@ static int Demux( demux_t *p_demux )
if( !p_sys->b_hurry_up )
{
p_sys->i_pcr += ( INT64_C(1000000) / p_sys->f_rate );
p_sys->i_pcr += CLOCK_FREQ / p_sys->f_rate;
}
return VLC_DEMUXER_SUCCESS;
......
......@@ -82,10 +82,10 @@ static size_t ParseInteger(uint8_t *data, size_t size)
}
static int64_t ParseTimeCode(uint8_t *data, double fps)
{
return INT64_C(1000000) * (data[0] * 3600 +
data[1] * 60 +
data[2] * 1 +
data[3] / fps);
return CLOCK_FREQ * (data[0] * 3600 +
data[1] * 60 +
data[2] * 1 +
data[3] / fps);
}
static int64_t ParseTextTimeCode(uint8_t *data, double fps)
{
......
......@@ -1836,10 +1836,10 @@ static int ParseJSS( vlc_object_t *p_obj, subs_properties_t *p_props,
{
p_subtitle->i_start = ( ( (int64_t) h1 *3600 + m1 * 60 + s1 ) +
(int64_t)( ( f1 + p_props->jss.i_time_shift ) / p_props->jss.i_time_resolution ) )
* 1000000;
* CLOCK_FREQ;
p_subtitle->i_stop = ( ( (int64_t) h2 *3600 + m2 * 60 + s2 ) +
(int64_t)( ( f2 + p_props->jss.i_time_shift ) / p_props->jss.i_time_resolution ) )
* 1000000;
* CLOCK_FREQ;
break;
}
/* Short time lines */
......@@ -2224,9 +2224,9 @@ static int ParseDKS( vlc_object_t *p_obj, subs_properties_t *p_props,
if( sscanf( s, "[%d:%d:%d]%[^\r\n]",
&h1, &m1, &s1, psz_text ) == 4 )
{
p_subtitle->i_start = ( (int64_t)h1 * 3600*1000 +
(int64_t)m1 * 60*1000 +
(int64_t)s1 * 1000 ) * 1000;
p_subtitle->i_start = ( (int64_t)h1 * 3600 +
(int64_t)m1 * 60 +
(int64_t)s1 ) * CLOCK_FREQ;
s = TextGetLine( txt );
if( !s )
......@@ -2277,9 +2277,9 @@ static int ParseSubViewer1( vlc_object_t *p_obj, subs_properties_t *p_props,
if( sscanf( s, "[%d:%d:%d]", &h1, &m1, &s1 ) == 3 )
{
p_subtitle->i_start = ( (int64_t)h1 * 3600*1000 +
(int64_t)m1 * 60*1000 +
(int64_t)s1 * 1000 ) * 1000;
p_subtitle->i_start = ( (int64_t)h1 * 3600 +
(int64_t)m1 * 60 +
(int64_t)s1 ) * CLOCK_FREQ;
s = TextGetLine( txt );
if( !s )
......@@ -2297,9 +2297,9 @@ static int ParseSubViewer1( vlc_object_t *p_obj, subs_properties_t *p_props,
}
if( sscanf( s, "[%d:%d:%d]", &h2, &m2, &s2 ) == 3 )
p_subtitle->i_stop = ( (int64_t)h2 * 3600*1000 +
(int64_t)m2 * 60*1000 +
(int64_t)s2 * 1000 ) * 1000;
p_subtitle->i_stop = ( (int64_t)h2 * 3600 +
(int64_t)m2 * 60 +
(int64_t)s2 ) * CLOCK_FREQ;
else
p_subtitle->i_stop = -1;
......
......@@ -208,7 +208,7 @@ static int Demux( demux_t *p_demux )
p_sys->pi_seektable[p_sys->i_currentframe] );
if( p_data == NULL )
return VLC_DEMUXER_EOF;
p_data->i_dts = p_data->i_pts = VLC_TS_0 + (int64_t)(INT64_C(1000000) * p_sys->i_currentframe) * TTA_FRAMETIME;
p_data->i_dts = p_data->i_pts = VLC_TS_0 + CLOCK_FREQ * p_sys->i_currentframe * TTA_FRAMETIME;
p_sys->i_currentframe++;
......@@ -266,12 +266,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_LENGTH:
pi64 = va_arg( args, int64_t * );
*pi64 = INT64_C(1000000) * p_sys->i_totalframes * TTA_FRAMETIME;
*pi64 = CLOCK_FREQ * p_sys->i_totalframes * TTA_FRAMETIME;
return VLC_SUCCESS;
case DEMUX_GET_TIME:
pi64 = va_arg( args, int64_t * );
*pi64 = INT64_C(1000000) * p_sys->i_currentframe * TTA_FRAMETIME;
*pi64 = CLOCK_FREQ * p_sys->i_currentframe * TTA_FRAMETIME;
return VLC_SUCCESS;
case DEMUX_CAN_PAUSE:
......
......@@ -267,7 +267,7 @@ static NSString *kAssociatedFullscreenRect = @"VLCFullscreenAssociatedWindowRect
mtime_t remaining = 0;
if (dur > t)
remaining = dur - t;
totalTime = [NSString stringWithFormat:@"-%s", secstotimestr(psz_time, (remaining / 1000000))];
totalTime = [NSString stringWithFormat:@"-%s", secstotimestr(psz_time, (remaining / CLOCK_FREQ))];
} else {
totalTime = toNSStr(secstotimestr(psz_time, (dur / 1000000)));
}
......
......@@ -595,7 +595,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
if (result == RESUME_RESTART)
return;
mtime_t lastPos = (mtime_t)lastPosition.intValue * 1000000;
mtime_t lastPos = (mtime_t)lastPosition.intValue * CLOCK_FREQ;
msg_Dbg(getIntf(), "continuing playback at %lld", lastPos);
var_SetInteger(p_input_thread, "time", lastPos);
};
......@@ -634,7 +634,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
float relativePos = var_GetFloat(p_input_thread, "position");
mtime_t pos = var_GetInteger(p_input_thread, "time") / CLOCK_FREQ;
mtime_t dur = input_item_GetDuration(p_item) / 1000000;
mtime_t dur = input_item_GetDuration(p_item) / CLOCK_FREQ;
NSMutableArray *mediaList = [[defaults objectForKey:@"recentlyPlayedMediaList"] mutableCopy];
......
......@@ -848,7 +848,7 @@
input_thread_t *p_input = pl_CurrentInput(getIntf());
if (p_input) {
input_Control(p_input, INPUT_SET_TIME, (int64_t)(returnTime *1000000));
input_Control(p_input, INPUT_SET_TIME, (int64_t)(returnTime * CLOCK_FREQ));
vlc_object_release(p_input);
}
}];
......
......@@ -873,7 +873,7 @@ static const float f_min_window_height = 307.;
if (mt_duration < 1)
return @"";
mt_duration = mt_duration / 1000000;
mt_duration = mt_duration / CLOCK_FREQ;
NSDateComponentsFormatter *formatter = [[NSDateComponentsFormatter alloc] init];
formatter.unitsStyle = NSDateComponentsFormatterUnitsStyleAbbreviated;
......
......@@ -235,7 +235,7 @@
input_Control(p_input, INPUT_GET_TIME, &i_currentTime);
vlc_object_release(p_input);
return (int)(i_currentTime / 1000000);
return (int)(i_currentTime / CLOCK_FREQ);
}
- (void) setCurrentTime:(int)i_currentTime {
......@@ -246,7 +246,7 @@
if (!p_input)
return;
input_Control(p_input, INPUT_SET_TIME, (int64_t)(i64_value * 1000000));
input_Control(p_input, INPUT_SET_TIME, (int64_t)(i64_value * CLOCK_FREQ));
vlc_object_release(p_input);
}
}
......
......@@ -57,7 +57,7 @@ bool Chromaprint::enqueue( input_item_t *p_item )
fingerprint_request_t *p_r = fingerprint_request_New( p_item );
if ( ! p_r ) return false;
mtime_t t = input_item_GetDuration( p_item );
if ( t ) p_r->i_duration = (unsigned int) ( t / 1000000 );
if ( t ) p_r->i_duration = (unsigned int) ( t / CLOCK_FREQ );
if( p_fingerprinter->pf_enqueue( p_fingerprinter, p_r ) != 0 )
{
fingerprint_request_Delete( p_r );
......
......@@ -206,7 +206,7 @@ void PLSelector::updateTotalDuration( PLSelItem* item, const char* prefix )
/* Formatting time */
QString qs_timeLabel( prefix );
int i_seconds = mt_duration / 1000000;
int i_seconds = mt_duration / CLOCK_FREQ;
int i_minutes = i_seconds / 60;
i_seconds = i_seconds % 60;
if( i_minutes >= 60 )
......
......@@ -86,7 +86,7 @@ static inline char * psz_column_meta( input_item_t *p_item, uint32_t i_column )
case COLUMN_TITLE:
return input_item_GetTitleFbName( p_item );
case COLUMN_DURATION:
i_duration = input_item_GetDuration( p_item ) / 1000000;
i_duration