From 06ab9d186b2f7f770907d626fea9d64333efe542 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 9 Aug 2015 17:54:31 +0200 Subject: [PATCH] eitd: add and move viasat to extra switch --- src/eitd/dmx.cpp | 19 +++++++++++++++---- src/eitd/sectionsd.cpp | 15 ++++++++++++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/eitd/dmx.cpp b/src/eitd/dmx.cpp index aa6612468..184bf25f1 100644 --- a/src/eitd/dmx.cpp +++ b/src/eitd/dmx.cpp @@ -271,8 +271,14 @@ int DMX::getSection(uint8_t *buf, const unsigned timeoutInMSeconds, int &timeout eit_extended_section_header *eit_extended_header; + bool use_viasat_epg_pid = false; +#ifdef ENABLE_VIASATEPG + if (pID == 0x39) + use_viasat_epg_pid = true; +#endif + /* filter == 0 && maks == 0 => EIT dummy filter to slow down EIT thread startup */ - if ((pID == 0x12 || pID == 0x39) && filters[filter_index].filter == 0 && filters[filter_index].mask == 0) + if ((pID == 0x12 || use_viasat_epg_pid) && filters[filter_index].filter == 0 && filters[filter_index].mask == 0) { //dprintf("dmx: dummy filter, sleeping for %d ms\n", timeoutInMSeconds); usleep(timeoutInMSeconds * 1000); @@ -392,7 +398,7 @@ int DMX::getSection(uint8_t *buf, const unsigned timeoutInMSeconds, int &timeout unsigned short current_tsid = 0; uint8_t segment_last_section_number = last_section_number; - if (pID == 0x12 || pID == 0x39) { + if (pID == 0x12 || use_viasat_epg_pid) { eit_extended_header = (eit_extended_section_header *)(buf+8); current_onid = eit_extended_header->original_network_id_hi * 256 + eit_extended_header->original_network_id_lo; @@ -404,7 +410,7 @@ int DMX::getSection(uint8_t *buf, const unsigned timeoutInMSeconds, int &timeout sections_id_t s_id = create_sections_id(table_id, eh_tbl_extension_id, current_onid, current_tsid, section_number); bool complete = false; - if (pID == 0x12 || pID == 0x39) + if (pID == 0x12 || use_viasat_epg_pid) complete = check_complete(s_id, section_number, last_section_number, segment_last_section_number); /* if we are not caching the already read sections (CN-thread), check EIT version and get out */ @@ -647,7 +653,12 @@ int DMX::change(const int new_filter_index, const t_channel_id new_current_servi } if (sections_debug) { // friendly debug output... - if((pID==0x12 || pID==0x39) && filters[0].filter != 0x4e) { // Only EIT + bool use_viasat_epg_pid = false; +#ifdef ENABLE_VIASATEPG + if (pID == 0x39) + use_viasat_epg_pid = true; +#endif + if((pID==0x12 || use_viasat_epg_pid) && filters[0].filter != 0x4e) { // Only EIT printdate_ms(stderr); fprintf(stderr, "changeDMX [EIT]-> %d (0x%x/0x%x) %s (%ld seconds)\n", new_filter_index, filters[new_filter_index].filter, diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index b682be9fe..3df08603a 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -132,8 +132,11 @@ OpenThreads::Mutex filter_mutex; static CTimeThread threadTIME; static CEitThread threadEIT; static CCNThread threadCN; + +#ifdef ENABLE_VIASATEPG // ViaSAT uses pid 0x39 instead of 0x12 static CEitThread threadVSEIT("viasatThread", 0x39); +#endif #ifdef ENABLE_FREESATEPG static CFreeSatThread threadFSEIT; @@ -838,7 +841,10 @@ static void wakeupAll() { threadCN.change(0); threadEIT.change(0); +#ifdef ENABLE_VIASATEPG threadVSEIT.change(0); +#endif + #ifdef ENABLE_FREESATEPG threadFSEIT.change(0); #endif @@ -961,7 +967,9 @@ static void commandserviceChanged(int connfd, char *data, const unsigned dataLen threadCN.setCurrentService(messaging_current_servicekey); threadEIT.setDemux(cmd->dnum); threadEIT.setCurrentService(uniqueServiceKey /*messaging_current_servicekey*/); +#ifdef ENABLE_VIASATEPG threadVSEIT.setCurrentService(messaging_current_servicekey); +#endif #ifdef ENABLE_FREESATEPG threadFSEIT.setCurrentService(messaging_current_servicekey); #endif @@ -2225,7 +2233,9 @@ printf("SIevent size: %d\n", (int)sizeof(SIevent)); threadTIME.Start(); threadEIT.Start(); threadCN.Start(); +#ifdef ENABLE_VIASATEPG threadVSEIT.Start(); +#endif #ifdef ENABLE_FREESATEPG threadFSEIT.Start(); @@ -2264,7 +2274,9 @@ printf("SIevent size: %d\n", (int)sizeof(SIevent)); threadEIT.StopRun(); threadCN.StopRun(); threadTIME.StopRun(); +#ifdef ENABLE_VIASATEPG threadVSEIT.StopRun(); +#endif #ifdef ENABLE_SDT threadSDT.StopRun(); #endif @@ -2288,9 +2300,10 @@ printf("SIevent size: %d\n", (int)sizeof(SIevent)); xprintf("join CN\n"); threadCN.Stop(); - +#ifdef ENABLE_VIASATEPG xprintf("join VSEIT\n"); threadVSEIT.Stop(); +#endif #ifdef ENABLE_SDT xprintf("join SDT\n");