summaryrefslogtreecommitdiff
path: root/p2pvr/lib/tuner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'p2pvr/lib/tuner.cpp')
-rw-r--r--p2pvr/lib/tuner.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/p2pvr/lib/tuner.cpp b/p2pvr/lib/tuner.cpp
index b958e31..bfa5a68 100644
--- a/p2pvr/lib/tuner.cpp
+++ b/p2pvr/lib/tuner.cpp
@@ -22,7 +22,6 @@ class FrontendNotSupported : public NotSupported {
Tuner::Tuner(const boost::filesystem::path & df) :
deviceFrontend(df),
deviceRoot(df.branch_path()),
- timeout(20000),
backgroundThread(NULL),
lastUsedTime(time(NULL))
{
@@ -152,7 +151,7 @@ Tuner::SendPID(int pid, const P2PVR::RawDataClientPrx & client, const Ice::Curre
void
Tuner::RequestPID(int pid, int demux)
{
- setBufferSize(demux, 409600);
+ setBufferSize(demux, DemuxTableBufferSize);
struct dmx_sct_filter_params sctFilterParams;
memset(&sctFilterParams, 0, sizeof(dmx_sct_filter_params));
sctFilterParams.pid = pid;
@@ -176,7 +175,7 @@ Tuner::ReadDemuxAndSend(int demux, const P2PVR::RawDataClientPrx & client) const
memset(&ufd, 0, sizeof(pollfd));
ufd.fd = demux;
ufd.events = POLLIN;
- if (poll(&ufd, 1, timeout) < 1) {
+ if (poll(&ufd, 1, DemuxReadTimeout) < 1) {
Logger()->messagebf(LOG_DEBUG, "%s: Timed out waiting for data", __PRETTY_FUNCTION__);
break;
}
@@ -289,7 +288,7 @@ Tuner::StartSendingTS(const P2PVR::PacketIds & pids, const P2PVR::RawDataClientP
}
}
- setBufferSize(demux, 4096000);
+ setBufferSize(demux, 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));
@@ -428,3 +427,22 @@ Tuner::crc32(const P2PVR::Data & buf)
return crc.checksum() == 0;
}
+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);
+