Commit 95bcedeb authored by François Cartegnie's avatar François Cartegnie 🤞

demux: ts: add special value for undefined tdt deltas

delta could be 0
parent 30f6b14c
......@@ -387,7 +387,7 @@ static int Open( vlc_object_t *p_this )
p_sys->b_end_preparse = false;
ARRAY_INIT( p_sys->programs );
p_sys->b_default_selection = false;
p_sys->i_tdt_delta = 0;
p_sys->i_tdt_delta = TS_TIME_DELTA_INVALID;
p_sys->vdr = vdr;
......@@ -744,9 +744,12 @@ static int Demux( demux_t *p_demux )
/*****************************************************************************
* Control:
*****************************************************************************/
static int EITCurrentEventTime( const ts_pmt_t *p_pmt, time_t i_tdt_offset,
static int EITCurrentEventTime( const ts_pmt_t *p_pmt, time_t i_tdt_delta,
time_t *pi_time, time_t *pi_length )
{
if( i_tdt_delta == TS_TIME_DELTA_INVALID )
return VLC_EGENERIC;
if( pi_length )
*pi_length = 0;
if( pi_time )
......@@ -754,7 +757,7 @@ static int EITCurrentEventTime( const ts_pmt_t *p_pmt, time_t i_tdt_offset,
if( p_pmt && p_pmt->eit.i_event_length > 0 )
{
const time_t t = time(NULL) + i_tdt_offset;
const time_t t = time(NULL) + i_tdt_delta;
if( p_pmt->eit.i_event_start <= t && t < p_pmt->eit.i_event_start + p_pmt->eit.i_event_length )
{
if( pi_length )
......
......@@ -20,6 +20,9 @@
#ifndef VLC_TS_H
#define VLC_TS_H
#include <limits.h>
#define TS_TIME_DELTA_INVALID INT64_MAX
#ifdef HAVE_ARIBB24
typedef struct arib_instance_t arib_instance_t;
#endif
......
......@@ -342,7 +342,7 @@ static void EITCallBack( demux_t *p_demux,
time_t i_now = time(NULL);
time_t i_tot_time = 0;
if( p_sys->i_tdt_delta == 0 )
if( p_sys->i_tdt_delta == TS_TIME_DELTA_INVALID )
p_sys->i_tdt_delta = (i_start + i_duration - 5) - i_now;
i_tot_time = i_now + p_sys->i_tdt_delta;
......
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