unused and alignas macros

This commit is contained in:
nickkelsey 2018-10-27 13:03:54 -07:00
commit 9719cbc7a5
4 changed files with 33 additions and 9 deletions

View file

@ -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"},

View file

@ -53,6 +53,10 @@ typedef struct {
#define LIBHDHOMERUN_API
#if !defined(alignas)
#define alignas(n) __attribute__((aligned(n)))
#endif
#ifdef __cplusplus
extern "C" {
#endif

View file

@ -56,6 +56,14 @@
#define LIBHDHOMERUN_API
#endif
#if !defined(__unused)
#define __unused __pragma(warning(suppress: 4100 4101))
#endif
#if !defined(alignas) && !defined(__cplusplus)
#define alignas(n) __declspec(align(n))
#endif
typedef void (*sig_t)(int);
typedef void (*thread_task_func_t)(void *arg);
typedef HANDLE thread_task_t;

View file

@ -183,15 +183,23 @@ void hdhomerun_video_leave_multicast_group(struct hdhomerun_video_sock_t *vs, ui
static void hdhomerun_video_stats_ts_pkt(struct hdhomerun_video_sock_t *vs, uint8_t *ptr)
{
uint16_t packet_identifier = ((uint16_t)(ptr[1] & 0x1F) << 8) | (uint16_t)ptr[2];
uint16_t packet_identifier;
packet_identifier = (uint16_t)(ptr[1] & 0x1F) << 8;
packet_identifier |= (uint16_t)ptr[2] << 0;
bool transport_error = (ptr[1] & 0x80) != 0;
if (transport_error) {
vs->transport_error_count++;
vs->sequence[packet_identifier] = 0xFF;
return;
}
if (packet_identifier == 0x1FFF) {
return;
}
bool transport_error = ptr[1] >> 7;
if (transport_error) {
vs->transport_error_count++;
vs->sequence[packet_identifier] = 0xFF;
bool payload_present = (ptr[3] & 0x10) != 0;
if (!payload_present) {
return;
}
@ -206,9 +214,6 @@ static void hdhomerun_video_stats_ts_pkt(struct hdhomerun_video_sock_t *vs, uint
if (sequence == ((previous_sequence + 1) & 0x0F)) {
return;
}
if (sequence == previous_sequence) {
return;
}
vs->sequence_error_count++;
}