Project

General

Profile

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

updated to apply to the current trunk - Lars Op den Kamp -, 2010-11-06 15:11

View differences:

tvheadend-patch/src/htsp.c 2010-11-06 14:45:50.311506646 +0100
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);
tvheadend-patch/src/transports.c 2010-11-06 14:46:40.579505415 +0100
1025 1025
  if(t->tht_ch != NULL)
1026 1026
    htsp_channel_update(t->tht_ch);
1027 1027
}
1028

  
1029
/**
1030
 * Get the encryption CAID from a transport
1031
 *
1032
 * only the first CA stream in a transport is returned
1033
 */
1034
uint16_t
1035
get_encryption_from_transport(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

  
tvheadend-patch/src/transports.h 2010-11-06 14:45:50.311506646 +0100
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 */
(2-2/3)