]> git.vomp.tv Git - jsonserver.git/commitdiff
Return resume point in seconds instead of frames
authorChris Tallon <chris@vomp.tv>
Tue, 9 Feb 2016 15:06:07 +0000 (15:06 +0000)
committerChris Tallon <chris@vomp.tv>
Tue, 9 Feb 2016 15:06:07 +0000 (15:06 +0000)
handler.c

index 9690bc86b1271c8e211d7c7352cfe84b7d7eea60..f8750e63dbdc24f4eee2fe053bb92ce3c45a2164 100755 (executable)
--- a/handler.c
+++ b/handler.c
@@ -209,7 +209,7 @@ bool jsonserver_recinfo(Json::Value& js, const char* postData)
   }
 
   log->log("JSONServer", Log::DEBUG, "%s", reqfilename);
-  
+
   cRecordings Recordings;
   Recordings.Load(); // probably have to do this
   cRecording *recording = Recordings.GetByName(reqfilename);
@@ -229,10 +229,6 @@ bool jsonserver_recinfo(Json::Value& js, const char* postData)
   js["LifeTime"] = recording->Lifetime();
   js["Start"] = (Json::UInt)recording->Start();
 
-  js["ResumePoint"] = 0;
-  cResumeFile ResumeFile(recording->FileName(), recording->IsPesRecording());
-  if (ResumeFile.Read() >= 0) js["ResumePoint"] = ResumeFile.Read();
-
   js["CurrentlyRecordingStart"] = 0;
   js["CurrentlyRecordingStop"] = 0;
   cRecordControl *rc = cRecordControls::GetRecordControl(recording->FileName());
@@ -242,6 +238,8 @@ bool jsonserver_recinfo(Json::Value& js, const char* postData)
     js["CurrentlyRecordingStop"] = (Json::UInt)rc->Timer()->StopTime();
   }
 
+  js["ResumePoint"] = 0;
+
   const cRecordingInfo *info = recording->Info();
   if (info)
   {
@@ -274,6 +272,9 @@ bool jsonserver_recinfo(Json::Value& js, const char* postData)
 
       js["Components"] = jscomponents;
     }
+
+    cResumeFile ResumeFile(recording->FileName(), recording->IsPesRecording());
+    if (ResumeFile.Read() >= 0) js["ResumePoint"] = floor(ResumeFile.Read() / info->FramesPerSecond());
   }
 
   js["Result"] = true;