From 94aa7e4c1bd0720ffd42064a301e486ef1e2891e Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Thu, 11 May 2017 15:25:29 +0200 Subject: [PATCH] linuxdvb: fix satconf active/enable handling, fixes #4365 --- src/htsmsg.c | 12 ++++++++++++ src/htsmsg.h | 8 ++++++++ src/input/mpegts/linuxdvb/linuxdvb_satconf.c | 4 ++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/htsmsg.c b/src/htsmsg.c index b81a1e35c..6744481b4 100644 --- a/src/htsmsg.c +++ b/src/htsmsg.c @@ -309,6 +309,18 @@ htsmsg_add_bool(htsmsg_t *msg, const char *name, int b) f->hmf_bool = !!b; } +/* + * + */ +void +htsmsg_set_bool(htsmsg_t *msg, const char *name, int b) +{ + htsmsg_field_t *f = htsmsg_field_find(msg, name); + if (!f) + f = htsmsg_field_add(msg, name, HMF_BOOL, HMF_NAME_INALLOCED, 0); + f->hmf_bool = !!b; +} + /* * */ diff --git a/src/htsmsg.h b/src/htsmsg.h index fc20f18b9..47f765cea 100644 --- a/src/htsmsg.h +++ b/src/htsmsg.h @@ -119,8 +119,16 @@ void htsmsg_field_destroy(htsmsg_t *msg, htsmsg_field_t *f); */ void htsmsg_destroy(htsmsg_t *msg); +/** + * Add an boolean field. + */ void htsmsg_add_bool(htsmsg_t *msg, const char *name, int b); +/** + * Add/update an boolean field. + */ +void htsmsg_set_bool(htsmsg_t *msg, const char *name, int b); + /** * Add an integer field where source is signed 64 bit. */ diff --git a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c index 8820849b4..817d29977 100644 --- a/src/input/mpegts/linuxdvb/linuxdvb_satconf.c +++ b/src/input/mpegts/linuxdvb/linuxdvb_satconf.c @@ -1185,9 +1185,9 @@ linuxdvb_satconf_create htsmsg_add_str(l, NULL, str); htsmsg_add_msg(e, "networks", l); } - lse = linuxdvb_satconf_ele_create0(htsmsg_get_str(e, "uuid"), e, ls); if (lst->enable) - lse->lse_enabled = 1; + htsmsg_set_bool(e, "enabled", 1); + lse = linuxdvb_satconf_ele_create0(htsmsg_get_str(e, "uuid"), e, ls); } } -- 2.47.2