mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Setting the "broken link" or "TEI" flags when cutting recordings is now suppressed if the editing point merges two seamlessly fitting parts of the same stream
This commit is contained in:
parent
6dec09a376
commit
478027b5e9
@ -2873,6 +2873,8 @@ Torsten Lang <info@torstenlang.de>
|
||||
for reporting a bug in checking for UTF-8 support in cFont::Bidi()
|
||||
for a patch that was used to implement caching the information whether a recording
|
||||
is stored on the video directory file system within the cRecording data
|
||||
for suppressing setting the "broken link" or "TEI" flags when cutting recordings
|
||||
if the editing point merges two seamlessly fitting parts of the same stream
|
||||
|
||||
Christian Ruppert <idl0r@gentoo.org>
|
||||
for some improvements to the Makefiles
|
||||
|
3
HISTORY
3
HISTORY
@ -7179,3 +7179,6 @@ Video Disk Recorder Revision History
|
||||
- Fixed handling recording with more than two bonded devices.
|
||||
- Fixed the type of MBperMinute in cVideoDiskUsage::HasChanged() (thanks to Andreas
|
||||
Mair).
|
||||
- Setting the "broken link" or "TEI" flags when cutting recordings is now suppressed
|
||||
if the editing point merges two seamlessly fitting parts of the same stream (thanks
|
||||
to Torsten Lang).
|
||||
|
32
cutter.c
32
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 2.12 2012/06/02 13:46:55 kls Exp $
|
||||
* $Id: cutter.c 2.13 2012/06/10 14:33:36 kls Exp $
|
||||
*/
|
||||
|
||||
#include "cutter.h"
|
||||
@ -83,7 +83,9 @@ void cCuttingThread::Action(void)
|
||||
int LastIFrame = 0;
|
||||
toMarks.Add(0);
|
||||
toMarks.Save();
|
||||
uchar buffer[MAXFRAMESIZE];
|
||||
uchar buffer[MAXFRAMESIZE], buffer2[MAXFRAMESIZE];
|
||||
int Length2;
|
||||
bool CheckForSeamlessStream = false;
|
||||
bool LastMark = false;
|
||||
bool cutIn = true;
|
||||
while (Running()) {
|
||||
@ -142,7 +144,21 @@ void cCuttingThread::Action(void)
|
||||
FileSize = 0;
|
||||
}
|
||||
LastIFrame = 0;
|
||||
|
||||
// Compare the current frame with the previously stored one, to see if this is a seamlessly merged recording of the same stream:
|
||||
if (CheckForSeamlessStream) {
|
||||
if (Length == Length2) {
|
||||
int diffs = 0;
|
||||
for (int i = 0; i < Length; i++) {
|
||||
if (buffer[i] != buffer2[i]) {
|
||||
if (diffs++ > 10)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (diffs < 10) // the continuity counters of the PAT/PMT packets may differ
|
||||
cutIn = false; // it's apparently a seamless stream, so no need for "broken" handling
|
||||
}
|
||||
CheckForSeamlessStream = false;
|
||||
}
|
||||
if (cutIn) {
|
||||
if (isPesRecording)
|
||||
cRemux::SetBrokenLink(buffer, Length);
|
||||
@ -172,6 +188,16 @@ void cCuttingThread::Action(void)
|
||||
toMarks.Add(toIndex->Last() + 1);
|
||||
toMarks.Save();
|
||||
if (Mark) {
|
||||
// Read the next frame, for later comparison with the first frame at this mark:
|
||||
if (fromIndex->Get(Index, &FileNumber, &FileOffset, &Independent, &Length2)) {
|
||||
if (FileNumber != CurrentFileNumber)
|
||||
fromFile = fromFileName->SetOffset(FileNumber, FileOffset);
|
||||
if (fromFile) {
|
||||
int len = ReadFrame(fromFile, buffer2, Length2, sizeof(buffer2));
|
||||
if (len >= 0 && len == Length2)
|
||||
CheckForSeamlessStream = true;
|
||||
}
|
||||
}
|
||||
Index = Mark->Position();
|
||||
Mark = fromMarks.Next(Mark);
|
||||
CurrentFileNumber = 0; // triggers SetOffset before reading next frame
|
||||
|
Loading…
Reference in New Issue
Block a user