aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2010-10-21 00:24:44 +0200
committerghost <andreas.monzner@multimedia-labs.de>2010-10-21 00:25:20 +0200
commit2c12949f63d76781a3ad187488560159b1fd13ac (patch)
tree9b0e12676c6c35f6251a6636f452b8b26530f451 /lib/dvb
parent3cc01c8deb6aa80db50ba6c4bc6f79e0a7a9bbd9 (diff)
downloadenigma2-2c12949f63d76781a3ad187488560159b1fd13ac.tar.gz
enigma2-2c12949f63d76781a3ad187488560159b1fd13ac.zip
add possibility to set demux buffer size for PES Reader, Section Reader and TS Recorder
Diffstat (limited to 'lib/dvb')
-rw-r--r--lib/dvb/demux.cpp35
-rw-r--r--lib/dvb/demux.h4
-rw-r--r--lib/dvb/idemux.h3
3 files changed, 35 insertions, 7 deletions
diff --git a/lib/dvb/demux.cpp b/lib/dvb/demux.cpp
index 4fba8fa8..081059b9 100644
--- a/lib/dvb/demux.cpp
+++ b/lib/dvb/demux.cpp
@@ -247,6 +247,14 @@ eDVBSectionReader::~eDVBSectionReader()
::close(fd);
}
+RESULT eDVBSectionReader::setBufferSize(int size)
+{
+ int res=::ioctl(fd, DMX_SET_BUFFER_SIZE, size);
+ if (res < 0)
+ eDebug("eDVBSectionReader DMX_SET_BUFFER_SIZE failed(%m)");
+ return res;
+}
+
RESULT eDVBSectionReader::start(const eDVBSectionFilterMask &mask)
{
RESULT res;
@@ -279,8 +287,7 @@ RESULT eDVBSectionReader::start(const eDVBSectionFilterMask &mask)
memcpy(sct.filter.mask, mask.mask, DMX_FILTER_SIZE);
#if HAVE_DVB_API_VERSION >= 3
memcpy(sct.filter.mode, mask.mode, DMX_FILTER_SIZE);
- if (::ioctl(fd, DMX_SET_BUFFER_SIZE, 8192*8) < 0)
- eDebug("DMX_SET_BUFFER_SIZE failed(%m)");
+ setBufferSize(8192*8);
#endif
res = ::ioctl(fd, DMX_SET_FILTER, &sct);
@@ -352,7 +359,7 @@ eDVBPESReader::eDVBPESReader(eDVBDemux *demux, eMainloop *context, RESULT &res):
if (m_fd >= 0)
{
- ::ioctl(m_fd, DMX_SET_BUFFER_SIZE, 64*1024);
+ setBufferSize(64*1024);
::fcntl(m_fd, F_SETFL, O_NONBLOCK);
m_notifier = eSocketNotifier::create(context, m_fd, eSocketNotifier::Read, false);
CONNECT(m_notifier->activated, eDVBPESReader::data);
@@ -364,6 +371,14 @@ eDVBPESReader::eDVBPESReader(eDVBDemux *demux, eMainloop *context, RESULT &res):
}
}
+RESULT eDVBPESReader::setBufferSize(int size)
+{
+ int res = ::ioctl(m_fd, DMX_SET_BUFFER_SIZE, size);
+ if (res < 0)
+ eDebug("eDVBPESReader DMX_SET_BUFFER_SIZE failed(%m)");
+ return res;
+}
+
DEFINE_REF(eDVBPESReader)
eDVBPESReader::~eDVBPESReader()
@@ -484,7 +499,7 @@ eDVBTSRecorder::eDVBTSRecorder(eDVBDemux *demux): m_demux(demux)
m_running = 0;
m_target_fd = -1;
m_thread = new eDVBRecordFileThread();
- CONNECT(m_thread->m_event, eDVBTSRecorder::filepushEvent);
+ CONNECT(m_thread->m_event, eDVBTSRecorder::filepushEvent);
#ifndef HAVE_ADD_PID
m_demux->m_dvr_busy = 1;
#endif
@@ -536,8 +551,8 @@ RESULT eDVBTSRecorder::start()
eDebug("FAILED to open demux (%s) in ts recoder (%m)", filename);
return -3;
}
-
- ::ioctl(m_source_fd, DMX_SET_BUFFER_SIZE, 1024*1024);
+
+ setBufferSize(1024*1024);
dmx_pes_filter_params flt;
#if HAVE_DVB_API_VERSION > 3
@@ -577,6 +592,14 @@ RESULT eDVBTSRecorder::start()
return 0;
}
+RESULT eDVBTSRecorder::setBufferSize(int size)
+{
+ int res = ::ioctl(m_source_fd, DMX_SET_BUFFER_SIZE, size);
+ if (res < 0)
+ eDebug("eDVBTSRecorder DMX_SET_BUFFER_SIZE failed(%m)");
+ return res;
+}
+
RESULT eDVBTSRecorder::addPID(int pid)
{
if (m_pids.find(pid) != m_pids.end())
diff --git a/lib/dvb/demux.h b/lib/dvb/demux.h
index 7a697d49..d43c41bb 100644
--- a/lib/dvb/demux.h
+++ b/lib/dvb/demux.h
@@ -56,9 +56,9 @@ class eDVBSectionReader: public iDVBSectionReader, public Object
void data(int);
ePtr<eSocketNotifier> notifier;
public:
-
eDVBSectionReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
virtual ~eDVBSectionReader();
+ RESULT setBufferSize(int size);
RESULT start(const eDVBSectionFilterMask &mask);
RESULT stop();
RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn);
@@ -76,6 +76,7 @@ class eDVBPESReader: public iDVBPESReader, public Object
public:
eDVBPESReader(eDVBDemux *demux, eMainloop *context, RESULT &res);
virtual ~eDVBPESReader();
+ RESULT setBufferSize(int size);
RESULT start(int pid);
RESULT stop();
RESULT connectRead(const Slot2<void,const __u8*, int> &read, ePtr<eConnection> &conn);
@@ -90,6 +91,7 @@ public:
eDVBTSRecorder(eDVBDemux *demux);
~eDVBTSRecorder();
+ RESULT setBufferSize(int size);
RESULT start();
RESULT addPID(int pid);
RESULT removePID(int pid);
diff --git a/lib/dvb/idemux.h b/lib/dvb/idemux.h
index e92b1e75..86b35fdb 100644
--- a/lib/dvb/idemux.h
+++ b/lib/dvb/idemux.h
@@ -6,6 +6,7 @@
class iDVBSectionReader: public iObject
{
public:
+ virtual RESULT setBufferSize(int size)=0;
virtual RESULT start(const eDVBSectionFilterMask &mask)=0;
virtual RESULT stop()=0;
virtual RESULT connectRead(const Slot1<void,const __u8*> &read, ePtr<eConnection> &conn)=0;
@@ -15,6 +16,7 @@ public:
class iDVBPESReader: public iObject
{
public:
+ virtual RESULT setBufferSize(int size)=0;
virtual RESULT start(int pid)=0;
virtual RESULT stop()=0;
virtual RESULT connectRead(const Slot2<void,const __u8*, int> &read, ePtr<eConnection> &conn)=0;
@@ -26,6 +28,7 @@ public:
class iDVBTSRecorder: public iObject
{
public:
+ virtual RESULT setBufferSize(int size) = 0;
virtual RESULT start() = 0;
virtual RESULT addPID(int pid) = 0;
virtual RESULT removePID(int pid) = 0;