libdvbv5: do not adjust DVB time daylight saving
PATCH 1/3 libdvbv5: do not adjust DVB time daylight saving
Sets tm_isdst to -1. This makes dvb_time available outside of EIT parsing, and struct tm to reflect the actual values received from DVB.
Also fixes indentation.
Signed-off-by André Roth <[email protected]>
--- lib/libdvbv5/tables/eit.c | 49 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-)
lib/libdvbv5/tables/eit.c +24 -25
@@ -156,33 +156,32 @@ void dvb_table_eit_print(struct dvb_v5_fe_parms *parms, struct dvb_table_eit *eivoid dvb_time (const uint8_t data[5 ],struct tm *tm) { -/* ETSI EN 300 468 V1.4.1 */ -int year, month, day, hour, min, sec; -int k =0 ; -uint16_t mjd; - - mjd = *(uint16_t *) data; - hour =dvb_bcd (data[2 ]); - min =dvb_bcd (data[3 ]); - sec =dvb_bcd (data[4 ]); - year = ((mjd -15078.2 ) /365.25 ); - month = ((mjd -14956.1 - (int ) (year *365.25 )) /30.6001 ); - day = mjd -14956 - (int ) (year *365.25 ) - (int ) (month *30.6001 ); -if (month ==14 || month ==15 ) k =1 ; - year += k; - month = month -1 - k *12 ; - - tm->tm_sec = sec; - tm->tm_min = min; - tm->tm_hour = hour; - tm->tm_mday = day; - tm->tm_mon = month -1 ; - tm->tm_year = year; - tm->tm_isdst =1 ;/* dst in effect, do not adjust */ -mktime ( tm ); +/* ETSI EN 300 468 V1.4.1 */ +int year, month, day, hour, min, sec; +int k =0 ; +uint16_t mjd; + + mjd = *(uint16_t *) data; + hour =dvb_bcd (data[2 ]); + min =dvb_bcd (data[3 ]); + sec =dvb_bcd (data[4 ]); + year = ((mjd -15078.2 ) /365.25 ); + month = ((mjd -14956.1 - (int ) (year *365.25 )) /30.6001 ); + day = mjd -14956 - (int ) (year *365.25 ) - (int ) (month *30.6001 ); +if (month ==14 || month ==15 ) k =1 ; + year += k; + month = month -1 - k *12 ; + + tm->tm_sec = sec; + tm->tm_min = min; + tm->tm_hour = hour; + tm->tm_mday = day; + tm->tm_mon = month -1 ; + tm->tm_year = year; + tm->tm_isdst =-1 ;/* do not adjust */ +mktime ( tm ); } -const char *dvb_eit_running_status_name[8 ] = { [0 ] ="Undefined" , [1 ] ="Not running" ,
Signature · 1 line
2.17.1
PATCH 2/3 libdvbv5: enable newlines in dvb strings
Newlines in are encoded as 0x8a, convert them to '\n'
Signed-off-by André Roth <[email protected]>
--- lib/libdvbv5/parse_string.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/libdvbv5/parse_string.c +5 -1
@@ -461,11 +461,13 @@ void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph, emphasis =1 ; else if (*s == 0x87 && emphasis) emphasis =0 ; - else if (*s >= 0x20 && (*s < 0x80 || *s > 0x9f)) { + else if (*s >= 0x20 && (*s < 0x80 || *s > 0x9f)) { *p++ = *s;if (emphasis) *p2++ = *s; } + else if (*s == 0x8a) + *p++ = '\n'; } *p ='\0' ; *p2 ='\0' ;
@@ -495,6 +497,8 @@ void dvb_parse_string(struct dvb_v5_fe_parms *parms, char **dest, char **emph, emphasis =1 ; else if (code == 0xe087 && emphasis) emphasis =0 ; + else if (code == 0xe08a) +/* newline, append code blow */ ; else if (code >= 0xe080 && code <= 0xe09f)continue ;
Signature · 1 line
2.17.1
PATCH 3/3 libdvbv5: fix array size in desc_logical_channel
In reply to André RothThis fixes the descriptor paring on 64bit systems. Thanks to [email protected] for finding and patching.
Signed-off-by André Roth <[email protected]>
--- lib/libdvbv5/descriptors/desc_logical_channel.c | 4 ++-- lib/libdvbv5/dvb-file.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
lib/libdvbv5/descriptors/desc_logical_channel.c +2 -2
@@ -40,7 +40,7 @@ int dvb_desc_logical_channel_init(struct dvb_v5_fe_parms *parms,memcpy (d->lcn, p, d->length); - len = d->length /sizeof (d->lcn); + len = d->length /4 ;for (i =0 ; i < len; i++) {bswap16 (d->lcn[i].service_id);
@@ -55,7 +55,7 @@ void dvb_desc_logical_channel_print(struct dvb_v5_fe_parms *parms, const structint i;size_t len; - len = d->length /sizeof (d->lcn); + len = d->length /4 ;for (i =0 ; i < len; i++) {dvb_loginfo ("| service ID[%d] %d" , i, d->lcn[i].service_id);
lib/libdvbv5/dvb-file.c +1 -1
@@ -987,7 +987,7 @@ static char *dvb_vchannel(struct dvb_v5_fe_parms_priv *parms,size_t len;int r; - len = d->length /sizeof (d->lcn); + len = d->length /4 ;for (i =0 ; i < len; i++) {if (service_id == d->lcn[i].service_id) { r = asprintf(&buf, "%d.%d",
Signature · 1 line
2.17.1