summaryrefslogtreecommitdiff
path: root/command/marks.cpp
diff options
context:
space:
mode:
authorJochen Dolze <vdr@dolze.de>2010-08-09 23:45:30 +0200
committerJochen Dolze <vdr@dolze.de>2010-08-09 23:45:30 +0200
commit462f8e37728c3d835e9a922f4fb4b11c7619ea9d (patch)
tree0d5b1514f945797aa3038a97d1d421747ff85727 /command/marks.cpp
parentade86712df523fc7c10545cfe450b59f39a71ba7 (diff)
downloadvdr-plugin-markad-462f8e37728c3d835e9a922f4fb4b11c7619ea9d.tar.gz
vdr-plugin-markad-462f8e37728c3d835e9a922f4fb4b11c7619ea9d.tar.bz2
Fixed AC3 demux error on restart
Diffstat (limited to 'command/marks.cpp')
-rw-r--r--command/marks.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/command/marks.cpp b/command/marks.cpp
index df486c4..529467b 100644
--- a/command/marks.cpp
+++ b/command/marks.cpp
@@ -372,7 +372,7 @@ void clMarks::CloseIndex(const char *Directory, bool isTS)
indexfd=-1;
}
-bool clMarks::CheckIndex(const char *Directory, bool isTS, bool *IndexError)
+bool clMarks::CheckIndex(const char *Directory, bool isTS, int FrameCnt, bool *IndexError)
{
if (!IndexError) return false;
*IndexError=false;
@@ -384,7 +384,34 @@ bool clMarks::CheckIndex(const char *Directory, bool isTS, bool *IndexError)
int fd=open(ipath,O_RDONLY);
free(ipath);
- if (fd==-1) return false;
+ if (fd==-1)
+ {
+ *IndexError=true;
+ return true;
+ }
+
+ if (FrameCnt)
+ {
+ struct stat statbuf;
+ if (fstat(fd,&statbuf)!=-1)
+ {
+ int framecnt;
+ if (isTS)
+ {
+ framecnt=statbuf.st_size/sizeof(struct tIndexTS);
+ }
+ else
+ {
+ framecnt=statbuf.st_size/sizeof(struct tIndexVDR);
+ }
+ if (framecnt!=FrameCnt)
+ {
+ *IndexError=true;
+ close(fd);
+ return true;
+ }
+ }
+ }
clMark *mark=first;
while (mark)
@@ -431,7 +458,7 @@ bool clMarks::CheckIndex(const char *Directory, bool isTS, bool *IndexError)
}
mark=mark->Next();
}
-
+ close(fd);
return true;
}