scansdt: check dmx

This commit is contained in:
Jacek Jendrzej
2018-09-25 20:25:30 +02:00
parent 06808405b5
commit f5bc433d7e

View File

@@ -69,37 +69,41 @@ bool CSdt::PMTPing(unsigned short pid, unsigned short sid)
unsigned char buffer[PMT_SECTION_SIZE]; unsigned char buffer[PMT_SECTION_SIZE];
cDemux * dmx = new cDemux(dmxnum); cDemux * dmx = new cDemux(dmxnum);
dmx->Open(DMX_PSI_CHANNEL); bool badservice = false;
if(dmx){
dmx->Open(DMX_PSI_CHANNEL);
memset(filter, 0x00, DMX_FILTER_SIZE); memset(filter, 0x00, DMX_FILTER_SIZE);
memset(mask, 0x00, DMX_FILTER_SIZE); memset(mask, 0x00, DMX_FILTER_SIZE);
filter[0] = 0x02; /* table_id */ filter[0] = 0x02; /* table_id */
filter[1] = sid >> 8; filter[1] = sid >> 8;
filter[2] = sid; filter[2] = sid;
filter[3] = 0x01; /* current_next_indicator */ filter[3] = 0x01; /* current_next_indicator */
filter[4] = 0x00; /* section_number */ filter[4] = 0x00; /* section_number */
mask[0] = 0xFF; mask[0] = 0xFF;
mask[1] = 0xFF; mask[1] = 0xFF;
mask[2] = 0xFF; mask[2] = 0xFF;
mask[3] = 0x01; mask[3] = 0x01;
mask[4] = 0xFF; mask[4] = 0xFF;
if (!dmx->sectionFilter(pid, filter, mask, 1)) { if (!dmx->sectionFilter(pid, filter, mask, 1)) {
ret = false; ret = false;
}else{ }else{
if(dmx->Read(buffer, PMT_SECTION_SIZE) > 0){ if(dmx->Read(buffer, PMT_SECTION_SIZE) > 0){
ProgramMapSection pmt(buffer); ProgramMapSection pmt(buffer);
if(0x1fff==pmt.getPcrPid()){ if(0x1fff==pmt.getPcrPid()){
ret = false; ret = false;
}else{ badservice = false;
ret = true; }else{
ret = true;
}
} }
} }
delete dmx;
} }
delete dmx;
#ifdef DEBUG_SDT #ifdef DEBUG_SDT
if(!ret) if(!ret)
printf("Ping: PMT-pid 0%x failed\n", pid); printf("Ping: PMT-pid 0%x %s\n", pid,badservice ? "not supportet stream type":"failed");
#endif #endif
return ret; return ret;
} }