summaryrefslogtreecommitdiff
path: root/remux.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2008-12-14 16:54:12 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2008-12-14 16:54:12 +0100
commit1834751c4510edb66c96d0b741def5922738e74c (patch)
tree7ce12d0916803847ebec437d4c03b90338d815f6 /remux.c
parentc848ab793a302dc067663ec4a06395745e443c9d (diff)
downloadvdr-patch-lnbsharing-1834751c4510edb66c96d0b741def5922738e74c.tar.gz
vdr-patch-lnbsharing-1834751c4510edb66c96d0b741def5922738e74c.tar.bz2
Version 1.7.2vdr-1.7.2
- Added a note about 'Id' being obsolete to the description of cDevice::PlayAudio(). - Switched to the new S2API driver API, which was decided to become the official DVB API in the kernel (based on patches from Igor M. Liplianin, Niels Wagenaar and Edgar Hucek). VDR now uses the S2API driver from http://linuxtv.org/hg/v4l-dvb. In order to correctly detect DVB-S2 capable devices, you need to apply the patch from ftp://ftp.cadsoft.de/vdr/Developer/v4l-dvb-s2api-add-s2-capability.diff to the driver source, because the S2API doesn't provide a way of telling whether a device can handle DVB-S2 transponders. - The cDvbTuner::IsTunedTo() function now also checks the symbol rate in case of DVB-S and DVB-C. - Improved handling PES video packets with zero length when converting from TS to PES. For good replay in Transfer Mode on full featured DVB cards you may want to apply the patch from ftp://ftp.cadsoft.de/vdr/Developer/av7110_v4ldvb_api5_audiobuf_test_1.diff to the driver (thanks to Oliver Endriss).
Diffstat (limited to 'remux.c')
-rw-r--r--remux.c37
1 files changed, 30 insertions, 7 deletions
diff --git a/remux.c b/remux.c
index 8312a74..1938549 100644
--- a/remux.c
+++ b/remux.c
@@ -11,7 +11,7 @@
* The cRepacker family's code was originally written by Reinhard Nissl <rnissl@gmx.de>,
* and adapted to the VDR coding style by Klaus.Schmidinger@cadsoft.de.
*
- * $Id: remux.c 2.1 2008/08/15 14:49:34 kls Exp $
+ * $Id: remux.c 2.2 2008/12/13 14:30:15 kls Exp $
*/
#include "remux.h"
@@ -2578,7 +2578,7 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
cTsToPes::cTsToPes(void)
{
data = NULL;
- size = length = 0;
+ size = length = offset = 0;
synced = false;
}
@@ -2602,12 +2602,35 @@ void cTsToPes::PutTs(const uchar *Data, int Length)
length += Length;
}
+#define MAXPESLENGTH 0xFFF0
+
const uchar *cTsToPes::GetPes(int &Length)
{
- if (PesLongEnough(length)) {
- Length = PesLength(data);
- if (Length <= length) {
- Length = length; // in case the PES packet has no explicit length, as is the case for video PES
+ if (offset < length && PesLongEnough(length)) {
+ if (!PesHasLength(data)) // this is a video PES packet with undefined length
+ offset = 6; // trigger setting PES length for initial slice
+ if (offset) {
+ uchar *p = data + offset - 6;
+ if (p != data) {
+ p -= 3;
+ memmove(p, data, 4);
+ }
+ int l = min(length - offset, MAXPESLENGTH);
+ offset += l;
+ if (p != data) {
+ l += 3;
+ p[6] = 0x80;
+ p[7] = 0x00;
+ p[8] = 0x00;
+ }
+ p[4] = l / 256;
+ p[5] = l & 0xFF;
+ Length = l + 6;
+ return p;
+ }
+ else {
+ Length = PesLength(data);
+ offset = Length; // to make sure we break out in case of garbage data
return data;
}
}
@@ -2616,7 +2639,7 @@ const uchar *cTsToPes::GetPes(int &Length)
void cTsToPes::Reset(void)
{
- length = 0;
+ length = offset = 0;
}
// --- Some helper functions for debugging -----------------------------------