[vlc-commits] demux: ts: add special value for undefined tdt deltas

Francois Cartegnie git at videolan.org
Sun Feb 28 21:26:57 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Feb 27 19:41:17 2016 +0100| [95bcedebaa2d50e27ee995975068eaab7493982a] | committer: Francois Cartegnie

demux: ts: add special value for undefined tdt deltas

delta could be 0

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

 modules/demux/mpeg/ts.c         |    9 ++++++---
 modules/demux/mpeg/ts.h         |    3 +++
 modules/demux/mpeg/ts_psi_eit.c |    2 +-
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index 6295093..e14e85d 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -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 )
diff --git a/modules/demux/mpeg/ts.h b/modules/demux/mpeg/ts.h
index 1360a06..b58ad2b 100644
--- a/modules/demux/mpeg/ts.h
+++ b/modules/demux/mpeg/ts.h
@@ -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
diff --git a/modules/demux/mpeg/ts_psi_eit.c b/modules/demux/mpeg/ts_psi_eit.c
index 0ebe9b2..a45eea7 100644
--- a/modules/demux/mpeg/ts_psi_eit.c
+++ b/modules/demux/mpeg/ts_psi_eit.c
@@ -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;



More information about the vlc-commits mailing list