From 060a9537237e076d3d6536c0d2728c21f480eb82 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Fri, 27 Jan 2006 13:55:51 +0000 Subject: [PATCH] allow TS only if >1G of free space --- lib/service/servicedvb.cpp | 26 +++++++++++++++++++++++--- 1 file 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 #include +#include + +#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 &ptr) RESULT eDVBServicePlay::timeshift(ePtr &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; -- 2.30.2