summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-08-08 20:44:03 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-08-08 20:44:03 +0100
commitf5d81bc8e8dd77f807507019898058d08f14a23d (patch)
tree231eb65df21952d87ba7124a169274804c33c03d
parentTuner::GetDevice should return the frontend that was opened (diff)
downloadp2pvr-f5d81bc8e8dd77f807507019898058d08f14a23d.tar.bz2
p2pvr-f5d81bc8e8dd77f807507019898058d08f14a23d.tar.xz
p2pvr-f5d81bc8e8dd77f807507019898058d08f14a23d.zip
Support passing a frontend instance into a tuner (easier testing)
-rw-r--r--p2pvr/devices/tuner.cpp7
-rw-r--r--p2pvr/devices/tuner.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/p2pvr/devices/tuner.cpp b/p2pvr/devices/tuner.cpp
index 41a77c3..e7fd2eb 100644
--- a/p2pvr/devices/tuner.cpp
+++ b/p2pvr/devices/tuner.cpp
@@ -16,17 +16,22 @@ namespace P2PVR {
namespace DVB {
IceTray::Logging::LoggerPtr TunerI::logger = LOGMANAGER()->getLogger<TunerI>();
-TunerI::TunerI(const boost::filesystem::path & df) :
+TunerI::TunerI(const boost::filesystem::path & df, FrontendPtr pfe) :
deviceFrontend(df),
deviceRoot(df.branch_path()),
frontendFD(deviceFrontend, O_RDWR),
backgroundThread(NULL)
{
+ if (pfe) {
+ frontend = pfe;
+ }
+ else {
struct dvb_frontend_info fe_info;
if (ioctl(frontendFD, FE_GET_INFO, &fe_info) < 0) {
throw DeviceError(deviceFrontend.string(), strerror(errno), errno);
}
frontend = FrontendPtr(FrontendFactory::createNew(Frontend::FactoryKey(fe_info.type), this, fe_info));
+ }
logger->messagebf(LOG::INFO, "%s: Attached to %s (%s, type %s)", __PRETTY_FUNCTION__,
deviceRoot, frontend->Info().name, frontend->Type());
}
diff --git a/p2pvr/devices/tuner.h b/p2pvr/devices/tuner.h
index 7db09e4..8534a3c 100644
--- a/p2pvr/devices/tuner.h
+++ b/p2pvr/devices/tuner.h
@@ -41,7 +41,7 @@ class TunerI : public Tuner {
typedef boost::shared_ptr<IDataSender> BackgroundClient;
typedef std::map<int, BackgroundClient> BackgroundClients;
- TunerI(const boost::filesystem::path & deviceFrontend);
+ TunerI(const boost::filesystem::path & deviceFrontend, FrontendPtr = FrontendPtr());
~TunerI();
void TuneTo(const DVBSI::DeliveryPtr &) override;