From 355a80253c675b1aa6705b0c69f15d5885a7776f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Fri, 10 Feb 2012 20:16:19 +0400 Subject: [PATCH] eitd/dmx: remove unused pauselock; add default constructor Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5a0fce7700f89565fb1b6d6ceef5277bb31b7ffb Author: [CST] Focus Date: 2012-02-10 (Fri, 10 Feb 2012) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/eitd/dmx.cpp | 32 +++++++++++++++++++++++--------- src/eitd/dmx.h | 14 ++++++++------ 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/eitd/dmx.cpp b/src/eitd/dmx.cpp index e6f73bae7..892a9aa1d 100644 --- a/src/eitd/dmx.cpp +++ b/src/eitd/dmx.cpp @@ -54,17 +54,36 @@ extern void showProfiling(std::string text); DMX::DMX(const unsigned short p, const unsigned short bufferSizeInKB, const bool c, int dmx_source) { dmx_num = dmx_source; + dmxBufferSizeInKB = bufferSizeInKB; + pID = p; + cache = c; + init(); +} + +DMX::DMX() +{ + pID = 0; + cache = true; + dmx_num = 0; + dmxBufferSizeInKB = 512; + init(); +} + + +void DMX::init() +{ fd = -1; lastChanged = time_monotonic(); filter_index = 0; - pID = p; - dmxBufferSizeInKB = bufferSizeInKB; + real_pauseCounter = 0; + current_service = 0; + first_skipped = 0; + #if HAVE_TRIPLEDRAGON /* hack, to keep the TD changes in one place. */ dmxBufferSizeInKB = 128; /* 128kB is enough on TD */ dmx_num = 0; /* always use demux 0 */ #endif - pthread_mutex_init(&pauselock, NULL); // default = fast mutex #ifdef DEBUG_MUTEX pthread_mutexattr_t start_stop_mutex_attr; pthread_mutexattr_init(&start_stop_mutex_attr); @@ -74,20 +93,15 @@ DMX::DMX(const unsigned short p, const unsigned short bufferSizeInKB, const bool pthread_mutex_init(&start_stop_mutex, NULL); // default = fast mutex #endif pthread_cond_init (&change_cond, NULL); - real_pauseCounter = 0; - current_service = 0; - - first_skipped = 0; - cache = c; } DMX::~DMX() { first_skipped = 0; myDMXOrderUniqueKey.clear(); - pthread_mutex_destroy(&pauselock); pthread_mutex_destroy(&start_stop_mutex); pthread_cond_destroy (&change_cond); + // FIXME closefd(); } diff --git a/src/eitd/dmx.h b/src/eitd/dmx.h index b92464c7a..8b5200264 100644 --- a/src/eitd/dmx.h +++ b/src/eitd/dmx.h @@ -43,16 +43,16 @@ class DMX { private: - int fd; - cDemux * dmx; - int dmx_num; - pthread_mutex_t pauselock; + int fd; + cDemux * dmx; + int dmx_num; unsigned short pID; unsigned short dmxBufferSizeInKB; - sections_id_t first_skipped; + sections_id_t first_skipped; int current_service; unsigned char eit_version; bool cache; /* should read sections be cached? true for all but dmxCN */ + int real_pauseCounter; inline bool isOpen(void) { return (fd != -1); @@ -63,6 +63,8 @@ private: bool check_complete(const unsigned char table_id, const unsigned short extension_id, const unsigned short onid, const unsigned short tsid, const unsigned char); sections_id_t create_sections_id(const unsigned char table_id, const unsigned short extension_id, const unsigned char section_number, const unsigned short onid, const unsigned short tsid); + void init(); + public: struct s_filters { @@ -74,11 +76,11 @@ public: int filter_index; time_t lastChanged; - int real_pauseCounter; pthread_cond_t change_cond; pthread_mutex_t start_stop_mutex; + DMX(); DMX(const unsigned short p, const unsigned short bufferSizeInKB, const bool cache = true, int dmx_source = 0); ~DMX();