[vlc-commits] demux:mpeg: extract packet SCR as a readily usable vlc_tick_t

Steve Lhomme git at videolan.org
Tue Sep 18 09:43:42 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 18 09:04:05 2018 +0200| [9e7108c17303e85a481fc9da35183a8571333db3] | committer: Steve Lhomme

demux:mpeg: extract packet SCR as a readily usable vlc_tick_t

With the VLC_TICK_0 shift to avoid issues when comparing with VLC_TICK_INVALID.
It was used unshifted in dvdread.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9e7108c17303e85a481fc9da35183a8571333db3
---

 modules/access/dvdnav.c | 2 +-
 modules/demux/mpeg/ps.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/access/dvdnav.c b/modules/access/dvdnav.c
index bfe9ab8899..8992b781ea 100644
--- a/modules/access/dvdnav.c
+++ b/modules/access/dvdnav.c
@@ -1392,7 +1392,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
             int i_mux_rate;
             if( !ps_pkt_parse_pack( p_pkt, &i_scr, &i_mux_rate ) )
             {
-                es_out_SetPCR( p_demux->out, i_scr + 1 );
+                es_out_SetPCR( p_demux->out, i_scr );
                 if( i_mux_rate > 0 ) p_sys->i_mux_rate = i_mux_rate;
             }
             block_Release( p_pkt );
diff --git a/modules/demux/mpeg/ps.h b/modules/demux/mpeg/ps.h
index 5e0a9babeb..84d4cb6920 100644
--- a/modules/demux/mpeg/ps.h
+++ b/modules/demux/mpeg/ps.h
@@ -436,14 +436,14 @@ static inline int ps_pkt_parse_pack( block_t *p_pkt, int64_t *pi_scr,
     uint8_t *p = p_pkt->p_buffer;
     if( p_pkt->i_buffer >= 14 && (p[4] >> 6) == 0x01 )
     {
-        *pi_scr = FROM_SCALE_NZ( ExtractPackHeaderTimestamp( &p[4] ) );
+        *pi_scr = FROM_SCALE( ExtractPackHeaderTimestamp( &p[4] ) );
         *pi_mux_rate = ( p[10] << 14 )|( p[11] << 6 )|( p[12] >> 2);
     }
     else if( p_pkt->i_buffer >= 12 && (p[4] >> 4) == 0x02 ) /* MPEG-1 Pack SCR, same bits as PES/PTS */
     {
         if(!ExtractPESTimestamp( &p[4], 0x02, pi_scr ))
             return VLC_EGENERIC;
-        *pi_scr = FROM_SCALE_NZ( *pi_scr );
+        *pi_scr = FROM_SCALE( *pi_scr );
         *pi_mux_rate = ( ( p[9]&0x7f )<< 15 )|( p[10] << 7 )|( p[11] >> 1);
     }
     else



More information about the vlc-commits mailing list