Compatiblity to Network Media Tank (#496)

- minor fixes of PAT repacker
- repack and send every PAT packet we receive
This commit is contained in:
schmirl 2008-11-24 12:10:27 +00:00
parent 459e41e810
commit cd8d7fbd6c
3 changed files with 22 additions and 11 deletions

View File

@ -29,6 +29,7 @@ Rolf Ahrenberg
for fixing output format of some debug messages for fixing output format of some debug messages
for replacing private members by cThread::Running()/Active() for replacing private members by cThread::Running()/Active()
for improving externremux script termination for improving externremux script termination
for fixing PAT repacker version field
Rantanen Teemu Rantanen Teemu
for providing vdr-incompletesections.diff for providing vdr-incompletesections.diff
@ -97,3 +98,6 @@ Anssi Hannula
wirbel wirbel
for pointing out that section filtering is optional for VDR devices for pointing out that section filtering is optional for VDR devices
Jori Hamalainen
for extensive testing while making stream compatible to Network Media Tank

View File

@ -1,6 +1,8 @@
VDR Plugin 'streamdev' Revision History VDR Plugin 'streamdev' Revision History
--------------------------------------- ---------------------------------------
- minor fixes of PAT repacker
- repack and send every PAT packet we receive
- fixed null pointer in server.c when cConnection::Accept() failes - fixed null pointer in server.c when cConnection::Accept() failes
- consider Pids from channels.conf when HTTP TS streaming. Section filtering - consider Pids from channels.conf when HTTP TS streaming. Section filtering
is an optional feature for VDR devices, so we must not rely on the PMT is an optional feature for VDR devices, so we must not rely on the PMT

View File

@ -211,7 +211,7 @@ int cStreamdevPatFilter::GetPid(SI::PMT::Stream& stream)
void cStreamdevPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length) void cStreamdevPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length)
{ {
if (Pid == 0x00) { if (Pid == 0x00) {
if (Tid == 0x00 && !pmtPid) { if (Tid == 0x00) {
SI::PAT pat(Data, false); SI::PAT pat(Data, false);
if (!pat.CheckCRCAndParse()) if (!pat.CheckCRCAndParse())
return; return;
@ -220,6 +220,7 @@ void cStreamdevPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, i
if (!assoc.isNITPid()) { if (!assoc.isNITPid()) {
const cChannel *Channel = Channels.GetByServiceID(Source(), Transponder(), assoc.getServiceId()); const cChannel *Channel = Channels.GetByServiceID(Source(), Transponder(), assoc.getServiceId());
if (Channel && (Channel == m_Channel)) { if (Channel && (Channel == m_Channel)) {
int prevPmtPid = pmtPid;
if (0 != (pmtPid = assoc.getPid())) { if (0 != (pmtPid = assoc.getPid())) {
Dprintf("cStreamdevPatFilter: PMT pid for channel %s: %d\n", Channel->Name(), pmtPid); Dprintf("cStreamdevPatFilter: PMT pid for channel %s: %d\n", Channel->Name(), pmtPid);
pmtSid = assoc.getServiceId(); pmtSid = assoc.getServiceId();
@ -233,25 +234,27 @@ void cStreamdevPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, i
int ts_id; int ts_id;
unsigned int crc, i, len; unsigned int crc, i, len;
uint8_t *tmp, tspat_buf[TS_SIZE]; uint8_t *tmp, tspat_buf[TS_SIZE];
static uint8_t ccounter = 0;
ccounter = (ccounter + 1) % 16;
memset(tspat_buf, 0xff, TS_SIZE); memset(tspat_buf, 0xff, TS_SIZE);
memset(tspat_buf, 0x0, 4 + 12 + 5); // TS_HDR_LEN + PAT_TABLE_LEN + 5
ts_id = Channel->Tid(); // Get transport stream id of the channel ts_id = Channel->Tid(); // Get transport stream id of the channel
tspat_buf[0] = TS_SYNC_BYTE; // Transport packet header sunchronization byte (1000011 = 0x47h) tspat_buf[0] = TS_SYNC_BYTE; // Transport packet header sunchronization byte (1000011 = 0x47h)
tspat_buf[1] = 0x40; // Set payload unit start indicator bit tspat_buf[1] = 0x40; // Set payload unit start indicator bit
tspat_buf[2] = 0x0; // PID tspat_buf[2] = 0x0; // PID
tspat_buf[3] = 0x10; // Set payload flag to indicate precence of payload data tspat_buf[3] = 0x10 | ccounter; // Set payload flag, Continuity counter
tspat_buf[4] = 0x0; // PSI tspat_buf[4] = 0x0; // SI pointer field
tspat_buf[5] = 0x0; // PAT table id tspat_buf[5] = 0x0; // PAT table id
tspat_buf[6] = 0xb0; // Section syntax indicator bit and reserved bits set tspat_buf[6] = 0xb0; // Section syntax indicator bit and reserved bits set
tspat_buf[7] = 12 + 1; // Section length (12 bit): PAT_TABLE_LEN + 1 tspat_buf[7] = 12 + 1; // Section length (12 bit): PAT_TABLE_LEN + 1
tspat_buf[8] = (ts_id >> 8) & 0xff; // Transport stream ID (bits 8-15) tspat_buf[8] = (ts_id >> 8); // Transport stream ID (bits 8-15)
tspat_buf[9] = (ts_id & 0xff); // Transport stream ID (bits 0-7) tspat_buf[9] = (ts_id & 0xff); // Transport stream ID (bits 0-7)
tspat_buf[10] = 0x01; // Version number 0, Current next indicator bit set tspat_buf[10] = 0xc0 | ((pat.getVersionNumber() << 1) & 0x3e) |
pat.getCurrentNextIndicator();// Version number, Current next indicator
tspat_buf[11] = 0x0; // Section number tspat_buf[11] = 0x0; // Section number
tspat_buf[12] = 0x0; // Last section number tspat_buf[12] = 0x0; // Last section number
tspat_buf[13] = (pmtSid >> 8) & 0xff; // Program number (bits 8-15) tspat_buf[13] = (pmtSid >> 8); // Program number (bits 8-15)
tspat_buf[14] = (pmtSid & 0xff); // Program number (bits 0-7) tspat_buf[14] = (pmtSid & 0xff); // Program number (bits 0-7)
tspat_buf[15] = (pmtPid >> 8) & 0xff; // Network ID (bits 8-12) tspat_buf[15] = 0xe0 | (pmtPid >> 8); // Network ID (bits 8-12)
tspat_buf[16] = (pmtPid & 0xff); // Network ID (bits 0-7) tspat_buf[16] = (pmtPid & 0xff); // Network ID (bits 0-7)
crc = 0xffffffff; crc = 0xffffffff;
len = 12; // PAT_TABLE_LEN len = 12; // PAT_TABLE_LEN
@ -269,9 +272,11 @@ void cStreamdevPatFilter::Process(u_short Pid, u_char Tid, const u_char *Data, i
#endif #endif
} else } else
isyslog("cStreamdevPatFilter: PAT size %d too large to fit in one TS", Length); isyslog("cStreamdevPatFilter: PAT size %d too large to fit in one TS", Length);
m_Streamer->SetPids(pmtPid); if (pmtPid != prevPmtPid) {
Add(pmtPid, 0x02); m_Streamer->SetPids(pmtPid);
pmtVersion = -1; Add(pmtPid, 0x02);
pmtVersion = -1;
}
return; return;
} }
} }