Commit edbfa973 authored by Tristan Matthews's avatar Tristan Matthews Committed by Tristan Matthews

ogg: use CLOCK_FREQ

parent bbe24b45
...@@ -683,7 +683,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) ...@@ -683,7 +683,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
} }
assert( p_sys->i_length > 0 ); assert( p_sys->i_length > 0 );
i64 = INT64_C(1000000) * p_sys->i_length * f; i64 = CLOCK_FREQ * p_sys->i_length * f;
Ogg_ResetStreamHelper( p_sys ); Ogg_ResetStreamHelper( p_sys );
if ( Oggseek_SeektoAbsolutetime( p_demux, p_stream, i64 ) >= 0 ) if ( Oggseek_SeektoAbsolutetime( p_demux, p_stream, i64 ) >= 0 )
{ {
...@@ -838,7 +838,7 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream, ...@@ -838,7 +838,7 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream,
sample -= p_stream->i_pre_skip; sample -= p_stream->i_pre_skip;
else else
sample = 0; sample = 0;
p_stream->i_pcr = sample * INT64_C(1000000) / p_stream->f_rate; p_stream->i_pcr = sample * CLOCK_FREQ / p_stream->f_rate;
} }
p_stream->i_pcr += VLC_TS_0; p_stream->i_pcr += VLC_TS_0;
...@@ -853,7 +853,7 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream, ...@@ -853,7 +853,7 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream,
* If we can't then don't touch the old value. */ * If we can't then don't touch the old value. */
if( p_stream->fmt.i_cat == VIDEO_ES ) if( p_stream->fmt.i_cat == VIDEO_ES )
/* 1 frame per packet */ /* 1 frame per packet */
p_stream->i_interpolated_pcr += (INT64_C(1000000) / p_stream->f_rate); p_stream->i_interpolated_pcr += (CLOCK_FREQ / p_stream->f_rate);
else if( p_stream->fmt.i_codec == VLC_CODEC_OPUS && else if( p_stream->fmt.i_codec == VLC_CODEC_OPUS &&
p_stream->i_previous_granulepos >= 0 && p_stream->i_previous_granulepos >= 0 &&
( duration = ( duration =
...@@ -868,12 +868,12 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream, ...@@ -868,12 +868,12 @@ static void Ogg_UpdatePCR( logical_stream_t *p_stream,
else else
sample = 0; sample = 0;
p_stream->i_interpolated_pcr = p_stream->i_interpolated_pcr =
VLC_TS_0 + sample * INT64_C(1000000) / p_stream->f_rate; VLC_TS_0 + sample * CLOCK_FREQ / p_stream->f_rate;
} }
else if( p_stream->fmt.i_bitrate ) else if( p_stream->fmt.i_bitrate )
{ {
p_stream->i_interpolated_pcr += p_stream->i_interpolated_pcr +=
( p_oggpacket->bytes * INT64_C(1000000) / ( p_oggpacket->bytes * CLOCK_FREQ /
p_stream->fmt.i_bitrate / 8 ); p_stream->fmt.i_bitrate / 8 );
} }
} }
...@@ -1141,7 +1141,7 @@ static void Ogg_DecodePacket( demux_t *p_demux, ...@@ -1141,7 +1141,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
{ {
i_pts = VLC_TS_0 + (p_stream->i_previous_granulepos i_pts = VLC_TS_0 + (p_stream->i_previous_granulepos
- p_block->i_nb_samples - p_stream->i_pre_skip) * - p_block->i_nb_samples - p_stream->i_pre_skip) *
INT64_C(1000000) / p_stream->f_rate; CLOCK_FREQ / p_stream->f_rate;
} }
p_stream->i_skip_frames = 0; p_stream->i_skip_frames = 0;
} }
...@@ -1196,7 +1196,7 @@ static void Ogg_DecodePacket( demux_t *p_demux, ...@@ -1196,7 +1196,7 @@ static void Ogg_DecodePacket( demux_t *p_demux,
/* granulepos for dirac is possibly broken, this value should be ignored */ /* granulepos for dirac is possibly broken, this value should be ignored */
if( -1 != p_oggpacket->granulepos ) if( -1 != p_oggpacket->granulepos )
p_block->i_pts = u_pnum * INT64_C(1000000) / p_stream->f_rate / 2; p_block->i_pts = u_pnum * CLOCK_FREQ / p_stream->f_rate / 2;
} }
else else
{ {
......
...@@ -775,7 +775,7 @@ int64_t Oggseek_GranuleToAbsTimestamp( logical_stream_t *p_stream, ...@@ -775,7 +775,7 @@ int64_t Oggseek_GranuleToAbsTimestamp( logical_stream_t *p_stream,
if ( p_stream->b_oggds ) if ( p_stream->b_oggds )
{ {
i_timestamp = i_granule * INT64_C(1000000) / p_stream->f_rate; i_timestamp = i_granule * CLOCK_FREQ / p_stream->f_rate;
} }
else if( p_stream->fmt.i_codec == VLC_CODEC_THEORA || else if( p_stream->fmt.i_codec == VLC_CODEC_THEORA ||
p_stream->fmt.i_codec == VLC_CODEC_KATE ) p_stream->fmt.i_codec == VLC_CODEC_KATE )
...@@ -784,21 +784,21 @@ int64_t Oggseek_GranuleToAbsTimestamp( logical_stream_t *p_stream, ...@@ -784,21 +784,21 @@ int64_t Oggseek_GranuleToAbsTimestamp( logical_stream_t *p_stream,
ogg_int64_t pframe = i_granule - ( iframe << p_stream->i_granule_shift ); ogg_int64_t pframe = i_granule - ( iframe << p_stream->i_granule_shift );
/* See Theora A.2.3 */ /* See Theora A.2.3 */
if ( b_presentation ) pframe -= p_stream->i_keyframe_offset; if ( b_presentation ) pframe -= p_stream->i_keyframe_offset;
i_timestamp = ( iframe + pframe ) * INT64_C(1000000) / p_stream->f_rate; i_timestamp = ( iframe + pframe ) * CLOCK_FREQ / p_stream->f_rate;
} }
else if( p_stream->fmt.i_codec == VLC_CODEC_DIRAC ) else if( p_stream->fmt.i_codec == VLC_CODEC_DIRAC )
{ {
ogg_int64_t i_dts = i_granule >> 31; ogg_int64_t i_dts = i_granule >> 31;
/* NB, OggDirac granulepos values are in units of 2*picturerate */ /* NB, OggDirac granulepos values are in units of 2*picturerate */
i_timestamp = (i_dts/2) * INT64_C(1000000) / p_stream->f_rate; i_timestamp = (i_dts/2) * CLOCK_FREQ / p_stream->f_rate;
} }
else if( p_stream->fmt.i_codec == VLC_CODEC_OPUS ) else if( p_stream->fmt.i_codec == VLC_CODEC_OPUS )
{ {
i_timestamp = p_stream->i_pre_skip + i_granule * INT64_C(1000000) / 48000; i_timestamp = p_stream->i_pre_skip + i_granule * CLOCK_FREQ / 48000;
} }
else if( p_stream->fmt.i_codec == VLC_CODEC_VORBIS ) else if( p_stream->fmt.i_codec == VLC_CODEC_VORBIS )
{ {
i_timestamp = i_granule * INT64_C(1000000) / p_stream->f_rate; i_timestamp = i_granule * CLOCK_FREQ / p_stream->f_rate;
} }
return i_timestamp; return i_timestamp;
...@@ -821,7 +821,7 @@ bool Oggseek_PacketPCRFixup( logical_stream_t *p_stream, ogg_page *p_page, ...@@ -821,7 +821,7 @@ bool Oggseek_PacketPCRFixup( logical_stream_t *p_stream, ogg_page *p_page,
p_stream->i_pcr = Oggseek_GranuleToAbsTimestamp( p_stream, p_stream->i_pcr = Oggseek_GranuleToAbsTimestamp( p_stream,
ogg_page_granulepos( p_page ), false ); ogg_page_granulepos( p_page ), false );
/* Computes the presentation time of the first packet on page */ /* Computes the presentation time of the first packet on page */
p_stream->i_pcr -= INT64_C(1000000) * p_stream->i_pcr -= CLOCK_FREQ *
ogg_page_packets( p_page ) / p_stream->f_rate; ogg_page_packets( p_page ) / p_stream->f_rate;
return true; return true;
} }
......
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