Commit 178c1a4d authored by Steve Lhomme's avatar Steve Lhomme

modules: fix VLC_TS_INVALID tests

parent 28180787
......@@ -1887,7 +1887,7 @@ static int Demux( demux_t *p_demux )
i_pts = VLC_TS_INVALID;
}
if( i_pts > VLC_TS_INVALID ) {
if( i_pts != VLC_TS_INVALID ) {
i_pts += 5;
i_pts /= 10; /* 100-ns to µs conversion */
i_pts += VLC_TS_0;
......@@ -1901,7 +1901,7 @@ static int Demux( demux_t *p_demux )
memcpy( p_block->p_buffer, p_data, i_data_size );
p_block->i_pts = p_block->i_dts = i_pts;
if( i_pts > VLC_TS_INVALID )
if( i_pts != VLC_TS_INVALID )
es_out_SetPCR( p_demux->out, i_pts );
es_out_Send( p_demux->out, p_stream->p_es, p_block );
......
......@@ -1423,7 +1423,7 @@ static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )
tk->i_next_block_flags = 0;
if( i_next_block_flags & BLOCK_FLAG_CELL_DISCONTINUITY )
{
if( p_pkt->i_dts >= VLC_TS_INVALID )
if( p_pkt->i_dts != VLC_TS_INVALID )
{
i_next_block_flags &= ~BLOCK_FLAG_CELL_DISCONTINUITY;
i_next_block_flags |= BLOCK_FLAG_DISCONTINUITY;
......
......@@ -1435,7 +1435,7 @@ static int Demux( demux_t *p_demux )
i_minpcr = tk->i_pcr;
}
if( p_sys->i_pcr > VLC_TS_INVALID && b_need_flush )
if( p_sys->i_pcr != VLC_TS_INVALID && b_need_flush )
{
es_out_Control( p_demux->out, ES_OUT_RESET_PCR );
p_sys->i_pcr = i_minpcr;
......
......@@ -336,7 +336,7 @@ static int DecodeBlock (decoder_t *p_dec, block_t *p_block)
}
}
if (p_block->i_pts > VLC_TS_INVALID && !date_Get(&p_sys->end_date)) {
if (p_block->i_pts != VLC_TS_INVALID && !date_Get(&p_sys->end_date)) {
date_Set(&p_sys->end_date, p_block->i_pts);
} else if (p_block->i_pts < date_Get(&p_sys->end_date)) {
msg_Warn(p_dec, "MIDI message in the past?");
......
......@@ -336,7 +336,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
}
/* We've just started the stream, wait for the first PTS. */
if( !date_Get( &p_sys->end_date ) && p_block->i_pts <= VLC_TS_INVALID )
if( !date_Get( &p_sys->end_date ) && p_block->i_pts == VLC_TS_INVALID )
goto drop;
if( p_block->i_buffer <= 0 )
......
......@@ -1191,7 +1191,7 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
/* Set the pts of the frame being encoded
* avcodec likes pts to be in time_base units
* frame number */
if( likely( p_pict->date > VLC_TS_INVALID ) )
if( likely( p_pict->date != VLC_TS_INVALID ) )
frame->pts = p_pict->date * p_sys->p_context->time_base.den /
CLOCK_FREQ / p_sys->p_context->time_base.num;
else
......@@ -1328,7 +1328,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
//Calculate how many bytes we would need from current buffer to fill frame
size_t leftover_samples = __MAX(0,__MIN((ssize_t)i_samples_left, (ssize_t)(p_sys->i_frame_size - p_sys->i_samples_delay)));
if( p_aout_buf && ( p_aout_buf->i_pts > VLC_TS_INVALID ) )
if( p_aout_buf && ( p_aout_buf->i_pts != VLC_TS_INVALID ) )
{
date_Set( &p_sys->buffer_date, p_aout_buf->i_pts );
/* take back amount we have leftover from previous buffer*/
......
......@@ -765,7 +765,7 @@ static void update_late_frame_count( decoder_t *p_dec, block_t *p_block,
if( !p_block || !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
i_display_date = decoder_GetDisplayDate( p_dec, i_pts );
if( i_display_date > VLC_TS_INVALID && i_display_date <= current_time )
if( i_display_date != VLC_TS_INVALID && i_display_date <= current_time )
{
/* Out of preroll, consider only late frames on rising delay */
if( p_sys->b_from_preroll )
......@@ -1037,8 +1037,8 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
{
pkt.data = p_block->p_buffer;
pkt.size = p_block->i_buffer;
pkt.pts = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : AV_NOPTS_VALUE;
pkt.dts = p_block->i_dts > VLC_TS_INVALID ? p_block->i_dts : AV_NOPTS_VALUE;
pkt.pts = p_block->i_pts != VLC_TS_INVALID ? p_block->i_pts : AV_NOPTS_VALUE;
pkt.dts = p_block->i_dts != VLC_TS_INVALID ? p_block->i_dts : AV_NOPTS_VALUE;
}
else
{
......@@ -1152,7 +1152,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
i_pts = date_Get( &p_sys->pts );
/* Interpolate the next PTS */
if( i_pts > VLC_TS_INVALID )
if( i_pts != VLC_TS_INVALID )
date_Set( &p_sys->pts, i_pts );
interpolate_next_pts( p_dec, frame );
......@@ -1272,7 +1272,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
av_frame_free(&frame);
/* Send decoded frame to vout */
if (i_pts > VLC_TS_INVALID)
if (i_pts != VLC_TS_INVALID)
{
p_sys->b_first_frame = false;
decoder_QueueVideo( p_dec, p_pic );
......
......@@ -149,7 +149,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
}
p_pic->date = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
p_pic->date = p_block->i_pts != VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
decoder_QueueVideo( p_dec, p_pic );
error:
......
......@@ -488,7 +488,7 @@ static subpicture_t *Subtitle( decoder_t *p_dec, eia608_t *h, mtime_t i_pts )
subpicture_t *p_spu = NULL;
/* We cannot display a subpicture with no date */
if( i_pts <= VLC_TS_INVALID )
if( i_pts == VLC_TS_INVALID )
return NULL;
/* Create the subpicture unit */
......
......@@ -177,7 +177,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
goto exit;
Render( p_sys, p_pic );
p_pic->date = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
p_pic->date = p_block->i_pts != VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
}
exit:
......
......@@ -453,7 +453,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
BC_STATUS status = BC_FUNC_PSYS(DtsProcInput)( p_sys->bcm_handle,
p_block->p_buffer,
p_block->i_buffer,
p_block->i_pts >= VLC_TS_INVALID ? TO_BC_PTS(p_block->i_pts) : 0, false );
p_block->i_pts != VLC_TS_INVALID ? TO_BC_PTS(p_block->i_pts) : 0, false );
block_Release( p_block );
......
......@@ -238,7 +238,7 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
* to detect the first packet in a subtitle. The first packet
* seems to have a valid PTS while later packets for the same
* image don't. */
if( p_sys->i_state == SUBTITLE_BLOCK_EMPTY && p_block->i_pts <= VLC_TS_INVALID )
if( p_sys->i_state == SUBTITLE_BLOCK_EMPTY && p_block->i_pts == VLC_TS_INVALID )
{
msg_Warn( p_dec, "first packet expected but no PTS present");
return NULL;
......
......@@ -431,7 +431,7 @@ static void *ProcessPacket( decoder_t *p_dec, daala_packet *p_dpacket,
}
/* Date management */
if( p_block->i_pts > VLC_TS_INVALID && p_block->i_pts != p_sys->i_pts )
if( p_block->i_pts != VLC_TS_INVALID && p_block->i_pts != p_sys->i_pts )
{
p_sys->i_pts = p_block->i_pts;
}
......
......@@ -837,11 +837,11 @@ static int DecBlock( decoder_t *p_dec, block_t **pp_block )
p_block = *pp_block;
/* Won't work with streams with B-frames, but do we have any ? */
if( p_block && p_block->i_pts <= VLC_TS_INVALID )
if( p_block && p_block->i_pts == VLC_TS_INVALID )
p_block->i_pts = p_block->i_dts;
/* Date management */
if( p_block && p_block->i_pts > VLC_TS_INVALID &&
if( p_block && p_block->i_pts != VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
{
date_Set( &p_sys->end_date, p_block->i_pts );
......
......@@ -426,7 +426,7 @@ static int Decode( decoder_t *p_dec, block_t *p_block )
default_dds_init( p_dec );
p_sys->i_pts = p_block->i_pts;
if( p_sys->i_pts <= VLC_TS_INVALID )
if( p_sys->i_pts == VLC_TS_INVALID )
{
#ifdef DEBUG_DVBSUB
/* Some DVB channels send stuffing segments in non-dated packets so
......
......@@ -317,7 +317,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
date_Init( &p_sys->date, i_rate, 1 );
}
if( i_pts > VLC_TS_INVALID && i_pts != date_Get( &p_sys->date ) )
if( i_pts != VLC_TS_INVALID && i_pts != date_Get( &p_sys->date ) )
{
date_Set( &p_sys->date, i_pts );
}
......
......@@ -247,7 +247,7 @@ DecoderWriteCallback( const FLAC__StreamDecoder *decoder,
if( decoder_UpdateAudioFormat( p_dec ) )
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
if( date_Get( &p_sys->end_date ) <= VLC_TS_INVALID )
if( date_Get( &p_sys->end_date ) == VLC_TS_INVALID )
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
p_sys->p_aout_buffer =
......@@ -662,7 +662,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_sys->p_block = p_block;
if( p_sys->p_block->i_pts > VLC_TS_INVALID &&
if( p_sys->p_block->i_pts != VLC_TS_INVALID &&
p_sys->p_block->i_pts != date_Get( &p_sys->end_date ) )
date_Set( &p_sys->end_date, p_sys->p_block->i_pts );
......
......@@ -682,17 +682,17 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
return VLCDEC_ECRITICAL;
}
if( p_block->i_dts > VLC_TS_INVALID )
if( p_block->i_dts != VLC_TS_INVALID )
GST_BUFFER_DTS( p_buf ) = gst_util_uint64_scale( p_block->i_dts,
GST_SECOND, GST_MSECOND );
if( p_block->i_pts <= VLC_TS_INVALID )
if( p_block->i_pts == VLC_TS_INVALID )
GST_BUFFER_PTS( p_buf ) = GST_BUFFER_DTS( p_buf );
else
GST_BUFFER_PTS( p_buf ) = gst_util_uint64_scale( p_block->i_pts,
GST_SECOND, GST_MSECOND );
if( p_block->i_length > VLC_TS_INVALID )
if( p_block->i_length != VLC_TS_INVALID )
GST_BUFFER_DURATION( p_buf ) = gst_util_uint64_scale(
p_block->i_length, GST_SECOND, GST_MSECOND );
......
......@@ -569,7 +569,7 @@ static int DecodeBlock(decoder_t *p_dec, block_t *p_block)
jpeg_destroy_decompress(&p_sys->p_jpeg);
free(p_row_pointers);
p_pic->date = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
p_pic->date = p_block->i_pts != VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
block_Release(p_block);
decoder_QueueVideo( p_dec, p_pic );
......
......@@ -626,7 +626,7 @@ static void *ProcessPacket( decoder_t *p_dec, kate_packet *p_kp,
decoder_sys_t *p_sys = p_dec->p_sys;
/* Date management */
if( p_block->i_pts > VLC_TS_INVALID && p_block->i_pts != p_sys->i_pts )
if( p_block->i_pts != VLC_TS_INVALID && p_block->i_pts != p_sys->i_pts )
{
p_sys->i_pts = p_block->i_pts;
}
......
......@@ -349,7 +349,7 @@ static block_t *Packetize( decoder_t *p_dec, block_t **pp_block )
}
/* Date management */
if( p_block->i_pts > VLC_TS_INVALID &&
if( p_block->i_pts != VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
{
date_Set( &p_sys->end_date, p_block->i_pts );
......
......@@ -215,7 +215,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
/* Feed input block */
if( p_block != NULL )
{
i_pts = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
i_pts = p_block->i_pts != VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
if( p_block->i_flags & (BLOCK_FLAG_DISCONTINUITY|BLOCK_FLAG_CORRUPTED) )
{
......@@ -227,7 +227,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
}
if( !date_Get( &p_sys->end_date ) && i_pts <= VLC_TS_INVALID )
if( !date_Get( &p_sys->end_date ) && i_pts == VLC_TS_INVALID )
{
/* We've just started the stream, wait for the first PTS. */
msg_Dbg( p_dec, "waiting for PTS" );
......
......@@ -310,7 +310,7 @@ static void* ProcessPacket(decoder_t* p_dec, block_t* p_block)
}
/* Date management */
if (p_block->i_pts > VLC_TS_INVALID && p_block->i_pts != p_sys->i_pts) {
if (p_block->i_pts != VLC_TS_INVALID && p_block->i_pts != p_sys->i_pts) {
p_sys->i_pts = p_block->i_pts;
}
......
......@@ -1678,7 +1678,7 @@ static int Audio_OnNewBlock(decoder_t *p_dec, block_t **pp_block)
/* We've just started the stream, wait for the first PTS. */
if (!date_Get(&p_sys->audio.i_end_date))
{
if (p_block->i_pts <= VLC_TS_INVALID)
if (p_block->i_pts == VLC_TS_INVALID)
return 0;
date_Set(&p_sys->audio.i_end_date, p_block->i_pts);
}
......
......@@ -408,7 +408,7 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
}
/* Date management */
if( p_block->i_pts > VLC_TS_INVALID &&
if( p_block->i_pts != VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
{
date_Set( &p_sys->end_date, p_block->i_pts );
......
......@@ -304,7 +304,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
png_destroy_read_struct( &p_png, &p_info, &p_end_info );
free( p_row_pointers );
p_pic->date = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
p_pic->date = p_block->i_pts != VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
block_Release( p_block );
decoder_QueueVideo( p_dec, p_pic );
......
......@@ -159,7 +159,7 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
}
if( p_block->i_pts <= VLC_TS_INVALID && p_block->i_dts <= VLC_TS_INVALID &&
if( p_block->i_pts == VLC_TS_INVALID && p_block->i_dts == VLC_TS_INVALID &&
!date_Get( &p_sys->pts ) )
{
/* We've just started the stream, wait for the first PTS. */
......@@ -168,11 +168,11 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
/* Date management: If there is a pts avaliable, use that. */
if( p_block->i_pts > VLC_TS_INVALID )
if( p_block->i_pts != VLC_TS_INVALID )
{
date_Set( &p_sys->pts, p_block->i_pts );
}
else if( p_block->i_dts > VLC_TS_INVALID )
else if( p_block->i_dts != VLC_TS_INVALID )
{
/* NB, davidf doesn't quite agree with this in general, it is ok
* for rawvideo since it is in order (ie pts=dts), however, it
......
......@@ -782,7 +782,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_schrobuffer = schro_buffer_new_with_data( p_block->p_buffer, p_block->i_buffer );
p_schrobuffer->free = SchroBufferFree;
p_schrobuffer->priv = p_block;
if( p_block->i_pts > VLC_TS_INVALID ) {
if( p_block->i_pts != VLC_TS_INVALID ) {
mtime_t *p_pts = malloc( sizeof(*p_pts) );
if( p_pts ) {
*p_pts = p_block->i_pts;
......@@ -844,7 +844,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
p_pic->date = *(mtime_t*) p_tag->value;
schro_tag_free( p_tag );
}
else if( p_sys->i_lastpts > VLC_TS_INVALID )
else if( p_sys->i_lastpts != VLC_TS_INVALID )
{
/* NB, this shouldn't happen since the packetizer does a
* very thorough job of inventing timestamps. The
......
......@@ -447,7 +447,7 @@ static int Decode(decoder_t *dec, block_t *b)
if (index == 0) {
sys->segment_id = id;
sys->segment_size = 0;
sys->segment_date = b->i_pts > VLC_TS_INVALID ? b->i_pts : b->i_dts;
sys->segment_date = b->i_pts != VLC_TS_INVALID ? b->i_pts : b->i_dts;
} else {
if (sys->segment_id != id || sys->segment_size <= 0) {
sys->segment_id = -1;
......@@ -474,7 +474,7 @@ static int Decode(decoder_t *dec, block_t *b)
sub = DecodeSubtitleMessage(dec,
&b->p_buffer[4],
section_length - 1 - 4,
b->i_pts > VLC_TS_INVALID ? b->i_pts : b->i_dts);
b->i_pts != VLC_TS_INVALID ? b->i_pts : b->i_dts);
}
if (sub != NULL)
decoder_QueueSub(dec, sub);
......
......@@ -256,7 +256,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
}
}
p_pic->date = (p_block->i_pts > VLC_TS_INVALID) ?
p_pic->date = (p_block->i_pts != VLC_TS_INVALID) ?
p_block->i_pts : p_block->i_dts;
decoder_QueueVideo( p_dec, p_pic );
......
......@@ -578,7 +578,7 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
block_t *p_block = *pp_block;
/* Date management */
if( p_block && p_block->i_pts > VLC_TS_INVALID &&
if( p_block && p_block->i_pts != VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
{
date_Set( &p_sys->end_date, p_block->i_pts );
......@@ -681,7 +681,7 @@ static int DecodeRtpSpeexPacket( decoder_t *p_dec, block_t *p_speex_bit_block )
int i_decode_ret;
unsigned int i_speex_frame_size;
if ( !p_speex_bit_block || p_speex_bit_block->i_pts <= VLC_TS_INVALID )
if ( !p_speex_bit_block || p_speex_bit_block->i_pts == VLC_TS_INVALID )
return VLCDEC_SUCCESS;
/*
......
......@@ -222,7 +222,7 @@ static block_t *Reassemble( decoder_t *p_dec, block_t *p_block )
}
if( p_sys->i_spu_size <= 0 &&
( p_block->i_pts <= VLC_TS_INVALID || p_block->i_buffer < 4 ) )
( p_block->i_pts == VLC_TS_INVALID || p_block->i_buffer < 4 ) )
{
msg_Dbg( p_dec, "invalid starting packet (size < 4 or pts <=0)" );
msg_Dbg( p_dec, "spu size: %d, i_pts: %"PRId64" i_buffer: %zu",
......
......@@ -366,7 +366,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
return NULL;
/* We cannot display a subpicture with no date */
if( p_block->i_pts <= VLC_TS_INVALID )
if( p_block->i_pts == VLC_TS_INVALID )
{
msg_Warn( p_dec, "subtitle without a date" );
return NULL;
......
......@@ -221,7 +221,7 @@ static subpicture_t *ParseText( decoder_t *p_dec, block_t *p_block )
return NULL;
/* We cannot display a subpicture with no date */
if( p_block->i_pts <= VLC_TS_INVALID )
if( p_block->i_pts == VLC_TS_INVALID )
{
msg_Warn( p_dec, "subtitle without a date" );
return NULL;
......
......@@ -244,7 +244,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
goto done;
}
p_pic->date = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
p_pic->date = p_block->i_pts != VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
done:
if( rsvg )
......
......@@ -259,7 +259,7 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
{
b_decode = (pts - now) > (TAU_PRIME(I_CODING_TYPE) + DELTA);
}
if( pts <= VLC_TS_INVALID )
if( pts == VLC_TS_INVALID )
b_decode = 1;
if( !b_decode && !p_synchro->b_quiet )
......@@ -310,7 +310,7 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
{
b_decode = 0;
}
if( p_synchro->i_nb_ref >= 1 && pts <= VLC_TS_INVALID )
if( p_synchro->i_nb_ref >= 1 && pts == VLC_TS_INVALID )
b_decode = 1;
break;
......@@ -329,7 +329,7 @@ bool decoder_SynchroChoose( decoder_synchro_t * p_synchro, int i_coding_type,
{
b_decode = 0;
}
if( p_synchro->i_nb_ref >= 2 && pts <= VLC_TS_INVALID )
if( p_synchro->i_nb_ref >= 2 && pts == VLC_TS_INVALID )
b_decode = 1;
break;
}
......
......@@ -471,7 +471,7 @@ static void *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
}
/* Date management */
if( p_block->i_pts > VLC_TS_INVALID && p_block->i_pts != p_sys->i_pts )
if( p_block->i_pts != VLC_TS_INVALID && p_block->i_pts != p_sys->i_pts )
{
p_sys->i_pts = p_block->i_pts;
}
......
......@@ -1068,7 +1068,7 @@ static int ParseBlock( decoder_t *p_dec, const block_t *p_block )
return VLCDEC_SUCCESS;
/* We cannot display a subpicture with no date */
if( p_block->i_pts <= VLC_TS_INVALID )
if( p_block->i_pts == VLC_TS_INVALID )
{
msg_Warn( p_dec, "subtitle without a date" );
return VLCDEC_SUCCESS;
......
......@@ -78,7 +78,7 @@ static block_t *DecodeBlock(decoder_t *dec, block_t **block_ptr)
}
}
if (block->i_pts > VLC_TS_INVALID &&
if (block->i_pts != VLC_TS_INVALID &&
block->i_pts != date_Get(&sys->end_date))
date_Set(&sys->end_date, block->i_pts);
block->i_pts = VLC_TS_INVALID;
......
......@@ -482,7 +482,7 @@ static block_t *ProcessPacket( decoder_t *p_dec, ogg_packet *p_oggpacket,
}
/* Date management */
if( p_block->i_pts > VLC_TS_INVALID &&
if( p_block->i_pts != VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
{
date_Set( &p_sys->end_date, p_block->i_pts );
......
......@@ -222,7 +222,7 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
}
/* Date management */
if( p_block->i_pts > VLC_TS_INVALID &&
if( p_block->i_pts != VLC_TS_INVALID &&
p_block->i_pts != date_Get( &p_sys->end_date ) )
{
date_Set( &p_sys->end_date, p_block->i_pts );
......
......@@ -64,7 +64,7 @@ static int Decode (decoder_t *dec, block_t *block)
if (block == NULL) /* No Drain */
return VLCDEC_SUCCESS;
if (block->i_pts <= VLC_TS_INVALID)
if (block->i_pts == VLC_TS_INVALID)
goto drop; /* undated block, should never happen */
if (block->i_buffer < sz_XWDheader)
goto drop;
......
......@@ -314,7 +314,7 @@ mtime_t PlaylistManager::getPCR() const
const mtime_t pcr = (*it)->getPCR();
if(minpcr == VLC_TS_INVALID)
minpcr = pcr;
else if(pcr > VLC_TS_INVALID)
else if(pcr != VLC_TS_INVALID)
minpcr = std::min(minpcr, pcr);
}
return minpcr;
......@@ -329,7 +329,7 @@ mtime_t PlaylistManager::getFirstDTS() const
const mtime_t dts = (*it)->getFirstDTS();
if(mindts == VLC_TS_INVALID)
mindts = dts;
else if(dts > VLC_TS_INVALID)
else if(dts != VLC_TS_INVALID)
mindts = std::min(mindts, dts);
}
return mindts;
......
......@@ -476,7 +476,7 @@ mtime_t CommandsQueue::getFirstDTS() const
for( it = commands.begin(); it != commands.end(); ++it )
{
const mtime_t i_dts = (*it)->getTime();
if( i_dts > VLC_TS_INVALID )
if( i_dts != VLC_TS_INVALID )
{
if( i_dts < i_firstdts || i_firstdts == VLC_TS_INVALID )
i_firstdts = i_dts;
......
......@@ -324,10 +324,10 @@ int FakeESOut::esOutSend_Callback(es_out_t *fakees, es_out_id_t *p_es, block_t *
me->checkTimestampsStart( p_block->i_dts );
mtime_t offset = me->getTimestampOffset();
if( p_block->i_dts > VLC_TS_INVALID )
if( p_block->i_dts != VLC_TS_INVALID )
{
p_block->i_dts += offset;
if( p_block->i_pts > VLC_TS_INVALID )
if( p_block->i_pts != VLC_TS_INVALID )
p_block->i_pts += offset;
}
AbstractCommand *command = me->commandsqueue->factory()->createEsOutSendCommand( es_id, p_block );
......
......@@ -852,7 +852,7 @@ static int Demux( demux_t *p_demux )
msg_Dbg( p_demux, "tk[%d] dts=%"PRId64" pts=%"PRId64,
pkt.stream_index, p_frame->i_dts, p_frame->i_pts );
#endif
if( p_frame->i_dts > VLC_TS_INVALID && p_track->p_es != NULL )
if( p_frame->i_dts != VLC_TS_INVALID && p_track->p_es != NULL )
p_track->i_pcr = p_frame->i_dts;
int64_t i_ts_max = INT64_MIN;
......@@ -866,7 +866,7 @@ static int Demux( demux_t *p_demux )
for( unsigned i = 0; i < p_sys->i_tracks; i++ )
{
if( p_sys->tracks[i].p_es != NULL &&
p_sys->tracks[i].i_pcr > VLC_TS_INVALID &&
p_sys->tracks[i].i_pcr != VLC_TS_INVALID &&
p_sys->tracks[i].i_pcr + 10 * CLOCK_FREQ >= i_ts_max )
i_ts_min = __MIN( i_ts_min, p_sys->tracks[i].i_pcr );
}
......@@ -921,7 +921,7 @@ static void ResetTime( demux_t *p_demux, int64_t i_time )
for( unsigned i = 0; i < p_sys->i_tracks; i++ )
p_sys->tracks[i].i_pcr = VLC_TS_INVALID;
if( i_time > VLC_TS_INVALID )
if( i_time != VLC_TS_INVALID )
{
es_out_Control( p_demux->out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_time );
UpdateSeekPoint( p_demux, i_time );
......
......@@ -258,7 +258,7 @@ void M3U8Parser::parseSegments(vlc_object_t *, Representation *rep, const std::l
segment->startTime.Set(rep->getTimescale().ToScaled(nzStartTime));
nzStartTime += nzDuration;
totalduration += nzDuration;
if(absReferenceTime > VLC_TS_INVALID)
if(absReferenceTime != VLC_TS_INVALID)
{
segment->utcTime = absReferenceTime;
absReferenceTime += nzDuration;
......
......@@ -192,7 +192,7 @@ static int Demux(demux_t *demux)
mtime_t deadline;
const mtime_t pts_first = sys->pts_origin + date_Get(&sys->pts);
if (sys->pts_next > VLC_TS_INVALID) {
if (sys->pts_next != VLC_TS_INVALID) {
deadline = sys->pts_next;
} else if (sys->is_realtime) {
deadline = mdate();
......@@ -265,7 +265,7 @@ static int Control(demux_t *demux, int query, va_list args)
}
case DEMUX_SET_NEXT_DEMUX_TIME: {
int64_t pts_next = VLC_TS_0 + va_arg(args, int64_t);
if (sys->pts_next <= VLC_TS_INVALID)
if (sys->pts_next == VLC_TS_INVALID)
sys->pts_origin = pts_next;
sys->pts_next = pts_next;
return VLC_SUCCESS;
......
......@@ -794,7 +794,7 @@ bool matroska_segment_c::Seek( demux_t &demuxer, mtime_t i_absolute_mk_date, mti
mkv_track_t &track = *it->second;
track.i_skip_until_fpos = std::numeric_limits<uint64_t>::max();
if( track.i_last_dts > VLC_TS_INVALID )
if( track.i_last_dts != VLC_TS_INVALID )
track.b_discontinuity = true;
track.i_last_dts = VLC_TS_INVALID;
......
......@@ -787,13 +787,13 @@ static int Demux( demux_t *p_demux)
if( track.fmt.i_cat != VIDEO_ES && track.fmt.i_cat != AUDIO_ES )
continue;
if( track.i_last_dts < i_pcr || i_pcr <= VLC_TS_INVALID )
if( track.i_last_dts < i_pcr || i_pcr == VLC_TS_INVALID )
{
i_pcr = track.i_last_dts;
}
}
if( i_pcr > VLC_TS_INVALID && i_pcr > p_sys->i_pcr )
if( i_pcr != VLC_TS_INVALID && i_pcr > p_sys->i_pcr )
{
if( es_out_SetPCR( p_demux->out, i_pcr ) )
{
......
......@@ -249,7 +249,7 @@ void send_Block( demux_t * p_demux, mkv_track_t * p_tk, block_t * p_block, unsig
p_tk->pi_chan_table, p_tk->fmt.i_codec );
}
if( p_block->i_dts > VLC_TS_INVALID &&
if( p_block->i_dts != VLC_TS_INVALID &&
( p_tk->fmt.i_cat == VIDEO_ES || p_tk->fmt.i_cat == AUDIO_ES ) )
{
p_tk->i_last_dts = p_block->i_dts;
......
......@@ -1455,7 +1455,7 @@ static int DemuxMoov( demux_t *p_demux )
}
p_sys->i_nztime += DEMUX_INCREMENT;
if( p_sys->i_pcr > VLC_TS_INVALID )
if( p_sys->i_pcr != VLC_TS_INVALID )
{
p_sys->i_pcr = VLC_TS_0 + p_sys->i_nztime;
es_out_SetPCR( p_demux->out, p_sys->i_pcr );
...