Project

General

Profile

Feature #299 » 00-tvheadend-add-caid-to-channel.patch

patch: add caid to channel - Lars Op den Kamp -, 2010-10-05 23:39

View differences:

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

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

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

  
333
  htsmsg_add_u32(out, "channelCaid", caid);
328 334
  htsmsg_add_msg(out, "services", services);
329 335
  htsmsg_add_msg(out, "tags", tags);
330 336
  htsmsg_add_str(out, "method", method);
src/transports.c
1022 1022
  if(t->tht_ch != NULL)
1023 1023
    htsp_channel_update(t->tht_ch);
1024 1024
}
1025

  
1026
/**
1027
 * Get the encryption CAID from a transport
1028
 *
1029
 * only the first CA stream in a transport is returned
1030
 */
1031
uint16_t
1032
get_encryption_from_transport(th_transport_t *t)
1033
{
1034
  th_stream_t *st;
1035
  caid_t *c;
1036

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

  
1051
  return 0;
1052
}
src/transports.h
98 98

  
99 99
int tss2errcode(int tss);
100 100

  
101
uint16_t get_encryption_from_transport(th_transport_t *t);
102

  
101 103
#endif /* TRANSPORTS_H */
(1-1/3)