summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Meyerholt <dxm523@googlemail.com>2011-06-13 16:01:41 +0200
committerDaniel Meyerholt <dxm523@googlemail.com>2011-06-13 16:01:41 +0200
commit6b4836c2ef1cc14e314f324a47dd65bea1fe8d57 (patch)
tree08ceff0c41812f3c3121a6b89428d4d1e97afb6f
parentce06eebe187569464c41954d41a0b9c3482d89c8 (diff)
downloadvdr-plugin-vdrrip-6b4836c2ef1cc14e314f324a47dd65bea1fe8d57.tar.gz
vdr-plugin-vdrrip-6b4836c2ef1cc14e314f324a47dd65bea1fe8d57.tar.bz2
* Do the FPS/movie length detection more elegant using cRecording. Fixes bug #628.
-rwxr-xr-xmovie.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/movie.c b/movie.c
index 5e5c6cd..206d7d3 100755
--- a/movie.c
+++ b/movie.c
@@ -494,24 +494,16 @@ const char* cMovie::getPPValues() {return PPValues;}
void cMovie::setLengthVDR() {
- char *infoFile = NULL;
- asprintf(&infoFile, "%s%s", Dir, OldRecording ? "/info.vdr" : "/info");
- dsyslog ("[vdrrip] reading recording info %s ",infoFile);
- cRecordingInfo *crec = new cRecordingInfo(Dir);
- FILE *f = fopen(infoFile, "r");
- if (crec->Read(f)) {
- cIndexFile *ifile = new cIndexFile(Dir, false, OldRecording);
- Length = ifile->Last() / crec->FramesPerSecond();
- delete (ifile);
- dsyslog("[vdrrip] parsed index && info");
- } else {
- dsyslog ("[vdrrip] failed reading info");
- Length = 10;
- }
+ int frames=0;
+ double fps=10.0;
+ cIndexFile *ifile = new cIndexFile(Dir, false, OldRecording);
+ frames= ifile->Last();
+ delete (ifile);
+ cRecording *crec = new cRecording(Dir);
+ fps= crec->FramesPerSecond();
delete (crec);
- FREE (infoFile);
- fclose(f);
- dsyslog ("[vdrrip] length: %i seconds ",Length);
+ Length=frames / fps;
+ dsyslog ("[vdrrip] %i frames / %f fps = %i seconds ", frames, fps, Length);
}
//TODO: maybe get these out of cRecordingInfo et al. ?