diff --git a/lib/libdvbsub/dvbsub.cpp b/lib/libdvbsub/dvbsub.cpp index b573a31b5..ad67f055e 100644 --- a/lib/libdvbsub/dvbsub.cpp +++ b/lib/libdvbsub/dvbsub.cpp @@ -360,7 +360,6 @@ static void* dvbsub_thread(void* /*arg*/) gettimeofday(&now, NULL); - int ret = 0; now.tv_usec += (timeout == 0) ? 1000000 : timeout; // add the timeout while (now.tv_usec >= 1000000) { // take care of an overflow now.tv_sec++; @@ -370,7 +369,7 @@ static void* dvbsub_thread(void* /*arg*/) restartWait.tv_nsec = now.tv_usec * 1000; // nano seconds pthread_mutex_lock( &packetMutex ); - ret = pthread_cond_timedwait( &packetCond, &packetMutex, &restartWait ); + pthread_cond_timedwait( &packetCond, &packetMutex, &restartWait ); pthread_mutex_unlock( &packetMutex ); timeout = dvbSubtitleConverter->Action(); diff --git a/lib/libeventserver/eventserver.cpp b/lib/libeventserver/eventserver.cpp index 0ce98e244..c37f4dfda 100644 --- a/lib/libeventserver/eventserver.cpp +++ b/lib/libeventserver/eventserver.cpp @@ -102,12 +102,14 @@ bool CEventServer::sendEvent2Client(const unsigned int eventID, const initiators head.eventID = eventID; head.initiatorID = initiatorID; head.dataSize = eventbodysize; - int written = write(sock_fd, &head, sizeof(head)); + /*int written = */ + write(sock_fd, &head, sizeof(head)); // printf ("[eventserver]: sent 0x%x - following eventbody= %d\n", written, eventbodysize ); if(eventbodysize!=0) { - written = write(sock_fd, eventbody, eventbodysize); + /*written = */ + write(sock_fd, eventbody, eventbodysize); // printf ("[eventserver]: eventbody sent 0x%x - peventbody= %x eventbody= %x\n", written, (unsigned)eventbody, *(unsigned*)eventbody ); } close(sock_fd); diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index e36df5b2d..346210d4f 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -3383,8 +3383,6 @@ void ConfigMenu(int Init) void PageInput(int Number) { - int zoom = 0; - /* clear temp_page */ if (inputcounter == 2) temp_page = 0; @@ -3416,9 +3414,6 @@ void PageInput(int Number) CopyBB2FB(); } - if (zoommode == 1) - zoom = 1<<10; - PosY = StartY; switch (inputcounter) @@ -3915,7 +3910,7 @@ void SwitchScreenMode(int newscreenmode) { ClearFB(clearbbcolor); - int fw, fh, tx, ty, tw, th; + int fw, tx, ty, tw, th; if (screenmode==1) /* split with topmenu */ { @@ -3923,7 +3918,6 @@ void SwitchScreenMode(int newscreenmode) int w = CFrameBuffer::getInstance()->getScreenWidth(); int h = CFrameBuffer::getInstance()->getScreenHeight(); fw = fontwidth_topmenumain; - fh = fontheight; tx = 0; /* split means we start at the left edge */ sx = x; @@ -3951,7 +3945,6 @@ void SwitchScreenMode(int newscreenmode) { StartX = CFrameBuffer::getInstance()->getScreenX(); fw = fontwidth_small; - fh = fontheight; tx = TV169FULLSTARTX; ty = TV169FULLSTARTY; tw = TV169FULLWIDTH; @@ -4905,7 +4898,7 @@ void RenderCharLCDsmall(int Char, int XPos, int YPos) void RenderMessage(int Message) { int byte; - int fbcolor, timecolor, imenuatr; + int fbcolor, imenuatr; int pagecolumn; const char *msg; int national_subset_back = national_subset; @@ -4930,7 +4923,6 @@ void RenderMessage(int Message) /* set colors */ fbcolor = transp; - timecolor = transp<<4 | transp; imenuatr = ATR_MSG0; /* clear framebuffer */ diff --git a/lib/libupnpclient/UPNPDevice.cpp b/lib/libupnpclient/UPNPDevice.cpp index 8c23ac0a1..834f2ca8a 100644 --- a/lib/libupnpclient/UPNPDevice.cpp +++ b/lib/libupnpclient/UPNPDevice.cpp @@ -356,7 +356,7 @@ std::string CUPnPDevice::HTTP(std::string url, std::string post, std::string act std::string portname; std::string hostname; std::string path; - int port, t_socket, result, received; + int port, t_socket, received; std::stringstream command, reply; std::string commandstr, line; struct sockaddr_in socktcp; @@ -431,7 +431,7 @@ std::string CUPnPDevice::HTTP(std::string url, std::string post, std::string act } commandstr = command.str(); - result = send(t_socket, commandstr.c_str(), commandstr.size(), 0); + send(t_socket, commandstr.c_str(), commandstr.size(), 0); while ((received = recv(t_socket, buf, sizeof(buf)-1, 0)) > 0) { buf[received] = 0; diff --git a/src/daemonc/remotecontrol.cpp b/src/daemonc/remotecontrol.cpp index 54e220318..9ecd680ca 100644 --- a/src/daemonc/remotecontrol.cpp +++ b/src/daemonc/remotecontrol.cpp @@ -103,14 +103,14 @@ CRemoteControl::CRemoteControl() zap_completion_timeout = 0; current_EPGid = 0; - next_EPGid = 0; memset(¤t_PIDs.PIDs, 0, sizeof(current_PIDs.PIDs) ); has_ac3 = false; selected_subchannel = -1; needs_nvods = false; director_mode = 0; - current_programm_timer = 0; is_video_started = true; + //current_programm_timer = 0; + //next_EPGid = 0; } @@ -159,7 +159,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data current_channel_id = new_id; current_EPGid = 0; - next_EPGid = 0; + //next_EPGid = 0; memset(¤t_PIDs.PIDs, 0, sizeof(current_PIDs.PIDs) ); @@ -197,78 +197,82 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data } } - if ( msg == NeutrinoMessages::EVT_CURRENTEPG ) { + if ( msg == NeutrinoMessages::EVT_CURRENTEPG ) { CSectionsdClient::CurrentNextInfo* info_CN = (CSectionsdClient::CurrentNextInfo*) data; -//printf("[neutrino] got EVT_CURRENTEPG, uniqueKey %llx chid %llx flags %x\n", info_CN->current_uniqueKey, current_channel_id, info_CN->flags); -//printf("[neutrino] comparing: uniqueKey %llx chid %llx\n", info_CN->current_uniqueKey >> 16, current_channel_id & 0xFFFFFFFFFFFFULL); - if ( ( info_CN->current_uniqueKey >> 16) == (current_channel_id&0xFFFFFFFFFFFFULL)) +#if 0 + printf("[neutrino] EVT_CURRENTEPG: uniqueKey %llx chid %llx subid %llx flags %x\n", + info_CN->current_uniqueKey >> 16, current_channel_id & 0xFFFFFFFFFFFFULL, + current_sub_channel_id&0xFFFFFFFFFFFFULL, info_CN->flags); +#endif + t_channel_id chid = (info_CN->current_uniqueKey >> 16); + if(chid != (current_channel_id&0xFFFFFFFFFFFFULL) && chid != (current_sub_channel_id&0xFFFFFFFFFFFFULL)) + return messages_return::handled; + + /* current event came for current channel */ + if ( info_CN->current_uniqueKey != current_EPGid ) { -//printf("[neutrino] channel match\n"); - //CURRENT-EPG für den aktuellen Kanal bekommen!; - - if ( info_CN->current_uniqueKey != current_EPGid ) + if ( current_EPGid != 0 ) { -//printf("[neutrino] info_CN->current_uniqueKey != current_EPGid\n"); - if ( current_EPGid != 0 ) - { - // ist nur ein neues Programm, kein neuer Kanal - // PIDs neu holen - g_Zapit->getPIDS( current_PIDs ); - // APID Bearbeitung neu anstossen - has_unresolved_ctags = true; - // infobar indicate on epg change - g_InfoViewer->showEpgInfo(); - } - - current_EPGid= info_CN->current_uniqueKey; - - if ( has_unresolved_ctags ) - processAPIDnames(); - - if ( info_CN->flags & CSectionsdClient::epgflags::current_has_linkagedescriptors ) { -//printf("[neutrino] info_CN->flags have current_has_linkaged\n"); - subChannels.clear(); - getSubChannels(); - } - - if ( needs_nvods ) - getNVODs(); - - g_RCInput->killTimer( current_programm_timer ); - - time_t end_program= info_CN->current_zeit.startzeit+ info_CN->current_zeit.dauer; - current_programm_timer = g_RCInput->addTimer( &end_program ); + /* new event, not channel. get pids */ + g_Zapit->getPIDS( current_PIDs ); + has_unresolved_ctags = true; + // infobar indicate on epg change + g_InfoViewer->showEpgInfo(); } - // is_video_started is only false if channel is locked - if ((!is_video_started) && - (info_CN->current_fsk == 0 || g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED)) - g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x100, false); - else - g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, info_CN->current_fsk, false); + current_EPGid= info_CN->current_uniqueKey; + + if ( has_unresolved_ctags ) + processAPIDnames(); + + if ( info_CN->flags & CSectionsdClient::epgflags::current_has_linkagedescriptors ) { + subChannels.clear(); + getSubChannels(); + } + + if ( needs_nvods ) + getNVODs(); + +#if 0 + g_RCInput->killTimer( current_programm_timer ); + + time_t end_program= info_CN->current_zeit.startzeit+ info_CN->current_zeit.dauer; + current_programm_timer = g_RCInput->addTimer( &end_program ); +#endif } - return messages_return::handled; + + // is_video_started is only false if channel is locked + if ((!is_video_started) && + (info_CN->current_fsk == 0 || g_settings.parentallock_prompt == PARENTALLOCK_PROMPT_CHANGETOLOCKED)) + g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x100, false); + else + g_RCInput->postMsg(NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, info_CN->current_fsk, false); + return messages_return::handled; } else if ( msg == NeutrinoMessages::EVT_NEXTEPG ) { CSectionsdClient::CurrentNextInfo* info_CN = (CSectionsdClient::CurrentNextInfo*) data; + t_channel_id chid = (info_CN->next_uniqueKey >> 16); + if(chid != (current_channel_id&0xFFFFFFFFFFFFULL) && chid != (current_sub_channel_id&0xFFFFFFFFFFFFULL)) + return messages_return::handled; +#if 0 if ( ( info_CN->next_uniqueKey >> 16) == (current_channel_id&0xFFFFFFFFFFFFULL) ) { // next-EPG für den aktuellen Kanal bekommen, current ist leider net da?!; if ( info_CN->next_uniqueKey != next_EPGid ) { - next_EPGid= info_CN->next_uniqueKey; + next_EPGid = info_CN->next_uniqueKey; // timer setzen + g_RCInput->killTimer( current_programm_timer ); - g_RCInput->killTimer( current_programm_timer ); - - time_t end_program= info_CN->next_zeit.startzeit; + time_t end_program = info_CN->next_zeit.startzeit; current_programm_timer = g_RCInput->addTimer( &end_program ); } } +#endif if ( !is_video_started ) g_RCInput->postMsg( NeutrinoMessages::EVT_PROGRAMLOCKSTATUS, 0x100, false ); @@ -333,6 +337,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data } return messages_return::handled; } +#if 0 else if ( ( msg == NeutrinoMessages::EVT_TIMER ) && ( data == current_programm_timer ) ) { //printf("new program !\n"); @@ -343,6 +348,7 @@ int CRemoteControl::handleMsg(const neutrino_msg_t msg, neutrino_msg_data_t data return messages_return::handled; } +#endif else if (msg == NeutrinoMessages::EVT_TUNE_COMPLETE) { t_channel_id chid = *(t_channel_id *)data; printf("CRemoteControl::handleMsg: EVT_TUNE_COMPLETE (%016llx)\n", chid); @@ -674,7 +680,7 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s current_sub_channel_id = 0; current_EPGid = 0; - next_EPGid = 0; + //next_EPGid = 0; memset(¤t_PIDs.PIDs, 0, sizeof(current_PIDs.PIDs) ); @@ -697,10 +703,10 @@ void CRemoteControl::zapTo_ChannelID(const t_channel_id channel_id, const std::s //dvbsub_pause(true); CZapit::getInstance()->Abort(); g_Zapit->zapTo_serviceID_NOWAIT(channel_id); - //g_Sectionsd->setServiceChanged( current_channel_id, false ); zap_completion_timeout = now + ZAP_GUARD_TIME; - g_RCInput->killTimer( current_programm_timer ); + //g_Sectionsd->setServiceChanged( current_channel_id, false ); + //g_RCInput->killTimer( current_programm_timer ); } } diff --git a/src/daemonc/remotecontrol.h b/src/daemonc/remotecontrol.h index 6b70de6d5..a112523f1 100644 --- a/src/daemonc/remotecontrol.h +++ b/src/daemonc/remotecontrol.h @@ -71,7 +71,7 @@ typedef std::vector CSubServiceListSorted; class CRemoteControl { - unsigned int current_programm_timer; + //unsigned int current_programm_timer; uint64_t zap_completion_timeout; std::string current_channel_name; t_channel_id current_sub_channel_id; @@ -83,7 +83,7 @@ class CRemoteControl public: t_channel_id current_channel_id; uint64_t current_EPGid; - uint64_t next_EPGid; + //uint64_t next_EPGid; CZapitClient::responseGetPIDs current_PIDs; // APID - Details diff --git a/src/driver/abstime.c b/src/driver/abstime.c index c2af8d4f7..af7c1c7fc 100644 --- a/src/driver/abstime.c +++ b/src/driver/abstime.c @@ -1,3 +1,4 @@ +#include #include /* for perror */ #include @@ -27,3 +28,14 @@ time_t time_monotonic(void) time comparisons if the uptime is low, so add 7 days */ return t.tv_sec + 604800; } + +uint64_t time_monotonic_us(void) +{ + struct timespec t; + if (clock_gettime(CLOCK_MONOTONIC, &t)) + { + perror("time_monotonic_us clock_gettime"); + return -1; + } + return ((int64_t)t.tv_sec + (uint64_t)604800) * (uint64_t) 1000000 + (uint64_t) t.tv_nsec / (uint64_t)1000; +} diff --git a/src/driver/abstime.h b/src/driver/abstime.h index bbd000993..b530755b6 100644 --- a/src/driver/abstime.h +++ b/src/driver/abstime.h @@ -1,3 +1,5 @@ +#include + #ifndef _ABS_TIME_H_ #define _ABS_TIME_H_ #ifdef __cplusplus @@ -6,6 +8,7 @@ extern "C" #endif extern time_t time_monotonic_ms(void); extern time_t time_monotonic(void); +uint64_t time_monotonic_us(void); #ifdef __cplusplus } #endif diff --git a/src/driver/rcinput.cpp b/src/driver/rcinput.cpp index 82cec5d03..c064c5fd0 100644 --- a/src/driver/rcinput.cpp +++ b/src/driver/rcinput.cpp @@ -34,6 +34,7 @@ #endif #include +#include #include #include @@ -41,7 +42,6 @@ #include #include #include -//#define RCDEBUG #include #include #ifdef KEYBOARD_INSTEAD_OF_REMOTE_CONTROL @@ -61,6 +61,11 @@ #include #include +//#define RCDEBUG +//#define USE_GETTIMEOFDAY + +#define ENABLE_REPEAT_CHECK + //const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir", "/dev/input/event0"}; const char * const RC_EVENT_DEVICE[NUMBER_OF_EVENT_DEVICES] = {"/dev/input/nevis_ir"}; typedef struct input_event t_input_event; @@ -332,13 +337,15 @@ int CRCInput::messageLoop( bool anyKeyCancels, int timeout ) return res; } - int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) { +#ifdef USE_GETTIMEOFDAY struct timeval tv; - gettimeofday( &tv, NULL ); uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); +#else + uint64_t timeNow = time_monotonic_us(); +#endif timer _newtimer; if (!oneshot) @@ -365,6 +372,7 @@ int CRCInput::addTimer(uint64_t Interval, bool oneshot, bool correct_time ) return _newtimer.id; } +#ifdef USE_GETTIMEOFDAY int CRCInput::addTimer(struct timeval Timeout) { uint64_t timesout = (uint64_t) Timeout.tv_usec + (uint64_t)((uint64_t) Timeout.tv_sec * (uint64_t) 1000000); @@ -375,6 +383,7 @@ int CRCInput::addTimer(const time_t *Timeout) { return addTimer( (uint64_t)*Timeout* (uint64_t) 1000000, true, false ); } +#endif void CRCInput::killTimer(uint32_t &id) { @@ -394,13 +403,14 @@ void CRCInput::killTimer(uint32_t &id) int CRCInput::checkTimers() { - struct timeval tv; int _id = 0; - +#ifdef USE_GETTIMEOFDAY + struct timeval tv; gettimeofday( &tv, NULL ); uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - - +#else + uint64_t timeNow = time_monotonic_us(); +#endif std::vector::iterator e; for ( e= timers.begin(); e!= timers.end(); ++e ) if ( e->times_out< timeNow+ 2000 ) @@ -440,41 +450,46 @@ int CRCInput::checkTimers() int64_t CRCInput::calcTimeoutEnd(const int timeout_in_seconds) { +#ifdef USE_GETTIMEOFDAY struct timeval tv; - gettimeofday(&tv, NULL); - return (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec + (uint64_t)timeout_in_seconds) * (uint64_t) 1000000; +#else + return time_monotonic_us() + ((uint64_t)timeout_in_seconds * (uint64_t) 1000000); +#endif } int64_t CRCInput::calcTimeoutEnd_MS(const int timeout_in_milliseconds) { +#ifdef USE_GETTIMEOFDAY struct timeval tv; - gettimeofday(&tv, NULL); - uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - +#else + uint64_t timeNow = time_monotonic_us(); +#endif return ( timeNow + timeout_in_milliseconds * 1000 ); } - void CRCInput::getMsgAbsoluteTimeout(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint64_t *TimeoutEnd, bool bAllowRepeatLR) { +#ifdef USE_GETTIMEOFDAY struct timeval tv; - gettimeofday( &tv, NULL ); uint64_t timeNow = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - +#else + uint64_t timeNow = time_monotonic_us(); +#endif uint64_t diff; if ( *TimeoutEnd < timeNow+ 100 ) diff = 100; // Minimum Differenz... else diff = ( *TimeoutEnd - timeNow ); + //printf("CRCInput::getMsgAbsoluteTimeout diff %llx TimeoutEnd %llx now %llx\n", diff, *TimeoutEnd, timeNow); getMsg_us( msg, data, diff, bAllowRepeatLR ); - +#ifdef USE_GETTIMEOFDAY if ( *msg == NeutrinoMessages::EVT_TIMESET ) { // recalculate timeout.... @@ -483,6 +498,7 @@ void CRCInput::getMsgAbsoluteTimeout(neutrino_msg_t * msg, neutrino_msg_data_t * //printf("[getMsgAbsoluteTimeout]: EVT_TIMESET - recalculate timeout\n%llx/%llx - %llx/%llx\n", timeNow, *(int64_t*) *data, *TimeoutEnd, ta ); } +#endif } void CRCInput::getMsg(neutrino_msg_t * msg, neutrino_msg_data_t * data, int Timeout, bool bAllowRepeatLR) @@ -495,16 +511,16 @@ void CRCInput::getMsg_ms(neutrino_msg_t * msg, neutrino_msg_data_t * data, int T getMsg_us(msg, data, (uint64_t) Timeout * 1000, bAllowRepeatLR); } -#define ENABLE_REPEAT_CHECK void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint64_t Timeout, bool bAllowRepeatLR) { static uint64_t last_keypress = 0ULL; - uint64_t getKeyBegin; + //uint64_t getKeyBegin; //static __u16 rc_last_key = KEY_MAX; static __u16 rc_last_repeat_key = KEY_MAX; - struct timeval tv, tvselect; + struct timeval tv; + struct timeval tvselect; uint64_t InitialTimeout = Timeout; int64_t targetTimeout; @@ -515,15 +531,22 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 *data = 0; // wiederholung reinmachen - dass wirklich die ganze zeit bis timeout gewartet wird! +#ifdef USE_GETTIMEOFDAY gettimeofday( &tv, NULL ); - getKeyBegin = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - + uint64_t getKeyBegin = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); +#else + uint64_t getKeyBegin = time_monotonic_us(); +#endif while(1) { timer_id = 0; if ( timers.size()> 0 ) { +#ifdef USE_GETTIMEOFDAY gettimeofday( &tv, NULL ); uint64_t t_n= (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); +#else + uint64_t t_n = time_monotonic_us(); +#endif if ( timers[0].times_out< t_n ) { timer_id = checkTimers(); @@ -840,6 +863,7 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 { case CSectionsdClient::EVT_TIMESET: { +#if 0 struct timeval ltv; gettimeofday(<v, NULL); int64_t timeOld = ltv.tv_usec + ltv.tv_sec * (int64_t)1000000; @@ -847,7 +871,8 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 if (dvbtime) { printf("[neutrino] timeset event. "); time_t difftime = dvbtime - ltv.tv_sec; - if (abs(difftime) > 120) { + if (abs(difftime) > 120) + { printf("difference is %ld s, stepping...\n", difftime); if (stime(&dvbtime)) perror("stime"); @@ -868,14 +893,18 @@ void CRCInput::getMsg_us(neutrino_msg_t * msg, neutrino_msg_data_t * data, uint6 delete[] p;//new [] delete [] p = new unsigned char[sizeof(int64_t)]; *(int64_t*) p = timeNew - timeOld; - +#endif + printf("[neutrino] CSectionsdClient::EVT_TIMESET: timediff %lld\n", *(int64_t*) p); + /* FIXME what this code really do ? */ if ((int64_t)last_keypress > *(int64_t*)p) - last_keypress += *(int64_t *)p; + last_keypress += *(int64_t *)p; +#ifdef USE_GETTIMEOFDAY // Timer anpassen for(std::vector::iterator e = timers.begin(); e != timers.end(); ++e) if (e->correct_time) e->times_out+= *(int64_t*) p; +#endif *msg = NeutrinoMessages::EVT_TIMESET; *data = (neutrino_msg_data_t) p; dont_delete_p = true; @@ -887,16 +916,18 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n"); *data = (neutrino_msg_data_t) p; dont_delete_p = true; break; + case CSectionsdClient::EVT_WRITE_SI_FINISHED: + *msg = NeutrinoMessages::EVT_SI_FINISHED; + *data = 0; + break; +#if 0 case CSectionsdClient::EVT_SERVICES_UPDATE: *msg = NeutrinoMessages::EVT_SERVICES_UPD; *data = 0; break; case CSectionsdClient::EVT_BOUQUETS_UPDATE: break; - case CSectionsdClient::EVT_WRITE_SI_FINISHED: - *msg = NeutrinoMessages::EVT_SI_FINISHED; - *data = 0; - break; +#endif default: printf("[neutrino] event INITID_SECTIONSD - unknown eventID 0x%x\n", emsg.eventID ); } @@ -1260,8 +1291,12 @@ printf("[neutrino] CSectionsdClient::EVT_GOT_CN_EPG\n"); else { //timeout neu kalkulieren +#ifdef USE_GETTIMEOFDAY gettimeofday( &tv, NULL ); int64_t getKeyNow = (int64_t) tv.tv_usec + (int64_t)((int64_t) tv.tv_sec * (int64_t) 1000000); +#else + int64_t getKeyNow = time_monotonic_us(); +#endif int64_t diff = (getKeyNow - getKeyBegin); if( Timeout <= (uint64_t) diff ) { diff --git a/src/eitd/Makefile.am b/src/eitd/Makefile.am index 169f48b42..9cba35348 100644 --- a/src/eitd/Makefile.am +++ b/src/eitd/Makefile.am @@ -19,5 +19,5 @@ endif AM_CPPFLAGS = -fno-rtti -fno-exceptions noinst_LIBRARIES = libsectionsd.a -libsectionsd_a_SOURCES = sectionsd.cpp dmxapi.cpp debug.cpp dmx.cpp xmlutil.cpp \ +libsectionsd_a_SOURCES = sectionsd.cpp debug.cpp dmx.cpp xmlutil.cpp \ SIsections.cpp SIevents.cpp SIutils.cpp SIlanguage.cpp edvbstring.cpp diff --git a/src/eitd/SIevents.cpp b/src/eitd/SIevents.cpp index 37be2ff54..6ed4282d3 100644 --- a/src/eitd/SIevents.cpp +++ b/src/eitd/SIevents.cpp @@ -1,27 +1,27 @@ -// -// $Id: SIevents.cpp,v 1.35 2008/08/16 19:23:18 seife Exp $ -// -// classes SIevent and SIevents (dbox-II-project) -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2001 fnbrd (fnbrd@gmx.de) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// -// +/* + * class SIevents (dbox-II-project) + * + * Copyright (C) 2001 fnbrd (fnbrd@gmx.de) + * Homepage: http://dbox2.elxsi.de + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #include #include diff --git a/src/eitd/SIevents.hpp b/src/eitd/SIevents.hpp index 54f15c3b6..52e4b28c4 100644 --- a/src/eitd/SIevents.hpp +++ b/src/eitd/SIevents.hpp @@ -1,26 +1,24 @@ -// -// $Id: SIevents.hpp,v 1.29 2008/08/16 19:23:18 seife Exp $ -// -// classes SIevent and SIevents (dbox-II-project) -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2001 fnbrd (fnbrd@gmx.de) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// +/* + * (C) 2001 by fnbrd (fnbrd@gmx.de), + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #ifndef SIEVENTS_HPP #define SIEVENTS_HPP diff --git a/src/eitd/SIlanguage.cpp b/src/eitd/SIlanguage.cpp index a0c7e4b26..e6ec07ae8 100644 --- a/src/eitd/SIlanguage.cpp +++ b/src/eitd/SIlanguage.cpp @@ -1,43 +1,27 @@ -// -// $Id: SIlanguage.cpp,v 1.4 2006/04/21 20:40:13 houdini Exp $ -// -// Class for filtering preferred language -// -// Copyright (C) 2001 arzka (dbox2@oh3mqu.pp.hyper.fi) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// -// $Log: SIlanguage.cpp,v $ -// Revision 1.4 2006/04/21 20:40:13 houdini -// improvments when not using the MultiLanguageEPG feature -// -// Revision 1.3 2006/04/13 19:10:54 mws -// bugfix returned wrong value for error while saving; -// preincrement iterators; -// -// Revision 1.2 2006/04/12 21:23:58 Arzka -// Optimization. -// Removed unnecessary copying of std:map and -// removed few avoidable std::string creation -// -// Revision 1.1 2006/03/26 20:13:49 Arzka -// Added support for selecting EPG language -// -// -// - +/* + * SIlanguage.cpp, Class for filtering preferred language + * + * Copyright (C) 2001 arzka (dbox2@oh3mqu.pp.hyper.fi) + * Copyright (C) 2006 houdini, mws + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #include #include #include diff --git a/src/eitd/SIsections.cpp b/src/eitd/SIsections.cpp index 1ba629f2b..5761aa29f 100644 --- a/src/eitd/SIsections.cpp +++ b/src/eitd/SIsections.cpp @@ -1,28 +1,26 @@ -// -// $Id: SIsections.cpp,v 1.61 2009/09/04 18:37:00 dbt Exp $ -// -// classes for SI sections (dbox-II-project) -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2001 fnbrd (fnbrd@gmx.de) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// -// - +/* + * SIsections.cpp, classes for SI sections (dbox-II-project) + * + * (C) 2001 by fnbrd (fnbrd@gmx.de), + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #ifdef HAVE_CONFIG_H #include #endif diff --git a/src/eitd/SIsections.hpp b/src/eitd/SIsections.hpp index 168fa834c..932141657 100644 --- a/src/eitd/SIsections.hpp +++ b/src/eitd/SIsections.hpp @@ -1,27 +1,27 @@ -// -// $Id: SIsections.hpp,v 1.28 2009/07/26 17:02:46 rhabarber1848 Exp $ -// -// classes for SI sections (dbox-II-project) -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2001 fnbrd (fnbrd@gmx.de) -// Copyright (C) 2003 Andreas Oberritter -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// +/* + * SIsections.hpp, classes for SI sections (dbox-II-project) + * + * (C) 2001 by fnbrd (fnbrd@gmx.de), + * Copyright (C) 2003 Andreas Oberritter + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #ifndef SISECTIONS_HPP #define SISECTIONS_HPP diff --git a/src/eitd/SIservices.hpp b/src/eitd/SIservices.hpp index 0c6999fad..4eebb08c9 100644 --- a/src/eitd/SIservices.hpp +++ b/src/eitd/SIservices.hpp @@ -1,27 +1,27 @@ -// -// $Id: SIservices.hpp,v 1.15 2009/02/24 19:09:10 seife Exp $ -// -// classes SIservices and SIservices (dbox-II-project) -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2001 fnbrd (fnbrd@gmx.de), -// 2002 thegoodguy (thegoodguy@berlios.de) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// +/* + * classes SIservices and SIservices (dbox-II-project) + * + * (C) 2001 by fnbrd (fnbrd@gmx.de), + * 2003 by thegoodguy + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #ifndef SISERVICES_HPP #define SISERVICES_HPP diff --git a/src/eitd/SIutils.cpp b/src/eitd/SIutils.cpp index 745c733f7..09ab601f6 100644 --- a/src/eitd/SIutils.cpp +++ b/src/eitd/SIutils.cpp @@ -1,26 +1,26 @@ -// -// $Id: SIutils.cpp,v 1.15 2005/11/03 21:08:52 mogway Exp $ -// -// utility functions for the SI-classes (dbox-II-project) -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2001 fnbrd (fnbrd@gmx.de) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// +/* + * SIutils.cpp, utility functions for the SI-classes (dbox-II-project) + * + * (C) 2001 by fnbrd (fnbrd@gmx.de) + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #include #include diff --git a/src/eitd/SIutils.hpp b/src/eitd/SIutils.hpp index 4422bcc31..77f2e54c4 100644 --- a/src/eitd/SIutils.hpp +++ b/src/eitd/SIutils.hpp @@ -1,27 +1,26 @@ -// -// $Id: SIutils.hpp,v 1.5 2006/05/19 21:28:08 houdini Exp $ -// -// utility functions for the SI-classes (dbox-II-project) -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2001 fnbrd (fnbrd@gmx.de) -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - +/* + * SIutils.hpp, utility functions for the SI-classes (dbox-II-project) + * + * (C) 2001 by fnbrd (fnbrd@gmx.de), + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #ifndef SIUTILS_HPP #define SIUTILS_HPP diff --git a/src/eitd/debug.cpp b/src/eitd/debug.cpp index 5c80c9ffc..5a830d88e 100644 --- a/src/eitd/debug.cpp +++ b/src/eitd/debug.cpp @@ -1,14 +1,15 @@ /* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/debug.cpp,v 1.3 2008/06/15 10:19:38 seife Exp $ - * - * Debug tools (sectionsd) - d-box2 linux project + * debug.cpp, Debug tools (sectionsd) - d-box2 linux project * * (C) 2003 by thegoodguy * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/eitd/debug.h b/src/eitd/debug.h index b3262b7f1..0909d6362 100644 --- a/src/eitd/debug.h +++ b/src/eitd/debug.h @@ -1,14 +1,16 @@ /* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/debug.h,v 1.4 2008/10/05 13:40:36 seife Exp $ + * debug.h, Debug tools (sectionsd) - d-box2 linux project * - * Debug tools (sectionsd) - d-box2 linux project + * (C) 2001 by fnbrd (fnbrd@gmx.de), + * 2003 by thegoodguy * - * (C) 2003 by thegoodguy + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/eitd/dmx.cpp b/src/eitd/dmx.cpp index 2d9bf3272..d64526454 100644 --- a/src/eitd/dmx.cpp +++ b/src/eitd/dmx.cpp @@ -1,15 +1,16 @@ /* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/dmx.cpp,v 1.51 2009/06/14 21:46:03 rhabarber1848 Exp $ - * * DMX class (sectionsd) - d-box2 linux project * - * (C) 2001 by fnbrd, + * (C) 2001 by fnbrd (fnbrd@gmx.de), * 2003 by thegoodguy * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,12 +22,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ - - #ifdef HAVE_CONFIG_H #include #endif - #include #include #include @@ -205,11 +203,10 @@ inline sections_id_t create_sections_id(const uint8_t table_id, const uint16_t e bool DMX::check_complete(sections_id_t s_id, uint8_t number, uint8_t last, uint8_t segment_last) { bool ret = false; - //lock(); + section_map_t::iterator it = seenSections.find(s_id); - if (it == seenSections.end()) - { + if (it == seenSections.end()) { seenSections.insert(s_id); calcedSections.insert(s_id); uint64_t tmpval = s_id & 0xFFFFFFFFFFFFFF00ULL; @@ -255,7 +252,6 @@ printf(" [%s cache] old section for table 0x%02x sid 0x%04x section 0x%02x last if(seenSections.size() > 10) ret = true; } - //unlock(); return ret; } @@ -450,11 +446,9 @@ int DMX::getSection(uint8_t *buf, const unsigned timeoutInMSeconds, int &timeout } if(complete) { - //lock(); seenSections.clear(); calcedSections.clear(); timeouts = -2; - //unlock(); } if(rc > 0) first_skipped = 0; diff --git a/src/eitd/dmx.h b/src/eitd/dmx.h index 52032eeef..55bc210a5 100644 --- a/src/eitd/dmx.h +++ b/src/eitd/dmx.h @@ -1,14 +1,14 @@ /* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/dmx.h,v 1.17 2009/05/23 16:50:12 seife Exp $ - * * DMX class (sectionsd) - d-box2 linux project * * (C) 2003 by thegoodguy + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/eitd/dmxapi.cpp b/src/eitd/dmxapi.cpp deleted file mode 100644 index 10639a8ac..000000000 --- a/src/eitd/dmxapi.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/dmxapi.cpp,v 1.5 2005/01/13 10:48:02 diemade Exp $ - * - * DMX low level functions (sectionsd) - d-box2 linux project - * - * (C) 2003 by thegoodguy - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - - - -#include /* perror */ -#include /* memset */ -#include /* ioctl */ -#include /* open */ -#include /* close, read */ -#include /* htons */ -#include /* ctime */ -#include "dmxapi.h" - -#include "dmx.h" -#include "SIutils.hpp" -#include "debug.h" - -struct SI_section_TOT_header -{ - unsigned char table_id : 8; - unsigned char section_syntax_indicator : 1; - unsigned char reserved_future_use : 1; - unsigned char reserved1 : 2; - unsigned short section_length : 12; - UTC_t UTC_time; /* :40 */ -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned char reserved2 : 4; - unsigned char descr_loop_length_hi : 4; -#else - unsigned char descr_loop_length_hi : 4; - unsigned char reserved2 : 4; -#endif - unsigned short descr_loop_length_lo : 8; -} -__attribute__ ((packed)); /* 10 bytes */ - -struct SI_section_TDT_header -{ - unsigned char table_id : 8; - unsigned char section_syntax_indicator : 1; - unsigned char reserved_future_use : 1; - unsigned char reserved1 : 2; - unsigned short section_length : 12; - /* uint64_t UTC_time : 40;*/ - UTC_t UTC_time; -} -__attribute__ ((packed)); /* 8 bytes */ - -struct descrLocalTimeOffset -{ - unsigned char country_code[3]; -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned char country_region_id : 6; - unsigned char reserved_1 : 1; - unsigned char local_time_offset_polarity : 1; -#else - unsigned char local_time_offset_polarity : 1; - unsigned char reserved_1 : 1; - unsigned char country_region_id : 6; -#endif - unsigned int local_time_offset : 16; - unsigned int time_of_change_MJD : 16; - unsigned int time_of_change_UTC : 24; - unsigned int next_time_offset : 16; -} __attribute__ ((packed)); /* 13 bytes */; - - -cDemux * dmxUTC; -bool getUTC(UTC_t * const UTC, const bool TDT) -{ - unsigned char filter[DMX_FILTER_SIZE]; - unsigned char mask[DMX_FILTER_SIZE]; - int timeout; - struct SI_section_TOT_header tdt_tot_header; - char cUTC[5]; - bool ret = true; - - unsigned char buf[1023+3]; - - if(dmxUTC == NULL) { - dmxUTC = new cDemux(); - dmxUTC->Open(DMX_PSI_CHANNEL); - } - - memset(&filter, 0, DMX_FILTER_SIZE); - memset(&mask, 0, DMX_FILTER_SIZE); - - 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(0x0014, filter, mask, 5, timeout); - - int size = TDT ? sizeof(struct SI_section_TDT_header) : sizeof(tdt_tot_header); - int r = dmxUTC->Read(buf, TDT ? size : sizeof(buf)); - if (r < size) { - if (TDT || sections_debug) /* not having TOT is common, no need to log */ - perror("[sectionsd] getUTC: read"); - dmxUTC->Stop(); - return false; - } - memset(&tdt_tot_header, 0, sizeof(tdt_tot_header)); - memmove(&tdt_tot_header, buf, size); - - int64_t tmp = tdt_tot_header.UTC_time.time; - memmove(cUTC, (&tdt_tot_header.UTC_time), 5); - if ((cUTC[2] > 0x23) || (cUTC[3] > 0x59) || (cUTC[4] > 0x59)) // no valid time - { - printf("[sectionsd] getUTC: invalid %s section received: %02x %02x %02x %02x %02x\n", - TDT ? "TDT" : "TOT", cUTC[0], cUTC[1], cUTC[2], cUTC[3], cUTC[4]); - ret = false; - } - - (*UTC).time = tmp; - -#if 1 - short loop_length = tdt_tot_header.descr_loop_length_hi << 8 | tdt_tot_header.descr_loop_length_lo; - if (loop_length >= 15) { - int off = sizeof(tdt_tot_header); - int rem = loop_length; - while (rem >= 15) - { - unsigned char *b2 = &buf[off]; - if (b2[0] == 0x58) { - struct descrLocalTimeOffset *to; - to = (struct descrLocalTimeOffset *)&b2[2]; - unsigned char cc[4]; - cc[3] = 0; - memmove(cc, to->country_code, 3); - time_t t = changeUTCtoCtime(&b2[2+6],0); - xprintf("getUTC(TOT): len=%d cc=%s reg_id=%d " - "pol=%d offs=%04x new=%04x when=%s", - b2[1], cc, to->country_region_id, - to->local_time_offset_polarity, htons(to->local_time_offset), - htons(to->next_time_offset), ctime(&t)); - } else { - xprintf("getUTC(TOT): descriptor != 0x58: 0x%02x\n", b2[0]); - } - off += b2[1] + 2; - rem -= b2[1] + 2; - if (off + rem > (int)sizeof(buf)) - { - xprintf("getUTC(TOT): not enough buffer space? (%d/%d)\n", off+rem, sizeof(buf)); - break; - } - } - } -#endif - - /* TOT without descriptors seems to be not better than a plain TDT, such TOT's are */ - /* found on transponders which also have wrong time in TDT etc, so don't trust it. */ - if (loop_length < 15 && !TDT) - ret = false; - - //delete dmxUTC; - dmxUTC->Stop(); - - return ret; -} diff --git a/src/eitd/dmxapi.h b/src/eitd/dmxapi.h deleted file mode 100644 index 294beae80..000000000 --- a/src/eitd/dmxapi.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * $Header: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/sectionsd/dmxapi.h,v 1.3 2003/03/01 19:26:51 thegoodguy Exp $ - * - * DMX low level functions (sectionsd) - d-box2 linux project - * - * (C) 2003 by thegoodguy - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -#ifndef __sectionsd__dmxapi_h__ -#define __sectionsd__dmxapi_h__ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -typedef struct UTC_time -{ - uint64_t time : 40; -} __attribute__ ((packed)) UTC_t; - -bool getUTC(UTC_t * const UTC, const bool TDT = true); - -#endif /* __sectionsd__dmxapi_h__ */ - diff --git a/src/eitd/eitd.h b/src/eitd/eitd.h index 860789f51..34cc88d10 100644 --- a/src/eitd/eitd.h +++ b/src/eitd/eitd.h @@ -1,27 +1,27 @@ -// -// sectionsd.cpp (network daemon for SI-sections) -// (dbox-II-project) -// -// Copyright (C) 2001 by fnbrd -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2008, 2009 Stefan Seyfried -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// +/* + * sectionsd.cpp (network daemon for SI-sections) + * (dbox-II-project) + * + * (C) 2001 by fnbrd (fnbrd@gmx.de) + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #ifndef __eitd_h__ #define __eitd_h__ @@ -52,7 +52,7 @@ typedef SIservice * SIservicePtr; #define TIME_EIT_SCHEDULED_PAUSE 60 * 60 /* force EIT thread to change filter after, seconds */ -#define TIME_EIT_SKIPPING 120 // 90 <- Canal diditaal 19.2e -> ~100 seconds for 0x5x +#define TIME_EIT_SKIPPING 180 // 90 <- Canal diditaal 19.2e -> ~100 seconds for 0x5x /* a little more time for freesat epg */ #define TIME_FSEIT_SKIPPING 240 /* Timeout in ms for reading from dmx in EIT threads. Dont make this too long @@ -179,7 +179,8 @@ class CSectionThread : public OpenThreads::Thread, public DMX running = true; return (OpenThreads::Thread::start() == 0); } - void StopRun() { + void StopRun() + { xprintf("%s::StopRun: to lock\n", name.c_str()); lock(); running = false; @@ -189,7 +190,6 @@ class CSectionThread : public OpenThreads::Thread, public DMX xprintf("%s::StopRun: to unlock\n", name.c_str()); unlock(); } - void Wakeup() { pthread_cond_broadcast(&change_cond); } bool Stop() { xprintf("%s::Stop: to broadcast\n", name.c_str()); @@ -198,25 +198,6 @@ class CSectionThread : public OpenThreads::Thread, public DMX int ret = (OpenThreads::Thread::join() == 0); xprintf("%s::Stop: to close\n", name.c_str()); DMX::close(); -#if 0 - if(!running) - return false; -xprintf("%s::Stop: to lock\n", name.c_str()); - lock(); - running = false; -xprintf("%s::Stop: to broadcast\n", name.c_str()); - pthread_cond_broadcast(&change_cond); -xprintf("%s::Stop: to unlock\n", name.c_str()); - unlock(); -#if 1 -xprintf("%s::Stop: to closefd\n", name.c_str()); - DMX::closefd(); -#endif -xprintf("%s::Stop: to join\n", name.c_str()); - int ret = (OpenThreads::Thread::join() == 0); -xprintf("%s::Stop: to close\n", name.c_str()); - DMX::close(); -#endif return ret; } }; diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 116b5b3b2..6347ccc63 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -1,27 +1,30 @@ -// -// sectionsd.cpp (network daemon for SI-sections) -// (dbox-II-project) -// -// Copyright (C) 2001 by fnbrd -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2008, 2009 Stefan Seyfried -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// +/* + * sectionsd.cpp (network daemon for SI-sections) + * (dbox-II-project) + * + * Copyright (C) 2001 by fnbrd (fnbrd@gmx.de) + * Homepage: http://dbox2.elxsi.de + * + * Copyright (C) 2008, 2009 Stefan Seyfried + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #include #include @@ -55,7 +58,6 @@ #include #include -#include "dmxapi.h" #include "eitd.h" #include "edvbstring.h" #include "xmlutil.h" @@ -123,8 +125,6 @@ static t_channel_id messaging_current_servicekey = 0; static bool channel_is_blacklisted = false; bool timeset = false; -//pthread_cond_t timeIsSetCond = PTHREAD_COND_INITIALIZER; -//pthread_mutex_t timeIsSetMutex = PTHREAD_MUTEX_INITIALIZER; static int messaging_have_CN = 0x00; // 0x01 = CURRENT, 0x02 = NEXT static int messaging_got_CN = 0x00; // 0x01 = CURRENT, 0x02 = NEXT @@ -137,9 +137,6 @@ static CEventServer *eventServer; static pthread_rwlock_t servicesLock = PTHREAD_RWLOCK_INITIALIZER; // Unsere (fast-)mutex, damit nicht gleichzeitig in die Menge services geschrieben und gelesen wird static pthread_rwlock_t messagingLock = PTHREAD_RWLOCK_INITIALIZER; -//static pthread_cond_t timeThreadSleepCond = PTHREAD_COND_INITIALIZER; -//static pthread_mutex_t timeThreadSleepMutex = PTHREAD_MUTEX_INITIALIZER; - static CTimeThread threadTIME; static CEitThread threadEIT; static CCNThread threadCN; @@ -204,22 +201,6 @@ inline void unlockEvents(void) pthread_rwlock_unlock(&eventsLock); } -#if 0 -inline bool waitForTimeset(void) -{ - pthread_mutex_lock(&timeIsSetMutex); - while(!timeset) - pthread_cond_wait(&timeIsSetCond, &timeIsSetMutex); - pthread_mutex_unlock(&timeIsSetMutex); - /* we have time synchronization issues, at least on kernel 2.4, so - sometimes the time in the threads is still 1.1.1970, even after - waitForTimeset() returns. Let's hope that we work around this issue - with this sleep */ - sleep(1); - return true; -} -#endif - static const SIevent nullEvt; // Null-Event static MySIeventsOrderUniqueKey mySIeventsOrderUniqueKey; @@ -855,10 +836,10 @@ static void commandPauseScanning(int connfd, char *data, const unsigned dataLeng threadCN.request_pause(); threadEIT.request_pause(); #ifdef ENABLE_FREESATEPG - dmxFSEIT.request_pause(); + threadFSEIT.request_pause(); #endif #ifdef ENABLE_SDT - dmxSDT.request_pause(); + threadSDT.request_pause(); #endif #endif scanning = 0; @@ -869,10 +850,10 @@ static void commandPauseScanning(int connfd, char *data, const unsigned dataLeng threadCN.request_unpause(); threadEIT.request_unpause(); #ifdef ENABLE_FREESATEPG - dmxFSEIT.request_unpause(); + threadFSEIT.request_unpause(); #endif #ifdef ENABLE_SDT - dmxSDT.request_unpause(); + threadSDT.request_unpause(); #endif #endif writeLockEvents(); @@ -888,20 +869,16 @@ static void commandPauseScanning(int connfd, char *data, const unsigned dataLeng unlockMessaging(); scanning = 1; - if (!ntpenable) //FIXME flag if ntp update was good ? + /* FIXME should we stop time updates if not scanning ? flag if ntp update was good ? */ + if (!ntpenable) { -#if 0 - pthread_mutex_lock(&timeThreadSleepMutex); - pthread_cond_broadcast(&timeThreadSleepCond); - pthread_mutex_unlock(&timeThreadSleepMutex); -#endif threadTIME.change(0); } threadCN.change(0); threadEIT.change(0); #ifdef ENABLE_FREESATEPG - dmxFSEIT.change(0); + threadFSEIT.change(0); #endif #ifdef ENABLE_SDT threadSDT.change(0); @@ -921,12 +898,11 @@ static void commandserviceChanged(int connfd, char *data, const unsigned dataLen uniqueServiceKey = (((sectionsd::commandSetServiceChanged *)data)->channel_id); uniqueServiceKey &= 0xFFFFFFFFFFFFULL; - dprintf("[sectionsd] commandserviceChanged: Service changed to " PRINTF_CHANNEL_ID_TYPE "\n", uniqueServiceKey); -xprintf("[sectionsd] commandserviceChanged: Service change to " PRINTF_CHANNEL_ID_TYPE "\n\n", uniqueServiceKey); + xprintf("[sectionsd] commandserviceChanged: Service change to " PRINTF_CHANNEL_ID_TYPE "\n\n", uniqueServiceKey); static t_channel_id time_trigger_last = 0; - if (uniqueServiceKey && messaging_current_servicekey != uniqueServiceKey) { + if (messaging_current_servicekey != uniqueServiceKey) { dvb_time_update = !checkNoDVBTimelist(uniqueServiceKey); dprintf("[sectionsd] commandserviceChanged: DVB time update is %s\n", dvb_time_update ? "allowed" : "blocked!"); @@ -950,18 +926,13 @@ xprintf("[sectionsd] commandserviceChanged: Service change to " PRINTF_CHANNEL_I threadCN.setCurrentService(messaging_current_servicekey); threadEIT.setCurrentService(messaging_current_servicekey); #ifdef ENABLE_FREESATEPG - dmxFSEIT.setCurrentService(messaging_current_servicekey); + threadFSEIT.setCurrentService(messaging_current_servicekey); #endif #ifdef ENABLE_SDT threadSDT.setCurrentService(messaging_current_servicekey); #endif if (time_trigger_last != (messaging_current_servicekey & 0xFFFFFFFF0000ULL)) { time_trigger_last = messaging_current_servicekey & 0xFFFFFFFF0000ULL; -#if 0 - pthread_mutex_lock(&timeThreadSleepMutex); - pthread_cond_broadcast(&timeThreadSleepCond); - pthread_mutex_unlock(&timeThreadSleepMutex); -#endif threadTIME.setCurrentService(messaging_current_servicekey); } } @@ -970,7 +941,7 @@ xprintf("[sectionsd] commandserviceChanged: Service change to " PRINTF_CHANNEL_I out: //sendEmptyResponse(connfd, NULL, 0); -xprintf("[sectionsd] commandserviceChanged: Service changed to " PRINTF_CHANNEL_ID_TYPE "\n\n", uniqueServiceKey); + xprintf("[sectionsd] commandserviceChanged: Service changed to " PRINTF_CHANNEL_ID_TYPE "\n\n", uniqueServiceKey); } static void commandGetIsScanningActive(int connfd, char* /*data*/, const unsigned /*dataLength*/) @@ -1021,7 +992,6 @@ static void commandDumpStatusInformation(int /*connfd*/, char* /*data*/, const u char stati[MAX_SIZE_STATI]; snprintf(stati, MAX_SIZE_STATI, - "$Id: sectionsd.cpp,v 1.305 2009/07/30 12:41:39 seife Exp $\n" "Current time: %s" "Hours to cache: %ld\n" "Hours to cache extended text: %ld\n" @@ -1117,20 +1087,11 @@ static void commandSetConfig(int connfd, char *data, const unsigned /*dataLength } if (time_wakeup) { - //pthread_mutex_lock(&timeThreadSleepMutex); - ntpserver = (std::string)&data[sizeof(struct sectionsd::commandSetConfig)]; dprintf("new network_ntpserver = %s\n", ntpserver.c_str()); ntp_system_cmd = ntp_system_cmd_prefix + ntpserver; ntprefresh = pmsg->network_ntprefresh; ntpenable = (pmsg->network_ntpenable == 1); -#if 0 - if (timeset) { - // wake up time thread - pthread_cond_broadcast(&timeThreadSleepCond); - } - pthread_mutex_unlock(&timeThreadSleepMutex); -#endif if(timeset) threadTIME.change(1); } @@ -1150,8 +1111,8 @@ static void deleteSIexceptEPG() threadSDT.change(0); #endif #ifdef ENABLE_FREESATEPG - dmxFSEIT.setCurrentService(messaging_current_servicekey); - dmxFSEIT.change(0); + threadFSEIT.setCurrentService(messaging_current_servicekey); + threadFSEIT.change(0); #endif } @@ -1342,6 +1303,7 @@ CTimeThread::CTimeThread() void CTimeThread::sendTimeEvent(bool ntp, time_t tim) { +#if 0 time_t actTime = time(NULL); if (!ntp) { struct tm *tmTime = localtime(&actTime); @@ -1350,6 +1312,9 @@ void CTimeThread::sendTimeEvent(bool ntp, time_t tim) actTime = tim; } eventServer->sendEvent(CSectionsdClient::EVT_TIMESET, CEventServer::INITID_SECTIONSD, &actTime, sizeof(actTime) ); +#endif + if(ntp || tim) {} + eventServer->sendEvent(CSectionsdClient::EVT_TIMESET, CEventServer::INITID_SECTIONSD, &timediff, sizeof(timediff)); setTimeSet(); } @@ -1377,18 +1342,22 @@ void CTimeThread::setSystemTime(time_t tim) struct tm *tmTime = localtime(&now); gettimeofday(&tv, NULL); - timediff = tim * (int64_t)1000000 - (tv.tv_usec + tv.tv_sec * (int64_t)1000000); + timediff = (int64_t)tim * (int64_t)1000000 - (tv.tv_usec + tv.tv_sec * (int64_t)1000000); xprintf("%s: timediff %lld, current: %02d.%02d.%04d %02d:%02d:%02d, dvb: %s", name.c_str(), timediff, tmTime->tm_mday, tmTime->tm_mon+1, tmTime->tm_year+1900, tmTime->tm_hour, tmTime->tm_min, tmTime->tm_sec, ctime(&tim)); - if (!messaging_neutrino_sets_time) { - tv.tv_sec = tim; - tv.tv_usec = 0; - if (settimeofday(&tv, NULL) < 0) - perror("[sectionsd] settimeofday"); + /* if new time less than current for less than 1 second, ignore */ + if(timediff < 0 && timediff > (int64_t) -1000000) { + timediff = 0; + return; } + + tv.tv_sec = tim; + tv.tv_usec = 0; + if (settimeofday(&tv, NULL) < 0) + perror("[sectionsd] settimeofday"); } void CTimeThread::addFilters() @@ -1411,12 +1380,15 @@ void CTimeThread::run() xprintf("%s: going to sleep %d seconds, running %d scanning %d\n", name.c_str(), sleep_time, running, scanning); #endif - real_pause(); - int rs = Sleep(); + do { + real_pause(); + int rs = Sleep(); #ifdef DEBUG_TIME_THREAD - xprintf("%s: wakeup, running %d scanning %d reason %d\n", - name.c_str(), running, scanning, rs); + xprintf("%s: wakeup, running %d scanning %d channel %llx reason %d\n", + name.c_str(), running, scanning, current_service, rs); #endif + } while (running && !scanning); + if (!running) break; } @@ -1434,9 +1406,9 @@ void CTimeThread::run() else change(0); - xprintf("timeThread: getting DVB time (isOpen %d)\n", isOpen()); + xprintf("%s: getting DVB time (isOpen %d)\n", name.c_str(), isOpen()); int rc = dmx->Read(static_buf, MAX_SECTION_LENGTH, timeoutInMSeconds); - xprintf("timeThread: getting DVB time done : %d messaging_neutrino_sets_time %d\n", rc, messaging_neutrino_sets_time); + xprintf("%s: getting DVB time done : %d messaging_neutrino_sets_time %d\n", name.c_str(), rc, messaging_neutrino_sets_time); if (rc > 0) { SIsectionTIME st(static_buf); if (st.is_parsed()) { @@ -1465,60 +1437,8 @@ void CTimeThread::run() sleep_time = 1; } sendToSleepNow = true; - -#if 0 - if (timeset && dvb_time_update) { - if (!first_time) - sleep_time = ntprefresh * 60; - else - sleep_time = 5; /* retry a second time immediately */ - - if (time_ntp) { - xprintf("[%sThread] Time set via NTP, going to sleep for %d seconds.\n", "time", sleep_time); - } - else { - xprintf("[%sThread] Time %sset via DVB(%s), going to sleep for %d seconds.\n", - "time", success?"":"not ", first_time?"TDT":"TOT", sleep_time); - } - first_time = false; - } - else { - if (!first_time) { - /* time was already set, no need to do it again soon when DVB time-blocked channel is tuned */ - sleep_time = ntprefresh * 60; - } else { - sleep_time = 1; - } - if (!dvb_time_update && !first_time) { - xprintf("[%sThread] Time NOT set via DVB due to blocked channel, going to sleep for %d seconds.\n", "time", sleep_time); - } - } -#endif -#if 0 - if (sectionsd_stop) - break; - - xprintf("timeThread: going to sleep for %d sec\n\n", seconds); - - struct timespec restartWait; - struct timeval now; - gettimeofday(&now, NULL); - TIMEVAL_TO_TIMESPEC(&now, &restartWait); - restartWait.tv_sec += seconds; - pthread_mutex_lock( &timeThreadSleepMutex ); - int ret = pthread_cond_timedwait( &timeThreadSleepCond, &timeThreadSleepMutex, &restartWait ); - pthread_mutex_unlock( &timeThreadSleepMutex ); - if (ret == ETIMEDOUT) - { - dprintf("TDT-Thread sleeping is over - no signal received\n"); - } - else if (ret == EINTR) - { - dprintf("TDT-Thread sleeping interrupted\n"); - } -#endif } - + delete[] static_buf; printf("[sectionsd] timeThread ended\n"); pthread_exit(NULL); } @@ -1732,7 +1652,6 @@ void CEitThread::addFilters() void CEitThread::beforeSleep() { - xprintf("%s: CScheduledThread::beforeSleep()\n", name.c_str()); writeLockMessaging(); messaging_zap_detected = false; unlockMessaging(); @@ -2090,14 +2009,12 @@ static void *houseKeepingThread(void *) pthread_exit(NULL); } -//extern cDemux * dmxUTC; - void sectionsd_main_thread(void * /*data*/) { pthread_t /*threadTOT,*/ threadHouseKeeping; int rc; - printf("$Id: sectionsd.cpp,v 1.305 2009/07/30 12:41:39 seife Exp $\n"); + xprintf("[sectionsd] starting\n"); printf("SIevent size: %d\n", sizeof(SIevent)); /* "export NO_SLOW_ADDEVENT=true" to disable this */ @@ -2152,18 +2069,8 @@ printf("SIevent size: %d\n", sizeof(SIevent)); eventServer = new CEventServer; -#if 0 - // time-Thread starten - rc = pthread_create(&threadTOT, 0, timeThread, 0); - - if (rc) { - fprintf(stderr, "[sectionsd] failed to create time-thread (rc=%d)\n", rc); - return; - } -#endif threadTIME.Start(); threadEIT.Start(); - threadCN.Start(); #ifdef ENABLE_FREESATEPG @@ -2208,35 +2115,16 @@ printf("SIevent size: %d\n", sizeof(SIevent)); threadTIME.StopRun(); xprintf("broadcasting...\n"); -#if 0 - timeset = true; - pthread_mutex_lock(&timeIsSetMutex); - pthread_cond_broadcast(&timeIsSetCond); - pthread_mutex_unlock(&timeIsSetMutex); -#endif + threadTIME.setTimeSet(); -#if 0 - pthread_mutex_lock(&timeThreadSleepMutex); - pthread_cond_broadcast(&timeThreadSleepCond); - pthread_mutex_unlock(&timeThreadSleepMutex); -#endif + xprintf("pausing...\n"); pthread_cancel(threadHouseKeeping); - //if (dmxUTC) dmxUTC->Stop(); - -#if 0 - xprintf("cancel TOT\n"); - //threadTIME.cancel(); - //pthread_cancel(threadTOT); -#endif xprintf("join TOT\n"); - //pthread_join(threadTOT, NULL); threadTIME.Stop(); - //if (dmxUTC) delete dmxUTC; - xprintf("join EIT\n"); threadEIT.Stop(); diff --git a/src/eitd/xmlutil.cpp b/src/eitd/xmlutil.cpp index ac07a6074..8fd64e490 100644 --- a/src/eitd/xmlutil.cpp +++ b/src/eitd/xmlutil.cpp @@ -1,26 +1,25 @@ -// -// (dbox-II-project) -// -// Copyright (C) 2001 by fnbrd -// -// Homepage: http://dbox2.elxsi.de -// -// Copyright (C) 2008, 2009 Stefan Seyfried -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// +/* + * (C) 2001 by fnbrd, + * Copyright (C) 2008, 2009 Stefan Seyfried + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ #ifdef HAVE_CONFIG_H #include diff --git a/src/eitd/xmlutil.h b/src/eitd/xmlutil.h index 83e383264..783db5c19 100644 --- a/src/eitd/xmlutil.h +++ b/src/eitd/xmlutil.h @@ -1,11 +1,15 @@ /* * - * (C) 2003 by thegoodguy + * (C) 2001 by fnbrd (fnbrd@gmx.de), + * 2003 by thegoodguy + * + * Copyright (C) 2011-2012 CoolStream International Ltd + * + * License: GPLv2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index dfab14c1f..dfd6f119e 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -151,7 +151,7 @@ const struct button_label CBEBouquetWidgetButtons[3] = void CBEBouquetWidget::paintFoot() { - int icol_w, icol_h, h2, fh; + int icol_w, icol_h, h2; struct button_label Button[4]; Button[0] = CBEBouquetWidgetButtons[0]; @@ -162,7 +162,7 @@ void CBEBouquetWidget::paintFoot() const neutrino_locale_t button_ids[] = {LOCALE_BOUQUETEDITOR_RENAME,LOCALE_BOUQUETEDITOR_HIDE,LOCALE_BOUQUETEDITOR_LOCK}; const std::vector buttonID_rest (button_ids, button_ids + sizeof(button_ids) / sizeof(neutrino_locale_t) ); - fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); +// fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); /* ButtonHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+8*//*std::max(fh, icol_h+4)*/; diff --git a/src/gui/cec_setup.cpp b/src/gui/cec_setup.cpp index c716842fb..7b7de137a 100644 --- a/src/gui/cec_setup.cpp +++ b/src/gui/cec_setup.cpp @@ -113,11 +113,8 @@ void CCECSetup::setCECSettings() videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)g_settings.hdmi_cec_mode); } -bool CCECSetup::changeNotify(const neutrino_locale_t OptionName, void *data) +bool CCECSetup::changeNotify(const neutrino_locale_t OptionName, void * /*data*/) { - int val = 0; - if(data) - val = * (int *) data; if (ARE_LOCALES_EQUAL(OptionName, LOCALE_VIDEOMENU_HDMI_CEC_MODE)) { diff --git a/src/gui/cec_setup.h b/src/gui/cec_setup.h index 168dc9d47..9f69672f9 100644 --- a/src/gui/cec_setup.h +++ b/src/gui/cec_setup.h @@ -48,7 +48,7 @@ class CCECSetup : public CMenuTarget, CChangeObserver ~CCECSetup(); void setCECSettings(); int exec(CMenuTarget* parent, const std::string & actionKey); - virtual bool changeNotify(const neutrino_locale_t OptionName, void *data); + virtual bool changeNotify(const neutrino_locale_t OptionName, void * data); }; diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 17e6af18a..d4ad4202d 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -1079,10 +1079,9 @@ const struct button_label EpgButtons[] = void CEpgData::showTimerEventBar (bool pshow) { - int x,y,w,h,fh; + int x,y,h,fh; int icol_w, icol_h; - w = ox - 20; x = sx + 10; y = sy + oy; diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 2e979e8fd..bfc2fcaee 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -901,7 +901,7 @@ void EventList::showFunctionBar (bool show, t_channel_id channel_id) CColorKeyHelper keyhelper; //user_menue.h neutrino_msg_t dummy = CRCInput::RC_nokey; const char * icon = NULL; - std::string btncaption; +// std::string btncaption; bh = std::max(FunctionBarHeight, bh); frameBuffer->paintBackgroundBoxRel(x,by,width,bh); @@ -925,10 +925,10 @@ void EventList::showFunctionBar (bool show, t_channel_id channel_id) EventListFirstButton[0].button = icon; if(is_timer == CTimerd::TIMER_RECORD ){ - btncaption = g_Locale->getText(LOCALE_TIMERLIST_DELETE); +// btncaption = g_Locale->getText(LOCALE_TIMERLIST_DELETE); EventListFirstButton[0].locale = LOCALE_TIMERLIST_DELETE; } else { - btncaption = g_Locale->getText(LOCALE_EVENTLISTBAR_RECORDEVENT); +// btncaption = g_Locale->getText(LOCALE_EVENTLISTBAR_RECORDEVENT); EventListFirstButton[0].locale = LOCALE_EVENTLISTBAR_RECORDEVENT; } @@ -948,10 +948,10 @@ void EventList::showFunctionBar (bool show, t_channel_id channel_id) keyhelper.get(&dummy, &icon, g_settings.key_channelList_addremind); EventListThirdButton[0].button = icon; if(is_timer == CTimerd::TIMER_ZAPTO) { - btncaption = g_Locale->getText(LOCALE_TIMERLIST_DELETE); +// btncaption = g_Locale->getText(LOCALE_TIMERLIST_DELETE); EventListThirdButton[0].locale = LOCALE_TIMERLIST_DELETE; } else { - btncaption = g_Locale->getText(LOCALE_EVENTLISTBAR_CHANNELSWITCH); +// btncaption = g_Locale->getText(LOCALE_EVENTLISTBAR_CHANNELSWITCH); EventListThirdButton[0].locale = LOCALE_EVENTLISTBAR_CHANNELSWITCH; } } diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 62cf3e089..8a74475f8 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -1227,7 +1227,8 @@ void CInfoViewer::killRadiotext() void CInfoViewer::showRadiotext() { char stext[3][100]; - int yoff = 8, ii = 0; +// int yoff = 8; + int ii = 0; bool RTisIsUTF = false; if (g_Radiotext == NULL) return; @@ -1264,7 +1265,7 @@ void CInfoViewer::showRadiotext() frameBuffer->paintBoxRel(rt_x, rt_y, rt_dx, rt_dy, COL_INFOBAR_PLUS_0, RADIUS_LARGE, CORNER_TOP); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(rt_x+10, rt_y+ 30, rt_dx-20, stext[0], COL_INFOBAR, 0, RTisIsUTF); // UTF-8 } - yoff = 17; +// yoff = 17; ii = 1; #if 0 // RDS- or Rass-Symbol, ARec-Symbol or Bitrate @@ -1561,14 +1562,14 @@ void CInfoViewer::showSNR () g_SignalFont->RenderString (3 + BoxStartX + ((ChanWidth - satNameWidth) / 2), BoxStartY + 2 * chanH - 3, satNameWidth, freq, COL_INFOBAR); } int sw, snr, sig, posx, posy; - int height, ChanNumYPos; + + int height; ssig = CFEManager::getInstance()->getLiveFE()->getSignalStrength(); ssnr = CFEManager::getInstance()->getLiveFE()->getSignalNoiseRatio(); sig = (ssig & 0xFFFF) * 100 / 65535; snr = (ssnr & 0xFFFF) * 100 / 65535; height = g_SignalFont->getHeight () - 1; - ChanNumYPos = BoxStartY + ChanHeight /*+ 4*/ - 2 * height; if (lastsig != sig) { lastsig = sig; diff --git a/src/gui/motorcontrol.cpp b/src/gui/motorcontrol.cpp index 627b4dfc7..4df5d3506 100644 --- a/src/gui/motorcontrol.cpp +++ b/src/gui/motorcontrol.cpp @@ -714,7 +714,7 @@ void CMotorControl::showSNR() int barwidth = 100; uint16_t ssig, ssnr; int sig, snr; - int bheight, posx, posy; + int posx, posy; int sw; @@ -728,7 +728,6 @@ void CMotorControl::showSNR() g_sig = ssig & 0xFFFF; g_snr = snr; - bheight = mheight - 5; posy = y + height - mheight - 5; if (lastsig != sig) { diff --git a/src/gui/moviebrowser.cpp b/src/gui/moviebrowser.cpp index 655072405..d5cc1c4f9 100644 --- a/src/gui/moviebrowser.cpp +++ b/src/gui/moviebrowser.cpp @@ -681,7 +681,7 @@ void CMovieBrowser::initRows(void) m_settings.lastRecordRowWidth[4] = m_defaultRowWidth[m_settings.lastRecordRow[4]]; m_settings.lastRecordRowWidth[5] = m_defaultRowWidth[m_settings.lastRecordRow[5]]; } - +#if 0 void CMovieBrowser::initDevelopment(void) { TRACE("[mb]->initDevelopment\r\n"); @@ -694,6 +694,7 @@ void CMovieBrowser::initDevelopment(void) //addDir(name); } +#endif void CMovieBrowser::defaultSettings(MB_SETTINGS* settings) { @@ -2378,7 +2379,6 @@ void CMovieBrowser::updateDir(void) void CMovieBrowser::loadAllTsFileNamesFromStorage(void) { //TRACE("[mb]->loadAllTsFileNamesFromStorage \r\n"); - bool result; int i,size; m_movieSelectionHandler = NULL; @@ -2391,7 +2391,7 @@ void CMovieBrowser::loadAllTsFileNamesFromStorage(void) for(i=0; i < size;i++) { if(*m_dir[i].used == true ) - result = loadTsFileNamesFromDir(m_dir[i].name); + loadTsFileNamesFromDir(m_dir[i].name); } TRACE("[mb] Dir%d, Files:%d \r\n",m_dirNames.size(),m_vMovieInfo.size()); diff --git a/src/gui/moviebrowser.h b/src/gui/moviebrowser.h index 8f751f0e2..1f1bcf637 100644 --- a/src/gui/moviebrowser.h +++ b/src/gui/moviebrowser.h @@ -330,7 +330,9 @@ class CMovieBrowser : public CMenuTarget void init(void); //P1 void initGlobalSettings(void); //P1 void initFrames(void); +#if 0 void initDevelopment(void); //P1 for development testing only +#endif void initRows(void); void reinit(void); //P1 diff --git a/src/gui/movieinfo.cpp b/src/gui/movieinfo.cpp index ed87bbdd8..eda4e0dbd 100644 --- a/src/gui/movieinfo.cpp +++ b/src/gui/movieinfo.cpp @@ -957,8 +957,8 @@ bool CMovieInfo::saveFile_std(const CFile & file, const char *text, const int te bool result = false; int fd; if ((fd = open(file.Name.c_str(), O_SYNC | O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) { - int nr; - nr = write(fd, text, text_size); + /*int nr=*/ + write(fd, text, text_size); //fdatasync(fd); close(fd); result = true; diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 017340eff..871d1188d 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -601,7 +601,6 @@ void CMoviePlayerGui::PlayFile(void) if(!g_settings.screenshot_cover){ pos = fname.find_last_of('/'); if(pos != std::string::npos) { - std::string fname_scr=fname; fname.replace(0, pos, g_settings.screenshot_dir); } } diff --git a/src/gui/nfs.cpp b/src/gui/nfs.cpp index e9df3ad87..1d80c8371 100644 --- a/src/gui/nfs.cpp +++ b/src/gui/nfs.cpp @@ -208,7 +208,7 @@ const CMenuOptionChooser::keyval NFS_TYPE_OPTIONS[NFS_TYPE_OPTION_COUNT] = int CNFSMountGui::menuEntry(int nr) { - char *dir,*local_dir, *username, *password, *options1, *options2, *mac; + char *dir,*local_dir, *username, *password, *options1, *options2/*, *mac*/; int* automount; int* type; char cmd[9]; @@ -222,7 +222,7 @@ int CNFSMountGui::menuEntry(int nr) type = &g_settings.network_nfs_type[nr]; options1 = g_settings.network_nfs_mount_options1[nr]; options2 = g_settings.network_nfs_mount_options2[nr]; - mac = g_settings.network_nfs_mac[nr]; +// mac = g_settings.network_nfs_mac[nr]; sprintf(cmd,"domount%d",nr); sprintf(cmd2,"dir%d",nr); diff --git a/src/gui/osdlang_setup.cpp b/src/gui/osdlang_setup.cpp index 5acca3b52..fc2b32a84 100644 --- a/src/gui/osdlang_setup.cpp +++ b/src/gui/osdlang_setup.cpp @@ -128,7 +128,7 @@ CMenuOptionStringChooser* COsdLangSetup::getTzItems() if (!strcmp(xmlGetName(search), "zone")) { std::string name = xmlGetAttribute(search, "name"); - std::string zone = xmlGetAttribute(search, "zone"); +// std::string zone = xmlGetAttribute(search, "zone"); //printf("Timezone: %s -> %s\n", name.c_str(), zone.c_str()); tzSelect->addOption(name.c_str()); found = true; diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 8a5951df1..63cdeafc2 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -900,18 +900,17 @@ int CStreamInfo2::ts_setup () int CStreamInfo2::update_rate () { - unsigned char buf[TS_BUF_SIZE]; - long b; - - int ret = 0; - int b_len, b_start; - int timeout = 100; if(!dmx) return 0; - b_len = 0; - b_start = 0; + unsigned char buf[TS_BUF_SIZE] = {0}; + long b = 0; + + int ret = 0; + int b_len = 0; + int timeout = 100; + b_len = dmx->Read(buf, sizeof (buf), timeout); //printf("ts: read %d\n", b_len); diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 0413f53a7..238e153cc 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -787,12 +787,12 @@ void CTimerList::paintItem(int pos) if (liststart+pos==selected) { std::string line1 = convertTimerType2String(timer.eventType); // UTF-8 - std::string line2 = zAlarmTime; + //std::string line2 = zAlarmTime; switch (timer.eventType) { case CTimerd::TIMER_RECORD : - line2+= " -"; - line2+= zStopTime+6; + // line2+= " -"; + // line2+= zStopTime+6; case CTimerd::TIMER_NEXTPROGRAM : case CTimerd::TIMER_ZAPTO : { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 74bba9f4e..802b9d1b2 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3341,8 +3341,8 @@ void CNeutrinoApp::standbyMode( bool bOnOff ) videoDecoder->Standby(true); - g_Sectionsd->setServiceChanged(0, false); g_Sectionsd->setPauseScanning(true); + g_Sectionsd->setServiceChanged(0, false); if(!CRecordManager::getInstance()->RecordingStatus()) { //only save epg when not recording diff --git a/src/sectionsd/dmx.cpp b/src/sectionsd/dmx.cpp index b56158b6d..d97f6c87b 100644 --- a/src/sectionsd/dmx.cpp +++ b/src/sectionsd/dmx.cpp @@ -276,7 +276,7 @@ int DMX::getSection(char *buf, const unsigned timeoutInMSeconds, int &timeouts) extended_section_header *extended_header; eit_extended_section_header *eit_extended_header; int rc; - unsigned short section_length; + short section_length = 0; unsigned short current_onid = 0; unsigned short current_tsid = 0; diff --git a/src/sectionsd/sectionsd.cpp b/src/sectionsd/sectionsd.cpp index 45292c01c..87cbe9a69 100644 --- a/src/sectionsd/sectionsd.cpp +++ b/src/sectionsd/sectionsd.cpp @@ -32,6 +32,8 @@ #include #include +#include +#include #include #include #include @@ -4594,7 +4596,7 @@ static void *insertEventsfromFile(void *) struct stat buf; indexname = epg_dir + "index.tmp"; //skip read EPG cache if index.tmp available - if (!(stat(indexname.c_str(), &buf) == 0)){ + if (stat(indexname.c_str(), &buf) != 0){ indexname = epg_dir + "index.xml";