summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2003-04-26 15:11:17 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2003-04-26 15:11:17 +0200
commitc4b9c582705079e8ae8cf4a716ae75575e55e939 (patch)
treedaab05a89cb7d781939d340e6633a4f748a52f93
parenta86ed8181bc949c55ed808592471494a925e69a8 (diff)
downloadvdr-c4b9c582705079e8ae8cf4a716ae75575e55e939.tar.gz
vdr-c4b9c582705079e8ae8cf4a716ae75575e55e939.tar.bz2
Now setting the 'broken link' flag for GOPs at the beginning of a new video sequence
-rw-r--r--CONTRIBUTORS2
-rw-r--r--HISTORY2
-rw-r--r--cutter.c9
-rw-r--r--remux.c18
-rw-r--r--remux.h3
5 files changed, 31 insertions, 3 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index c7939fc3..196bf0cd 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -169,6 +169,8 @@ Stefan Huelswitt <huels@iname.com>
for adapting VDR to 'libdtv' version 0.0.5
for reporting a bug in handling of Ca parameters with values <= MAXDEVICES, which
don't indicate an actual encrypted channel
+ for implementing setting the "broken link" flag for GOPs at the beginning of a new
+ video sequence, which avoids artefacts when cutting
Ulrich Röder <roeder@efr-net.de>
for pointing out that there are channels that have a symbol rate higher than
diff --git a/HISTORY b/HISTORY
index d5a6c198..05b0de13 100644
--- a/HISTORY
+++ b/HISTORY
@@ -2067,3 +2067,5 @@ Video Disk Recorder Revision History
dated 2003-04-27 or higher (setting the PCR PID didn't work in earlier versions).
- Fixed deleting the last recording in the "Recordings" menu, which started pausing
live video (thanks to Christoph Friederich for reporting this one).
+- Now setting the "broken link" flag for GOPs at the beginning of a new video
+ sequence, which avoids artefacts when cutting (thanks to Stefan Huelswitt).
diff --git a/cutter.c b/cutter.c
index 234201cd..5ce0a2c4 100644
--- a/cutter.c
+++ b/cutter.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: cutter.c 1.2 2002/08/11 11:09:23 kls Exp $
+ * $Id: cutter.c 1.3 2003/04/26 15:11:17 kls Exp $
*/
#include "cutter.h"
@@ -77,6 +77,7 @@ void cCuttingThread::Action(void)
toMarks.Add(0);
toMarks.Save();
uchar buffer[MAXFRAMESIZE];
+ bool cutIn = true;
while (active) {
uchar FileNumber;
int FileOffset, Length;
@@ -126,6 +127,11 @@ void cCuttingThread::Action(void)
FileSize = 0;
}
LastIFrame = 0;
+
+ if (cutIn) {
+ cRemux::SetBrokenLink(buffer, Length);
+ cutIn = false;
+ }
}
if (safe_write(toFile, buffer, Length) < 0) {
error = "safe_write";
@@ -151,6 +157,7 @@ void cCuttingThread::Action(void)
Index = Mark->position;
Mark = fromMarks.Next(Mark);
CurrentFileNumber = 0; // triggers SetOffset before reading next frame
+ cutIn = true;
if (Setup.SplitEditedFiles) {
toFile = toFileName->NextFile();
if (toFile < 0) {
diff --git a/remux.c b/remux.c
index 097b4a55..c2ded246 100644
--- a/remux.c
+++ b/remux.c
@@ -8,7 +8,7 @@
* the Linux DVB driver's 'tuxplayer' example and were rewritten to suit
* VDR's needs.
*
- * $Id: remux.c 1.14 2003/01/24 17:22:29 kls Exp $
+ * $Id: remux.c 1.15 2003/04/26 15:07:41 kls Exp $
*/
/* The calling interface of the 'cRemux::Process()' function is defined
@@ -621,6 +621,7 @@ XXX*/
else if (!synced) {
if (pt == I_FRAME) {
resultDelivered = i; // will drop everything before this position
+ SetBrokenLink(resultBuffer + i, l);
synced = true;
}
else {
@@ -667,3 +668,18 @@ XXX*/
return NULL; // no useful data found, wait for more
}
+void cRemux::SetBrokenLink(uchar *Data, int Length)
+{
+ if (Length > 9 && Data[0] == 0 && Data[1] == 0 && Data[2] == 1 && (Data[3] & VIDEO_STREAM_S) == VIDEO_STREAM_S) {
+ for (int i = Data[8] + 9; i < Length - 7; i++) { // +9 to skip video packet header
+ if (Data[i] == 0 && Data[i + 1] == 0 && Data[i + 2] == 1 && Data[i + 3] == 0xB8) {
+ if (!(Data[i + 7] & 0x40)) // set flag only if GOP is not closed
+ Data[i + 7] |= 0x20;
+ return;
+ }
+ }
+ dsyslog("SetBrokenLink: no GOP header found in video packet");
+ }
+ else
+ dsyslog("SetBrokenLink: no video packet in frame");
+}
diff --git a/remux.h b/remux.h
index 638a3f9e..e953001d 100644
--- a/remux.h
+++ b/remux.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: remux.h 1.9 2002/11/01 10:06:46 kls Exp $
+ * $Id: remux.h 1.10 2003/04/26 14:13:11 kls Exp $
*/
#ifndef __REMUX_H
@@ -44,6 +44,7 @@ public:
cRemux(int VPid, int APid1, int APid2, int DPid1, int DPid2, bool ExitOnFailure = false);
~cRemux();
uchar *Process(const uchar *Data, int &Count, int &Result, uchar *PictureType = NULL);
+ static void SetBrokenLink(uchar *Data, int Length);
};
#endif // __REMUX_H