diff options
-rw-r--r-- | p2pvr/devices/devices.cpp | 10 | ||||
-rw-r--r-- | p2pvr/devices/devices.h | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/p2pvr/devices/devices.cpp b/p2pvr/devices/devices.cpp index 541cfa5..420632d 100644 --- a/p2pvr/devices/devices.cpp +++ b/p2pvr/devices/devices.cpp @@ -52,7 +52,7 @@ DevicesI::getTuner() } for (auto devItr = devices.begin(); devItr != devices.end(); devItr++) { try { - return new DVB::TunerI(*devItr); + return openTuner(*devItr); } catch (...) { logger->messagebf(LOG::DEBUG, "%s: Failed to open device %s", __PRETTY_FUNCTION__, @@ -79,7 +79,7 @@ DevicesI::getTuner(const DVBSI::DeliveryPtr & delivery) } for (auto devItr = devices.begin(); devItr != devices.end(); devItr++) { try { - TunerPtr tuner = new DVB::TunerI(*devItr); + TunerPtr tuner = openTuner(*devItr); tuner->TuneTo(delivery); openDevices.insert({ delivery->TransportStreamId, OpenTunerPtr(new OpenTuner(delivery, tuner)) }); devices.erase(devItr); @@ -109,6 +109,12 @@ DevicesI::getTuner(const DeliveryProvider & provider) return getTuner(provider()); } +TunerPtr +DevicesI::openTuner(const boost::filesystem::path & path) const +{ + return new DVB::TunerI(path); +} + void DevicesI::releaseTuner(const TunerPtr & tuner) { diff --git a/p2pvr/devices/devices.h b/p2pvr/devices/devices.h index 30e0848..d32971f 100644 --- a/p2pvr/devices/devices.h +++ b/p2pvr/devices/devices.h @@ -43,6 +43,9 @@ class DLL_PUBLIC DevicesI : public Tuners { void Remove(const std::string & frontend, const Ice::Current &) override; ::Ice::Int TunerCount(const Ice::Current &) override; + protected: + virtual TunerPtr openTuner(const boost::filesystem::path &) const; + private: typedef boost::function<DVBSI::DeliveryPtr()> DeliveryProvider; typedef boost::function<void(TunerPtr)> Target; |