idnode mpegts: minor corrections to previous refactoring
This commit is contained in:
parent
5f2de3a8a9
commit
c42b79960d
6 changed files with 24 additions and 15 deletions
|
@ -622,9 +622,12 @@ htsmsg_t *
|
|||
idnode_serialize0(idnode_t *self, int optmask)
|
||||
{
|
||||
const idclass_t *idc = self->in_class;
|
||||
const char *uuid;
|
||||
|
||||
htsmsg_t *m = htsmsg_create_map();
|
||||
htsmsg_add_str(m, "uuid", idnode_uuid_as_str(self));
|
||||
uuid = idnode_uuid_as_str(self);
|
||||
htsmsg_add_str(m, "uuid", uuid);
|
||||
htsmsg_add_str(m, "id", uuid);
|
||||
htsmsg_add_str(m, "text", idnode_get_title(self));
|
||||
|
||||
htsmsg_add_msg(m, "params", idnode_params(idc, self, optmask));
|
||||
|
|
|
@ -352,15 +352,21 @@ void
|
|||
mpegts_input_set_network ( mpegts_input_t *mi, mpegts_network_t *mn )
|
||||
{
|
||||
char buf1[256], buf2[265];
|
||||
mi->mi_display_name(mi, buf1, sizeof(buf1));
|
||||
if (mi->mi_network == mn) return;
|
||||
*buf1 = *buf2 = 0;
|
||||
if (mi->mi_display_name)
|
||||
mi->mi_display_name(mi, buf1, sizeof(buf1));
|
||||
if (mi->mi_network) {
|
||||
mi->mi_network->mn_display_name(mi->mi_network, buf2, sizeof(buf2));
|
||||
LIST_REMOVE(mi, mi_network_link);
|
||||
tvhdebug("mpegts", "%s - remove network %s", buf1, buf2);
|
||||
}
|
||||
mi->mi_network = mn;
|
||||
LIST_INSERT_HEAD(&mn->mn_inputs, mi, mi_network_link);
|
||||
tvhdebug("mpegts", "%s - added network %s", buf1, buf2);
|
||||
if (mn) {
|
||||
mn->mn_display_name(mn, buf2, sizeof(buf2));
|
||||
mi->mi_network = mn;
|
||||
LIST_INSERT_HEAD(&mn->mn_inputs, mi, mi_network_link);
|
||||
tvhdebug("mpegts", "%s - added network %s", buf1, buf2);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
|
|
@ -32,7 +32,7 @@ const idclass_t mpegts_service_class =
|
|||
.ic_caption = "MPEGTS Service",
|
||||
.ic_properties = (const property_t[]){
|
||||
{
|
||||
.type = PT_STR,
|
||||
.type = PT_U16,
|
||||
.id = "sid",
|
||||
.name = "Service ID",
|
||||
.opts = PO_RDONLY,
|
||||
|
|
14
src/prop.c
14
src/prop.c
|
@ -64,10 +64,9 @@ const static struct strtab typetab[] = {
|
|||
const property_t *
|
||||
prop_find(const property_t *p, const char *id)
|
||||
{
|
||||
int i = 0;
|
||||
for(;p[i].id; i++)
|
||||
if(!strcmp(id, p[i].id))
|
||||
return p + i;
|
||||
for(; p->id; p++)
|
||||
if(!strcmp(id, p->id))
|
||||
return p;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -90,7 +89,7 @@ prop_write_values(void *obj, const property_t *pl, htsmsg_t *m, int optmask)
|
|||
/* Find Property */
|
||||
const property_t *p = prop_find(pl, f->hmf_name);
|
||||
if(p == NULL) {
|
||||
tvhwarn("prop", "invalid property %s", f->hmf_name);
|
||||
//tvhwarn("prop", "invalid property %s", f->hmf_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -144,7 +143,7 @@ prop_write_values(void *obj, const property_t *pl, htsmsg_t *m, int optmask)
|
|||
char **val = v;
|
||||
if(p->str_set != NULL)
|
||||
save |= p->str_set(obj, f->hmf_str);
|
||||
else if (!strcmp(*val ?: "", f->hmf_str)) {
|
||||
else if (strcmp(*val ?: "", f->hmf_str)) {
|
||||
free(*val);
|
||||
*val = strdup(f->hmf_str);
|
||||
save = 1;
|
||||
|
@ -222,7 +221,6 @@ prop_serialize(void *obj, const property_t *pl, htsmsg_t *msg, int optmask)
|
|||
|
||||
for(; pl->id; pl++) {
|
||||
htsmsg_t *m = htsmsg_create_map();
|
||||
htsmsg_add_msg(msg, NULL, m);
|
||||
|
||||
/* Metadata */
|
||||
htsmsg_add_str(m, "id", pl->id);
|
||||
|
@ -244,6 +242,8 @@ prop_serialize(void *obj, const property_t *pl, htsmsg_t *msg, int optmask)
|
|||
/* Data */
|
||||
if (obj)
|
||||
prop_read_value(obj, pl, m, "value", optmask);
|
||||
|
||||
htsmsg_add_msg(msg, NULL, m);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2262,7 +2262,7 @@ extjs_get_idnode(http_connection_t *hc, const char *remain, void *opaque,
|
|||
|
||||
pthread_mutex_unlock(&global_lock);
|
||||
|
||||
idnode_set_free(v);
|
||||
if (v) idnode_set_free(v);
|
||||
|
||||
htsmsg_json_serialize(out, hq, 0);
|
||||
htsmsg_destroy(out);
|
||||
|
|
|
@ -101,7 +101,7 @@ tvheadend.idnode_editor = function(item, conf)
|
|||
text : 'Save',
|
||||
handler : function() {
|
||||
var params = {
|
||||
uuid: item.id,
|
||||
uuid: item.uuid,
|
||||
op : 'save',
|
||||
conf: Ext.util.JSON.encode(panel.getForm().getFieldValues())
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue