Ejemplo n.º 1
0
static void
tvhdhomerun_device_class_override_notify( void * obj, const char *lang )
{
  tvhdhomerun_device_t *hd = obj;
  tvhdhomerun_frontend_t *hfe;
  dvb_fe_type_t type = dvb_str2type(hd->hd_override_type);
  struct hdhomerun_discover_device_t discover_info;
  unsigned int tuner;
  htsmsg_t *conf;

  conf = hts_settings_load("input/tvhdhomerun/adapters/%s", hd->hd_info.uuid);
  if (conf)
    conf = htsmsg_get_map(conf, "frontends");

  lock_assert(&global_lock);

  while ((hfe = TAILQ_FIRST(&hd->hd_frontends)) != NULL)
  {
    if (hfe->hf_type == type)
      break;

    discover_info.device_id = hdhomerun_device_get_device_id(hfe->hf_hdhomerun_tuner);
    discover_info.ip_addr =  hdhomerun_device_get_device_ip(hfe->hf_hdhomerun_tuner);
    tuner = hfe->hf_tunerNumber;

    tvhdhomerun_frontend_delete(hfe);

    tvhdhomerun_frontend_create(hd, &discover_info, conf, type, tuner);
  }
}
Ejemplo n.º 2
0
PyObject *py_device_clone(py_device_object *self) {
    PyObject *arg_list, *copied_obj;
    uint32_t device_id, device_ip;
    unsigned int tuner;

    device_id = hdhomerun_device_get_device_id(self->hd);
    device_ip = hdhomerun_device_get_device_ip(self->hd);
    tuner = hdhomerun_device_get_tuner(self->hd);
    arg_list = Py_BuildValue("(III)", device_ip, device_id, tuner);
    if(arg_list == NULL) {
        return NULL;
    }
    copied_obj = PyObject_CallObject((PyObject *)&hdhomerun_Device_type, arg_list);
    Py_DECREF(arg_list);
    return copied_obj;
}
struct hdhomerun_device_t *hdhomerun_device_selector_find_device(struct hdhomerun_device_selector_t *hds, uint32_t device_id, unsigned int tuner_index)
{
	size_t index;
	for (index = 0; index < hds->hd_count; index++) {
		struct hdhomerun_device_t *entry = hds->hd_list[index];
		if (hdhomerun_device_get_device_id(entry) != device_id) {
			continue;
		}
		if (hdhomerun_device_get_tuner(entry) != tuner_index) {
			continue;
		}
		return entry;
	}

	return NULL;
}