summaryrefslogtreecommitdiff
path: root/p2pvr/devices/mockTuner.h
blob: ec73d252e6b6dcfa3ad3e5bee8b55ee0baa370d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef P2PVR_MOCKTUNER_H
#define P2PVR_MOCKTUNER_H

#include <dvb.h>
#include <visibility.h>
#include <Ice/BuiltinSequences.h>
#include <boost/thread.hpp>
#include <logger.h>
#include "tuner.h"
#include "mockData.h"

namespace P2PVR {
namespace DVB {
namespace Testing {
class DLL_PUBLIC MockTuner : public DVB::TunerI, MockData {
	public:
		MockTuner(const std::filesystem::path & deviceFrontend, Ice::CommunicatorPtr);

		AdHoc::FileUtils::FileHandle OpenDemux() const override;
		void RequestPID(int, int) const override;
		void RequestTS(const PacketIds &, int fd) const override;

		static void SetEventsSet(int n);

	protected:
		int iopoll(struct pollfd *fds, nfds_t nfds, int timeout) const override;
		ssize_t ioread(int fd, void *buf, size_t count) const override;
		int ioselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout) const override;

		Ice::CommunicatorPtr ic;
		// The open fh -> list of DVB packets
		mutable std::map<int, std::list<Ice::ByteSeq>> selectedPackets;

		static int eventSet;
		static IceTray::Logging::LoggerPtr logger;
};
}
}
}

#endif