mirror of
https://github.com/Silicondust/libhdhomerun
synced 2025-08-21 05:53:29 -07:00
speed up hdhomerun_device_selector by not requiring it to wait for full discover timeout
This commit is contained in:
parent
79be355cc7
commit
476568c2da
1 changed files with 9 additions and 15 deletions
|
@ -125,16 +125,13 @@ struct hdhomerun_device_t *hdhomerun_device_selector_find_device(struct hdhomeru
|
||||||
|
|
||||||
static int hdhomerun_device_selector_load_from_str_discover(struct hdhomerun_device_selector_t *hds, uint32_t target_ip, uint32_t device_id)
|
static int hdhomerun_device_selector_load_from_str_discover(struct hdhomerun_device_selector_t *hds, uint32_t target_ip, uint32_t device_id)
|
||||||
{
|
{
|
||||||
struct hdhomerun_discover_device_t result_list[64];
|
struct hdhomerun_discover_device_t result;
|
||||||
int discover_count = hdhomerun_discover_find_devices_custom_v2(target_ip, HDHOMERUN_DEVICE_TYPE_TUNER, device_id, result_list, 64);
|
int discover_count = hdhomerun_discover_find_devices_custom_v2(target_ip, HDHOMERUN_DEVICE_TYPE_TUNER, device_id, &result, 1);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int result_index;
|
|
||||||
struct hdhomerun_discover_device_t *result = result_list;
|
|
||||||
for (result_index = 0; result_index < discover_count; result_index++) {
|
|
||||||
unsigned int tuner_index;
|
unsigned int tuner_index;
|
||||||
for (tuner_index = 0; tuner_index < result->tuner_count; tuner_index++) {
|
for (tuner_index = 0; tuner_index < result.tuner_count; tuner_index++) {
|
||||||
struct hdhomerun_device_t *hd = hdhomerun_device_create(result->device_id, result->ip_addr, tuner_index, hds->dbg);
|
struct hdhomerun_device_t *hd = hdhomerun_device_create(result.device_id, result.ip_addr, tuner_index, hds->dbg);
|
||||||
if (!hd) {
|
if (!hd) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -143,9 +140,6 @@ static int hdhomerun_device_selector_load_from_str_discover(struct hdhomerun_dev
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue