diff options
author | Daniel Meyerholt <dxm523@googlemail.com> | 2011-06-13 16:01:41 +0200 |
---|---|---|
committer | Daniel Meyerholt <dxm523@googlemail.com> | 2011-06-13 16:01:41 +0200 |
commit | 6b4836c2ef1cc14e314f324a47dd65bea1fe8d57 (patch) | |
tree | 08ceff0c41812f3c3121a6b89428d4d1e97afb6f | |
parent | ce06eebe187569464c41954d41a0b9c3482d89c8 (diff) | |
download | vdr-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-x | movie.c | 26 |
1 files changed, 9 insertions, 17 deletions
@@ -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. ? |