diff options
author | zwer <zwer@1f4bef6d-8e0a-0410-8695-e467da8aaccf> | 2007-08-28 23:12:52 +0000 |
---|---|---|
committer | zwer <zwer@1f4bef6d-8e0a-0410-8695-e467da8aaccf> | 2007-08-28 23:12:52 +0000 |
commit | 9094d49876ad905193d92b8b6e6b73bbc8794ab1 (patch) | |
tree | 807d725c71688751b6bcc4507a219c282c7b1664 | |
parent | 27ae2b23fe40ac993d928f6787a7b222b6816483 (diff) | |
download | vdr-plugin-ffnetdev-9094d49876ad905193d92b8b6e6b73bbc8794ab1.tar.gz vdr-plugin-ffnetdev-9094d49876ad905193d92b8b6e6b73bbc8794ab1.tar.bz2 |
- Plugin lässt sich jetzt sauber beenden (beim beenden vom VDR gab es Probleme)
git-svn-id: svn://svn.berlios.de/ffnetdev/trunk@32 1f4bef6d-8e0a-0410-8695-e467da8aaccf
-rw-r--r-- | clientcontrol.c | 2 | ||||
-rw-r--r-- | ffnetdev.c | 2 | ||||
-rw-r--r-- | netosd.c | 1 | ||||
-rw-r--r-- | osdworker.c | 5 | ||||
-rw-r--r-- | pes2ts.c | 24 | ||||
-rw-r--r-- | pes2ts.h | 2 | ||||
-rw-r--r-- | streamdevice.c | 9 | ||||
-rw-r--r-- | tsworker.c | 4 |
8 files changed, 37 insertions, 12 deletions
diff --git a/clientcontrol.c b/clientcontrol.c index 8673dae..6cc545d 100644 --- a/clientcontrol.c +++ b/clientcontrol.c @@ -30,6 +30,8 @@ cClientControl::cClientControl(void) cClientControl::~cClientControl() { + dsyslog("[ffnetdev] Destructor cClientControl\n"); + if (m_Active) Stop(); delete m_ClientSocket; @@ -68,6 +68,8 @@ cPluginFFNetDev::cPluginFFNetDev(void) cPluginFFNetDev::~cPluginFFNetDev() { + dsyslog("[ffnetdev] Destructor cPluginFFNetDev\n"); + cOSDWorker::Exit(); cTSWorker::Exit(); cClientControl::Exit(); @@ -21,6 +21,7 @@ cNetOSD::~cNetOSD() #ifdef DEBUG fprintf(stderr,"[ffnetdev] NetOSD: Destructor cNetOSD.\n"); #endif + dsyslog("[ffnetdev] Destructor cNetOSD\n"); cOSDWorker::ClearScreen(); } diff --git a/osdworker.c b/osdworker.c index 3dcd5cb..46a929e 100644 --- a/osdworker.c +++ b/osdworker.c @@ -60,7 +60,10 @@ cOSDWorker::cOSDWorker(void) CreateSendBuffer(720 * 576); } -cOSDWorker::~cOSDWorker() { +cOSDWorker::~cOSDWorker() +{ + dsyslog("[ffnetdev] Destructor cOSDWorker\n"); + if (m_Active) Stop(); if (m_pEncoder != NULL) @@ -23,6 +23,7 @@ cPESRemux::cPESRemux(int inputBufferSize): cPESRemux::~cPESRemux() { + InputMutex.Unlock(); delete m_InputBuffer; } @@ -39,7 +40,8 @@ int cPESRemux::Put(const uchar *Data, int Count) cPES2TSRemux::cPES2TSRemux(int VPid, int APid): cPESRemux(INPUTBUFSIZE), cThread("[ffnetdev] PES2TS remux"), m_OutputBuffer(new cRingBufferLinear(OUTPUTBUFSIZE, TS_SIZE * 2)), - m_Active(false) + m_Active(false), + m_Ended(false) { vpid = VPid; apid = APid; @@ -48,7 +50,10 @@ cPES2TSRemux::cPES2TSRemux(int VPid, int APid): cPESRemux(INPUTBUFSIZE), cPES2TSRemux::~cPES2TSRemux() { + dsyslog("[ffnetdev] Destructor cPES2TSRemux\n"); m_Active = false; + while (!m_Ended) + cCondWait::SleepMs(10); delete m_OutputBuffer; } @@ -67,6 +72,7 @@ void cPES2TSRemux::Action(void) m_Active = true; + m_Ended = false; while (m_Active) { int count=0; // fprintf(stderr, "[ffnetdev] Remuxer: Inputbuffersize: %d, Outputbuffersize: %d\n", @@ -168,7 +174,7 @@ void cPES2TSRemux::Action(void) { if (!m_Active) continue; - cCondWait::SleepMs(10); + cCondWait::SleepMs(10); //dsyslog("[ffnetdev] Remuxer: sleep %d %d\n", m_OutputBuffer->Free(), tspacketlen); } @@ -207,7 +213,7 @@ void cPES2TSRemux::Action(void) UnlockOutput(); } - m_Active = false; + m_Ended = true; } @@ -215,7 +221,8 @@ void cPES2TSRemux::Action(void) cPES2PESRemux::cPES2PESRemux(): cPESRemux(INPUTBUFSIZE), cThread("[ffnetdev] PES2PES remux"), m_OutputBuffer(new cRingBufferLinear(OUTPUTBUFSIZE, IPACKS)), - m_Active(false) + m_Active(false), + m_Ended(false) { m_OutputBuffer->SetTimeouts(0, 1000); Start(); @@ -223,7 +230,10 @@ cPES2PESRemux::cPES2PESRemux(): cPESRemux(INPUTBUFSIZE), cPES2PESRemux::~cPES2PESRemux() { + dsyslog("[ffnetdev] Destructor cPES2PESRemux\n"); m_Active = false; + while (!m_Ended) + cCondWait::SleepMs(10); delete m_OutputBuffer; } @@ -233,7 +243,7 @@ void cPES2PESRemux::Action(void) unsigned int minNeededPacketlen = 10; // needed for read packet len: 6 Should be enought ... but makes no sense m_Active = true; - + m_Ended = false; while (m_Active) { int count=0; @@ -298,7 +308,7 @@ void cPES2PESRemux::Action(void) while (m_OutputBuffer->Free() < (int)packetlen) { if (!m_Active) - continue; + continue; cCondWait::SleepMs(10); //dsyslog("[ffnetdev] Remuxer: sleep %d %d\n", m_OutputBuffer->Free(), tspacketlen); } @@ -339,5 +349,5 @@ void cPES2PESRemux::Action(void) continue; } } - m_Active = false; + m_Ended = true; } @@ -49,6 +49,7 @@ class cPES2TSRemux: public cPESRemux, cThread private: cRingBufferLinear *m_OutputBuffer; bool m_Active; + bool m_Ended; unsigned short vpid; unsigned short apid; @@ -73,6 +74,7 @@ class cPES2PESRemux: public cPESRemux, cThread private: cRingBufferLinear *m_OutputBuffer; bool m_Active; + bool m_Ended; protected: virtual void Action(void); diff --git a/streamdevice.c b/streamdevice.c index ec8851d..48cfa22 100644 --- a/streamdevice.c +++ b/streamdevice.c @@ -24,9 +24,12 @@ cStreamDevice::cStreamDevice(void) cStreamDevice::~cStreamDevice(void) { - dsyslog("[ffnetdev] Device: Destructor cStreamDevice \n"); - m_PlayState = psPlay; - DELETENULL(m_Remux); + dsyslog("[ffnetdev] Device: Destructor cStreamDevice \n"); + m_PlayState = psPlay; + cOSDWorker::Exit(); + cTSWorker::Exit(); + cClientControl::Exit(); + DELETENULL(m_Remux); } @@ -43,7 +43,9 @@ cTSWorker::cTSWorker(void) origPrimaryDevice = -1; } -cTSWorker::~cTSWorker() { +cTSWorker::~cTSWorker() +{ + dsyslog("[ffnetdev] Destructor cTSWorker\n"); if (m_Active) Stop(); } |