diff options
Diffstat (limited to 'p2pvr/lib/tuner.h')
-rw-r--r-- | p2pvr/lib/tuner.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/p2pvr/lib/tuner.h b/p2pvr/lib/tuner.h new file mode 100644 index 0000000..8111f1e --- /dev/null +++ b/p2pvr/lib/tuner.h @@ -0,0 +1,50 @@ +#ifndef P2PVR_TUNER_H +#define P2PVR_TUNER_H + +#include <p2pvr.h> +#include <boost/filesystem/path.hpp> +#include "frontend.h" +#include <map> +#include <thread> +#include <mutex> +#include <boost/bind.hpp> + +class Tuner : public P2PVR::PrivateTuner { + public: + Tuner(const boost::filesystem::path & deviceFrontend); + ~Tuner(); + + void TuneTo(const DVBSI::DeliveryPtr &, const Ice::Current&); + int GetStatus(const Ice::Current&); + std::string Device() const; + + void ScanAndSendNetworkInformation(const P2PVR::RawDataClientPrx & client, const Ice::Current&); + void SendNetworkInformation(const P2PVR::RawDataClientPrx & client, const Ice::Current&); + void SendBouquetAssociations(const P2PVR::RawDataClientPrx & client, const Ice::Current&); + void SendServiceDescriptions(const P2PVR::RawDataClientPrx & client, const Ice::Current&); + void SendEventInformation(const P2PVR::RawDataClientPrx & client, const Ice::Current&); + + int StartSendingTS(const P2PVR::PacketIds & pids, const P2PVR::RawDataClientPrx & client, const Ice::Current &); + void StopSendingTS(int handle, const Ice::Current &); + + private: + static bool crc32(const P2PVR::Data &); + int OpenDemux() const; + void SendPID(int pid, const P2PVR::RawDataClientPrx & client, const Ice::Current &) const; + void ReadDemuxAndSend(int fd, const P2PVR::RawDataClientPrx & client) const; + void startSenderThread(); + void senderThread(); + + const boost::filesystem::path deviceFrontend; + const boost::filesystem::path deviceRoot; + const int timeout; + typedef std::map<int, P2PVR::RawDataClientPrx> BackgroundClients; + BackgroundClients backgroundClients; + std::thread * backgroundThread; + std::mutex lock; + + FrontendPtr frontend; +}; + +#endif + |