dvb network: Add EIT local time option, fixes #2617

This commit is contained in:
Jaroslav Kysela 2015-01-14 09:47:12 +01:00
parent 04fcdce37d
commit eb5cfaa6e9
6 changed files with 20 additions and 5 deletions

View file

@ -79,6 +79,12 @@ Buttons have the following functions:
<dd>If you experience problems caused by overlaps between multiple network
providers this option can be used to filter which network ID is received
by a given adapter.
<p>
<dt><b>Ignore Provider's Channel Numbers</b>
<dd>Do not use the local channel numbers defined by provider.
<p>
<dt><b>EIT Local Time</b>
<dd>EPG (EIT) events uses local time instead UTC.
<p>
<dt><b>Character Set</b>
<dd>The character encoding for this network (e.g. UTF-8).

View file

@ -398,7 +398,7 @@ static int _eit_desc_crid
static int _eit_process_event
( epggrab_module_t *mod, int tableid,
mpegts_service_t *svc, const uint8_t *ptr, int len,
int *resched, int *save )
int local, int *resched, int *save )
{
int save2 = 0;
int ret, dllen;
@ -415,7 +415,7 @@ static int _eit_process_event
/* Core fields */
eid = ptr[0] << 8 | ptr[1];
start = dvb_convert_date(&ptr[2]);
start = dvb_convert_date(&ptr[2], local);
stop = start + bcdtoint(ptr[7] & 0xff) * 3600 +
bcdtoint(ptr[8] & 0xff) * 60 +
bcdtoint(ptr[9] & 0xff);
@ -643,6 +643,7 @@ _eit_callback
while (len) {
int r;
if ((r = _eit_process_event(mod, tableid, svc, ptr, len,
mm->mm_network->mn_localtime,
&resched, &save)) < 0)
break;
len -= r;

View file

@ -298,6 +298,7 @@ struct mpegts_network
char *mn_charset;
int mn_idlescan;
int mn_ignore_chnum;
int mn_localtime;
};
typedef enum mpegts_mux_scan_state

View file

@ -162,7 +162,7 @@ int dvb_get_string_with_len
#define bcdtoint(i) ((((i & 0xf0) >> 4) * 10) + (i & 0x0f))
time_t dvb_convert_date(const uint8_t *dvb_buf);
time_t dvb_convert_date(const uint8_t *dvb_buf, int local);
void atsc_utf16_to_utf8(const uint8_t *src, int len, char *buf, int buflen);

View file

@ -396,7 +396,7 @@ atsc_utf16_to_utf8(const uint8_t *src, int len, char *buf, int buflen)
*/
time_t
dvb_convert_date(const uint8_t *dvb_buf)
dvb_convert_date(const uint8_t *dvb_buf, int local)
{
int i;
int year, month, day, hour, min, sec;
@ -432,7 +432,7 @@ dvb_convert_date(const uint8_t *dvb_buf)
dvb_time.tm_isdst = -1;
dvb_time.tm_wday = 0;
dvb_time.tm_yday = 0;
return (timegm(&dvb_time));
return local ? mktime(&dvb_time) : timegm(&dvb_time);
}
/*

View file

@ -189,6 +189,13 @@ const idclass_t mpegts_network_class =
.list = dvb_charset_enum,
.opts = PO_ADVANCED,
},
{
.type = PT_BOOL,
.id = "localtime",
.name = "EIT Local Time",
.off = offsetof(mpegts_network_t, mn_localtime),
.opts = PO_ADVANCED,
},
{
.type = PT_INT,
.id = "num_mux",