Beispiel #1
0
bouquet_t *
bouquet_create(const char *uuid, htsmsg_t *conf,
               const char *name, const char *src)
{
  bouquet_t *bq, *bq2;
  int i;

  lock_assert(&global_lock);

  bq = calloc(1, sizeof(bouquet_t));
  bq->bq_services = idnode_set_create(1);
  bq->bq_active_services = idnode_set_create(1);

  if (idnode_insert(&bq->bq_id, uuid, &bouquet_class, 0)) {
    if (uuid)
      tvherror("bouquet", "invalid uuid '%s'", uuid);
    free(bq);
    return NULL;
  }

  if (conf) {
    bq->bq_in_load = 1;
    idnode_load(&bq->bq_id, conf);
    bq->bq_in_load = 0;
    if (!htsmsg_get_bool(conf, "shield", &i) && i)
      bq->bq_shield = 1;
  }

  if (name) {
    free(bq->bq_name);
    bq->bq_name = strdup(name);
  }

  if (src) {
    free(bq->bq_src);
    bq->bq_src = strdup(src);
  }

  bq2 = RB_INSERT_SORTED(&bouquets, bq, bq_link, _bq_cmp);
  assert(bq2 == NULL);

  bq->bq_saveflag = 1;

  return bq;
}
Beispiel #2
0
linuxdvb_ca_t *
linuxdvb_ca_create
  ( htsmsg_t *conf, linuxdvb_adapter_t *la, int number, const char *ca_path)
{
  linuxdvb_ca_t *lca;
  char id[6];
  const char *uuid = NULL;

  lca = calloc(1, sizeof(linuxdvb_ca_t));
  memset(lca, 0, sizeof(linuxdvb_ca_t));
  lca->lca_number = number;
  lca->lca_ca_path  = strdup(ca_path);
  lca->lca_ca_fd = -1;
  lca->lca_capmt_interval = 100;
  lca->lca_capmt_query_interval = 1200;

  /* Internal config ID */
  snprintf(id, sizeof(id), "ca%u", number);

  if (conf)
    conf = htsmsg_get_map(conf, id);
  if (conf)
    uuid = htsmsg_get_str(conf, "uuid");

  if (idnode_insert(&lca->lca_id, uuid, &linuxdvb_ca_class, 0)) {
    free(lca);
    return NULL;
  }

  if (conf)
    idnode_load(&lca->lca_id, conf);

  /* Adapter link */
  lca->lca_adapter = la;
  LIST_INSERT_HEAD(&la->la_ca_devices, lca, lca_link);

  TAILQ_INIT(&lca->lca_capmt_queue);

  gtimer_arm_ms(&lca->lca_monitor_timer, linuxdvb_ca_monitor, lca, 250);

  return lca;
}
Beispiel #3
0
linuxdvb_lnb_t *
linuxdvb_lnb_create0
  ( const char *name, htsmsg_t *conf, linuxdvb_satconf_ele_t *ls )
{
  int i;

  /* Setup static entries */
  for (i = 0; i < ARRAY_SIZE(linuxdvb_lnb_all); i++)
    if (!linuxdvb_lnb_all[i].ld_id.in_class)
      idnode_insert(&linuxdvb_lnb_all[i].ld_id, NULL, &linuxdvb_lnb_class);

  /* Find */
  if (name) {
    for (i = 0; i < ARRAY_SIZE(linuxdvb_lnb_all); i++) {
      if (!strcmp(linuxdvb_lnb_all[i].ld_type, name))
        return (linuxdvb_lnb_t*)&linuxdvb_lnb_all[i];
    }
  }
  return (linuxdvb_lnb_t*)linuxdvb_lnb_all; // Universal
}
Beispiel #4
0
/*
 * Create entry
 */
void *
tvh_hardware_create0
  ( void *o, const idclass_t *idc, const char *uuid, htsmsg_t *conf )
{
  tvh_hardware_t *th = o;

  /* Create node */
  if (idnode_insert(&th->th_id, uuid, idc, 0)) {
    free(o);
    return NULL;
  }
  
  /* Update list */
  LIST_INSERT_HEAD(&tvh_hardware, th, th_link);
  
  /* Load config */
  if (conf)
    idnode_load(&th->th_id, conf);

  notify_reload("hardware");
  
  return o;
}