summaryrefslogtreecommitdiff
path: root/command/markad-standalone.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2013-01-02 16:00:48 +0100
committerJochen Dolze <vdr@dolze.de>2013-01-02 16:00:48 +0100
commitf68a8728b20301de5e92e3f58759b7ab664155aa (patch)
tree68bf31919ac726527aad3c81524b203ecb48c4a8 /command/markad-standalone.cpp
parent00937c990fe7e7fc0f3418d44f8e89b433ff9738 (diff)
downloadvdr-plugin-markad-f68a8728b20301de5e92e3f58759b7ab664155aa.tar.gz
vdr-plugin-markad-f68a8728b20301de5e92e3f58759b7ab664155aa.tar.bz2
Fixed bug with --astopoffs (option doesnt worked)
Added more debug output while waiting for new data
Diffstat (limited to 'command/markad-standalone.cpp')
-rw-r--r--command/markad-standalone.cpp40
1 files changed, 32 insertions, 8 deletions
diff --git a/command/markad-standalone.cpp b/command/markad-standalone.cpp
index 85eef76..b8c8866 100644
--- a/command/markad-standalone.cpp
+++ b/command/markad-standalone.cpp
@@ -620,13 +620,19 @@ void cMarkAdStandalone::CheckIndexGrowing()
if (!indexFile) return;
if (macontext.Config->logoExtraction!=-1) return;
- if (sleepcnt>=2) return; // we already slept too much
+ if (sleepcnt>=2) {
+ dsyslog("slept too much");
+ return; // we already slept too much
+ }
bool notenough=true;
do
{
struct stat statbuf;
- if (stat(indexFile,&statbuf)==-1) return;
+ if (stat(indexFile,&statbuf)==-1) {
+ esyslog("failed to stat %s",indexFile);
+ return;
+ }
int maxframes=statbuf.st_size/8;
if (maxframes<(framecnt+200))
@@ -638,6 +644,7 @@ void cMarkAdStandalone::CheckIndexGrowing()
if (time(NULL)>(startTime+(time_t) length))
{
// "old" recording
+ dsyslog("assuming old recording, now>startTime+length");
return;
}
else
@@ -650,13 +657,30 @@ void cMarkAdStandalone::CheckIndexGrowing()
else
{
// "old" recording
+ dsyslog("assuming old recording - no length and startTime");
return;
}
}
marks.Save(directory,macontext.Video.Info.FramesPerSecond,isTS);
- sleep(WAITTIME); // now we sleep and hopefully the index will grow
- waittime+=WAITTIME;
- if (errno==EINTR) return;
+ unsigned int sleeptime=WAITTIME;
+ time_t sleepstart=time(NULL);
+ double slepttime=0;
+ while ((unsigned int)slepttime<sleeptime) {
+ while (sleeptime>0) {
+ errno=0;
+ unsigned int ret=sleep(sleeptime); // now we sleep and hopefully the index will grow
+ if ((errno) && (ret)) {
+ esyslog("got errno %i while waiting for new data",errno);
+ if (errno!=EINTR) return;
+ }
+ sleeptime=ret;
+ }
+ slepttime=difftime(time(NULL),sleepstart);
+ if (slepttime<WAITTIME) {
+ esyslog("what's wrong with your system? we just slept %.0fs",slepttime);
+ }
+ }
+ waittime+=(int) slepttime;
sleepcnt++;
if (sleepcnt>=2)
{
@@ -670,6 +694,8 @@ void cMarkAdStandalone::CheckIndexGrowing()
if (iwaittime)
{
esyslog("resuming after %is of interrupted recording, marks can be wrong now!",iwaittime);
+ } else {
+ tsyslog("we have enough frames (%i)",maxframes-framecnt);
}
iwaittime=0;
sleepcnt=0;
@@ -2914,7 +2940,7 @@ int main(int argc, char *argv[])
case 12: // --astopoffs
if (isnumber(optarg) && atoi(optarg) >= 0 && atoi(optarg) <= 240)
{
- config.svdrpport=atoi(optarg);
+ config.astopoffs=atoi(optarg);
}
else
{
@@ -2922,8 +2948,6 @@ int main(int argc, char *argv[])
return 2;
}
break;
- break;
-
default:
printf ("? getopt returned character code 0%o ? (option_index %d)\n", c,option_index);