Project

General

Profile

Feature #299 » 0001-add-CA-id-and-name-to-the-channel-entry-in-htsp.patch

updated to apply to the current trunk and sends the encryption name too - Lars Op den Kamp -, 2010-11-13 12:03

View differences:

src/htsp.c
296 296
  channel_tag_mapping_t *ctm;
297 297
  channel_tag_t *ct;
298 298
  th_transport_t *t;
299
  uint16_t caid = 0;
299 300

  
300 301
  htsmsg_t *out = htsmsg_create_map();
301 302
  htsmsg_t *tags = htsmsg_create_list();
......
322 323
    htsmsg_add_str(svcmsg, "name", transport_nicename(t));
323 324
    htsmsg_add_str(svcmsg, "type", transport_servicetype_txt(t));
324 325
    htsmsg_add_msg(services, NULL, svcmsg);
326

  
327
    if (caid == 0) {
328
      caid = transport_get_encryption(t);
329
    }
325 330
  }
326 331

  
327 332
  htsmsg_add_msg(out, "services", services);
328 333
  htsmsg_add_msg(out, "tags", tags);
329 334
  htsmsg_add_str(out, "method", method);
335
  htsmsg_add_u32(out, "channelCaId", caid);
336
  htsmsg_add_str(out, "channelCaName", psi_caid2name(caid));
330 337
  return out;
331 338
}
332 339

  
src/htsp.h
21 21

  
22 22
#include "epg.h"
23 23
#include "dvr/dvr.h"
24
#include "psi.h"
24 25

  
25 26
void htsp_init(void);
26 27

  
src/transports.c
1027 1027
}
1028 1028

  
1029 1029

  
1030
/**
1031
 * Get the encryption CAID from a transport
1032
 * only the first CA stream in a transport is returned
1033
 */
1034
uint16_t
1035
transport_get_encryption(th_transport_t *t)
1036
{
1037
  th_stream_t *st;
1038
  caid_t *c;
1039

  
1040
  TAILQ_FOREACH(st, &t->tht_components, st_link) {
1041
    switch(st->st_type) {
1042
      case SCT_CA:
1043
        while((c = LIST_FIRST(&st->st_caids)) != NULL) {
1044
          if (c->caid) {
1045
            return c->caid;
1046
          }
1047
        }
1048
        break;
1049
      default:
1050
        break;
1051
        }
1052
  }
1053

  
1054
  return 0;
1055
}
1056

  
1030 1057

  
1031 1058
/**
1032 1059
 * Get the signal status from a transport
src/transports.h
98 98

  
99 99
int tss2errcode(int tss);
100 100

  
101
uint16_t transport_get_encryption(th_transport_t *t);
102

  
101 103
int transport_get_signal_status(th_transport_t *t, signal_status_t *status);
102 104

  
103 105
#endif /* TRANSPORTS_H */
104
- 
(3-3/3)