mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-02 18:31:12 +02:00
zapit/src/scannit.cpp: parse network descriptors
Origin commit data
------------------
Branch: ni/coolstream
Commit: f9262a20b1
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-03-18 (Sun, 18 Mar 2012)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include <zapit/scan.h>
|
#include <zapit/scan.h>
|
||||||
#include <dvbsi++/descriptor_tag.h>
|
#include <dvbsi++/descriptor_tag.h>
|
||||||
#include <dvbsi++/network_name_descriptor.h>
|
#include <dvbsi++/network_name_descriptor.h>
|
||||||
|
#include <dvbsi++/linkage_descriptor.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <eitd/edvbstring.h>
|
#include <eitd/edvbstring.h>
|
||||||
|
|
||||||
@@ -51,8 +52,8 @@ CNit::~CNit()
|
|||||||
|
|
||||||
bool CNit::Start()
|
bool CNit::Start()
|
||||||
{
|
{
|
||||||
int ret = start();
|
int ret = start();
|
||||||
return (ret == 0);
|
return (ret == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CNit::Stop()
|
bool CNit::Stop()
|
||||||
@@ -158,58 +159,94 @@ bool CNit::Parse()
|
|||||||
NetworkInformationSectionIterator sit;
|
NetworkInformationSectionIterator sit;
|
||||||
for (sit = sections.begin(); sit != sections.end(); ++sit) {
|
for (sit = sections.begin(); sit != sections.end(); ++sit) {
|
||||||
NetworkInformationSection * nit = *sit;
|
NetworkInformationSection * nit = *sit;
|
||||||
const TransportStreamInfoList *tslist = nit->getTsInfo();
|
|
||||||
|
|
||||||
if (CServiceScan::getInstance()->Aborted())
|
if (CServiceScan::getInstance()->Aborted())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for(TransportStreamInfoConstIterator tit = tslist->begin(); tit != tslist->end(); ++tit) {
|
const DescriptorList * dlist = nit->getDescriptors();
|
||||||
TransportStreamInfo * tsinfo = *tit;
|
DescriptorConstIterator dit;
|
||||||
const DescriptorList * dlist = tsinfo->getDescriptors();
|
#ifdef DEBUG_NIT
|
||||||
#if 0
|
printf("NIT: section %d, %d descriptors\n", nit->getSectionNumber(), dlist->size());
|
||||||
printf("NIT: tsid %04x onid %04x %d descriptors\n", tsinfo->getTransportStreamId(),
|
|
||||||
tsinfo->getOriginalNetworkId(), dlist->size());
|
|
||||||
#endif
|
#endif
|
||||||
DescriptorConstIterator dit;
|
for (dit = dlist->begin(); dit != dlist->end(); ++dit) {
|
||||||
for (dit = dlist->begin(); dit != dlist->end(); ++dit) {
|
Descriptor * d = *dit;
|
||||||
Descriptor * d = *dit;
|
switch(d->getTag()) {
|
||||||
switch(d->getTag()) {
|
|
||||||
case SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR:
|
|
||||||
ParseSatelliteDescriptor((SatelliteDeliverySystemDescriptor *)d, tsinfo);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CABLE_DELIVERY_SYSTEM_DESCRIPTOR:
|
|
||||||
ParseCableDescriptor((CableDeliverySystemDescriptor *)d, tsinfo);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SERVICE_LIST_DESCRIPTOR:
|
|
||||||
ParseServiceList((ServiceListDescriptor *) d, tsinfo);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LOGICAL_CHANNEL_DESCRIPTOR:
|
|
||||||
ParseLogicalChannels((LogicalChannelDescriptor *) d, tsinfo);
|
|
||||||
break;
|
|
||||||
case NETWORK_NAME_DESCRIPTOR:
|
case NETWORK_NAME_DESCRIPTOR:
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_NIT
|
||||||
NetworkNameDescriptor * nd = (NetworkNameDescriptor *) d;
|
NetworkNameDescriptor * nd = (NetworkNameDescriptor *) d;
|
||||||
int tsidonid = (tsinfo->getTransportStreamId() << 16) | tsinfo->getOriginalNetworkId();
|
std::string networkName = stringDVBUTF8(nd->getNetworkName());
|
||||||
std::string networkName = stringDVBUTF8(nd->getNetworkName(), 0, tsidonid);
|
|
||||||
printf("NIT: network name [%s]\n", networkName.c_str());
|
printf("NIT: network name [%s]\n", networkName.c_str());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case LINKAGE_DESCRIPTOR:
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_NIT
|
||||||
|
LinkageDescriptor * ld = (LinkageDescriptor*) d;
|
||||||
|
printf("NIT: linkage, tsid %04x onid %04x sid %04x type %02x\n", ld->getTransportStreamId(),
|
||||||
|
ld->getOriginalNetworkId(), ld->getServiceId(), ld->getLinkageType());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_NIT_UNUSED
|
#ifdef DEBUG_NIT_UNUSED
|
||||||
printf("NIT: descriptor %02x: ", d->getTag());
|
printf("NIT net loop: descriptor %02x len %d: ", d->getTag(), d->getLength());
|
||||||
|
#if 0
|
||||||
uint8_t len = 2+d->getLength();
|
uint8_t len = 2+d->getLength();
|
||||||
uint8_t buf[len];
|
uint8_t buf[len];
|
||||||
d->writeToBuffer(buf);
|
d->writeToBuffer(buf);
|
||||||
for(uint8_t i = 0; i < len; i++)
|
for(uint8_t i = 0; i < len; i++)
|
||||||
printf("%02x ", buf[i]);
|
printf("%02x ", buf[i]);
|
||||||
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const TransportStreamInfoList *tslist = nit->getTsInfo();
|
||||||
|
for(TransportStreamInfoConstIterator tit = tslist->begin(); tit != tslist->end(); ++tit) {
|
||||||
|
TransportStreamInfo * tsinfo = *tit;
|
||||||
|
dlist = tsinfo->getDescriptors();
|
||||||
|
#if 0
|
||||||
|
printf("NIT: tsid %04x onid %04x %d descriptors\n", tsinfo->getTransportStreamId(),
|
||||||
|
tsinfo->getOriginalNetworkId(), dlist->size());
|
||||||
|
#endif
|
||||||
|
//DescriptorConstIterator dit;
|
||||||
|
for (dit = dlist->begin(); dit != dlist->end(); ++dit) {
|
||||||
|
Descriptor * d = *dit;
|
||||||
|
switch(d->getTag()) {
|
||||||
|
case SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR:
|
||||||
|
ParseSatelliteDescriptor((SatelliteDeliverySystemDescriptor *)d, tsinfo);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case CABLE_DELIVERY_SYSTEM_DESCRIPTOR:
|
||||||
|
ParseCableDescriptor((CableDeliverySystemDescriptor *)d, tsinfo);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SERVICE_LIST_DESCRIPTOR:
|
||||||
|
ParseServiceList((ServiceListDescriptor *) d, tsinfo);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LOGICAL_CHANNEL_DESCRIPTOR:
|
||||||
|
ParseLogicalChannels((LogicalChannelDescriptor *) d, tsinfo);
|
||||||
|
break;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_NIT_UNUSED
|
||||||
|
printf("NIT TS loop: descriptor %02x: ", d->getTag());
|
||||||
|
uint8_t len = 2+d->getLength();
|
||||||
|
uint8_t buf[len];
|
||||||
|
d->writeToBuffer(buf);
|
||||||
|
for(uint8_t i = 0; i < len; i++)
|
||||||
|
printf("%02x ", buf[i]);
|
||||||
|
printf("\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,10 +348,10 @@ bool CNit::ParseLogicalChannels(LogicalChannelDescriptor * ld, TransportStreamIn
|
|||||||
/* FIXME dont use freq_id / satellitePosition ? */
|
/* FIXME dont use freq_id / satellitePosition ? */
|
||||||
t_channel_id channel_id = CZapitChannel::makeChannelId(satellitePosition,
|
t_channel_id channel_id = CZapitChannel::makeChannelId(satellitePosition,
|
||||||
freq_id, transport_stream_id, original_network_id, service_id);
|
freq_id, transport_stream_id, original_network_id, service_id);
|
||||||
// (*it)->getVisibleServiceFlag();
|
/* (*it)->getVisibleServiceFlag(); */
|
||||||
logical_map[channel_id] = lcn;
|
logical_map[channel_id] = lcn;
|
||||||
#ifdef DEBUG_LCN
|
#ifdef DEBUG_LCN
|
||||||
printf("NIT: lcn tsid %04x onid %04x %llx -> %d\n", transport_stream_id, original_network_id, channel_id, lcn);
|
printf("NIT: logical channel tsid %04x onid %04x %llx -> %d\n", transport_stream_id, original_network_id, channel_id, lcn);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user