summaryrefslogtreecommitdiff
path: root/recording.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-11-18 12:19:51 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-11-18 12:19:51 +0100
commitcca2cd35ad7ef20ae7d124e06d05e896c4d8f9b6 (patch)
tree21b5f90cfe4143d1fc2188663d671b7f92f05670 /recording.c
parent5b4e1fa793506405d0d8bac47a36640a06340c80 (diff)
downloadvdr-cca2cd35ad7ef20ae7d124e06d05e896c4d8f9b6.tar.gz
vdr-cca2cd35ad7ef20ae7d124e06d05e896c4d8f9b6.tar.bz2
Improved editing TS recordings
Diffstat (limited to 'recording.c')
-rw-r--r--recording.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/recording.c b/recording.c
index 79db1c74..497bf2dd 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.72 2012/11/12 14:51:09 kls Exp $
+ * $Id: recording.c 2.73 2012/11/13 13:46:49 kls Exp $
*/
#include "recording.h"
@@ -1456,6 +1456,54 @@ cMark *cMarks::GetNext(int Position)
return NULL;
}
+cMark *cMarks::GetNextBegin(cMark *EndMark)
+{
+ cMark *BeginMark = EndMark ? Next(EndMark) : First();
+ if (BeginMark) {
+ while (cMark *NextMark = Next(BeginMark)) {
+ if (BeginMark->Position() == NextMark->Position()) { // skip Begin/End at the same position
+ if (!(BeginMark = Next(NextMark)))
+ break;
+ }
+ else
+ break;
+ }
+ }
+ return BeginMark;
+}
+
+cMark *cMarks::GetNextEnd(cMark *BeginMark)
+{
+ if (!BeginMark)
+ return NULL;
+ cMark *EndMark = Next(BeginMark);
+ if (EndMark) {
+ while (cMark *NextMark = Next(EndMark)) {
+ if (EndMark->Position() == NextMark->Position()) { // skip End/Begin at the same position
+ if (!(EndMark = Next(NextMark)))
+ break;
+ }
+ else
+ break;
+ }
+ }
+ return EndMark;
+}
+
+int cMarks::GetNumSequences(void)
+{
+ int NumSequences = 0;
+ if (cMark *BeginMark = GetNextBegin()) {
+ while (cMark *EndMark = GetNextEnd(BeginMark)) {
+ NumSequences++;
+ BeginMark = GetNextBegin(EndMark);
+ }
+ if (NumSequences == 0 && BeginMark->Position() > 0)
+ NumSequences = 1; // there is only one actual "begin" mark at a non-zero offset, and no actual "end" mark
+ }
+ return NumSequences;
+}
+
// --- cRecordingUserCommand -------------------------------------------------
const char *cRecordingUserCommand::command = NULL;