diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2006-01-27 13:55:51 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2006-01-27 13:55:51 +0000 |
| commit | 060a9537237e076d3d6536c0d2728c21f480eb82 (patch) | |
| tree | 5e0d733d098d654d4483e41a04ef6b3896c03fb8 /lib | |
| parent | 9f3e792457790fcac094b3fc9282ca8983e8a503 (diff) | |
| download | enigma2-060a9537237e076d3d6536c0d2728c21f480eb82.tar.gz enigma2-060a9537237e076d3d6536c0d2728c21f480eb82.zip | |
allow TS only if >1G of free space
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/service/servicedvb.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index d1cc4ef8..7beb6c25 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -15,6 +15,10 @@ #include <lib/dvb/tstools.h> #include <lib/python/python.h> +#include <sys/vfs.h> + +#define TSPATH "/media/hdd" + class eStaticServiceDVBInformation: public iStaticServiceInformation { DECLARE_REF(eStaticServiceDVBInformation); @@ -685,7 +689,7 @@ RESULT eDVBServicePlay::setFastForward(int ratio) { skipmode = 0; ffratio = 0; - } else if (ratio < 0) + } else // if (ratio < 0) { skipmode = ratio; ffratio = 1; @@ -837,12 +841,28 @@ RESULT eDVBServicePlay::subServices(ePtr<iSubserviceList> &ptr) RESULT eDVBServicePlay::timeshift(ePtr<iTimeshiftService> &ptr) { + ptr = 0; if (m_timeshift_enabled || !m_is_pvr) { + if (!m_timeshift_enabled) + { + /* we need enough diskspace */ + struct statfs fs; + if (statfs(TSPATH "/.", &fs) < 0) + { + eDebug("statfs failed!"); + return -2; + } + + if (((off_t)fs.f_bavail) * ((off_t)fs.f_bsize) < 1024*1024*1024LL) + { + eDebug("not enough diskspace for timeshift! (less than 1GB)"); + return -3; + } + } ptr = this; return 0; } - ptr = 0; return -1; } @@ -1085,7 +1105,7 @@ RESULT eDVBServicePlay::startTimeshift() if (!m_record) return -3; - char templ[]="/media/hdd/timeshift.XXXXXX"; + char templ[]=TSPATH "/timeshift.XXXXXX"; m_timeshift_fd = mkstemp(templ); m_timeshift_file = templ; |
