[vlc-commits] vout: epg: use epg_time instead of system clock time
Francois Cartegnie
git at videolan.org
Wed Dec 28 11:14:08 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Dec 27 16:40:32 2016 +0100| [c9383327fc54db4a7be0a2bd04c2bad35c07403c] | committer: Francois Cartegnie
vout: epg: use epg_time instead of system clock time
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c9383327fc54db4a7be0a2bd04c2bad35c07403c
---
modules/demux/mpeg/ts_psip.c | 2 ++
modules/demux/mpeg/ts_si.c | 2 ++
src/video_output/video_epg.c | 17 ++++++++++++++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/modules/demux/mpeg/ts_psip.c b/modules/demux/mpeg/ts_psip.c
index 748c0c6..afb1d50 100644
--- a/modules/demux/mpeg/ts_psip.c
+++ b/modules/demux/mpeg/ts_psip.c
@@ -801,6 +801,8 @@ static void ATSC_STT_Callback( void *p_cb_basepid, dvbpsi_atsc_stt_t* p_stt )
EIT_DEBUG_TIMESHIFT( i_current_time );
p_demux->p_sys->i_network_time = i_current_time;
p_demux->p_sys->i_network_time_update = time(NULL);
+
+ es_out_Control( p_demux->out, ES_OUT_SET_EPG_TIME, p_demux->p_sys->i_network_time );
}
p_ctx->p_stt = p_stt;
diff --git a/modules/demux/mpeg/ts_si.c b/modules/demux/mpeg/ts_si.c
index c98b7f5..203fb3f 100644
--- a/modules/demux/mpeg/ts_si.c
+++ b/modules/demux/mpeg/ts_si.c
@@ -370,6 +370,8 @@ static void TDTCallBack( demux_t *p_demux, dvbpsi_tot_t *p_tdt )
ts_pid_t *pid = ts_pid_Get( &p_sys->pids, TS_SI_TDT_PID );
dvbpsi_decoder_reset( pid->u.p_si->handle->p_decoder, true );
dvbpsi_tot_delete(p_tdt);
+
+ es_out_Control( p_demux->out, ES_OUT_SET_EPG_TIME, (int64_t) p_sys->i_network_time );
}
static void EITCallBack( demux_t *p_demux, dvbpsi_eit_t *p_eit )
diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c
index 9e493f2..474e7c2 100644
--- a/src/video_output/video_epg.c
+++ b/src/video_output/video_epg.c
@@ -144,6 +144,7 @@ static subpicture_region_t * vout_OSDEpgText(const char *text,
static subpicture_region_t * vout_BuildOSDEpg(vlc_epg_t *epg,
+ int64_t epgtime,
int x, int y,
int visible_width,
int visible_height)
@@ -151,7 +152,7 @@ static subpicture_region_t * vout_BuildOSDEpg(vlc_epg_t *epg,
subpicture_region_t *head;
subpicture_region_t **last_ptr = &head;
- time_t current_time = time(NULL);
+ float f_progress = 0;
/* Display the name of the channel. */
*last_ptr = vout_OSDEpgText(epg->psz_name,
@@ -174,14 +175,19 @@ static subpicture_region_t * vout_BuildOSDEpg(vlc_epg_t *epg,
if (!*last_ptr || !epg->p_current)
return head;
+ if(epgtime)
+ {
+ f_progress = (epgtime - epg->p_current->i_start) /
+ (float)epg->p_current->i_duration;
+ }
+
/* Display the current program time slider. */
last_ptr = &(*last_ptr)->p_next;
*last_ptr = vout_OSDEpgSlider(x + visible_width * EPG_LEFT,
y + visible_height * (EPG_TOP + 0.1),
visible_width * (1 - 2 * EPG_LEFT),
visible_height * 0.05,
- (current_time - epg->p_current->i_start)
- / (float)epg->p_current->i_duration);
+ f_progress);
if (!*last_ptr)
return head;
@@ -223,6 +229,7 @@ static subpicture_region_t * vout_BuildOSDEpg(vlc_epg_t *epg,
struct subpicture_updater_sys_t
{
vlc_epg_t *epg;
+ int64_t time;
};
static int OSDEpgValidate(subpicture_t *subpic,
@@ -255,6 +262,7 @@ static void OSDEpgUpdate(subpicture_t *subpic,
subpic->i_original_picture_width = fmt.i_width;
subpic->i_original_picture_height = fmt.i_height;
subpic->p_region = vout_BuildOSDEpg(sys->epg,
+ sys->time,
fmt.i_x_offset,
fmt.i_y_offset,
fmt.i_visible_width,
@@ -277,6 +285,7 @@ static void OSDEpgDestroy(subpicture_t *subpic)
int vout_OSDEpg(vout_thread_t *vout, input_item_t *input)
{
vlc_epg_t *epg = NULL;
+ int64_t epg_time;
/* Look for the current program EPG event */
@@ -308,6 +317,7 @@ int vout_OSDEpg(vout_thread_t *vout, input_item_t *input)
epg->psz_name = strdup(tmp->psz_name);
}
}
+ epg_time = input->i_epg_time;
vlc_mutex_unlock(&input->lock);
/* If no EPG event has been found. */
@@ -323,6 +333,7 @@ int vout_OSDEpg(vout_thread_t *vout, input_item_t *input)
return VLC_EGENERIC;
}
sys->epg = epg;
+ sys->time = epg_time;
subpicture_updater_t updater = {
.pf_validate = OSDEpgValidate,
.pf_update = OSDEpgUpdate,
More information about the vlc-commits
mailing list