mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Fixed handling the 'pointer field' in generating and parsing PAT/PMT
This commit is contained in:
parent
051f0def47
commit
5cbc33d897
@ -2201,6 +2201,7 @@ Frank Schmirler <vdr@schmirler.de>
|
||||
for making entering text via the numeric keys check the characters against the
|
||||
allowed characters
|
||||
for fixing handling address masks in SVDRP host settings
|
||||
for fixing handling the 'pointer field' in generating and parsing PAT/PMT
|
||||
|
||||
Jörn Reder <joern@zyn.de>
|
||||
for reporting that a recording may unnecessarily block a device with a CAM, while
|
||||
|
4
HISTORY
4
HISTORY
@ -5849,6 +5849,8 @@ Video Disk Recorder Revision History
|
||||
the patch from ftp://ftp.cadsoft.de/vdr/Developer/av7110_v4ldvb_api5_audiobuf_test_1.diff
|
||||
to the driver (thanks to Oliver Endriss).
|
||||
|
||||
2008-12-17: Version 1.7.3
|
||||
2008-12-20: Version 1.7.3
|
||||
|
||||
- Updated the Russian OSD texts (thanks to Oleg Roitburd).
|
||||
- Fixed handling the 'pointer field' in generating and parsing PAT/PMT (thanks to
|
||||
Frank Schmirler).
|
||||
|
14
remux.c
14
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.2 2008/12/13 14:30:15 kls Exp $
|
||||
* $Id: remux.c 2.3 2008/12/20 10:38:47 kls Exp $
|
||||
*/
|
||||
|
||||
#include "remux.h"
|
||||
@ -2298,6 +2298,7 @@ void cPatPmtGenerator::GeneratePat(void)
|
||||
p[i++] = 0x40; // flags (3), pid hi (5)
|
||||
p[i++] = 0x00; // pid lo
|
||||
p[i++] = 0x10; // flags (4), continuity counter (4)
|
||||
p[i++] = 0x00; // pointer field (payload unit start indicator is set)
|
||||
int PayloadStart = i;
|
||||
p[i++] = 0x00; // table id
|
||||
p[i++] = 0xB0; // section syntax indicator (1), dummy (3), section length hi (4)
|
||||
@ -2367,13 +2368,18 @@ void cPatPmtGenerator::GeneratePmt(tChannelID ChannelID)
|
||||
MakeCRC(buf + i, buf, i);
|
||||
// split the PMT section into several TS packets:
|
||||
uchar *q = buf;
|
||||
bool pusi = true;
|
||||
while (i > 0) {
|
||||
uchar *p = pmt[numPmtPackets++];
|
||||
int j = 0;
|
||||
p[j++] = 0x47; // TS indicator
|
||||
p[j++] = 0x40 | (P_PNR >> 8); // flags (3), pid hi (5)
|
||||
p[j++] = (pusi ? 0x40 : 0x00) | (P_PNR >> 8); // flags (3), pid hi (5)
|
||||
p[j++] = P_PNR & 0xFF; // pid lo
|
||||
p[j++] = 0x10; // flags (4), continuity counter (4)
|
||||
if (pusi) {
|
||||
p[j++] = 0x00; // pointer field (payload unit start indicator is set)
|
||||
pusi = false;
|
||||
}
|
||||
int l = TS_SIZE - j;
|
||||
memcpy(p + j, q, l);
|
||||
q += l;
|
||||
@ -2412,6 +2418,7 @@ cPatPmtParser::cPatPmtParser(void)
|
||||
void cPatPmtParser::ParsePat(const uchar *Data, int Length)
|
||||
{
|
||||
// The PAT is always assumed to fit into a single TS packet
|
||||
Data += Data[0] + 1; // process pointer_field
|
||||
SI::PAT Pat(Data, false);
|
||||
if (Pat.CheckCRCAndParse()) {
|
||||
dbgpatpmt("PAT: TSid = %d, c/n = %d, v = %d, s = %d, ls = %d\n", Pat.getTransportStreamId(), Pat.getCurrentNextIndicator(), Pat.getVersionNumber(), Pat.getSectionNumber(), Pat.getLastSectionNumber());
|
||||
@ -2432,7 +2439,8 @@ void cPatPmtParser::ParsePmt(const uchar *Data, int Length)
|
||||
{
|
||||
// The PMT may extend over several TS packets, so we need to assemble them
|
||||
if (pmtSize == 0) {
|
||||
// this is the first packet
|
||||
Data += Data[0] + 1; // this is the first packet
|
||||
Length -= Data[0] + 1;
|
||||
if (SectionLength(Data, Length) > Length) {
|
||||
if (Length <= int(sizeof(pmt))) {
|
||||
memcpy(pmt, Data, Length);
|
||||
|
Loading…
Reference in New Issue
Block a user