From e59b5bf1afb180a710f09c3b44338425aae07d13 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 11 Sep 2015 11:18:40 +0200 Subject: [PATCH] Empty adaptation field TS packets are now skipped when recording --- CONTRIBUTORS | 5 +++++ HISTORY | 2 ++ recorder.c | 24 +++++++++++++++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 78991c54..7f7a2d37 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2966,6 +2966,7 @@ Christopher Reimer for reporting a possible crash in the OSD demo for adding support for systemd for suggesting to replace VDR_CHARSET_OVERRIDE with a command line option + for making the recorder skip empty adaptation field TS packets Stefan Huskamp for suggesting to make entering characters via the number keys @@ -3423,3 +3424,7 @@ Daniel Ribeiro Janne Pänkälä for reporting that some broadcasters use the character 0x0D in EPG texts + +Stefan Pöschel + for coding the AFFcleaner, parts of which were used to make the recorder skip empty + adaptation field TS packets diff --git a/HISTORY b/HISTORY index 4ab55fd4..c13bc74c 100644 --- a/HISTORY +++ b/HISTORY @@ -8823,3 +8823,5 @@ Video Disk Recorder Revision History - The new setup option "Recording/Record key handling" can be used to define what happens if the Record key on the remote control is pressed during live tv (suggested by Dietmar Spingler). +- Empty adaptation field TS packets are now skipped when recording (thanks to + Christopher Reimer, based on the "AFFcleaner" by Stefan Pöschel). diff --git a/recorder.c b/recorder.c index 5915fe11..1103f198 100644 --- a/recorder.c +++ b/recorder.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recorder.c 4.2 2015/09/05 11:43:51 kls Exp $ + * $Id: recorder.c 4.3 2015/09/11 11:18:40 kls Exp $ */ #include "recorder.h" @@ -109,6 +109,28 @@ void cRecorder::Activate(bool On) void cRecorder::Receive(const uchar *Data, int Length) { if (Running()) { + static uchar aff[TS_SIZE - 4] = { 0xB7, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 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 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF}; // Length is always TS_SIZE! + if ((Data[3] & 0b00110000) == 0b00100000 && !memcmp(Data + 4, aff, sizeof(aff))) + return; // Adaptation Field Filler found, skipping int p = ringBuffer->Put(Data, Length); if (p != Length && Running()) ringBuffer->ReportOverflow(Length - p);