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

Implemented TsSetTeiOnBrokenPackets()

This commit is contained in:
Klaus Schmidinger 2009-04-19 11:07:07 +02:00
parent 457208b101
commit 3f492c4f57
5 changed files with 40 additions and 5 deletions

View File

@ -670,6 +670,7 @@ Oliver Endriss <o.endriss@gmx.de>
for adding missing AUDIO_PAUSE/AUDIO_CONTINUE calls to cDvbDevice
for reporting that the video type is unnecessarily written into channels.conf if
VPID is 0
for reporting chirping sound disturbences at editing points in TS recordings
Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf'

View File

@ -6049,3 +6049,8 @@ Video Disk Recorder Revision History
- Fixed detecting the frame rate for streams with PTS distances of 1800, which
apparently split one frame over two payload units.
- Added missing 'const' to cRecording::FramesPerSecond() (thanks to Joachim Wilke).
- Any TS packets in the first "frame" after a cut in an edited recording that don't
belong to a payload unit that started in that frame now get their TEI flag set,
so that a decoder will ignore them together with any PES data collected for that
PID so far (thanks to Oliver Endriss for reporting chirping sound disturbences at
editing points in TS recordings).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: cutter.c 2.2 2009/01/24 15:19:26 kls Exp $
* $Id: cutter.c 2.3 2009/04/19 10:56:33 kls Exp $
*/
#include "cutter.h"
@ -18,6 +18,7 @@
class cCuttingThread : public cThread {
private:
const char *error;
bool isPesRecording;
cUnbufferedFile *fromFile, *toFile;
cFileName *fromFileName, *toFileName;
cIndexFile *fromIndex, *toIndex;
@ -39,7 +40,7 @@ cCuttingThread::cCuttingThread(const char *FromFileName, const char *ToFileName)
fromFileName = toFileName = NULL;
fromIndex = toIndex = NULL;
cRecording Recording(FromFileName);
bool isPesRecording = Recording.IsPesRecording();
isPesRecording = Recording.IsPesRecording();
if (fromMarks.Load(FromFileName, Recording.FramesPerSecond(), isPesRecording) && fromMarks.Count()) {
fromFileName = new cFileName(FromFileName, false, true, isPesRecording);
toFileName = new cFileName(ToFileName, true, true, isPesRecording);
@ -140,7 +141,10 @@ void cCuttingThread::Action(void)
LastIFrame = 0;
if (cutIn) {
if (isPesRecording)
cRemux::SetBrokenLink(buffer, Length);
else
TsSetTeiOnBrokenPackets(buffer, Length);
cutIn = false;
}
}

24
remux.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.c 2.18 2009/04/18 14:53:42 kls Exp $
* $Id: remux.c 2.19 2009/04/19 10:59:56 kls Exp $
*/
#include "remux.h"
@ -124,6 +124,24 @@ int64_t TsGetPts(const uchar *p, int l)
return -1;
}
void TsSetTeiOnBrokenPackets(uchar *p, int l)
{
bool Processed[MAXPID] = { false };
while (l >= TS_SIZE) {
if (*p != TS_SYNC_BYTE)
break;
int Pid = TsPid(p);
if (!Processed[Pid]) {
if (!TsPayloadStart(p))
p[1] |= TS_ERROR;
else
Processed[Pid] = true;
}
l -= TS_SIZE;
p += TS_SIZE;
}
}
// --- cPatPmtGenerator ------------------------------------------------------
cPatPmtGenerator::cPatPmtGenerator(cChannel *Channel)
@ -582,6 +600,10 @@ cTsToPes::~cTsToPes()
void cTsToPes::PutTs(const uchar *Data, int Length)
{
if (TsError(Data)) {
Reset();
return; // ignore packets with TEI set, and drop any PES data collected so far
}
if (TsPayloadStart(Data))
Reset();
else if (!size)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.h 2.9 2009/03/27 13:38:59 kls Exp $
* $Id: remux.h 2.10 2009/04/19 10:57:09 kls Exp $
*/
#ifndef __REMUX_H
@ -49,6 +49,8 @@ public:
#define TS_ADAPT_TP_PRIVATE 0x02
#define TS_ADAPT_EXTENSION 0x01
#define MAXPID 0x2000 // for arrays that use a PID as the index
inline bool TsHasPayload(const uchar *p)
{
return p[3] & TS_PAYLOAD_EXISTS;
@ -104,6 +106,7 @@ inline int TsGetAdaptationField(const uchar *p)
// The following functions all take a pointer to a sequence of complete TS packets.
int64_t TsGetPts(const uchar *p, int l);
void TsSetTeiOnBrokenPackets(uchar *p, int l);
// Some PES handling tools:
// The following functions that take a pointer to PES data all assume that