Permalink
Browse files

update libhdhomerun to 20170930

  • Loading branch information...
jason-bean committed Mar 8, 2018
1 parent a6b6219 commit f673d13fe6d68dd9220ac8f284cf903ccd20c3fe
Showing with 2,023 additions and 999 deletions.
  1. +3 −3 native/so/HDHomeRun2.0/HDHRDevice.cpp
  2. +1 −1 native/so/HDHomeRun2.0/sage_HDHomeRun.cpp
  3. +504 −0 third_party/SiliconDust/libhdhomerun/LICENSE
  4. +1 −1 third_party/SiliconDust/libhdhomerun/Makefile
  5. +12 −0 third_party/SiliconDust/libhdhomerun/README.md
  6. +9 −2 third_party/SiliconDust/libhdhomerun/hdhomerun_channels.c
  7. +18 −18 third_party/SiliconDust/libhdhomerun/hdhomerun_channels.h
  8. +18 −18 third_party/SiliconDust/libhdhomerun/hdhomerun_channelscan.c
  9. +6 −6 third_party/SiliconDust/libhdhomerun/hdhomerun_channelscan.h
  10. +18 −26 third_party/SiliconDust/libhdhomerun/hdhomerun_config.c
  11. +30 −28 third_party/SiliconDust/libhdhomerun/hdhomerun_control.c
  12. +14 −14 third_party/SiliconDust/libhdhomerun/hdhomerun_control.h
  13. +95 −84 third_party/SiliconDust/libhdhomerun/hdhomerun_debug.c
  14. +12 −12 third_party/SiliconDust/libhdhomerun/hdhomerun_debug.h
  15. +22 −17 third_party/SiliconDust/libhdhomerun/hdhomerun_device.c
  16. +66 −66 third_party/SiliconDust/libhdhomerun/hdhomerun_device.h
  17. +40 −42 third_party/SiliconDust/libhdhomerun/hdhomerun_device_selector.c
  18. +13 −12 third_party/SiliconDust/libhdhomerun/hdhomerun_device_selector.h
  19. +110 −46 third_party/SiliconDust/libhdhomerun/hdhomerun_discover.c
  20. +14 −11 third_party/SiliconDust/libhdhomerun/hdhomerun_discover.h
  21. +2 −14 third_party/SiliconDust/libhdhomerun/hdhomerun_os.h
  22. +162 −28 third_party/SiliconDust/libhdhomerun/hdhomerun_os_posix.c
  23. +34 −13 third_party/SiliconDust/libhdhomerun/hdhomerun_os_posix.h
  24. +85 −43 third_party/SiliconDust/libhdhomerun/hdhomerun_os_windows.c
  25. +49 −40 third_party/SiliconDust/libhdhomerun/hdhomerun_os_windows.h
  26. +1 −1 third_party/SiliconDust/libhdhomerun/hdhomerun_pkt.c
  27. +21 −17 third_party/SiliconDust/libhdhomerun/hdhomerun_pkt.h
  28. +24 −20 third_party/SiliconDust/libhdhomerun/hdhomerun_sock.h
  29. +255 −162 third_party/SiliconDust/libhdhomerun/hdhomerun_sock_posix.c
  30. +273 −194 third_party/SiliconDust/libhdhomerun/hdhomerun_sock_windows.c
  31. +9 −9 third_party/SiliconDust/libhdhomerun/hdhomerun_types.h
  32. +86 −40 third_party/SiliconDust/libhdhomerun/hdhomerun_video.c
  33. +16 −11 third_party/SiliconDust/libhdhomerun/hdhomerun_video.h
