server: Add the CAID column to make possible to filter services against CAID - fixes #2153

This commit is contained in:
Jaroslav Kysela 2014-08-13 20:53:02 +02:00
parent 39c202cff2
commit 1579757ca0
2 changed files with 39 additions and 6 deletions

View file

@ -130,12 +130,12 @@ const idclass_t mpegts_service_class =
.off = offsetof(mpegts_service_t, s_dvb_servicetype),
},
{
.type = PT_STR,
.id = "charset",
.name = "Character Set",
.off = offsetof(mpegts_service_t, s_dvb_charset),
.list = dvb_charset_enum,
.opts = PO_ADVANCED,
.type = PT_STR,
.id = "charset",
.name = "Character Set",
.off = offsetof(mpegts_service_t, s_dvb_charset),
.list = dvb_charset_enum,
.opts = PO_ADVANCED,
},
{
.type = PT_U16,

View file

@ -142,6 +142,32 @@ service_class_encrypted_get ( void *p )
return &t;
}
static const void *
service_class_caid_get ( void *obj )
{
static char buf[256], *s = buf;
service_t *svc = obj;
elementary_stream_t *st;
caid_t *c;
size_t l;
buf[0] = '\0';
TAILQ_FOREACH(st, &svc->s_components, es_link) {
switch(st->es_type) {
case SCT_CA:
LIST_FOREACH(c, &st->es_caids, link) {
l = strlen(buf);
snprintf(buf + l, l - sizeof(buf), "%s%04X:%06X",
l ? "," : "", c->caid, c->providerid);
}
break;
default:
break;
}
}
return &s;
}
const idclass_t service_class = {
.ic_class = "service",
.ic_caption = "Service",
@ -172,6 +198,13 @@ const idclass_t service_class = {
.get = service_class_encrypted_get,
.opts = PO_NOSAVE | PO_RDONLY
},
{
.type = PT_STR,
.id = "caid",
.name = "CAID",
.get = service_class_caid_get,
.opts = PO_NOSAVE | PO_RDONLY | PO_HIDDEN,
},
{}
}
};