[vlc-commits] demux: ts: move eit event start/length to programs
Francois Cartegnie
git at videolan.org
Sat Feb 27 13:46:49 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Feb 27 11:37:54 2016 +0100| [6a1d414edf2170dafef7a028cd58a7abba99f866] | committer: Francois Cartegnie
demux: ts: move eit event start/length to programs
current event is relative to programs, not to first eit callback
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6a1d414edf2170dafef7a028cd58a7abba99f866
---
modules/demux/mpeg/ts.c | 25 +++++++++++--------------
modules/demux/mpeg/ts.h | 2 --
modules/demux/mpeg/ts_psi_eit.c | 17 +++++++++++------
modules/demux/mpeg/ts_streams.c | 3 +++
modules/demux/mpeg/ts_streams_private.h | 6 ++++++
5 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/modules/demux/mpeg/ts.c b/modules/demux/mpeg/ts.c
index d4f288d..58d6373 100644
--- a/modules/demux/mpeg/ts.c
+++ b/modules/demux/mpeg/ts.c
@@ -388,8 +388,6 @@ static int Open( vlc_object_t *p_this )
ARRAY_INIT( p_sys->programs );
p_sys->b_default_selection = false;
p_sys->i_tdt_delta = 0;
- p_sys->i_dvb_start = 0;
- p_sys->i_dvb_length = 0;
p_sys->vdr = vdr;
@@ -746,24 +744,23 @@ static int Demux( demux_t *p_demux )
/*****************************************************************************
* Control:
*****************************************************************************/
-static int DVBEventInformation( demux_t *p_demux, int64_t *pi_time, int64_t *pi_length )
+static int EITCurrentEventTime( const ts_pmt_t *p_pmt, mtime_t i_tdt_offset,
+ time_t *pi_time, time_t *pi_length )
{
- demux_sys_t *p_sys = p_demux->p_sys;
if( pi_length )
*pi_length = 0;
if( pi_time )
*pi_time = 0;
- if( p_sys->i_dvb_length > 0 )
+ if( p_pmt && p_pmt->eit.i_event_length > 0 )
{
- const int64_t t = mdate() + p_sys->i_tdt_delta;
-
- if( p_sys->i_dvb_start <= t && t < p_sys->i_dvb_start + p_sys->i_dvb_length )
+ const time_t t = time(NULL) + i_tdt_offset / CLOCK_FREQ;
+ if( p_pmt->eit.i_event_start <= t && t < p_pmt->eit.i_event_start + p_pmt->eit.i_event_length )
{
if( pi_length )
- *pi_length = p_sys->i_dvb_length;
+ *pi_length = p_pmt->eit.i_event_length;
if( pi_time )
- *pi_time = t - p_sys->i_dvb_start;
+ *pi_time = t - p_pmt->eit.i_event_start;
return VLC_SUCCESS;
}
}
@@ -893,7 +890,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( p_sys->b_dvb_meta && p_sys->b_access_control )
{
int64_t i_time, i_length;
- if( !DVBEventInformation( p_demux, &i_time, &i_length ) && i_length > 0 )
+ if( !EITCurrentEventTime( p_pmt, p_sys->i_tdt_delta, &i_time, &i_length ) && i_length > 0 )
{
*pf = (double)i_time/(double)i_length;
return VLC_SUCCESS;
@@ -934,7 +931,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
!p_sys->b_force_seek_per_percent && p_pmt )
{
int64_t i_time, i_length;
- if( !DVBEventInformation( p_demux, &i_time, &i_length ) &&
+ if( !EITCurrentEventTime( p_pmt, p_sys->i_tdt_delta, &i_time, &i_length ) &&
i_length > 0 && !SeekToTime( p_demux, p_pmt, (int64_t)(TO_SCALE(i_length) * f) ) )
{
ReadyQueuesPostSeek( p_demux );
@@ -989,7 +986,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( p_sys->b_dvb_meta && p_sys->b_access_control )
{
- if( !DVBEventInformation( p_demux, pi64, NULL ) )
+ if( !EITCurrentEventTime( p_pmt, p_sys->i_tdt_delta, pi64, NULL ) )
return VLC_SUCCESS;
}
@@ -1006,7 +1003,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
if( p_sys->b_dvb_meta && p_sys->b_access_control )
{
- if( !DVBEventInformation( p_demux, NULL, pi64 ) )
+ if( !EITCurrentEventTime( p_pmt, p_sys->i_tdt_delta, NULL, pi64 ) )
return VLC_SUCCESS;
}
diff --git a/modules/demux/mpeg/ts.h b/modules/demux/mpeg/ts.h
index 86459a6..87e5db6 100644
--- a/modules/demux/mpeg/ts.h
+++ b/modules/demux/mpeg/ts.h
@@ -99,8 +99,6 @@ struct demux_sys_t
/* */
bool b_dvb_meta;
int64_t i_tdt_delta;
- int64_t i_dvb_start;
- int64_t i_dvb_length;
bool b_broken_charset; /* True if broken encoding is used in EPG/SDT */
/* Selected programs */
diff --git a/modules/demux/mpeg/ts_psi_eit.c b/modules/demux/mpeg/ts_psi_eit.c
index 91a795b..4d49c51 100644
--- a/modules/demux/mpeg/ts_psi_eit.c
+++ b/modules/demux/mpeg/ts_psi_eit.c
@@ -480,13 +480,18 @@ static void EITCallBack( demux_t *p_demux,
p_eit->i_extension
) )
{
- p_sys->i_dvb_length = 0;
- p_sys->i_dvb_start = 0;
-
- if( p_epg->p_current )
+ ts_pat_t *p_pat = ts_pid_Get(&p_sys->pids, 0)->u.p_pat;
+ ts_pmt_t *p_pmt = ts_pat_Get_pmt(p_pat, p_eit->i_extension);
+ if(p_pmt)
{
- p_sys->i_dvb_start = CLOCK_FREQ * p_epg->p_current->i_start;
- p_sys->i_dvb_length = CLOCK_FREQ * p_epg->p_current->i_duration;
+ p_pmt->eit.i_event_length = 0;
+ p_pmt->eit.i_event_start = 0;
+
+ if( p_epg->p_current )
+ {
+ p_pmt->eit.i_event_start = p_epg->p_current->i_start;
+ p_pmt->eit.i_event_length = p_epg->p_current->i_duration;
+ }
}
}
es_out_Control( p_demux->out, ES_OUT_SET_GROUP_EPG,
diff --git a/modules/demux/mpeg/ts_streams.c b/modules/demux/mpeg/ts_streams.c
index 47ea7bc..b0962ae 100644
--- a/modules/demux/mpeg/ts_streams.c
+++ b/modules/demux/mpeg/ts_streams.c
@@ -132,6 +132,9 @@ ts_pmt_t *ts_pmt_New( demux_t *p_demux )
pmt->pcr.b_fix_done = false;
+ pmt->eit.i_event_length = 0;
+ pmt->eit.i_event_start = 0;
+
return pmt;
}
diff --git a/modules/demux/mpeg/ts_streams_private.h b/modules/demux/mpeg/ts_streams_private.h
index 808dfe6..cdbfec5 100644
--- a/modules/demux/mpeg/ts_streams_private.h
+++ b/modules/demux/mpeg/ts_streams_private.h
@@ -62,6 +62,12 @@ struct ts_pmt_t
bool b_fix_done;
} pcr;
+ struct
+ {
+ time_t i_event_start;
+ time_t i_event_length;
+ } eit;
+
mtime_t i_last_dts;
};
More information about the vlc-commits
mailing list