diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-08-13 12:45:42 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-08-13 12:45:42 +0200 |
commit | 30009067158bc40f50469cb82234b4013ef14e9e (patch) | |
tree | fc9a851816fe2fa5bd4e255cfb5158562302ed31 /recording.c | |
parent | ef611229f39c1792f045002906443622f63987f1 (diff) | |
download | vdr-30009067158bc40f50469cb82234b4013ef14e9e.tar.gz vdr-30009067158bc40f50469cb82234b4013ef14e9e.tar.bz2 |
The length (as number of frames) of a recording's index file can now be determined by a call to cIndexFile::GetLength()
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/recording.c b/recording.c index 317e6305..4456bddb 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 2.32 2011/08/13 10:59:32 kls Exp $ + * $Id: recording.c 2.33 2011/08/13 12:37:25 kls Exp $ */ #include "recording.h" @@ -1816,6 +1816,15 @@ void cIndexFile::Delete(void) } } +int cIndexFile::GetLength(const char *FileName, bool IsPesRecording) +{ + struct stat buf; + cString s = IndexFileName(FileName, IsPesRecording); + if (*s && stat(s, &buf) == 0) + return buf.st_size / (IsPesRecording ? sizeof(tIndexTs) : sizeof(tIndexPes)); + return -1; +} + bool GenerateIndex(const char *FileName) { if (DirectoryOk(FileName)) { |