diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-07-30 00:15:33 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-07-30 00:15:33 +0100 |
commit | add5644f64c86b635b62d560187c993aa7072b76 (patch) | |
tree | 70aaf1ae49ef4f27c4b20809250d5f5d63921d0e /p2pvr/devices | |
parent | Single definition of glibmm (diff) | |
download | p2pvr-add5644f64c86b635b62d560187c993aa7072b76.tar.bz2 p2pvr-add5644f64c86b635b62d560187c993aa7072b76.tar.xz p2pvr-add5644f64c86b635b62d560187c993aa7072b76.zip |
BIG migration from Project2 based to IceTray/Slicer :D
Diffstat (limited to 'p2pvr/devices')
-rw-r--r-- | p2pvr/devices/Jamfile.jam | 25 | ||||
-rw-r--r-- | p2pvr/devices/frontend.cpp | 9 | ||||
-rw-r--r-- | p2pvr/devices/frontend.h | 4 | ||||
-rw-r--r-- | p2pvr/devices/frontends/ofdm.cpp | 29 | ||||
-rw-r--r-- | p2pvr/devices/localDevices.cpp | 56 | ||||
-rw-r--r-- | p2pvr/devices/localDevices.h | 13 | ||||
-rw-r--r-- | p2pvr/devices/mockTuner.cpp | 27 | ||||
-rw-r--r-- | p2pvr/devices/mockTuner.h | 4 | ||||
-rw-r--r-- | p2pvr/devices/pch.hpp | 20 | ||||
-rw-r--r-- | p2pvr/devices/sampleSiData/events1.datxz | bin | 1112856 -> 1112857 bytes | |||
-rw-r--r-- | p2pvr/devices/tuner.cpp | 95 | ||||
-rw-r--r-- | p2pvr/devices/tuner.h | 27 | ||||
-rw-r--r-- | p2pvr/devices/tunerSendSi.cpp | 13 | ||||
-rw-r--r-- | p2pvr/devices/tunerSendSi.h | 2 | ||||
-rw-r--r-- | p2pvr/devices/tunerSendTs.cpp | 5 | ||||
-rw-r--r-- | p2pvr/devices/tunerSendTs.h | 2 |
16 files changed, 174 insertions, 157 deletions
diff --git a/p2pvr/devices/Jamfile.jam b/p2pvr/devices/Jamfile.jam index f39256b..0379340 100644 --- a/p2pvr/devices/Jamfile.jam +++ b/p2pvr/devices/Jamfile.jam @@ -1,29 +1,23 @@ -import type ; -import generators ; +import type ; +import generators ; lib boost_system ; lib boost_thread ; lib boost_filesystem ; +lib boost_program_options ; lib lzma ; -cpp-pch pch : pch.hpp : - <library>boost_system - <library>boost_filesystem - <library>..//p2common - <implicit-dependency>../ice//p2pvrice -; - lib p2pvrdevices : - pch [ glob-tree *.cpp : mockTuner.cpp ] : <library>boost_system <library>boost_filesystem + <library>boost_program_options <library>../dvb//p2pvrdvb <library>../ice//p2pvrice <library>../lib//p2pvrlib - <library>..//p2common <library>..//adhocutil + <library>..//icetray <implicit-dependency>../ice//p2pvrice : : <library>boost_filesystem @@ -32,12 +26,12 @@ lib p2pvrdevices : <include>. ; -type.register DATXZ : datxz ; +type.register DATXZ : datxz ; -generators.register-standard datxz.embed.asm : DATXZ : ASM ; +generators.register-standard datxz.embed.asm : DATXZ : ASM ; actions datxz.embed.asm -{ +{ m4 -DNAME="$(2:B)" -DPATH="$(2)" "$(root)/embed.m4" > "$(1)" } @@ -45,7 +39,6 @@ IMPORT $(__name__) : datxz.embed.asm : : datxz.embed.asm ; lib p2pvrMockTuner : - pch mockTuner.cpp [ glob-tree *.datxz ] : @@ -56,8 +49,8 @@ lib p2pvrMockTuner : <library>../dvb//p2pvrdvb <library>../ice//p2pvrice <library>../lib//p2pvrlib - <library>..//p2common <library>..//adhocutil + <library>..//icetray <implicit-dependency>../ice//p2pvrice : : <library>boost_filesystem diff --git a/p2pvr/devices/frontend.cpp b/p2pvr/devices/frontend.cpp index 5b9280b..c1d2c61 100644 --- a/p2pvr/devices/frontend.cpp +++ b/p2pvr/devices/frontend.cpp @@ -1,15 +1,14 @@ -#include <pch.hpp> #include "frontend.h" #include "tuner.h" -#include <logger.h> #include <sys/ioctl.h> #include <linux/dvb/frontend.h> #include <factory.impl.h> -Frontend::Frontend(Tuner * t, int fd, const struct dvb_frontend_info & i) : +Frontend::Frontend(Tuner * t, int fd, const struct dvb_frontend_info & i, IceTray::Logging::LoggerPtr log) : tuner(t), frontendFD(fd), - fe_info(i) + fe_info(i), + logger(log) { } @@ -29,7 +28,7 @@ Frontend::GetStatus() const { fe_status_t status; if (ioctl(frontendFD, FE_READ_STATUS, &status) < 0) { - Logger()->messagebf(LOG_ERR, "Reading frontend %s status failed (%s:%d)", tuner->Device(), strerror(errno), errno); + logger->messagebf(LOG::ERR, "Reading frontend %s status failed (%s:%d)", tuner->Device(), strerror(errno), errno); throw P2PVR::DeviceError(tuner->Device(), strerror(errno), errno); } return status; diff --git a/p2pvr/devices/frontend.h b/p2pvr/devices/frontend.h index b68cdba..51399b1 100644 --- a/p2pvr/devices/frontend.h +++ b/p2pvr/devices/frontend.h @@ -4,13 +4,14 @@ #include <linux/dvb/frontend.h> #include <factory.h> #include <dvb.h> +#include <logger.h> class Tuner; class Frontend { public: typedef boost::function<bool(long)> OnFrequencyFound; - Frontend(Tuner *, int fd, const struct dvb_frontend_info &); + Frontend(Tuner *, int fd, const struct dvb_frontend_info &, IceTray::Logging::LoggerPtr); virtual ~Frontend(); fe_status_t GetStatus() const; @@ -25,6 +26,7 @@ class Frontend { const Tuner * tuner; const int frontendFD; const struct dvb_frontend_info fe_info; + IceTray::Logging::LoggerPtr logger; }; typedef AdHoc::Factory<Frontend, Tuner *, int, const struct dvb_frontend_info &> FrontendFactory; diff --git a/p2pvr/devices/frontends/ofdm.cpp b/p2pvr/devices/frontends/ofdm.cpp index cb174ba..caa42a6 100644 --- a/p2pvr/devices/frontends/ofdm.cpp +++ b/p2pvr/devices/frontends/ofdm.cpp @@ -1,8 +1,6 @@ -#include <pch.hpp> #include "../frontend.h" #include "../tuner.h" #include <sys/ioctl.h> -#include <logger.h> #include <linux/dvb/frontend.h> #define FREQ_OFFSET_MIN 0 @@ -10,8 +8,11 @@ class Frontend_OFDM : public Frontend { public: - Frontend_OFDM(Tuner * t, int fd, const struct dvb_frontend_info & i) : Frontend(t, fd, i) { } - + Frontend_OFDM(Tuner * t, int fd, const struct dvb_frontend_info & i) : + Frontend(t, fd, i, LOGMANAGER()->getLogger<Frontend_OFDM>()) + { + } + void TuneTo(const DVBSI::DeliveryPtr & mp) const { auto td = DVBSI::TerrestrialDeliveryPtr::dynamicCast(mp); @@ -38,7 +39,7 @@ class Frontend_OFDM : public Frontend { dvb_frontend_parameters feparams; memset(&feparams, 0, sizeof(dvb_frontend_parameters)); if (ioctl(frontendFD, FE_GET_FRONTEND, &feparams) < 0) { - Logger()->messagebf(LOG_ERR, "Reading frontend parameters failed (%s:%d)", tuner->Device(), strerror(errno), errno); + logger->messagebf(LOG::ERR, "Reading frontend parameters failed (%s:%d)", tuner->Device(), strerror(errno), errno); throw P2PVR::DeviceError(tuner->Device(), strerror(errno), errno); } return feparams; @@ -48,20 +49,20 @@ class Frontend_OFDM : public Frontend { { fe_status_t status = (fe_status_t)0; // Wait for something - for (int x = Tuner::TuningTimeout / 10; x > 0 && (status = GetStatus()) == 0; x -= 1) { + for (int x = tuner->options->TuningTimeout / 10; x > 0 && (status = GetStatus()) == 0; x -= 1) { usleep(10000); } // Was it useful? if (!(status & (FE_HAS_SIGNAL | FE_HAS_CARRIER))) { - Logger()->messagebf(LOG_ERR, "Tuning of device %s failed (No signal or carrier: 0x%02x)", tuner->Device(), status); + logger->messagebf(LOG::ERR, "Tuning of device %s failed (No signal or carrier: 0x%02x)", tuner->Device(), status); throw P2PVR::DeviceError(tuner->Device(), "No carrier", 0); } // Wait for lock - for (int x = Tuner::LockTimeout / 10; x > 0 && ((status = GetStatus()) & FE_HAS_LOCK) == 0; x -= 1) { + for (int x = tuner->options->LockTimeout / 10; x > 0 && ((status = GetStatus()) & FE_HAS_LOCK) == 0; x -= 1) { usleep(10000); } if (!(status & FE_HAS_LOCK)) { - Logger()->messagebf(LOG_ERR, "Tuning of device %s failed (%s)", tuner->Device(), "No lock"); + logger->messagebf(LOG::ERR, "Tuning of device %s failed (%s)", tuner->Device(), "No lock"); throw P2PVR::DeviceError(tuner->Device(), "No lock", 0); } } @@ -69,7 +70,7 @@ class Frontend_OFDM : public Frontend { void SetParameters(const dvb_frontend_parameters & feparams) const { if (ioctl(frontendFD, FE_SET_FRONTEND, &feparams) < 0) { - Logger()->messagebf(LOG_ERR, "Tuning of device %s failed (%s:%d)", tuner->Device(), strerror(errno), errno); + logger->messagebf(LOG::ERR, "Tuning of device %s failed (%s:%d)", tuner->Device(), strerror(errno), errno); throw P2PVR::DeviceError(tuner->Device(), strerror(errno), errno); } } @@ -134,15 +135,15 @@ class Frontend_OFDM : public Frontend { continue; } if (fe_info.frequency_min > feparams.frequency || fe_info.frequency_max < feparams.frequency) { - Logger()->messagebf(LOG_WARNING, "Channel %d, freq (%d Hz) outside card range", channel, feparams.frequency); + logger->messagebf(LOG::WARNING, "Channel %d, freq (%d Hz) outside card range", channel, feparams.frequency); continue; } try { - Logger()->messagebf(LOG_DEBUG, "Channel %d, Frequency %d Hz", channel, feparams.frequency); + logger->messagebf(LOG::DEBUG, "Channel %d, Frequency %d Hz", channel, feparams.frequency); SetParameters(feparams); WaitForLock(); - Logger()->messagebf(LOG_INFO, "Found multiplex at %d Hz", feparams.frequency); - Logger()->messagebf(LOG_DEBUG, "frequency %d", feparams.frequency); + logger->messagebf(LOG::INFO, "Found multiplex at %d Hz", feparams.frequency); + logger->messagebf(LOG::DEBUG, "frequency %d", feparams.frequency); if (onFrequencyFound(feparams.frequency)) { return; } diff --git a/p2pvr/devices/localDevices.cpp b/p2pvr/devices/localDevices.cpp index 00ec395..cbe74a8 100644 --- a/p2pvr/devices/localDevices.cpp +++ b/p2pvr/devices/localDevices.cpp @@ -1,32 +1,36 @@ -#include <pch.hpp> #include "localDevices.h" #include <Ice/Ice.h> #include "tuner.h" #include "bindTimerTask.h" -#include <logger.h> LocalDevices::Devices LocalDevices::devices; std::mutex LocalDevices::lock; -DECLARE_OPTIONS(LocalDevices, "P2PVR Devices") -("p2pvr.localdevices.frontend", - Options::functions( - [](const VariableType & df) { devices.insert(Devices::value_type(df.as<std::string>(), OpenTunerPtr())); }, - []{ devices.clear(); }), - "Frontend of DVB devices to use (/dev/dvb/adapterX/frontendY)") -END_OPTIONS(LocalDevices); +LocalDevices::Options::Options() : + IceTray::Options("P2PVR Devices") +{ +} + +ICETRAY_OPTIONS(LocalDevices::Options, + ("p2pvr.localdevices.frontend", boost::program_options::value(&devices), "Frontend of DVB device(s) to use (/dev/dvb/adapterX/frontendY)") +); + +IceTray::Logging::LoggerPtr LocalDevices::logger(LOGMANAGER()->getLogger<LocalDevices>()); LocalDevices::LocalDevices(Ice::ObjectAdapterPtr adapter, IceUtil::TimerPtr t) : timer(t), clientCheck(new BindTimerTask(boost::bind(&LocalDevices::ClientCheck, this, adapter))) { - Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__); + for (auto & device : options->devices) { + devices.insert({ device, nullptr }); + } + logger->message(LOG::DEBUG, __PRETTY_FUNCTION__); timer->scheduleRepeated(clientCheck, IceUtil::Time::seconds(30)); } LocalDevices::~LocalDevices() { - Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__); + logger->message(LOG::DEBUG, __PRETTY_FUNCTION__); timer->cancel(clientCheck); } @@ -36,7 +40,7 @@ LocalDevices::ClientCheck(Ice::ObjectAdapterPtr adapter) std::lock_guard<std::mutex> g(lock); for (auto & device : devices) { if (device.second && device.second->tuner->GetLastUsedTime() < time(NULL) - 30) { - Logger()->messagebf(LOG_DEBUG, "%s: Device %s no longer in use", __PRETTY_FUNCTION__, device.first); + logger->messagebf(LOG::DEBUG, "%s: Device %s no longer in use", __PRETTY_FUNCTION__, device.first); auto id = device.second->tuner->ice_getIdentity(); if (adapter->find(id)) { adapter->remove(id); @@ -50,7 +54,7 @@ P2PVR::TunerPrx LocalDevices::GetTunerSpecific(const DVBSI::DeliveryPtr & delivery, const Ice::Current & ice) { std::lock_guard<std::mutex> g(lock); - Logger()->messagebf(LOG_DEBUG, "%s: Searching for an open sharable tuner (frequency %d)", __PRETTY_FUNCTION__, delivery->Frequency); + logger->messagebf(LOG::DEBUG, "%s: Searching for an open sharable tuner (frequency %d)", __PRETTY_FUNCTION__, delivery->Frequency); auto openTuner = std::find_if(devices.begin(), devices.end(), [delivery](const Devices::value_type & ot) { return ot.second && !ot.second->openedPrivate && ot.second->delivery && ot.second->delivery->Frequency == delivery->Frequency; }); @@ -61,19 +65,19 @@ LocalDevices::GetTunerSpecific(const DVBSI::DeliveryPtr & delivery, const Ice::C openTuner = std::find_if(devices.begin(), devices.end(), [](const Devices::value_type & ot) { return !ot.second; }); if (openTuner == devices.end()) { - Logger()->messagebf(LOG_DEBUG, "%s: None suitable and none free (frequency %d)", + logger->messagebf(LOG::DEBUG, "%s: None suitable and none free (frequency %d)", __PRETTY_FUNCTION__, delivery->Frequency); throw P2PVR::NoSuitableDeviceAvailable(); } - Logger()->messagebf(LOG_DEBUG, "%s: Opening a sharable tuner (frequency %d, frontend %s)", + logger->messagebf(LOG::DEBUG, "%s: Opening a sharable tuner (frequency %d, frontend %s)", __PRETTY_FUNCTION__, delivery->Frequency, openTuner->first); P2PVR::PrivateTunerPtr t = new Tuner(openTuner->first); t->TuneTo(delivery, ice); auto tuner = P2PVR::PrivateTunerPrx::checkedCast(ice.adapter->addWithUUID(t)); openTuner->second = OpenTunerPtr(new OpenTuner(delivery, tuner, false)); - Logger()->messagebf(LOG_DEBUG, "%s: Tuned, returning (frequency %d, frontend %s)", + logger->messagebf(LOG::DEBUG, "%s: Tuned, returning (frequency %d, frontend %s)", __PRETTY_FUNCTION__, delivery->Frequency, openTuner->first); return tuner; } @@ -82,7 +86,7 @@ P2PVR::TunerPrx LocalDevices::GetTunerAny(const DVBSI::DeliveryPtr & delivery, const Ice::Current & ice) { std::lock_guard<std::mutex> g(lock); - Logger()->messagebf(LOG_DEBUG, "%s: Searching for an open sharable tuner any frequency", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: Searching for an open sharable tuner any frequency", __PRETTY_FUNCTION__); auto openTuner = std::find_if(devices.begin(), devices.end(), [delivery](const Devices::value_type & ot) { return ot.second && !ot.second->openedPrivate && ot.second->delivery; }); @@ -93,19 +97,19 @@ LocalDevices::GetTunerAny(const DVBSI::DeliveryPtr & delivery, const Ice::Curren openTuner = std::find_if(devices.begin(), devices.end(), [](const Devices::value_type & ot) { return !ot.second; }); if (openTuner == devices.end()) { - Logger()->messagebf(LOG_DEBUG, "%s: None suitable and none free (frequency %d)", + logger->messagebf(LOG::DEBUG, "%s: None suitable and none free (frequency %d)", __PRETTY_FUNCTION__, delivery->Frequency); throw P2PVR::NoSuitableDeviceAvailable(); } - Logger()->messagebf(LOG_DEBUG, "%s: Opening a sharable tuner (frequency %d, frontend %s)", + logger->messagebf(LOG::DEBUG, "%s: Opening a sharable tuner (frequency %d, frontend %s)", __PRETTY_FUNCTION__, delivery->Frequency, openTuner->first); P2PVR::PrivateTunerPtr t = new Tuner(openTuner->first); t->TuneTo(delivery, ice); auto tuner = P2PVR::PrivateTunerPrx::checkedCast(ice.adapter->addWithUUID(t)); openTuner->second = OpenTunerPtr(new OpenTuner(delivery, tuner, false)); - Logger()->messagebf(LOG_DEBUG, "%s: Tuned, returning (frequency %d, frontend %s)", + logger->messagebf(LOG::DEBUG, "%s: Tuned, returning (frequency %d, frontend %s)", __PRETTY_FUNCTION__, delivery->Frequency, openTuner->first); return tuner; } @@ -114,14 +118,14 @@ P2PVR::PrivateTunerPrx LocalDevices::GetPrivateTuner(short , const Ice::Current & ice) { std::lock_guard<std::mutex> g(lock); - Logger()->messagebf(LOG_DEBUG, "%s: Opening a private tuner", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: Opening a private tuner", __PRETTY_FUNCTION__); auto openTuner = std::find_if(devices.begin(), devices.end(), [](const Devices::value_type & ot) { return !ot.second; }); if (openTuner == devices.end()) { - Logger()->messagebf(LOG_DEBUG, "%s: None free", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: None free", __PRETTY_FUNCTION__); throw P2PVR::NoSuitableDeviceAvailable(); } - Logger()->messagebf(LOG_DEBUG, "%s: Opening a private tuner (frontend %s)", + logger->messagebf(LOG::DEBUG, "%s: Opening a private tuner (frontend %s)", __PRETTY_FUNCTION__, openTuner->first); auto tuner = P2PVR::PrivateTunerPrx::checkedCast(ice.adapter->addWithUUID(new Tuner(openTuner->first))); openTuner->second = OpenTunerPtr(new OpenTuner(NULL, tuner, true)); @@ -133,15 +137,15 @@ void LocalDevices::ReleaseTuner(const P2PVR::TunerPrx & tuner, const Ice::Current & ice) { std::lock_guard<std::mutex> g(lock); - Logger()->messagebf(LOG_DEBUG, "%s", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s", __PRETTY_FUNCTION__); auto openTuner = std::find_if(devices.begin(), devices.end(), [tuner](const Devices::value_type & ot) { return ot.second && ot.second->tuner == tuner; }); if (openTuner == devices.end()) { - Logger()->messagebf(LOG_DEBUG, "%s: Not one of mine", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: Not one of mine", __PRETTY_FUNCTION__); return; } - Logger()->messagebf(LOG_DEBUG, "%s: Locally owned deivce %s", __PRETTY_FUNCTION__, openTuner->first); + logger->messagebf(LOG::DEBUG, "%s: Locally owned deivce %s", __PRETTY_FUNCTION__, openTuner->first); openTuner->second->clients -= 1; if (openTuner->second->clients == 0) { auto id = tuner->ice_getIdentity(); diff --git a/p2pvr/devices/localDevices.h b/p2pvr/devices/localDevices.h index 1845256..7bd97ee 100644 --- a/p2pvr/devices/localDevices.h +++ b/p2pvr/devices/localDevices.h @@ -9,9 +9,19 @@ #include <mutex> #include <visibility.h> #include <IceUtil/Timer.h> +#include <logger.h> class DLL_PUBLIC LocalDevices : public P2PVR::LocalDevices { public: + class Options : public IceTray::Options { + public: + Options(); + + ICETRAY_OPTIONS_DECLARE; + + std::vector<std::string> devices; + }; + LocalDevices(Ice::ObjectAdapterPtr adapter, IceUtil::TimerPtr); ~LocalDevices(); @@ -25,7 +35,6 @@ class DLL_PUBLIC LocalDevices : public P2PVR::LocalDevices { void Add(const std::string & frontend, const Ice::Current &); void Remove(const std::string & frontend, const Ice::Current &); - INITOPTIONS; private: // Reference to global timer IceUtil::TimerPtr timer; @@ -48,6 +57,8 @@ class DLL_PUBLIC LocalDevices : public P2PVR::LocalDevices { typedef std::map<std::string, OpenTunerPtr> Devices; static Devices devices; static std::mutex lock; + static IceTray::Logging::LoggerPtr logger; + IceTray::OptionsResolver<Options> options; }; #endif diff --git a/p2pvr/devices/mockTuner.cpp b/p2pvr/devices/mockTuner.cpp index 05a0437..b040128 100644 --- a/p2pvr/devices/mockTuner.cpp +++ b/p2pvr/devices/mockTuner.cpp @@ -11,11 +11,14 @@ extern "C" { \ } \ static const Ice::ByteSeq resource(&resource##_start, &resource##_end); -#define LZMA_ASSERT(ret_xz) \ - if (ret_xz != LZMA_OK) { \ - Logger()->messagebf(LOG_ERR, "%s: LZMA error (%d)", __PRETTY_FUNCTION__, ret_xz); \ - throw P2PVR::DeviceError("LZMA", "Decompressor error", ret_xz); \ +void +MockTuner::LZMA_ASSERT(int ret_xz) +{ + if (ret_xz != LZMA_OK) { + MockTuner::logger->messagebf(LOG::ERR, "%s: LZMA error (%d)", __PRETTY_FUNCTION__, ret_xz); + throw P2PVR::DeviceError("LZMA", "Decompressor error", ret_xz); } +} ResourceFile(network); ResourceFile(services); @@ -27,6 +30,8 @@ ResourceFile(vid); int MockTuner::eventSet = 0; +IceTray::Logging::LoggerPtr MockTuner::logger = LOGMANAGER()->getLogger<MockTuner>(); + void MockTuner::SetEventsSet(int n) { @@ -49,7 +54,7 @@ int MockTuner::GetStatus(const Ice::Current&) Ice::ByteSeq MockTuner::Decompress(const Ice::ByteSeq & dataxz) { - Logger()->messagebf(LOG_DEBUG, "%s: setup", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: setup", __PRETTY_FUNCTION__); lzma_stream strm = LZMA_STREAM_INIT; const uint32_t flags = LZMA_TELL_UNSUPPORTED_CHECK | LZMA_CONCATENATED; const uint64_t memory_limit = UINT64_MAX; @@ -58,7 +63,7 @@ Ice::ByteSeq MockTuner::Decompress(const Ice::ByteSeq & dataxz) strm.avail_in = dataxz.size(); uint8_t buf[BUFSIZ]; - Logger()->messagebf(LOG_DEBUG, "%s: decompress %d bytes", __PRETTY_FUNCTION__, dataxz.size()); + logger->messagebf(LOG::DEBUG, "%s: decompress %d bytes", __PRETTY_FUNCTION__, dataxz.size()); Ice::ByteSeq data; data.reserve(dataxz.size() * 20); do { @@ -75,17 +80,17 @@ Ice::ByteSeq MockTuner::Decompress(const Ice::ByteSeq & dataxz) void MockTuner::DecompressAndSendPackets(const Ice::ByteSeq & dataxz, const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) const { - Logger()->messagebf(LOG_DEBUG, "%s: deserialize", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: deserialize", __PRETTY_FUNCTION__); std::list<Ice::ByteSeq> packets; auto istrm = Ice::createInputStream(ice.adapter->getCommunicator(), Decompress(dataxz)); istrm->read(packets); - Logger()->messagebf(LOG_DEBUG, "%s: send", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: send", __PRETTY_FUNCTION__); for (const auto & packet : packets) { client->NewData(packet); } - Logger()->messagebf(LOG_DEBUG, "%s: complete", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: complete", __PRETTY_FUNCTION__); } void MockTuner::ScanAndSendNetworkInformation(const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) @@ -125,7 +130,7 @@ void MockTuner::SendLoop(const P2PVR::RawDataClientPrx & t, const Ice::ByteSeq & std::list<Ice::ByteSeq> packets; auto istrm = Ice::createInputStream(ice.adapter->getCommunicator(), Decompress(dataxz)); istrm->read(packets); - Logger()->messagebf(LOG_DEBUG, "%s: loop over %d packets", __PRETTY_FUNCTION__, packets.size()); + logger->messagebf(LOG::DEBUG, "%s: loop over %d packets", __PRETTY_FUNCTION__, packets.size()); auto p = packets.begin(); while (true) { { @@ -160,7 +165,7 @@ int MockTuner::StartSendingSection(Ice::Int sid, const P2PVR::RawDataClientPrx & void MockTuner::StopSending(int s, const Ice::Current &) { - Logger()->messagebf(LOG_DEBUG, "%s: stop %d", __PRETTY_FUNCTION__, s); + logger->messagebf(LOG::DEBUG, "%s: stop %d", __PRETTY_FUNCTION__, s); auto sitr = senders.find(s); if (sitr != senders.end()) { sitr->second->interrupt(); diff --git a/p2pvr/devices/mockTuner.h b/p2pvr/devices/mockTuner.h index d640209..60372c9 100644 --- a/p2pvr/devices/mockTuner.h +++ b/p2pvr/devices/mockTuner.h @@ -5,6 +5,7 @@ #include <visibility.h> #include <Ice/BuiltinSequences.h> #include <boost/thread.hpp> +#include <logger.h> class DLL_PUBLIC MockTuner : public P2PVR::PrivateTuner { public: @@ -31,12 +32,15 @@ class DLL_PUBLIC MockTuner : public P2PVR::PrivateTuner { protected: static Ice::ByteSeq Decompress(const Ice::ByteSeq &); + static void LZMA_ASSERT(int ret_xz); void DecompressAndSendPackets(const Ice::ByteSeq &, const P2PVR::RawDataClientPrx &, const Ice::Current&) const; void SendLoop(const P2PVR::RawDataClientPrx & t, const Ice::ByteSeq & dataxz, const Ice::Current & ice) const; static int eventSet; std::map<int, boost::thread *> senders; int senderId; + + static IceTray::Logging::LoggerPtr logger; }; #endif diff --git a/p2pvr/devices/pch.hpp b/p2pvr/devices/pch.hpp deleted file mode 100644 index 7a7881c..0000000 --- a/p2pvr/devices/pch.hpp +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef BOOST_BUILD_PCH_ENABLED -#ifndef P2PVRLIB_PCH -#define P2PVRLIB_PCH - -#include <Ice/Ice.h> -#include <boost/bind.hpp> -#include <boost/function/function_fwd.hpp> -#include <boost/intrusive_ptr.hpp> -#include <boost/shared_ptr.hpp> - -#include <list> -#include <map> -#include <set> -#include <string> -#include <vector> -#include <thread> - -#endif -#endif - diff --git a/p2pvr/devices/sampleSiData/events1.datxz b/p2pvr/devices/sampleSiData/events1.datxz Binary files differindex a84d777..43358a9 100644 --- a/p2pvr/devices/sampleSiData/events1.datxz +++ b/p2pvr/devices/sampleSiData/events1.datxz diff --git a/p2pvr/devices/tuner.cpp b/p2pvr/devices/tuner.cpp index f6df896..148790b 100644 --- a/p2pvr/devices/tuner.cpp +++ b/p2pvr/devices/tuner.cpp @@ -1,10 +1,8 @@ -#include <pch.hpp> #include "tuner.h" #include <fcntl.h> #include <Ice/Ice.h> #include <sys/ioctl.h> #include <poll.h> -#include <logger.h> #include <factory.h> #include <linux/dvb/frontend.h> #include <linux/dvb/dmx.h> @@ -14,6 +12,8 @@ #include "tunerSendSi.h" #include "tunerSendTs.h" +IceTray::Logging::LoggerPtr Tuner::logger = LOGMANAGER()->getLogger<Tuner>(); + Tuner::Tuner(const boost::filesystem::path & df) : deviceFrontend(df), deviceRoot(df.branch_path()), @@ -35,7 +35,7 @@ Tuner::Tuner(const boost::filesystem::path & df) : close(fd); throw; } - Logger()->messagebf(LOG_INFO, "%s: Attached to %s (%s, type %s)", __PRETTY_FUNCTION__, + logger->messagebf(LOG::INFO, "%s: Attached to %s (%s, type %s)", __PRETTY_FUNCTION__, deviceRoot, frontend->Info().name, frontend->Type()); } @@ -94,12 +94,12 @@ Tuner::ScanAndSendNetworkInformation(const P2PVR::RawDataClientPrx & client, con } catch (const std::exception & ex) { char * buf = __cxxabiv1::__cxa_demangle(typeid(ex).name(), NULL, NULL, NULL); - Logger()->messagebf(LOG_DEBUG, "%s: frequency scan lock event failed %s:%s", __PRETTY_FUNCTION__, buf, ex.what()); + logger->messagebf(LOG::DEBUG, "%s: frequency scan lock event failed %s:%s", __PRETTY_FUNCTION__, buf, ex.what()); free(buf); return false; } catch (...) { - Logger()->messagebf(LOG_DEBUG, "%s: frequency scan lock event failed", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: frequency scan lock event failed", __PRETTY_FUNCTION__); return false; } }); @@ -145,7 +145,7 @@ uint64_t Tuner::SendPID(int pid, const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) const { time(&lastUsedTime); - Logger()->messagebf(LOG_DEBUG, "%s: pid = 0x%x", __PRETTY_FUNCTION__, pid); + logger->messagebf(LOG::DEBUG, "%s: pid = 0x%x", __PRETTY_FUNCTION__, pid); if (ice.con) { ice.con->createProxy(client->ice_getIdentity()); @@ -156,9 +156,9 @@ Tuner::SendPID(int pid, const P2PVR::RawDataClientPrx & client, const Ice::Curre } void -Tuner::RequestPID(int pid, int demux) +Tuner::RequestPID(int pid, int demux) const { - setBufferSize(demux, DemuxTableBufferSize); + setBufferSize(demux, options->DemuxTableBufferSize); struct dmx_sct_filter_params sctFilterParams; memset(&sctFilterParams, 0, sizeof(dmx_sct_filter_params)); sctFilterParams.pid = pid; @@ -172,7 +172,7 @@ Tuner::RequestPID(int pid, int demux) uint64_t Tuner::ReadDemuxAndSend(int demux, const P2PVR::RawDataClientPrx & _client) const { - Logger()->messagebf(LOG_DEBUG, "%s: begin", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: begin", __PRETTY_FUNCTION__); struct pollfd ufd; memset(&ufd, 0, sizeof(pollfd)); ufd.fd = demux; @@ -180,13 +180,13 @@ Tuner::ReadDemuxAndSend(int demux, const P2PVR::RawDataClientPrx & _client) cons BackgroundClient client = BackgroundClient(new SendSi(_client)); do { // Wait for data to appear - switch (poll(&ufd, 1, DemuxReadTimeout)) { + switch (poll(&ufd, 1, options->DemuxReadTimeout)) { case -1: - Logger()->messagebf(LOG_DEBUG, "%s: poll error reading demux (%d:%s)", __PRETTY_FUNCTION__, errno, strerror(errno)); + logger->messagebf(LOG::DEBUG, "%s: poll error reading demux (%d:%s)", __PRETTY_FUNCTION__, errno, strerror(errno)); throw P2PVR::DeviceError("demux", strerror(errno), errno); case 0: auto status = frontend->GetStatus(); - Logger()->messagebf(LOG_DEBUG, "%s: Timed out waiting for data (device status 0x%02x)", __PRETTY_FUNCTION__, status); + logger->messagebf(LOG::DEBUG, "%s: Timed out waiting for data (device status 0x%02x)", __PRETTY_FUNCTION__, status); throw P2PVR::DeviceError("demux", "timeout", 0); } @@ -194,7 +194,7 @@ Tuner::ReadDemuxAndSend(int demux, const P2PVR::RawDataClientPrx & _client) cons P2PVR::Data buf(1 << 12); int nr = read(demux, &buf.front(), buf.size()); if (nr < 0) { - Logger()->messagebf(LOG_DEBUG, "%s: error reading demux (%d:%s) status 0x%02x", + logger->messagebf(LOG::DEBUG, "%s: error reading demux (%d:%s) status 0x%02x", __PRETTY_FUNCTION__, errno, strerror(errno), frontend->GetStatus()); throw P2PVR::DeviceError("demux", strerror(errno), errno); } @@ -207,7 +207,7 @@ Tuner::ReadDemuxAndSend(int demux, const P2PVR::RawDataClientPrx & _client) cons } while (!client->IsFinished()); auto packetsSent = client->PacketsSent(); client.reset(); - Logger()->messagebf(LOG_DEBUG, "%s: end (sent %d packets)", __PRETTY_FUNCTION__, packetsSent); + logger->messagebf(LOG::DEBUG, "%s: end (sent %d packets)", __PRETTY_FUNCTION__, packetsSent); return packetsSent; } @@ -215,7 +215,7 @@ int Tuner::StartSendingSection(int pid, const P2PVR::RawDataClientPrx & client, const Ice::Current &) { time(&lastUsedTime); - Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__); + logger->message(LOG::DEBUG, __PRETTY_FUNCTION__); std::lock_guard<std::mutex> g(lock); int demux = backgroundClients.insert(BackgroundClients::value_type(OpenDemux(), @@ -229,7 +229,7 @@ int Tuner::StartSendingTS(const P2PVR::PacketIds & pids, const P2PVR::RawDataClientPrx & client, const Ice::Current & ice) { time(&lastUsedTime); - Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__); + logger->message(LOG::DEBUG, __PRETTY_FUNCTION__); if (pids.empty()) { throw P2PVR::DeviceError("demux", "Packet Id list cannot be empty", 0); } @@ -240,10 +240,10 @@ Tuner::StartSendingTS(const P2PVR::PacketIds & pids, const P2PVR::RawDataClientP std::lock_guard<std::mutex> g(lock); int demux = backgroundClients.insert(BackgroundClients::value_type(OpenDemux(), BackgroundClient(new SendTs(client)))).first->first; - + struct dmx_pes_filter_params pesFilterParams; memset(&pesFilterParams, 0, sizeof(struct dmx_pes_filter_params)); - Logger()->messagebf(LOG_ERR, "%s: DMX_SET_PES_FILTER for pid %d", __PRETTY_FUNCTION__, pids[0]); + logger->messagebf(LOG::ERR, "%s: DMX_SET_PES_FILTER for pid %d", __PRETTY_FUNCTION__, pids[0]); pesFilterParams.pid = pids[0]; pesFilterParams.input = DMX_IN_FRONTEND; pesFilterParams.output = DMX_OUT_TSDEMUX_TAP; @@ -252,24 +252,24 @@ Tuner::StartSendingTS(const P2PVR::PacketIds & pids, const P2PVR::RawDataClientP if (ioctl(demux, DMX_SET_PES_FILTER, &pesFilterParams) < 0) { backgroundClients.erase(demux); - Logger()->messagebf(LOG_ERR, "%s: DMX_SET_PES_FILTER failed (%d: %s)", __PRETTY_FUNCTION__, errno, strerror(errno)); + logger->messagebf(LOG::ERR, "%s: DMX_SET_PES_FILTER failed (%d: %s)", __PRETTY_FUNCTION__, errno, strerror(errno)); throw P2PVR::DeviceError("demux", strerror(errno), errno); } for (unsigned int x = 1; x < pids.size(); x += 1) { __u16 p = pids[x]; - Logger()->messagebf(LOG_ERR, "%s: DMX_ADD_PID for pid %d", __PRETTY_FUNCTION__, p); + logger->messagebf(LOG::ERR, "%s: DMX_ADD_PID for pid %d", __PRETTY_FUNCTION__, p); if (ioctl(demux, DMX_ADD_PID, &p) < 0) { backgroundClients.erase(demux); - Logger()->messagebf(LOG_ERR, "%s: DMX_ADD_PID failed (%d: %s)", __PRETTY_FUNCTION__, errno, strerror(errno)); + logger->messagebf(LOG::ERR, "%s: DMX_ADD_PID failed (%d: %s)", __PRETTY_FUNCTION__, errno, strerror(errno)); throw P2PVR::DeviceError("demux", strerror(errno), errno); } } - setBufferSize(demux, DemuxStreamBufferSize); + setBufferSize(demux, options->DemuxStreamBufferSize); if (ioctl(demux, DMX_START) < 0) { backgroundClients.erase(demux); - Logger()->messagebf(LOG_ERR, "%s: DMX_START failed (%d: %s)", __PRETTY_FUNCTION__, errno, strerror(errno)); + logger->messagebf(LOG::ERR, "%s: DMX_START failed (%d: %s)", __PRETTY_FUNCTION__, errno, strerror(errno)); throw P2PVR::DeviceError("demux", strerror(errno), errno); } @@ -281,17 +281,17 @@ void Tuner::setBufferSize(int demux, unsigned long size) { if (ioctl(demux, DMX_SET_BUFFER_SIZE, size)) { - Logger()->messagebf(LOG_ERR, "%s: DMX_SET_BUFFER_SIZE to %d failed (%d: %s)", __PRETTY_FUNCTION__, size, errno, strerror(errno)); + logger->messagebf(LOG::ERR, "%s: DMX_SET_BUFFER_SIZE to %d failed (%d: %s)", __PRETTY_FUNCTION__, size, errno, strerror(errno)); throw P2PVR::DeviceError("demux", strerror(errno), errno); } - Logger()->messagebf(LOG_DEBUG, "%s: DMX_SET_BUFFER_SIZE to %d", __PRETTY_FUNCTION__, size); + logger->messagebf(LOG::DEBUG, "%s: DMX_SET_BUFFER_SIZE to %d", __PRETTY_FUNCTION__, size); } void Tuner::StopSending(int handle, const Ice::Current &) { time(&lastUsedTime); - Logger()->message(LOG_DEBUG, __PRETTY_FUNCTION__); + logger->message(LOG::DEBUG, __PRETTY_FUNCTION__); std::lock_guard<std::mutex> g(lock); if (backgroundClients.find(handle) != backgroundClients.end()) { close(handle); @@ -324,7 +324,7 @@ Tuner::senderThread() struct timeval tv { 2, 0 }; switch (select(n, &rfds, NULL, NULL, &tv)) { case -1: // error - Logger()->messagebf(LOG_DEBUG, "%s: select failed (%d:%s)", __PRETTY_FUNCTION__, errno, strerror(errno)); + logger->messagebf(LOG::DEBUG, "%s: select failed (%d:%s)", __PRETTY_FUNCTION__, errno, strerror(errno)); case 0: // nothing to read, but all is well break; default: @@ -336,7 +336,7 @@ Tuner::senderThread() P2PVR::Data buf(1 << 16); int nr = read(c->first, &buf.front(), buf.size()); if (nr < 0) { - Logger()->messagebf(LOG_DEBUG, "%s: read failed (%d:%s)", __PRETTY_FUNCTION__, errno, strerror(errno)); + logger->messagebf(LOG::DEBUG, "%s: read failed (%d:%s)", __PRETTY_FUNCTION__, errno, strerror(errno)); close(c->first); c = backgroundClients.erase(c); } @@ -367,7 +367,7 @@ Tuner::senderThread() } } backgroundThread = NULL; - Logger()->messagebf(LOG_DEBUG, "%s: Unlocking", __PRETTY_FUNCTION__); + logger->messagebf(LOG::DEBUG, "%s: Unlocking", __PRETTY_FUNCTION__); lock.unlock(); } @@ -393,22 +393,23 @@ Tuner::IDataSender::PacketsSent() const return _packetsSent; } -int Tuner::TuningTimeout; -int Tuner::LockTimeout; -int Tuner::DemuxReadTimeout; -int Tuner::DemuxTableBufferSize; -int Tuner::DemuxStreamBufferSize; - -DECLARE_OPTIONS(Tuner, "P2PVR Tuner Options") -("p2pvr.tuner.tuningtimeout", Options::value(&TuningTimeout, 500), - "Timeout for a DVB frontend to tune (ms, default 500ms)") -("p2pvr.tuner.locktimeout", Options::value(&LockTimeout, 2000), - "Timeout for a DVB frontend to acquire lock (ms, default 2000ms)") -("p2pvr.tuner.demuxreadtimeout", Options::value(&DemuxReadTimeout, 20000), - "Timeout when reading from a demux device (ms, default 20s)") -("p2pvr.tuner.demuxtablebuffersize", Options::value(&DemuxTableBufferSize, 256*1024), - "Kernel buffer size for demux table data (bytes, default 256KB)") -("p2pvr.tuner.demuxstreambuffersize", Options::value(&DemuxStreamBufferSize, 1024*1024), - "Kernel buffer size for demux stream data (bytes, default 1MB)") -END_OPTIONS(Tuner); +Tuner::Options::Options() : + IceTray::Options("P2PVR Tuner Options") +{ +} + +namespace po = boost::program_options; + +ICETRAY_OPTIONS(Tuner::Options, + ("p2pvr.tuner.tuningtimeout", po::value(&TuningTimeout)->default_value(500), + "Timeout for a DVB frontend to tune (ms, default 500ms)") + ("p2pvr.tuner.locktimeout", po::value(&LockTimeout)->default_value(2000), + "Timeout for a DVB frontend to acquire lock (ms, default 2000ms)") + ("p2pvr.tuner.demuxreadtimeout", po::value(&DemuxReadTimeout)->default_value(20000), + "Timeout when reading from a demux device (ms, default 20s)") + ("p2pvr.tuner.demuxtablebuffersize", po::value(&DemuxTableBufferSize)->default_value(256*1024), + "Kernel buffer size for demux table data (bytes, default 256KB)") + ("p2pvr.tuner.demuxstreambuffersize", po::value(&DemuxStreamBufferSize)->default_value(1024*1024), + "Kernel buffer size for demux stream data (bytes, default 1MB)") +) diff --git a/p2pvr/devices/tuner.h b/p2pvr/devices/tuner.h index 670a17d..42f2948 100644 --- a/p2pvr/devices/tuner.h +++ b/p2pvr/devices/tuner.h @@ -11,6 +11,7 @@ #include <boost/function.hpp> #include <boost/tuple/tuple.hpp> #include <options.h> +#include <logger.h> class Tuner : public P2PVR::PrivateTuner { public: @@ -51,12 +52,10 @@ class Tuner : public P2PVR::PrivateTuner { Ice::Long GetLastUsedTime(const Ice::Current&); - INITOPTIONS; - private: int OpenDemux() const; uint64_t SendPID(int pid, const P2PVR::RawDataClientPrx & client, const Ice::Current &) const; - static void RequestPID(int pid, int fd); + void RequestPID(int pid, int fd) const; uint64_t ReadDemuxAndSend(int fd, const P2PVR::RawDataClientPrx & client) const; void startSenderThread(); void senderThread(); @@ -70,13 +69,25 @@ class Tuner : public P2PVR::PrivateTuner { mutable time_t lastUsedTime; FrontendPtr frontend; + static IceTray::Logging::LoggerPtr logger; public: - static int TuningTimeout; - static int LockTimeout; - static int DemuxReadTimeout; - static int DemuxTableBufferSize; - static int DemuxStreamBufferSize; + class Options : public IceTray::Options { + public: + Options(); + + ICETRAY_OPTIONS_DECLARE; + + int TuningTimeout; + int LockTimeout; + int DemuxReadTimeout; + int DemuxTableBufferSize; + int DemuxStreamBufferSize; + }; + + private: + friend class Frontend_OFDM; + IceTray::OptionsResolver<Options> options; }; #endif diff --git a/p2pvr/devices/tunerSendSi.cpp b/p2pvr/devices/tunerSendSi.cpp index e1f4637..c8a8310 100644 --- a/p2pvr/devices/tunerSendSi.cpp +++ b/p2pvr/devices/tunerSendSi.cpp @@ -1,9 +1,10 @@ -#include <pch.hpp> #include "tunerSendSi.h" #include <logger.h> #include <boost/crc.hpp> #include "siParsers/table.h" +IceTray::Logging::LoggerPtr SendSi::logger(LOGMANAGER()->getLogger<SendSi>()); + SendSi::SendSi(const P2PVR::RawDataClientPrx & c) : Tuner::IDataSender(c->ice_collocationOptimized(false)) { @@ -41,7 +42,7 @@ SendSi::IsFinished() return false; } catch (const std::exception & ex) { - Logger()->messagebf(LOG_DEBUG, "%s: Client transmit error (%s)", __PRETTY_FUNCTION__, ex.what()); + logger->messagebf(LOG::DEBUG, "%s: Client transmit error (%s)", __PRETTY_FUNCTION__, ex.what()); return true; } } @@ -51,21 +52,21 @@ SendSi::IsValidSection(const P2PVR::Data & buf) { auto n = buf.size(); if (n < sizeof(SiTableHeader)) { - Logger()->messagebf(LOG_WARNING, "Received data too small to be an SI table."); + logger->messagebf(LOG::WARNING, "Received data too small to be an SI table."); return false; } auto * tab = (const SiTableHeader *)(&buf.front()); size_t l = sizeof(SiTableHeaderBase) + HILO(tab->section_length); if (n < l) { - Logger()->messagebf(LOG_WARNING, "Received data shorter than its defined length."); + logger->messagebf(LOG::WARNING, "Received data shorter than its defined length."); return false; } if (n > l) { - Logger()->messagebf(LOG_WARNING, "Received data longer than its defined length."); + logger->messagebf(LOG::WARNING, "Received data longer than its defined length."); return false; } if (!crc32(buf)) { - Logger()->messagebf(LOG_WARNING, "Received data is corrupted (crc32 failed)."); + logger->messagebf(LOG::WARNING, "Received data is corrupted (crc32 failed)."); return false; } return true; diff --git a/p2pvr/devices/tunerSendSi.h b/p2pvr/devices/tunerSendSi.h index df48f43..27d15af 100644 --- a/p2pvr/devices/tunerSendSi.h +++ b/p2pvr/devices/tunerSendSi.h @@ -2,6 +2,7 @@ #define TUNER_SENDSI_H #include "tuner.h" +#include <logger.h> class SendSi : public Tuner::IDataSender { public: @@ -17,6 +18,7 @@ class SendSi : public Tuner::IDataSender { std::set<Ice::AsyncResultPtr> asyncs; bool finish; + static IceTray::Logging::LoggerPtr logger; }; #endif diff --git a/p2pvr/devices/tunerSendTs.cpp b/p2pvr/devices/tunerSendTs.cpp index 70b6670..6d4e3e1 100644 --- a/p2pvr/devices/tunerSendTs.cpp +++ b/p2pvr/devices/tunerSendTs.cpp @@ -1,4 +1,3 @@ -#include <pch.hpp> #include "tunerSendTs.h" #include <logger.h> @@ -7,6 +6,8 @@ // About the ICE message size limit #define TARGET_BUFFER_LIMIT 512 * 1024 +IceTray::Logging::LoggerPtr SendTs::logger(LOGMANAGER()->getLogger<SendTs>()); + SendTs::SendTs(const P2PVR::RawDataClientPrx & c) : Tuner::IDataSender(c->ice_collocationOptimized(false)) { @@ -69,7 +70,7 @@ SendTs::IsFinished() } catch (const std::exception & ex) { async = NULL; - Logger()->messagebf(LOG_DEBUG, "%s: Client transmit error (%s)", __PRETTY_FUNCTION__, ex.what()); + logger->messagebf(LOG::DEBUG, "%s: Client transmit error (%s)", __PRETTY_FUNCTION__, ex.what()); return true; } } diff --git a/p2pvr/devices/tunerSendTs.h b/p2pvr/devices/tunerSendTs.h index ecf32fd..162248d 100644 --- a/p2pvr/devices/tunerSendTs.h +++ b/p2pvr/devices/tunerSendTs.h @@ -2,6 +2,7 @@ #define TUNER_SENDTS_H #include "tuner.h" +#include <logger.h> class SendTs : public Tuner::IDataSender { public: @@ -16,6 +17,7 @@ class SendTs : public Tuner::IDataSender { Ice::AsyncResultPtr async; P2PVR::Data buffer; + static IceTray::Logging::LoggerPtr logger; }; #endif |