mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 23:42:58 +02:00
introduce CEitManager class
This commit is contained in:
@@ -299,10 +299,4 @@ class CTimeThread : public CSectionThread
|
|||||||
void setTimeSet();
|
void setTimeSet();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CEitManager
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
public:
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -60,6 +60,7 @@
|
|||||||
#include <driver/abstime.h>
|
#include <driver/abstime.h>
|
||||||
|
|
||||||
#include "eitd.h"
|
#include "eitd.h"
|
||||||
|
#include "sectionsd.h"
|
||||||
#include "edvbstring.h"
|
#include "edvbstring.h"
|
||||||
#include "xmlutil.h"
|
#include "xmlutil.h"
|
||||||
|
|
||||||
@@ -2009,7 +2010,48 @@ static void *houseKeepingThread(void *)
|
|||||||
pthread_exit(NULL);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sectionsd_main_thread(void * /*data*/)
|
CEitManager* CEitManager::manager = NULL;
|
||||||
|
OpenThreads::Mutex CEitManager::m;
|
||||||
|
|
||||||
|
CEitManager::CEitManager()
|
||||||
|
{
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CEitManager::~CEitManager()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CEitManager * CEitManager::getInstance()
|
||||||
|
{
|
||||||
|
m.lock();
|
||||||
|
if(manager == NULL)
|
||||||
|
manager = new CEitManager();
|
||||||
|
m.unlock();
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEitManager::Start()
|
||||||
|
{
|
||||||
|
xprintf("[sectionsd] start\n");
|
||||||
|
if(running)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
running = true;
|
||||||
|
return (OpenThreads::Thread::start() == 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CEitManager::Stop()
|
||||||
|
{
|
||||||
|
if(!running)
|
||||||
|
return false;
|
||||||
|
running = false;
|
||||||
|
int ret = (OpenThreads::Thread::join() == 0);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEitManager::run()
|
||||||
{
|
{
|
||||||
pthread_t /*threadTOT,*/ threadHouseKeeping;
|
pthread_t /*threadTOT,*/ threadHouseKeeping;
|
||||||
int rc;
|
int rc;
|
||||||
@@ -2093,7 +2135,7 @@ printf("SIevent size: %d\n", sizeof(SIevent));
|
|||||||
|
|
||||||
sectionsd_ready = true;
|
sectionsd_ready = true;
|
||||||
|
|
||||||
while (!sectionsd_stop && sectionsd_server.run(sectionsd_parse_command, sectionsd::ACTVERSION, true)) {
|
while (running && sectionsd_server.run(sectionsd_parse_command, sectionsd::ACTVERSION, true)) {
|
||||||
sched_yield();
|
sched_yield();
|
||||||
if (threadCN.checkUpdate()) {
|
if (threadCN.checkUpdate()) {
|
||||||
sched_yield();
|
sched_yield();
|
||||||
@@ -2113,6 +2155,12 @@ printf("SIevent size: %d\n", sizeof(SIevent));
|
|||||||
threadEIT.StopRun();
|
threadEIT.StopRun();
|
||||||
threadCN.StopRun();
|
threadCN.StopRun();
|
||||||
threadTIME.StopRun();
|
threadTIME.StopRun();
|
||||||
|
#ifdef ENABLE_SDT
|
||||||
|
threadSDT.StopRun();
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_FREESATEPG
|
||||||
|
threadFSEIT.StopRun();
|
||||||
|
#endif
|
||||||
|
|
||||||
xprintf("broadcasting...\n");
|
xprintf("broadcasting...\n");
|
||||||
|
|
||||||
|
61
src/eitd/sectionsd.h
Normal file
61
src/eitd/sectionsd.h
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* sectionsd.h (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 __sectionsd_h__
|
||||||
|
#define __sectionsd_h__
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include <OpenThreads/Thread>
|
||||||
|
#include <OpenThreads/Condition>
|
||||||
|
#include "dmx.h"
|
||||||
|
|
||||||
|
//#include "SIutils.hpp"
|
||||||
|
//#include "SIservices.hpp"
|
||||||
|
//#include "SIevents.hpp"
|
||||||
|
//#include "SIsections.hpp"
|
||||||
|
//#include "SIlanguage.hpp"
|
||||||
|
|
||||||
|
class CEitManager : public OpenThreads::Thread, public OpenThreads::Mutex
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
bool running;
|
||||||
|
|
||||||
|
static OpenThreads::Mutex m;
|
||||||
|
static CEitManager * manager;
|
||||||
|
|
||||||
|
CEitManager();
|
||||||
|
/* main thread function */
|
||||||
|
void run();
|
||||||
|
public:
|
||||||
|
~CEitManager();
|
||||||
|
|
||||||
|
static CEitManager * getInstance();
|
||||||
|
|
||||||
|
bool Start();
|
||||||
|
bool Stop();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@@ -111,6 +111,7 @@
|
|||||||
|
|
||||||
#include "libdvbsub/dvbsub.h"
|
#include "libdvbsub/dvbsub.h"
|
||||||
#include "libtuxtxt/teletext.h"
|
#include "libtuxtxt/teletext.h"
|
||||||
|
#include <eitd/sectionsd.h>
|
||||||
|
|
||||||
int old_b_id = -1;
|
int old_b_id = -1;
|
||||||
CHintBox * reloadhintBox = 0;
|
CHintBox * reloadhintBox = 0;
|
||||||
@@ -140,7 +141,7 @@ static pthread_t nhttpd_thread ;
|
|||||||
//#define DISABLE_SECTIONSD
|
//#define DISABLE_SECTIONSD
|
||||||
extern int sectionsd_stop;
|
extern int sectionsd_stop;
|
||||||
#ifndef DISABLE_SECTIONSD
|
#ifndef DISABLE_SECTIONSD
|
||||||
static pthread_t sections_thread;
|
//static pthread_t sections_thread;
|
||||||
#endif
|
#endif
|
||||||
void * sectionsd_main_thread(void *data);
|
void * sectionsd_main_thread(void *data);
|
||||||
extern bool timeset; // sectionsd
|
extern bool timeset; // sectionsd
|
||||||
@@ -1717,7 +1718,8 @@ int CNeutrinoApp::run(int argc, char **argv)
|
|||||||
hintBox->paint();
|
hintBox->paint();
|
||||||
|
|
||||||
#ifndef DISABLE_SECTIONSD
|
#ifndef DISABLE_SECTIONSD
|
||||||
pthread_create (§ions_thread, NULL, sectionsd_main_thread, (void *) NULL);
|
//pthread_create (§ions_thread, NULL, sectionsd_main_thread, (void *) NULL);
|
||||||
|
CEitManager::getInstance()->Start();
|
||||||
#endif
|
#endif
|
||||||
g_Zapit = new CZapitClient;
|
g_Zapit = new CZapitClient;
|
||||||
|
|
||||||
@@ -3697,7 +3699,8 @@ void stop_daemons(bool stopall)
|
|||||||
}
|
}
|
||||||
#ifndef DISABLE_SECTIONSD
|
#ifndef DISABLE_SECTIONSD
|
||||||
printf("sectionsd shutdown\n");
|
printf("sectionsd shutdown\n");
|
||||||
pthread_join(sections_thread, NULL);
|
//pthread_join(sections_thread, NULL);
|
||||||
|
CEitManager::getInstance()->Stop();
|
||||||
printf("sectionsd shutdown done\n");
|
printf("sectionsd shutdown done\n");
|
||||||
#endif
|
#endif
|
||||||
tuxtx_stop_subtitle();
|
tuxtx_stop_subtitle();
|
||||||
|
Reference in New Issue
Block a user