[vlc-commits] demux: ogg: use date_t for backward computation
Francois Cartegnie
git at videolan.org
Thu May 31 18:47:51 CEST 2018
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed May 23 19:07:33 2018 +0200| [6fc6295ea029e1ba6e8f8558dae0174fcc995598] | committer: Francois Cartegnie
demux: ogg: use date_t for backward computation
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6fc6295ea029e1ba6e8f8558dae0174fcc995598
---
modules/demux/ogg.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/modules/demux/ogg.c b/modules/demux/ogg.c
index 08412cb00f..ea862a4010 100644
--- a/modules/demux/ogg.c
+++ b/modules/demux/ogg.c
@@ -575,6 +575,9 @@ static int Demux( demux_t * p_demux )
// PASS 2
bool b_fixed = false;
+ date_t d;
+ date_Init( &d, p_stream->f_rate, 1 );
+ date_Set( &d, p_sys->i_nzpcr_offset + pagestamp - VLC_TS_0 );
for( int i=p_stream->prepcr.i_used - 1; i>=0; i-- )
{
block_t *p_block = p_stream->prepcr.pp_blocks[i];
@@ -585,8 +588,8 @@ static int Demux( demux_t * p_demux )
case VLC_CODEC_VORBIS:
if( pagestamp != VLC_TS_INVALID )
{
- pagestamp -= CLOCK_FREQ * p_block->i_nb_samples / p_stream->f_rate;
- p_block->i_pts = p_sys->i_nzpcr_offset + pagestamp;
+ date_Decrement( &d, p_block->i_nb_samples );
+ p_block->i_pts = date_Get( &d ) + VLC_TS_0;
}
else
{
@@ -601,8 +604,8 @@ static int Demux( demux_t * p_demux )
{
if( pagestamp != VLC_TS_INVALID )
{
- pagestamp = pagestamp - ( CLOCK_FREQ / p_stream->f_rate );
- p_block->i_pts = p_sys->i_nzpcr_offset + pagestamp;
+ date_Decrement( &d, 1 );
+ p_block->i_pts = date_Get( &d ) + VLC_TS_0;
}
b_fixed = true;
}
More information about the vlc-commits
mailing list