1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Now setting the 'broken link' flag for GOPs at the beginning of a new video sequence

This commit is contained in:
Klaus Schmidinger 2003-04-26 15:11:17 +02:00
parent a86ed8181b
commit c4b9c58270
5 changed files with 31 additions and 3 deletions

View File

@ -169,6 +169,8 @@ Stefan Huelswitt <huels@iname.com>
for adapting VDR to 'libdtv' version 0.0.5 for adapting VDR to 'libdtv' version 0.0.5
for reporting a bug in handling of Ca parameters with values <= MAXDEVICES, which for reporting a bug in handling of Ca parameters with values <= MAXDEVICES, which
don't indicate an actual encrypted channel 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> Ulrich Röder <roeder@efr-net.de>
for pointing out that there are channels that have a symbol rate higher than for pointing out that there are channels that have a symbol rate higher than

View File

@ -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). 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 - Fixed deleting the last recording in the "Recordings" menu, which started pausing
live video (thanks to Christoph Friederich for reporting this one). 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).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "cutter.h"
@ -77,6 +77,7 @@ void cCuttingThread::Action(void)
toMarks.Add(0); toMarks.Add(0);
toMarks.Save(); toMarks.Save();
uchar buffer[MAXFRAMESIZE]; uchar buffer[MAXFRAMESIZE];
bool cutIn = true;
while (active) { while (active) {
uchar FileNumber; uchar FileNumber;
int FileOffset, Length; int FileOffset, Length;
@ -126,6 +127,11 @@ void cCuttingThread::Action(void)
FileSize = 0; FileSize = 0;
} }
LastIFrame = 0; LastIFrame = 0;
if (cutIn) {
cRemux::SetBrokenLink(buffer, Length);
cutIn = false;
}
} }
if (safe_write(toFile, buffer, Length) < 0) { if (safe_write(toFile, buffer, Length) < 0) {
error = "safe_write"; error = "safe_write";
@ -151,6 +157,7 @@ void cCuttingThread::Action(void)
Index = Mark->position; Index = Mark->position;
Mark = fromMarks.Next(Mark); Mark = fromMarks.Next(Mark);
CurrentFileNumber = 0; // triggers SetOffset before reading next frame CurrentFileNumber = 0; // triggers SetOffset before reading next frame
cutIn = true;
if (Setup.SplitEditedFiles) { if (Setup.SplitEditedFiles) {
toFile = toFileName->NextFile(); toFile = toFileName->NextFile();
if (toFile < 0) { if (toFile < 0) {

18
remux.c
View File

@ -8,7 +8,7 @@
* the Linux DVB driver's 'tuxplayer' example and were rewritten to suit * the Linux DVB driver's 'tuxplayer' example and were rewritten to suit
* VDR's needs. * 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 /* The calling interface of the 'cRemux::Process()' function is defined
@ -621,6 +621,7 @@ XXX*/
else if (!synced) { else if (!synced) {
if (pt == I_FRAME) { if (pt == I_FRAME) {
resultDelivered = i; // will drop everything before this position resultDelivered = i; // will drop everything before this position
SetBrokenLink(resultBuffer + i, l);
synced = true; synced = true;
} }
else { else {
@ -667,3 +668,18 @@ XXX*/
return NULL; // no useful data found, wait for more 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");
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __REMUX_H
@ -44,6 +44,7 @@ public:
cRemux(int VPid, int APid1, int APid2, int DPid1, int DPid2, bool ExitOnFailure = false); cRemux(int VPid, int APid1, int APid2, int DPid1, int DPid2, bool ExitOnFailure = false);
~cRemux(); ~cRemux();
uchar *Process(const uchar *Data, int &Count, int &Result, uchar *PictureType = NULL); uchar *Process(const uchar *Data, int &Count, int &Result, uchar *PictureType = NULL);
static void SetBrokenLink(uchar *Data, int Length);
}; };
#endif // __REMUX_H #endif // __REMUX_H