From fee41526769ee0331615add141c78a14469d1d49 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Wed, 10 Nov 2010 12:28:54 +0100 Subject: [PATCH] add CA id and name to the channel entry in htsp --- src/htsp.c | 7 +++++++ src/htsp.h | 1 + src/transports.c | 27 +++++++++++++++++++++++++++ src/transports.h | 2 ++ 4 files changed, 37 insertions(+), 0 deletions(-) diff --git a/src/htsp.c b/src/htsp.c index bc09946..6798c91 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -296,6 +296,7 @@ htsp_build_channel(channel_t *ch, const char *method) channel_tag_mapping_t *ctm; channel_tag_t *ct; th_transport_t *t; + uint16_t caid = 0; htsmsg_t *out = htsmsg_create_map(); htsmsg_t *tags = htsmsg_create_list(); @@ -322,11 +323,17 @@ htsp_build_channel(channel_t *ch, const char *method) 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 == 0) { + caid = transport_get_encryption(t); + } } htsmsg_add_msg(out, "services", services); htsmsg_add_msg(out, "tags", tags); htsmsg_add_str(out, "method", method); + htsmsg_add_u32(out, "channelCaId", caid); + htsmsg_add_str(out, "channelCaName", psi_caid2name(caid)); return out; } diff --git a/src/htsp.h b/src/htsp.h index db6ca8d..367e946 100644 --- a/src/htsp.h +++ b/src/htsp.h @@ -21,6 +21,7 @@ #include "epg.h" #include "dvr/dvr.h" +#include "psi.h" void htsp_init(void); diff --git a/src/transports.c b/src/transports.c index e6449e8..2b81e7a 100644 --- a/src/transports.c +++ b/src/transports.c @@ -1027,6 +1027,33 @@ 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: + while((c = LIST_FIRST(&st->st_caids)) != NULL) { + if (c->caid) { + 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 71fe54f..ee5767a 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 */ -- 1.7.1