All pastes #2076504 Raw Edit

Something

public text v1 · immutable
#2076504 ·published 2011-06-08 01:38 UTC
rendered paste body
diff --git a/mythtv/libs/libmyth/programinfo.cpp b/mythtv/libs/libmyth/programinfo.cpp
index 47a4fa0..b1fd7f7 100644
--- a/mythtv/libs/libmyth/programinfo.cpp
+++ b/mythtv/libs/libmyth/programinfo.cpp
@@ -3391,6 +3391,37 @@ void ProgramInfo::SaveTotalDuration(int64_t duration)
         MythDB::DBError("Duration insert", query);
 }
 
+/// \brief Store the Total Frames at frame 0 in the recordedmarkup table
+void ProgramInfo::SaveTotalFrames(int64_t frames)
+{
+    if (!IsRecording())
+        return;
+
+    MSqlQuery query(MSqlQuery::InitCon());
+
+    query.prepare("DELETE FROM recordedmarkup "
+                  " WHERE chanid=:CHANID "
+                  " AND starttime=:STARTTIME "
+                  " AND type=:TYPE");
+    query.bindValue(":CHANID", chanid);
+    query.bindValue(":STARTTIME", recstartts);
+    query.bindValue(":TYPE", MARK_FRAMES);
+
+    if (!query.exec())
+        MythDB::DBError("Frames delete", query);
+
+    query.prepare("INSERT INTO recordedmarkup"
+                  "    (chanid, starttime, mark, type, data)"
+                  "    VALUES"
+                  " ( :CHANID, :STARTTIME, 0, :TYPE, :DATA);");
+    query.bindValue(":CHANID", chanid);
+    query.bindValue(":STARTTIME", recstartts);
+    query.bindValue(":TYPE", MARK_FRAMES);
+    query.bindValue(":DATA", (uint)(frames));
+
+    if (!query.exec())
+        MythDB::DBError("Frames insert", query);
+}
 
 /// \brief Store the Resolution at frame in the recordedmarkup table
 /// \note  All frames until the next one with a stored resolution
@@ -3500,6 +3531,14 @@ int64_t ProgramInfo::QueryTotalDuration(void) const
     return msec * 1000;
 }
 
+/** \brief If present in recording this loads total frames of the
+ *         main video stream from database's stream markup table.
+ */
+int64_t ProgramInfo::QueryTotalFrames(void) const
+{
+    int64_t frames = load_markup_datum(MARK_FRAMES, chanid, recstartts);
+    return frames;
+}
 
 void ProgramInfo::SaveResolutionProperty(VideoProperty vid_flags)
 {