diff --git a/src/htsp.c b/src/htsp.c index bc09946c..e9b13dc5 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -38,7 +38,7 @@ #include "htsp.h" #include "streaming.h" #include "transports.h" - +#include "psi.h" #include "htsmsg_binary.h" #include @@ -319,9 +319,14 @@ htsp_build_channel(channel_t *ch, const char *method) LIST_FOREACH(t, &ch->ch_transports, tht_ch_link) { htsmsg_t *svcmsg = htsmsg_create_map(); + uint16_t caid; htsmsg_add_str(svcmsg, "name", transport_nicename(t)); htsmsg_add_str(svcmsg, "type", transport_servicetype_txt(t)); htsmsg_add_msg(services, NULL, svcmsg); + if((caid = transport_get_encryption(t)) != 0) { + htsmsg_add_u32(svcmsg, "caid", caid); + htsmsg_add_str(svcmsg, "caname", psi_caid2name(caid)); + } } htsmsg_add_msg(out, "services", services); diff --git a/src/transports.c b/src/transports.c index e6449e82..144938d3 100644 --- a/src/transports.c +++ b/src/transports.c @@ -1027,6 +1027,30 @@ transport_refresh_channel(th_transport_t *t) } +/** + * Get the encryption CAID from a transport + * only the first CA stream in a transport is returned + */ +uint16_t +transport_get_encryption(th_transport_t *t) +{ + th_stream_t *st; + caid_t *c; + + TAILQ_FOREACH(st, &t->tht_components, st_link) { + switch(st->st_type) { + case SCT_CA: + LIST_FOREACH(c, &st->st_caids, link) + if(c->caid != 0) + return c->caid; + break; + default: + break; + } + } + return 0; +} + /** * Get the signal status from a transport diff --git a/src/transports.h b/src/transports.h index 71fe54fb..ee5767a4 100644 --- a/src/transports.h +++ b/src/transports.h @@ -98,6 +98,8 @@ void transport_refresh_channel(th_transport_t *t); int tss2errcode(int tss); +uint16_t transport_get_encryption(th_transport_t *t); + int transport_get_signal_status(th_transport_t *t, signal_status_t *status); #endif /* TRANSPORTS_H */