]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Send CAID & name in HTSP messages
authorAndreas Öman <andreas@lonelycoder.com>
Sun, 28 Nov 2010 11:22:54 +0000 (11:22 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Sun, 28 Nov 2010 11:22:54 +0000 (11:22 +0000)
src/htsp.c
src/transports.c
src/transports.h

index bc09946c0c8e875778ae761ac8f74ac74bea715d..e9b13dc51587360e57eab7829da3b8af630eb813 100644 (file)
@@ -38,7 +38,7 @@
 #include "htsp.h"
 #include "streaming.h"
 #include "transports.h"
-
+#include "psi.h"
 #include "htsmsg_binary.h"
 
 #include <sys/statvfs.h>
@@ -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);
index e6449e827b3e7255aa1d277d7e7bd51f39f53ea1..144938d329dcf2a7dd613f337d497dcd861644ab 100644 (file)
@@ -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
index 71fe54fb21cb8e6ecdae781861740faa0115bbc6..ee5767a472c0927612ea9a46eb463fdcd9c3b1e8 100644 (file)
@@ -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 */