Fix changing tuner-type
This commit is contained in:
parent
21a8762c3f
commit
a78a83c93a
3 changed files with 39 additions and 11 deletions
|
@ -89,11 +89,43 @@ tvhdhomerun_device_class_override_set( void *obj, const void * p )
|
|||
free(hd->hd_override_type);
|
||||
hd->hd_override_type = strdup(p);
|
||||
tvhlog(LOG_INFO, "tvhdhomerun", "Setting override_type : %s", hd->hd_override_type);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
tvhdhomerun_device_class_override_notify( void * obj )
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
const idclass_t tvhdhomerun_device_class =
|
||||
{
|
||||
.ic_class = "tvhdhomerun_client",
|
||||
|
@ -118,10 +150,10 @@ const idclass_t tvhdhomerun_device_class =
|
|||
},
|
||||
{
|
||||
.type = PT_STR,
|
||||
.id = "device_id",
|
||||
.id = "uuid",
|
||||
.name = "UUID",
|
||||
.opts = PO_RDONLY,
|
||||
.off = offsetof(tvhdhomerun_device_t, hd_info.device_id),
|
||||
.off = offsetof(tvhdhomerun_device_t, hd_info.uuid),
|
||||
},
|
||||
{
|
||||
.type = PT_STR,
|
||||
|
@ -143,6 +175,7 @@ const idclass_t tvhdhomerun_device_class =
|
|||
.name = "Network Type",
|
||||
.opts = PO_ADVANCED,
|
||||
.set = tvhdhomerun_device_class_override_set,
|
||||
.notify = tvhdhomerun_device_class_override_notify,
|
||||
.list = tvhdhomerun_device_class_override_enum,
|
||||
.off = offsetof(tvhdhomerun_device_t, hd_type),
|
||||
},
|
||||
|
@ -229,8 +262,7 @@ static void tvhdhomerun_device_create(struct hdhomerun_discover_device_t *dInfo)
|
|||
int j, save = 0;
|
||||
struct hdhomerun_device_t *hdhomerun_tuner;
|
||||
dvb_fe_type_t type = DVB_TYPE_C;
|
||||
|
||||
|
||||
struct in_addr ip_addr;
|
||||
|
||||
tvhdhomerun_device_calc_uuid(&uuid, dInfo->device_id);
|
||||
|
||||
|
@ -281,11 +313,8 @@ static void tvhdhomerun_device_create(struct hdhomerun_discover_device_t *dInfo)
|
|||
char fName[128];
|
||||
snprintf(fName, 128, "HDHomeRun(%08X)",dInfo->device_id);
|
||||
|
||||
char buffer[32];
|
||||
char *ipInt = (char*)&dInfo->ip_addr;
|
||||
sprintf(buffer, "%u.%u.%u.%u", ipInt[3],ipInt[2],ipInt[1],ipInt[0]);
|
||||
|
||||
hd->hd_info.ip_address = strdup(buffer);
|
||||
ip_addr.s_addr = htonl(dInfo->ip_addr);
|
||||
hd->hd_info.ip_address = strdup(inet_ntoa(ip_addr));
|
||||
hd->hd_info.uuid = strdup(uuid.hex);
|
||||
hd->hd_info.friendlyname = strdup(fName);
|
||||
|
||||
|
|
|
@ -546,7 +546,7 @@ tvhdhomerun_frontend_create(tvhdhomerun_device_t *hd, struct hdhomerun_discover_
|
|||
else if (type == DVB_TYPE_C)
|
||||
idc = &tvhdhomerun_frontend_dvbc_class;
|
||||
else if (type == DVB_TYPE_ATSC) {
|
||||
idc = &tvhdhomerun_frontend_atsc_class;
|
||||
idc = &tvhdhomerun_frontend_atsc_class;
|
||||
} else {
|
||||
tvherror("stvhdhomerun", "unknown FE type %d", type);
|
||||
return NULL;
|
||||
|
|
|
@ -61,7 +61,6 @@ static struct hdhomerun_debug_t* hdhomerun_debug_obj = 0;
|
|||
struct tvhdhomerun_device_info
|
||||
{
|
||||
char *ip_address; /* IP address */
|
||||
uint32_t device_id;
|
||||
char *friendlyname;
|
||||
char *deviceModel;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue