[vlc-devel] [PATCH 1/2] replace INT64_C(1000000) by CLOCK_FREQ
Steve Lhomme
robux4 at videolabs.io
Thu Apr 13 16:48:22 CEST 2017
---
modules/access/linsys/linsys_hdsdi.c | 2 +-
modules/access/linsys/linsys_sdi.c | 2 +-
modules/access/oss.c | 2 +-
modules/codec/omxil/mediacodec.c | 2 +-
modules/codec/stl.c | 2 +-
modules/demux/caf.c | 2 +-
modules/demux/cdg.c | 4 ++--
modules/demux/mkv/matroska_segment.cpp | 2 +-
modules/demux/mpeg/es.c | 2 +-
modules/demux/playlist/m3u.c | 2 +-
modules/demux/rawdv.c | 2 +-
modules/demux/stl.c | 2 +-
modules/demux/tta.c | 6 +++---
modules/packetizer/vc1.c | 2 +-
modules/services_discovery/upnp.cpp | 2 +-
modules/spu/mosaic.c | 2 +-
16 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/modules/access/linsys/linsys_hdsdi.c b/modules/access/linsys/linsys_hdsdi.c
index f97fa89b4d..2033d6c50e 100644
--- a/modules/access/linsys/linsys_hdsdi.c
+++ b/modules/access/linsys/linsys_hdsdi.c
@@ -638,7 +638,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 );
}
diff --git a/modules/access/linsys/linsys_sdi.c b/modules/access/linsys/linsys_sdi.c
index 18bd07baf5..84ca291cfd 100644
--- a/modules/access/linsys/linsys_sdi.c
+++ b/modules/access/linsys/linsys_sdi.c
@@ -943,7 +943,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 &&
diff --git a/modules/access/oss.c b/modules/access/oss.c
index 0a7581b66c..783710d0d5 100644
--- a/modules/access/oss.c
+++ b/modules/access/oss.c
@@ -322,7 +322,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;
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index c67278a2cf..835a6419c6 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -1368,7 +1368,7 @@ static int QueueBlockLocked(decoder_t *p_dec, block_t *p_in_block,
/* Wait for the OutThread to stop (and process all remaining output
* frames. Use a timeout here since we can't know if all decoders will
* behave correctly. */
- mtime_t deadline = mdate() + INT64_C(1000000);
+ mtime_t deadline = mdate() + CLOCK_FREQ;
while (!p_sys->b_aborted && !p_sys->b_drained
&& vlc_cond_timedwait(&p_sys->dec_cond, &p_sys->lock, deadline) == 0);
diff --git a/modules/codec/stl.c b/modules/codec/stl.c
index 95da13745d..8a10ac1e34 100644
--- a/modules/codec/stl.c
+++ b/modules/codec/stl.c
@@ -247,7 +247,7 @@ 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 +
+ return CLOCK_FREQ * (data[0] * 3600 +
data[1] * 60 +
data[2] * 1 +
data[3] / fps);
diff --git a/modules/demux/caf.c b/modules/demux/caf.c
index 5bdfb73275..54447ec340 100644
--- a/modules/demux/caf.c
+++ b/modules/demux/caf.c
@@ -1037,7 +1037,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_SET_TIME:
i64 = (int64_t)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;
diff --git a/modules/demux/cdg.c b/modules/demux/cdg.c
index d5679d6d93..97885e0aab 100644
--- a/modules/demux/cdg.c
+++ b/modules/demux/cdg.c
@@ -122,7 +122,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 )
@@ -174,7 +174,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
date_Set( &p_demux->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
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index 415f77f489..ab27adf56e 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1070,7 +1070,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 );
}
diff --git a/modules/demux/mpeg/es.c b/modules/demux/mpeg/es.c
index 3b5b35faa0..2b329b7c14 100644
--- a/modules/demux/mpeg/es.c
+++ b/modules/demux/mpeg/es.c
@@ -353,7 +353,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*CLOCK_FREQ*p_sys->i_bytes/(p_sys->i_pts-1);
p_sys->i_bytes += p_block_out->i_buffer;
diff --git a/modules/demux/playlist/m3u.c b/modules/demux/playlist/m3u.c
index d719350406..b10f354e38 100644
--- a/modules/demux/playlist/m3u.c
+++ b/modules/demux/playlist/m3u.c
@@ -205,7 +205,7 @@ static int Demux( demux_t *p_demux )
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 )
diff --git a/modules/demux/rawdv.c b/modules/demux/rawdv.c
index 76d4c63d41..10cb6f51e3 100644
--- a/modules/demux/rawdv.c
+++ b/modules/demux/rawdv.c
@@ -291,7 +291,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 1;
diff --git a/modules/demux/stl.c b/modules/demux/stl.c
index b2c6a1b126..95091b4d66 100644
--- a/modules/demux/stl.c
+++ b/modules/demux/stl.c
@@ -81,7 +81,7 @@ 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 +
+ return CLOCK_FREQ * (data[0] * 3600 +
data[1] * 60 +
data[2] * 1 +
data[3] / fps);
diff --git a/modules/demux/tta.c b/modules/demux/tta.c
index 0662215b1f..48413e79e1 100644
--- a/modules/demux/tta.c
+++ b/modules/demux/tta.c
@@ -207,7 +207,7 @@ static int Demux( demux_t *p_demux )
p_data = vlc_stream_Block( p_demux->s,
p_sys->pi_seektable[p_sys->i_currentframe] );
if( p_data == NULL ) return 0;
- 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 + (int64_t)(CLOCK_FREQ * p_sys->i_currentframe) * TTA_FRAMETIME;
p_sys->i_currentframe++;
@@ -264,12 +264,12 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
case DEMUX_GET_LENGTH:
pi64 = (int64_t*)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 = (int64_t*)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;
default:
diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index de817c644e..6c09088e9f 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -383,7 +383,7 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
if( p_dec->fmt_out.video.i_frame_rate != 0 && p_dec->fmt_out.video.i_frame_rate_base != 0 )
{
if( p_sys->i_interpolated_dts > VLC_TS_INVALID )
- p_sys->i_interpolated_dts += INT64_C(1000000) *
+ p_sys->i_interpolated_dts += CLOCK_FREQ *
p_dec->fmt_out.video.i_frame_rate_base /
p_dec->fmt_out.video.i_frame_rate;
diff --git a/modules/services_discovery/upnp.cpp b/modules/services_discovery/upnp.cpp
index 9c95cb8a94..6597917d15 100644
--- a/modules/services_discovery/upnp.cpp
+++ b/modules/services_discovery/upnp.cpp
@@ -894,7 +894,7 @@ namespace
{
int i_hours, i_minutes, i_seconds;
if( sscanf( psz_duration, "%d:%02d:%02d", &i_hours, &i_minutes, &i_seconds ) )
- i_duration = INT64_C(1000000) * ( i_hours * 3600 + i_minutes * 60 +
+ i_duration = CLOCK_FREQ * ( i_hours * 3600 + i_minutes * 60 +
i_seconds );
}
return input_item_NewExt( psz_resource_url, title, i_duration,
diff --git a/modules/spu/mosaic.c b/modules/spu/mosaic.c
index 30e2b35850..d2ea880c6b 100644
--- a/modules/spu/mosaic.c
+++ b/modules/spu/mosaic.c
@@ -40,7 +40,7 @@
#include "mosaic.h"
-#define BLANK_DELAY INT64_C(1000000)
+#define BLANK_DELAY (1*CLOCK_FREQ)
/*****************************************************************************
* Local prototypes
--
2.12.1
More information about the vlc-devel
mailing list