@@ -126,7 +126,7 @@ bool HDHRDevice::validate()
{
if(mDeviceInfo.device_id != 0) {
struct hdhomerun_discover_device_t deviceInfo;
bool_t valid = hdhomerun_discover_validate_device_id(mDeviceInfo.device_id);
bool valid = hdhomerun_discover_validate_device_id(mDeviceInfo.device_id);
bool done = false;
// if validation fails, give it a few seconds to come back
@@ -137,7 +137,7 @@ bool HDHRDevice::validate()
do {
// -1 = error, 0 = none found, else number of devices found (max 1 here)
result = hdhomerun_discover_find_devices_custom(0, HDHOMERUN_DEVICE_TYPE_TUNER, mDeviceInfo.device_id, &deviceInfo, 1);
result = hdhomerun_discover_find_devices_custom_v2(0, HDHOMERUN_DEVICE_TYPE_TUNER, mDeviceInfo.device_id, &deviceInfo, 1);
// flog( "Native.log", "hdhomerun_discover_find_device(%08lx) returned %d\r\n", mDeviceInfo.device_id, result);
if(result == -1) return false;
@@ -280,7 +280,7 @@ int HDHRDevice::setTuning(SageTuningParams *params)
sprintf(channelSetting, "auto%d%c:%ld", bandwidth, cable ? 'c' : 't', channel);
} else
{
sprintf(channelSetting, "auto:%ld", mTuningParams.tuningFrequency );
sprintf(channelSetting, "%" PRIu32, mTuningParams.tuningFrequency );
}
flog( "Native.log", "HDHRDevice::setTuning: channel %s\r\n", channelSetting);
@@ -217,7 +217,7 @@ static void DiscoverNewDevices(JNIEnv *env)
pthread_mutex_unlock(&gInputListLock);
}
count = hdhomerun_discover_find_devices_custom(0, HDHOMERUN_DEVICE_TYPE_TUNER, HDHOMERUN_DEVICE_ID_WILDCARD, list, 64);
count = hdhomerun_discover_find_devices_custom_v2(0, HDHOMERUN_DEVICE_TYPE_TUNER, HDHOMERUN_DEVICE_ID_WILDCARD, list, 64);
if(count < 0) {
sysOutPrint(env, "Error discovering new HDHR devices! (%d)\n", count);
return;

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -14,7 +14,7 @@ LIBSRCS += hdhomerun_video.c
CC := $(CROSS_COMPILE)gcc
STRIP := $(CROSS_COMPILE)strip
CFLAGS += -Wall -O2 -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
CFLAGS += -O2 -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wno-unused-parameter
LDFLAGS += -lpthread
SHARED = -shared -Wl,-soname,libhdhomerun$(LIBEXT)
@@ -0,0 +1,12 @@
Copyright © 2005-2017 Silicondust USA Inc. <www.silicondust.com>.
This library implements the libhdhomerun protocol for use with Silicondust HDHomeRun TV tuners.
To compile simply "make" - this will compile both the library and the hdhomerun_config command line
utility suitable for sending commands or scripting control of a HDHomeRun.
The top level API is hdhomerun_device - see hdhomerun_device.h for documentation.
Additional libraries required:
- pthread (osx, linux, bsd)
- iphlpapi (windows)
@@ -1,7 +1,7 @@
/*
* hdhomerun_channels.c
*
* Copyright © 2007-2008 Silicondust USA Inc. <www.silicondust.com>.
* Copyright © 2007-2014 Silicondust USA Inc. <www.silicondust.com>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -83,6 +83,13 @@ static const struct hdhomerun_channelmap_range_t hdhomerun_channelmap_range_jp_b
{ 0, 0, 0, 0}
};
/* TW antenna channels. */
static const struct hdhomerun_channelmap_range_t hdhomerun_channelmap_range_tw_bcast[] = {
{ 7, 13, 177000000, 6000000},
{ 14, 69, 473000000, 6000000},
{ 0, 0, 0, 0}
};
/* US antenna channels. */
static const struct hdhomerun_channelmap_range_t hdhomerun_channelmap_range_us_bcast[] = {
{ 2, 4, 57000000, 6000000},
@@ -136,7 +143,7 @@ static const struct hdhomerun_channelmap_record_t hdhomerun_channelmap_table[] =
{"au-cable", hdhomerun_channelmap_range_eu_cable, "au-cable", "AU"},
{"eu-bcast", hdhomerun_channelmap_range_eu_bcast, "eu-bcast", NULL},
{"eu-cable", hdhomerun_channelmap_range_eu_cable, "eu-cable", NULL},
{"tw-bcast", hdhomerun_channelmap_range_us_bcast, "tw-bcast", "TW"},
{"tw-bcast", hdhomerun_channelmap_range_tw_bcast, "tw-bcast", "TW"},
{"tw-cable", hdhomerun_channelmap_range_us_cable, "tw-cable", "TW"},
{"kr-bcast", hdhomerun_channelmap_range_us_bcast, "kr-bcast", "KR"},
@@ -1,7 +1,7 @@
/*
* hdhomerun_channels.h
*
* Copyright © 2007-2008 Silicondust USA Inc. <www.silicondust.com>.
* Copyright © 2007-2015 Silicondust USA Inc. <www.silicondust.com>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -25,27 +25,27 @@ extern "C" {
struct hdhomerun_channel_entry_t;
struct hdhomerun_channel_list_t;
extern LIBTYPE const char *hdhomerun_channelmap_get_channelmap_from_country_source(const char *countrycode, const char *source, const char *supported);
extern LIBTYPE const char *hdhomerun_channelmap_get_channelmap_scan_group(const char *channelmap);
extern LIBHDHOMERUN_API const char *hdhomerun_channelmap_get_channelmap_from_country_source(const char *countrycode, const char *source, const char *supported);
extern LIBHDHOMERUN_API const char *hdhomerun_channelmap_get_channelmap_scan_group(const char *channelmap);
extern LIBTYPE uint16_t hdhomerun_channel_entry_channel_number(struct hdhomerun_channel_entry_t *entry);
extern LIBTYPE uint32_t hdhomerun_channel_entry_frequency(struct hdhomerun_channel_entry_t *entry);
extern LIBTYPE const char *hdhomerun_channel_entry_name(struct hdhomerun_channel_entry_t *entry);
extern LIBHDHOMERUN_API uint16_t hdhomerun_channel_entry_channel_number(struct hdhomerun_channel_entry_t *entry);
extern LIBHDHOMERUN_API uint32_t hdhomerun_channel_entry_frequency(struct hdhomerun_channel_entry_t *entry);
extern LIBHDHOMERUN_API const char *hdhomerun_channel_entry_name(struct hdhomerun_channel_entry_t *entry);
extern LIBTYPE struct hdhomerun_channel_list_t *hdhomerun_channel_list_create(const char *channelmap);
extern LIBTYPE void hdhomerun_channel_list_destroy(struct hdhomerun_channel_list_t *channel_list);
extern LIBHDHOMERUN_API struct hdhomerun_channel_list_t *hdhomerun_channel_list_create(const char *channelmap);
extern LIBHDHOMERUN_API void hdhomerun_channel_list_destroy(struct hdhomerun_channel_list_t *channel_list);
extern LIBTYPE struct hdhomerun_channel_entry_t *hdhomerun_channel_list_first(struct hdhomerun_channel_list_t *channel_list);
extern LIBTYPE struct hdhomerun_channel_entry_t *hdhomerun_channel_list_last(struct hdhomerun_channel_list_t *channel_list);
extern LIBTYPE struct hdhomerun_channel_entry_t *hdhomerun_channel_list_next(struct hdhomerun_channel_list_t *channel_list, struct hdhomerun_channel_entry_t *entry);
extern LIBTYPE struct hdhomerun_channel_entry_t *hdhomerun_channel_list_prev(struct hdhomerun_channel_list_t *channel_list, struct hdhomerun_channel_entry_t *entry);
extern LIBTYPE uint32_t hdhomerun_channel_list_total_count(struct hdhomerun_channel_list_t *channel_list);
extern LIBTYPE uint32_t hdhomerun_channel_list_frequency_count(struct hdhomerun_channel_list_t *channel_list);
extern LIBHDHOMERUN_API struct hdhomerun_channel_entry_t *hdhomerun_channel_list_first(struct hdhomerun_channel_list_t *channel_list);
extern LIBHDHOMERUN_API struct hdhomerun_channel_entry_t *hdhomerun_channel_list_last(struct hdhomerun_channel_list_t *channel_list);
extern LIBHDHOMERUN_API struct hdhomerun_channel_entry_t *hdhomerun_channel_list_next(struct hdhomerun_channel_list_t *channel_list, struct hdhomerun_channel_entry_t *entry);
extern LIBHDHOMERUN_API struct hdhomerun_channel_entry_t *hdhomerun_channel_list_prev(struct hdhomerun_channel_list_t *channel_list, struct hdhomerun_channel_entry_t *entry);
extern LIBHDHOMERUN_API uint32_t hdhomerun_channel_list_total_count(struct hdhomerun_channel_list_t *channel_list);
extern LIBHDHOMERUN_API uint32_t hdhomerun_channel_list_frequency_count(struct hdhomerun_channel_list_t *channel_list);
extern LIBTYPE uint32_t hdhomerun_channel_frequency_round(uint32_t frequency, uint32_t resolution);
extern LIBTYPE uint32_t hdhomerun_channel_frequency_round_normal(uint32_t frequency);
extern LIBTYPE uint32_t hdhomerun_channel_number_to_frequency(struct hdhomerun_channel_list_t *channel_list, uint16_t channel_number);
extern LIBTYPE uint16_t hdhomerun_channel_frequency_to_number(struct hdhomerun_channel_list_t *channel_list, uint32_t frequency);
extern LIBHDHOMERUN_API uint32_t hdhomerun_channel_frequency_round(uint32_t frequency, uint32_t resolution);
extern LIBHDHOMERUN_API uint32_t hdhomerun_channel_frequency_round_normal(uint32_t frequency);
extern LIBHDHOMERUN_API uint32_t hdhomerun_channel_number_to_frequency(struct hdhomerun_channel_list_t *channel_list, uint16_t channel_number);
extern LIBHDHOMERUN_API uint16_t hdhomerun_channel_frequency_to_number(struct hdhomerun_channel_list_t *channel_list, uint32_t frequency);
#ifdef __cplusplus
}
@@ -1,7 +1,7 @@
/*
* hdhomerun_channelscan.c
*
* Copyright © 2007-2010 Silicondust USA Inc. <www.silicondust.com>.
* Copyright © 2007-2015 Silicondust USA Inc. <www.silicondust.com>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -127,10 +127,10 @@ static void channelscan_extract_name(struct hdhomerun_channelscan_program_t *pro
program->name[length] = 0;
}
static int channelscan_detect_programs(struct hdhomerun_channelscan_t *scan, struct hdhomerun_channelscan_result_t *result, bool_t *pchanged, bool_t *pincomplete)
static int channelscan_detect_programs(struct hdhomerun_channelscan_t *scan, struct hdhomerun_channelscan_result_t *result, bool *pchanged, bool *pincomplete)
{
*pchanged = FALSE;
*pincomplete = FALSE;
*pchanged = false;
*pincomplete = false;
char *streaminfo;
int ret = hdhomerun_device_get_tuner_streaminfo(scan->hd, &streaminfo);
@@ -152,15 +152,15 @@ static int channelscan_detect_programs(struct hdhomerun_channelscan_t *scan, str
unsigned int transport_stream_id;
if (sscanf(line, "tsid=0x%x", &transport_stream_id) == 1) {
result->transport_stream_id = transport_stream_id;
result->transport_stream_id_detected = TRUE;
result->transport_stream_id = (uint16_t)transport_stream_id;
result->transport_stream_id_detected = true;
continue;
}
unsigned int original_network_id;
if (sscanf(line, "onid=0x%x", &original_network_id) == 1) {
result->original_network_id = original_network_id;
result->original_network_id_detected = TRUE;
result->original_network_id = (uint16_t)original_network_id;
result->original_network_id_detected = true;
continue;
}
@@ -182,9 +182,9 @@ static int channelscan_detect_programs(struct hdhomerun_channelscan_t *scan, str
virtual_minor = 0;
}
program.program_number = program_number;
program.virtual_major = virtual_major;
program.virtual_minor = virtual_minor;
program.program_number = (uint16_t)program_number;
program.virtual_major = (uint16_t)virtual_major;
program.virtual_minor = (uint16_t)virtual_minor;
channelscan_extract_name(&program, line);
@@ -194,28 +194,28 @@ static int channelscan_detect_programs(struct hdhomerun_channelscan_t *scan, str
program.type = HDHOMERUN_CHANNELSCAN_PROGRAM_ENCRYPTED;
} else if (strstr(line, "(no data)")) {
program.type = HDHOMERUN_CHANNELSCAN_PROGRAM_NODATA;
*pincomplete = TRUE;
*pincomplete = true;
} else {
program.type = HDHOMERUN_CHANNELSCAN_PROGRAM_NORMAL;
if ((program.virtual_major == 0) || (program.name[0] == 0)) {
*pincomplete = TRUE;
*pincomplete = true;
}
}
if (memcmp(&result->programs[program_count], &program, sizeof(program)) != 0) {
memcpy(&result->programs[program_count], &program, sizeof(program));
*pchanged = TRUE;
*pchanged = true;
}
program_count++;
}
if (program_count == 0) {
*pincomplete = TRUE;
*pincomplete = true;
}
if (result->program_count != program_count) {
result->program_count = program_count;
*pchanged = TRUE;
*pchanged = true;
}
return 1;
@@ -282,7 +282,7 @@ int channelscan_detect(struct hdhomerun_channelscan_t *scan, struct hdhomerun_ch
uint64_t complete_time = getcurrenttime() + 1000;
while (1) {
bool_t changed, incomplete;
bool changed, incomplete;
ret = channelscan_detect_programs(scan, result, &changed, &incomplete);
if (ret <= 0) {
return ret;
@@ -343,5 +343,5 @@ uint8_t channelscan_get_progress(struct hdhomerun_channelscan_t *scan)
}
}
return scan->scanned_channels * 100 / (scan->scanned_channels + channels_remaining);
return (uint8_t) (scan->scanned_channels * 100 / (scan->scanned_channels + channels_remaining));
}
@@ -1,7 +1,7 @@
/*
* hdhomerun_channelscan.h
*
* Copyright © 2007-2008 Silicondust USA Inc. <www.silicondust.com>.
* Copyright © 2007-2015 Silicondust USA Inc. <www.silicondust.com>.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -29,12 +29,12 @@ extern "C" {
struct hdhomerun_channelscan_t;
extern LIBTYPE struct hdhomerun_channelscan_t *channelscan_create(struct hdhomerun_device_t *hd, const char *channelmap);
extern LIBTYPE void channelscan_destroy(struct hdhomerun_channelscan_t *scan);
extern LIBHDHOMERUN_API struct hdhomerun_channelscan_t *channelscan_create(struct hdhomerun_device_t *hd, const char *channelmap);
extern LIBHDHOMERUN_API void channelscan_destroy(struct hdhomerun_channelscan_t *scan);
extern LIBTYPE int channelscan_advance(struct hdhomerun_channelscan_t *scan, struct hdhomerun_channelscan_result_t *result);
extern LIBTYPE int channelscan_detect(struct hdhomerun_channelscan_t *scan, struct hdhomerun_channelscan_result_t *result);
extern LIBTYPE uint8_t channelscan_get_progress(struct hdhomerun_channelscan_t *scan);
extern LIBHDHOMERUN_API int channelscan_advance(struct hdhomerun_channelscan_t *scan, struct hdhomerun_channelscan_result_t *result);
extern LIBHDHOMERUN_API int channelscan_detect(struct hdhomerun_channelscan_t *scan, struct hdhomerun_channelscan_result_t *result);
extern LIBHDHOMERUN_API uint8_t channelscan_get_progress(struct hdhomerun_channelscan_t *scan);
#ifdef __cplusplus
}
Oops, something went wrong.

0 comments on commit f673d13

Please sign in to comment.