Send CAID & name in HTSP messages

This commit is contained in:
Andreas Öman 2010-11-28 11:22:54 +00:00
parent 083885e00c
commit 26af10b2f6
3 changed files with 32 additions and 1 deletions

View 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);

View 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

View 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 */