From f4ba558155f89aa769dfa025311dae6b615479e4 Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Wed, 7 Mar 2012 16:44:35 +0400 Subject: [PATCH] eitd: little cleanup --- src/eitd/dmx.cpp | 22 ++++++--------- src/eitd/dmx.h | 8 +++--- src/eitd/eitd.h | 71 ++++++++++++++++++------------------------------ 3 files changed, 39 insertions(+), 62 deletions(-) diff --git a/src/eitd/dmx.cpp b/src/eitd/dmx.cpp index cd41c5759..4bb133afd 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 @@ -22,7 +23,6 @@ * */ - #include #include #include @@ -44,7 +44,7 @@ #include "debug.h" //#define DEBUG_MUTEX 1 -//#define DEBUG_DEMUX 1 // debug start/close/change +#define DEBUG_DEMUX 1 // debug start/close/change //#define DEBUG_CACHED_SECTIONS 1 //#define DEBUG_COMPLETE_SECTIONS 1 #define DEBUG_COMPLETE 1 @@ -203,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; @@ -253,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; } @@ -448,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/eitd.h b/src/eitd/eitd.h index 27d24918d..016791f49 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__ @@ -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; } };