summaryrefslogtreecommitdiff
path: root/remux.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2003-01-26 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2003-01-26 18:00:00 +0100
commita3942b4d17a3a7e1af82b1950c39db1f9c7ce250 (patch)
tree8b88f1d2db36ab8609c79dc02758652a3d235db3 /remux.c
parent3e1d34f392792bbcf1bda4884c58ca9cec445d1d (diff)
downloadvdr-patch-lnbsharing-a3942b4d17a3a7e1af82b1950c39db1f9c7ce250.tar.gz
vdr-patch-lnbsharing-a3942b4d17a3a7e1af82b1950c39db1f9c7ce250.tar.bz2
Version 1.1.22vdr-1.1.22
- Added 'Hrvatska radiotelevizija' and 'RTV Slovenija' to ca.conf (thanks to Paul Gohn). - Implemented actual user input for CAM enquiry menus. - Since disk file systems apparently don't honor the O_NONBLOCK flag to read from a file in non-blocking mode the cDvbPlayer now uses a non blocking file reader class to make sure replay remains smooth even under heavy system load. - Increased the maximum possible packet size in remux.c to avoid corrupted streams with broadcasters that send extremely large PES packets (thanks to Teemu Rantanen). - Added TS error checking to remux.c (thanks to Teemu Rantanen). - Modified cRingBufferLinear to avoid excessive memmove() calls in 'Transfer Mode' and during recordings, which dramatically reduces CPU load. Thanks to Teemu Rantanen for pinpointing the problem with the excessive memmove() calls. - Updated 'channels.conf' (thanks to Achim Lange). - Added/improved Swedish language texts (thanks to Jan Ekholm). - Fixed the description of the "Scroll pages" OSD setup parameter ('yes' and 'no' were mixed up). - Fixed handling the LOG_LOCALn parameters in the -l option (thanks to Dimitrios Dimitrakos). - Changed EIT processing to always read a full section. - Fixed handling user defined CFLAGS in libdtv/libvdr/Makefile (thanks to Clemens Kirchgatterer and Robert Schiele). - Fixed skipping unavailable channels in the EPG scanner.
Diffstat (limited to 'remux.c')
-rw-r--r--remux.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/remux.c b/remux.c
index 786bb8f..097b4a5 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.12 2002/10/12 13:33:54 kls Exp $
+ * $Id: remux.c 1.14 2003/01/24 17:22:29 kls Exp $
*/
/* The calling interface of the 'cRemux::Process()' function is defined
@@ -97,14 +97,16 @@
#define PTS_ONLY 0x80
#define TS_SIZE 188
-#define PAY_START 0x40
#define PID_MASK_HI 0x1F
-//flags
+#define CONT_CNT_MASK 0x0F
+
+// Flags:
+#define PAY_START 0x40
+#define TS_ERROR 0x80
#define ADAPT_FIELD 0x20
-//XXX TODO
-#define MAX_PLENGTH 0xFFFF
-#define MMAX_PLENGTH (4*MAX_PLENGTH)
+#define MAX_PLENGTH 0xFFFF // the maximum PES packet length (theoretically)
+#define MMAX_PLENGTH (8*MAX_PLENGTH) // some stations send PES packets that are extremely large, e.g. DVB-T in Finland
#define IPACKS 2048
@@ -132,6 +134,9 @@ private:
bool done;
uint8_t *resultBuffer;
int *resultCount;
+ int tsErrors;
+ int ccErrors;
+ int ccCounter;
static uint8_t headr[];
void store(uint8_t *Data, int Count);
void reset_ipack(void);
@@ -154,6 +159,10 @@ cTS2PES::cTS2PES(uint8_t *ResultBuffer, int *ResultCount, int Size, uint8_t Audi
size = Size;
audioCid = AudioCid;
+ tsErrors = 0;
+ ccErrors = 0;
+ ccCounter = -1;
+
if (!(buf = MALLOC(uint8_t, size)))
esyslog("Not enough memory for ts_transform");
@@ -162,6 +171,8 @@ cTS2PES::cTS2PES(uint8_t *ResultBuffer, int *ResultCount, int Size, uint8_t Audi
cTS2PES::~cTS2PES()
{
+ if (tsErrors || ccErrors)
+ dsyslog("cTS2PES got %d TS errors, %d TS continuity errors", tsErrors, ccErrors);
free(buf);
}
@@ -384,6 +395,8 @@ void cTS2PES::instant_repack(const uint8_t *Buf, int Count)
}
if (plength && found == plength + 6) {
+ if (plength == MMAX_PLENGTH - 6)
+ esyslog("ERROR: PES packet length overflow in remuxer (stream corruption)");
send_ipack();
reset_ipack();
if (c < Count)
@@ -398,6 +411,22 @@ void cTS2PES::ts_to_pes(const uint8_t *Buf) // don't need count (=188)
if (!Buf)
return;
+ if (Buf[1] & TS_ERROR)
+ tsErrors++;
+ if ((Buf[3] ^ ccCounter) & CONT_CNT_MASK) {
+ // This should check duplicates and packets which do not increase the counter.
+ // But as the errors usually come in bursts this should be enough to
+ // show you there is something wrong with signal quality.
+ if (ccCounter != -1 && ((Buf[3] ^ (ccCounter + 1)) & CONT_CNT_MASK)) {
+ ccErrors++;
+ // Enable this if you are having problems with signal quality.
+ // These are the errors I used to get with Nova-T when antenna
+ // was not positioned correcly (not transport errors). //tvr
+ //dsyslog("TS continuity error (%d)", ccCounter);
+ }
+ ccCounter = Buf[3] & CONT_CNT_MASK;
+ }
+
if (Buf[1] & PAY_START) {
if (plength == MMAX_PLENGTH - 6 && found > 6) {
plength = found - 6;