mirror of
https://code.videolan.org/videolan/vlc
synced 2024-09-04 09:11:33 +02:00
Used VLC_TS_INVALID/0 in PS demuxer.
This commit is contained in:
parent
0053da9b52
commit
b4493aebb1
@ -397,8 +397,8 @@ static int Demux( demux_t *p_demux )
|
||||
p_sys->i_scr = -1;
|
||||
}
|
||||
|
||||
if( p_sys->i_scr > 0 )
|
||||
es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_sys->i_scr );
|
||||
if( p_sys->i_scr >= 0 )
|
||||
es_out_Control( p_demux->out, ES_OUT_SET_PCR, VLC_TS_0 + p_sys->i_scr );
|
||||
|
||||
p_sys->i_scr = -1;
|
||||
|
||||
@ -411,7 +411,7 @@ static int Demux( demux_t *p_demux )
|
||||
{
|
||||
if( !b_new && !p_sys->b_have_pack &&
|
||||
(tk->fmt.i_cat == AUDIO_ES) &&
|
||||
(p_pkt->i_pts > 0) )
|
||||
(p_pkt->i_pts > VLC_TS_INVALID) )
|
||||
{
|
||||
/* A hack to sync the A/V on PES files. */
|
||||
msg_Dbg( p_demux, "force SCR: %"PRId64, p_pkt->i_pts );
|
||||
|
@ -399,6 +399,8 @@ static inline int ps_pkt_parse_pes( block_t *p_pes, int i_skip_extra )
|
||||
{
|
||||
uint8_t header[34];
|
||||
unsigned int i_skip = 0;
|
||||
int64_t i_pts = -1;
|
||||
int64_t i_dts = -1;
|
||||
|
||||
memcpy( header, p_pes->p_buffer, __MIN( p_pes->i_buffer, 34 ) );
|
||||
|
||||
@ -423,19 +425,19 @@ static inline int ps_pkt_parse_pes( block_t *p_pes, int i_skip_extra )
|
||||
|
||||
if( header[7]&0x80 ) /* has pts */
|
||||
{
|
||||
p_pes->i_pts = ((mtime_t)(header[ 9]&0x0e ) << 29)|
|
||||
(mtime_t)(header[10] << 22)|
|
||||
((mtime_t)(header[11]&0xfe) << 14)|
|
||||
(mtime_t)(header[12] << 7)|
|
||||
(mtime_t)(header[13] >> 1);
|
||||
i_pts = ((mtime_t)(header[ 9]&0x0e ) << 29)|
|
||||
(mtime_t)(header[10] << 22)|
|
||||
((mtime_t)(header[11]&0xfe) << 14)|
|
||||
(mtime_t)(header[12] << 7)|
|
||||
(mtime_t)(header[13] >> 1);
|
||||
|
||||
if( header[7]&0x40 ) /* has dts */
|
||||
{
|
||||
p_pes->i_dts = ((mtime_t)(header[14]&0x0e ) << 29)|
|
||||
(mtime_t)(header[15] << 22)|
|
||||
((mtime_t)(header[16]&0xfe) << 14)|
|
||||
(mtime_t)(header[17] << 7)|
|
||||
(mtime_t)(header[18] >> 1);
|
||||
i_dts = ((mtime_t)(header[14]&0x0e ) << 29)|
|
||||
(mtime_t)(header[15] << 22)|
|
||||
((mtime_t)(header[16]&0xfe) << 14)|
|
||||
(mtime_t)(header[17] << 7)|
|
||||
(mtime_t)(header[18] >> 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -499,8 +501,10 @@ static inline int ps_pkt_parse_pes( block_t *p_pes, int i_skip_extra )
|
||||
p_pes->p_buffer += i_skip;
|
||||
p_pes->i_buffer -= i_skip;
|
||||
|
||||
p_pes->i_dts = 100 * p_pes->i_dts / 9;
|
||||
p_pes->i_pts = 100 * p_pes->i_pts / 9;
|
||||
if( i_dts >= 0 )
|
||||
p_pes->i_dts = VLC_TS_0 + 100 * i_dts / 9;
|
||||
if( i_pts >= 0 )
|
||||
p_pes->i_pts = VLC_TS_0 + 100 * i_pts / 9;
|
||||
|
||||
return VLC_SUCCESS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user