diff --git a/src/sectionsd/dmxapi.cpp b/src/sectionsd/dmxapi.cpp index 933ae2881..fdcfc1923 100644 --- a/src/sectionsd/dmxapi.cpp +++ b/src/sectionsd/dmxapi.cpp @@ -32,6 +32,7 @@ #include +#ifndef DO_NOT_INCLUDE_STUFF_NOT_NEEDED_FOR_SECTIONSD bool setfilter(const int fd, const uint16_t pid, const uint8_t filter, const uint8_t mask, const uint32_t flags) { struct dmx_sct_filter_params flt; @@ -51,6 +52,7 @@ bool setfilter(const int fd, const uint16_t pid, const uint8_t filter, const uin } return true; } +#endif struct SI_section_TOT_header { @@ -80,7 +82,9 @@ __attribute__ ((packed)); /* 8 bytes */ cDemux * dmxUTC; bool getUTC(UTC_t * const UTC, const bool TDT) { - struct dmx_sct_filter_params flt; + unsigned char filter[DMX_FILTER_SIZE]; + unsigned char mask[DMX_FILTER_SIZE]; + int timeout; struct SI_section_TDT_header tdt_tot_header; char cUTC[5]; bool ret = true; @@ -90,15 +94,15 @@ bool getUTC(UTC_t * const UTC, const bool TDT) dmxUTC->Open(DMX_PSI_CHANNEL); } - memset(&flt, 0, sizeof(struct dmx_sct_filter_params)); + memset(&filter, 0, DMX_FILTER_SIZE); + memset(&mask, 0, DMX_FILTER_SIZE); - flt.pid = 0x0014; - flt.filter.filter[0] = TDT ? 0x70 : 0x73; - flt.filter.mask [0] = 0xFF; - flt.timeout = 31000; - flt.flags = TDT ? (DMX_ONESHOT | DMX_IMMEDIATE_START) : (DMX_ONESHOT | DMX_CHECK_CRC | DMX_IMMEDIATE_START); + filter[0] = TDT ? 0x70 : 0x73; + mask [0] = 0xFF; + timeout = 31000; +// flags = TDT ? (DMX_ONESHOT | DMX_IMMEDIATE_START) : (DMX_ONESHOT | DMX_CHECK_CRC | DMX_IMMEDIATE_START); - dmxUTC->sectionFilter(flt.pid, flt.filter.filter, flt.filter.mask, 5, flt.timeout); + dmxUTC->sectionFilter(0x0014, filter, mask, 5, timeout); if(dmxUTC->Read((unsigned char *) &tdt_tot_header, sizeof(tdt_tot_header)) != sizeof(tdt_tot_header)) { perror("[sectionsd] getUTC: read"); diff --git a/src/sectionsd/sectionsd.cpp b/src/sectionsd/sectionsd.cpp index acfa1cb64..d38c97a8f 100644 --- a/src/sectionsd/sectionsd.cpp +++ b/src/sectionsd/sectionsd.cpp @@ -6861,11 +6861,7 @@ static void *timeThread(void *) static cDemux * eitDmx; int eit_set_update_filter(int *fd) { - struct dmx_sct_filter_params dsfp; - memset((void*)&dsfp, 0, sizeof(dsfp)); - dprintf("eit_set_update_filter\n"); - bzero(&dsfp, sizeof(struct dmx_sct_filter_params)); unsigned char cur_eit = dmxCN.get_eit_version(); /* tone down to dprintf later */ @@ -6886,26 +6882,31 @@ int eit_set_update_filter(int *fd) eitDmx->Open(DMX_PSI_CHANNEL); } - dsfp.filter.filter[0] = 0x4e; /* table_id */ - dsfp.filter.filter[1] = (unsigned char)(messaging_current_servicekey >> 8); - dsfp.filter.filter[2] = (unsigned char)messaging_current_servicekey; + unsigned char filter[DMX_FILTER_SIZE]; + unsigned char mask[DMX_FILTER_SIZE]; + unsigned char mode[DMX_FILTER_SIZE]; + memset(&filter, 0, DMX_FILTER_SIZE); + memset(&mask, 0, DMX_FILTER_SIZE); + memset(&mode, 0, DMX_FILTER_SIZE); - dsfp.filter.mask[0] = 0xFF; - dsfp.filter.mask[1] = 0xFF; - dsfp.filter.mask[2] = 0xFF; + filter[0] = 0x4e; /* table_id */ + filter[1] = (unsigned char)(messaging_current_servicekey >> 8); + filter[2] = (unsigned char)messaging_current_servicekey; - dsfp.flags = DMX_CHECK_CRC | DMX_IMMEDIATE_START; - dsfp.pid = 0x12; - dsfp.timeout = 0; + mask[0] = 0xFF; + mask[1] = 0xFF; + mask[2] = 0xFF; + + int timeout = 0; #if 0 - dsfp.filter.filter[3] = (cur_eit << 1) | 0x01; - dsfp.filter.mask[3] = (0x1F << 1) | 0x01; - dsfp.filter.mode[3] = 0x1F << 1; - eitDmx->sectionFilter(dsfp.pid, dsfp.filter.filter, dsfp.filter.mask, 4, dsfp.timeout, dsfp.filter.mode); + filter[3] = (cur_eit << 1) | 0x01; + mask[3] = (0x1F << 1) | 0x01; + mode[3] = 0x1F << 1; + eitDmx->sectionFilter(0x12, filter, mask, 4, timeout, mode); #else - dsfp.filter.filter[3] = (((cur_eit + 1) & 0x01) << 1) | 0x01; - dsfp.filter.mask[3] = (0x01 << 1) | 0x01; - eitDmx->sectionFilter(dsfp.pid, dsfp.filter.filter, dsfp.filter.mask, 4, dsfp.timeout, NULL); + filter[3] = (((cur_eit + 1) & 0x01) << 1) | 0x01; + mask[3] = (0x01 << 1) | 0x01; + eitDmx->sectionFilter(0x12, filter, mask, 4, timeout, NULL); #endif //printf("[sectionsd] start EIT update filter: current version %02X, filter %02X %02X %02X %02X, mask %02X mode %02X \n", cur_eit, dsfp.filter.filter[0], dsfp.filter.filter[1], dsfp.filter.filter[2], dsfp.filter.filter[3], dsfp.filter.mask[3], dsfp.filter.mode[3]);