diff options
author | randomdan <randomdan@localhost> | 2013-12-05 23:20:53 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2013-12-05 23:20:53 +0000 |
commit | f32e559558809c16889726e5d9cfe59ffb0797fc (patch) | |
tree | 55ddf5ead26ac8fbe42453e431ae192acf07328c | |
parent | Compat fix with stable versions (diff) | |
download | p2pvr-f32e559558809c16889726e5d9cfe59ffb0797fc.tar.bz2 p2pvr-f32e559558809c16889726e5d9cfe59ffb0797fc.tar.xz p2pvr-f32e559558809c16889726e5d9cfe59ffb0797fc.zip |
Move parent object Ids into domain objects, remove all the parent object mess from binders
-rw-r--r-- | p2pvr/ice/p2pvr.ice | 5 | ||||
-rw-r--r-- | p2pvr/lib/containerIterator.h | 5 | ||||
-rw-r--r-- | p2pvr/lib/dvbsiHelpers.h | 19 | ||||
-rw-r--r-- | p2pvr/lib/dvbsiHelpers/cableDelivery.cpp | 5 | ||||
-rw-r--r-- | p2pvr/lib/dvbsiHelpers/networkService.cpp | 4 | ||||
-rw-r--r-- | p2pvr/lib/dvbsiHelpers/networkTransportStream.cpp | 4 | ||||
-rw-r--r-- | p2pvr/lib/dvbsiHelpers/programMap.cpp | 4 | ||||
-rw-r--r-- | p2pvr/lib/dvbsiHelpers/satelliteDelivery.cpp | 5 | ||||
-rw-r--r-- | p2pvr/lib/dvbsiHelpers/service.cpp | 13 | ||||
-rw-r--r-- | p2pvr/lib/dvbsiHelpers/terrestrialDelivery.cpp | 4 | ||||
-rw-r--r-- | p2pvr/lib/maintenance/network.cpp | 6 | ||||
-rw-r--r-- | p2pvr/lib/maintenance/programMap.cpp | 2 | ||||
-rw-r--r-- | p2pvr/lib/maintenance/services.cpp | 2 | ||||
-rw-r--r-- | p2pvr/lib/objectRowState.h | 4 | ||||
-rw-r--r-- | p2pvr/lib/siParsers/network.cpp | 6 | ||||
-rw-r--r-- | p2pvr/lib/siParsers/programMap.cpp | 1 | ||||
-rw-r--r-- | p2pvr/lib/siParsers/service.cpp | 1 | ||||
-rw-r--r-- | p2pvr/lib/singleIterator.h | 5 |
18 files changed, 51 insertions, 44 deletions
diff --git a/p2pvr/ice/p2pvr.ice b/p2pvr/ice/p2pvr.ice index 7d84955..b5903d3 100644 --- a/p2pvr/ice/p2pvr.ice +++ b/p2pvr/ice/p2pvr.ice @@ -20,6 +20,7 @@ module Common { module DVBSI { // Descriptors class Delivery { + int TransportStreamId; long Frequency; }; @@ -57,11 +58,13 @@ module DVBSI { struct NetworkService { int ServiceId; + int TransportStreamId; short ServiceType; }; sequence<NetworkService> NetworkServiceList; class NetworkTransportStream { + int NetworkId; int TransportStreamId; int OriginalNetworkId; SatelliteDelivery Satellite; @@ -92,6 +95,7 @@ module DVBSI { class Service { int ServiceId; + int TransportStreamId; bool EitSchedule; bool EitPresentFollowing; short RunningStatus; @@ -112,6 +116,7 @@ module DVBSI { class Stream { short Type; int Id; + int ServiceId; }; sequence<Stream> StreamList; diff --git a/p2pvr/lib/containerIterator.h b/p2pvr/lib/containerIterator.h index 6c43a41..2b61055 100644 --- a/p2pvr/lib/containerIterator.h +++ b/p2pvr/lib/containerIterator.h @@ -8,11 +8,10 @@ template <typename T> class ContainerIterator : public IHaveSubTasks { public: - template <typename ... Parents> - ContainerIterator(const T * con, const Parents & ... p) : + ContainerIterator(const T * con) : SourceObject(__PRETTY_FUNCTION__), IHaveSubTasks(NULL), - binder(boost::bind(&BindColumns<typename T::value_type, Parents...>, _1, _2, p...)), + binder(boost::bind(&BindColumns<typename T::value_type>, _1, _2)), container(con) { } diff --git a/p2pvr/lib/dvbsiHelpers.h b/p2pvr/lib/dvbsiHelpers.h index 132c1b5..b8cc1cf 100644 --- a/p2pvr/lib/dvbsiHelpers.h +++ b/p2pvr/lib/dvbsiHelpers.h @@ -9,19 +9,14 @@ template<> void BindColumns(RowState & rs, const T & obj); \ template<> void UnbindColumns(RowState & rs, const T & s) -#define ColumnHelperParent(T, P) \ - template<> void CreateColumns<T>(const ColumnCreator & cc); \ - template<> void BindColumns(RowState & rs, const T & obj, const P & parent); \ - template<> void UnbindColumns(RowState & rs, const T & s) - ColumnHelper(DVBSI::NetworkPtr); -ColumnHelperParent(DVBSI::NetworkTransportStreamPtr, DVBSI::NetworkPtr); -ColumnHelperParent(DVBSI::NetworkService, DVBSI::NetworkTransportStreamPtr); -ColumnHelperParent(DVBSI::TerrestrialDeliveryPtr, DVBSI::TransportStreamPtr); -ColumnHelperParent(DVBSI::CableDeliveryPtr, DVBSI::TransportStreamPtr); -ColumnHelperParent(DVBSI::SatelliteDeliveryPtr, DVBSI::TransportStreamPtr); -ColumnHelperParent(DVBSI::ServicePtr, DVBSI::TransportStreamPtr); -ColumnHelperParent(DVBSI::StreamPtr, DVBSI::ProgramMapPtr); +ColumnHelper(DVBSI::NetworkTransportStreamPtr); +ColumnHelper(DVBSI::NetworkService); +ColumnHelper(DVBSI::TerrestrialDeliveryPtr); +ColumnHelper(DVBSI::CableDeliveryPtr); +ColumnHelper(DVBSI::SatelliteDeliveryPtr); +ColumnHelper(DVBSI::ServicePtr); +ColumnHelper(DVBSI::StreamPtr); ColumnHelper(DVBSI::EventPtr); #endif diff --git a/p2pvr/lib/dvbsiHelpers/cableDelivery.cpp b/p2pvr/lib/dvbsiHelpers/cableDelivery.cpp index a550de7..94aa275 100644 --- a/p2pvr/lib/dvbsiHelpers/cableDelivery.cpp +++ b/p2pvr/lib/dvbsiHelpers/cableDelivery.cpp @@ -15,10 +15,10 @@ CreateColumns<DVBSI::CableDeliveryPtr>(const ColumnCreator & cc) template<> void -BindColumns(RowState & rs, const DVBSI::CableDeliveryPtr & s, const DVBSI::NetworkTransportStreamPtr & ts) +BindColumns(RowState & rs, const DVBSI::CableDeliveryPtr & s) { rs.fields[0] << s->Frequency; - rs.fields[1] << ts->TransportStreamId; + rs.fields[1] << s->TransportStreamId; rs.fields[2] << s->FecOuter; rs.fields[3] << s->Modulation; rs.fields[4] << s->SymbolRate; @@ -29,6 +29,7 @@ void UnbindColumns(RowState & rs, DVBSI::CableDeliveryPtr const & s) { rs.fields[0] >> s->Frequency; + rs.fields[1] >> s->TransportStreamId; rs.fields[2] >> s->FecOuter; rs.fields[3] >> s->Modulation; rs.fields[4] >> s->SymbolRate; diff --git a/p2pvr/lib/dvbsiHelpers/networkService.cpp b/p2pvr/lib/dvbsiHelpers/networkService.cpp index 60b357a..80700b4 100644 --- a/p2pvr/lib/dvbsiHelpers/networkService.cpp +++ b/p2pvr/lib/dvbsiHelpers/networkService.cpp @@ -12,10 +12,10 @@ CreateColumns<DVBSI::NetworkService>(const ColumnCreator & cc) template<> void -BindColumns(RowState & rs, const DVBSI::NetworkService & s, const DVBSI::NetworkTransportStreamPtr & ts) +BindColumns(RowState & rs, const DVBSI::NetworkService & s) { rs.fields[0] << s.ServiceId; rs.fields[1] << s.ServiceType; - rs.fields[2] << ts->TransportStreamId; + rs.fields[2] << s.TransportStreamId; } diff --git a/p2pvr/lib/dvbsiHelpers/networkTransportStream.cpp b/p2pvr/lib/dvbsiHelpers/networkTransportStream.cpp index 884a7db..04f9bb0 100644 --- a/p2pvr/lib/dvbsiHelpers/networkTransportStream.cpp +++ b/p2pvr/lib/dvbsiHelpers/networkTransportStream.cpp @@ -12,10 +12,10 @@ CreateColumns<DVBSI::NetworkTransportStreamPtr>(const ColumnCreator & cc) template<> void -BindColumns(RowState & rs, const DVBSI::NetworkTransportStreamPtr & ts, const DVBSI::NetworkPtr & network) +BindColumns(RowState & rs, const DVBSI::NetworkTransportStreamPtr & ts) { rs.fields[0] << ts->TransportStreamId; - rs.fields[1] << network->NetworkId; + rs.fields[1] << ts->NetworkId; rs.fields[2] << ts->OriginalNetworkId; } diff --git a/p2pvr/lib/dvbsiHelpers/programMap.cpp b/p2pvr/lib/dvbsiHelpers/programMap.cpp index 5b543a9..60cf0d4 100644 --- a/p2pvr/lib/dvbsiHelpers/programMap.cpp +++ b/p2pvr/lib/dvbsiHelpers/programMap.cpp @@ -12,9 +12,9 @@ CreateColumns<DVBSI::StreamPtr>(const ColumnCreator & cc) template<> void -BindColumns(RowState & rs, const DVBSI::StreamPtr & stream, const DVBSI::ProgramMapPtr & pmp) +BindColumns(RowState & rs, const DVBSI::StreamPtr & stream) { - rs.fields[0] << pmp->ServiceId; + rs.fields[0] << stream->ServiceId; rs.fields[1] << stream->Id; rs.fields[2] << stream->Type; } diff --git a/p2pvr/lib/dvbsiHelpers/satelliteDelivery.cpp b/p2pvr/lib/dvbsiHelpers/satelliteDelivery.cpp index a8d6f1a..a337df6 100644 --- a/p2pvr/lib/dvbsiHelpers/satelliteDelivery.cpp +++ b/p2pvr/lib/dvbsiHelpers/satelliteDelivery.cpp @@ -19,10 +19,10 @@ CreateColumns<DVBSI::SatelliteDeliveryPtr>(const ColumnCreator & cc) template<> void -BindColumns(RowState & rs, const DVBSI::SatelliteDeliveryPtr & s, const DVBSI::NetworkTransportStreamPtr & ts) +BindColumns(RowState & rs, const DVBSI::SatelliteDeliveryPtr & s) { rs.fields[0] << s->Frequency; - rs.fields[1] << ts->TransportStreamId; + rs.fields[1] << s->TransportStreamId; rs.fields[2] << s->OrbitalPosition; rs.fields[3] << s->WestEastFlag; rs.fields[4] << s->Polarization; @@ -37,6 +37,7 @@ void UnbindColumns(RowState & rs, DVBSI::SatelliteDeliveryPtr const & s) { rs.fields[0] >> s->Frequency; + rs.fields[1] << s->TransportStreamId; rs.fields[2] >> s->OrbitalPosition; rs.fields[3] >> s->WestEastFlag; rs.fields[4] >> s->Polarization; diff --git a/p2pvr/lib/dvbsiHelpers/service.cpp b/p2pvr/lib/dvbsiHelpers/service.cpp index dfc03be..88b09cc 100644 --- a/p2pvr/lib/dvbsiHelpers/service.cpp +++ b/p2pvr/lib/dvbsiHelpers/service.cpp @@ -14,12 +14,12 @@ CreateColumns<DVBSI::ServicePtr>(const ColumnCreator & cc) template<> void -BindColumns(RowState & rs, const DVBSI::ServicePtr & s, const DVBSI::TransportStreamPtr & ts) +BindColumns(RowState & rs, const DVBSI::ServicePtr & s) { rs.fields[0] << s->ServiceId; - rs.fields[1] << ts->TransportStreamId; + rs.fields[1] << s->TransportStreamId; rs.fields[2] << s->Name; - rs.fields[4] << s->ProviderName; + rs.fields[3] << s->ProviderName; rs.fields[4] << s->DefaultAuthority; } @@ -28,8 +28,9 @@ void UnbindColumns(RowState & rs, DVBSI::ServicePtr const & s) { rs.fields[0] >> s->ServiceId; - rs.fields[0] >> s->Name; - rs.fields[0] >> s->ProviderName; - rs.fields[0] >> s->DefaultAuthority; + rs.fields[1] >> s->TransportStreamId; + rs.fields[2] >> s->Name; + rs.fields[3] >> s->ProviderName; + rs.fields[4] >> s->DefaultAuthority; } diff --git a/p2pvr/lib/dvbsiHelpers/terrestrialDelivery.cpp b/p2pvr/lib/dvbsiHelpers/terrestrialDelivery.cpp index dfacd01..d178845 100644 --- a/p2pvr/lib/dvbsiHelpers/terrestrialDelivery.cpp +++ b/p2pvr/lib/dvbsiHelpers/terrestrialDelivery.cpp @@ -22,10 +22,10 @@ CreateColumns<DVBSI::TerrestrialDeliveryPtr>(const ColumnCreator & cc) template<> void -BindColumns(RowState & rs, const DVBSI::TerrestrialDeliveryPtr & s, const DVBSI::NetworkTransportStreamPtr & ts) +BindColumns(RowState & rs, const DVBSI::TerrestrialDeliveryPtr & s) { rs.fields[0] << s->Frequency; - rs.fields[1] << ts->TransportStreamId; + rs.fields[1] << s->TransportStreamId; rs.fields[2] << s->Bandwidth; rs.fields[3] << s->Priority; rs.fields[4] << s->TimeSlicing; diff --git a/p2pvr/lib/maintenance/network.cpp b/p2pvr/lib/maintenance/network.cpp index 6b0ebc6..1cd224a 100644 --- a/p2pvr/lib/maintenance/network.cpp +++ b/p2pvr/lib/maintenance/network.cpp @@ -34,7 +34,7 @@ class SiNetworkInformationMerger : public SiNetworkInformationParser { SqlMergeTask mergeTransports("postgres", "transportstreams"); CreateColumns<DVBSI::NetworkTransportStreamPtr>(boost::bind(&Maintenance::SqlMergeColumnsInserter, &mergeTransports, _1, _2)); - mergeTransports.sources.insert(new ContainerIterator<DVBSI::NetworkTransportStreams>(&n->TransportStreams, n)); + mergeTransports.sources.insert(new ContainerIterator<DVBSI::NetworkTransportStreams>(&n->TransportStreams)); mergeTransports.loadComplete(commonObjects); mergeTransports.execute(NULL); @@ -42,7 +42,7 @@ class SiNetworkInformationMerger : public SiNetworkInformationParser { CreateColumns<DVBSI::TerrestrialDeliveryPtr>(boost::bind(&Maintenance::SqlMergeColumnsInserter, &mergeDvbt, _1, _2)); BOOST_FOREACH(const auto & s, n->TransportStreams) { if (s->Terrestrial) { - mergeDvbt.sources.insert(new SingleIterator<DVBSI::TerrestrialDeliveryPtr>(&s->Terrestrial, s)); + mergeDvbt.sources.insert(new SingleIterator<DVBSI::TerrestrialDeliveryPtr>(&s->Terrestrial)); } } mergeDvbt.loadComplete(commonObjects); @@ -51,7 +51,7 @@ class SiNetworkInformationMerger : public SiNetworkInformationParser { SqlMergeTask mergeServices("postgres", "services"); CreateColumns<DVBSI::NetworkService>(boost::bind(&Maintenance::SqlMergeColumnsInserter, &mergeServices, _1, _2)); BOOST_FOREACH(const auto & s, n->TransportStreams) { - mergeServices.sources.insert(new ContainerIterator<DVBSI::NetworkServiceList>(&s->Services, s)); + mergeServices.sources.insert(new ContainerIterator<DVBSI::NetworkServiceList>(&s->Services)); } mergeServices.loadComplete(commonObjects); mergeServices.execute(NULL); diff --git a/p2pvr/lib/maintenance/programMap.cpp b/p2pvr/lib/maintenance/programMap.cpp index f230f77..ecbd126 100644 --- a/p2pvr/lib/maintenance/programMap.cpp +++ b/p2pvr/lib/maintenance/programMap.cpp @@ -24,7 +24,7 @@ class SiProgramMapHandler : public SiProgramMapParser { Logger()->messagef(LOG_DEBUG, "type: %02x id: %d", s->Type, s->Id); } BOOST_FOREACH(const auto & s, pmp->Streams) { - BindColumns<DVBSI::StreamPtr>(rowState, s, pmp); + BindColumns<DVBSI::StreamPtr>(rowState, s); rowState.process(callBack); } } diff --git a/p2pvr/lib/maintenance/services.cpp b/p2pvr/lib/maintenance/services.cpp index 30df800..bd4d9a2 100644 --- a/p2pvr/lib/maintenance/services.cpp +++ b/p2pvr/lib/maintenance/services.cpp @@ -27,7 +27,7 @@ class SiServicesMerger : public SiServicesParser { // Don't change the list of services available from the network mergeServices.doDelete = VariableType(false); mergeServices.doInsert = VariableType(false); - mergeServices.sources.insert(new ContainerIterator<DVBSI::ServiceList>(&ts->Services, ts)); + mergeServices.sources.insert(new ContainerIterator<DVBSI::ServiceList>(&ts->Services)); mergeServices.loadComplete(commonObjects); mergeServices.execute(NULL); } diff --git a/p2pvr/lib/objectRowState.h b/p2pvr/lib/objectRowState.h index cf42055..9ba69f0 100644 --- a/p2pvr/lib/objectRowState.h +++ b/p2pvr/lib/objectRowState.h @@ -8,8 +8,8 @@ typedef boost::function<void(const std::string &, bool)> ColumnCreator; typedef boost::function<void(const ColumnCreator &)> ColumnSpecifier; -template <typename V, typename... Parents> -void BindColumns(RowState &, const V &, const Parents & ...); +template <typename V> +void BindColumns(RowState &, const V &); template <typename V> void UnbindColumns(RowState &, const V &); diff --git a/p2pvr/lib/siParsers/network.cpp b/p2pvr/lib/siParsers/network.cpp index 9f7434a..d992706 100644 --- a/p2pvr/lib/siParsers/network.cpp +++ b/p2pvr/lib/siParsers/network.cpp @@ -136,6 +136,7 @@ SiNetworkInformationParser::ParseSiTable(const struct NetworkInformation * nit, LoopOver<TransportStream>(nsh->data, HILO(nsh->transport_stream_loop_length), [this,n](const TransportStream * ts) { DVBSI::NetworkTransportStreamPtr nts = new DVBSI::NetworkTransportStream(); nts->TransportStreamId = ntohs(ts->transportStreamId); + nts->NetworkId = n->NetworkId; nts->OriginalNetworkId = ntohs(ts->originalNetworkId); ParseDescriptors(ts->data, HILO(ts->descriptors_length), 0x41, boost::bind(&SiNetworkInformationParser::parseDescriptor_ServiceList, nts, _1, _2), @@ -159,6 +160,7 @@ SiNetworkInformationParser::parseDescriptor_TerrestrialDelivery(DVBSI::NetworkTr auto tdd = reinterpret_cast<const TerrestrialDeliveryDescriptor *>(data); DVBSI::TerrestrialDeliveryPtr td = new DVBSI::TerrestrialDelivery; td->Frequency = ((uint64_t)ntohl(tdd->Frequency)) * 10; + td->TransportStreamId = nts->TransportStreamId; td->Bandwidth = tdd->Bandwidth; td->Priority = tdd->Priority; td->TimeSlicing = tdd->TimeSlicing; @@ -180,6 +182,7 @@ SiNetworkInformationParser::parseDescriptor_CableDelivery(DVBSI::NetworkTranspor auto cdd = reinterpret_cast<const CableDeliveryDescriptor *>(data); DVBSI::CableDeliveryPtr cd = new DVBSI::CableDelivery; cd->Frequency = ((uint64_t)ntohl(cdd->Frequency)) * 10; + cd->TransportStreamId = nts->TransportStreamId; cd->FecOuter = cdd->FecOuter; cd->Modulation = cdd->Modulation; cd->SymbolRate = HILO4(cdd->SymbolRate); @@ -194,6 +197,7 @@ SiNetworkInformationParser::parseDescriptor_SatelliteDelivery(DVBSI::NetworkTran auto sdd = reinterpret_cast<const SatelliteDeliveryDescriptor *>(data); DVBSI::SatelliteDeliveryPtr sd = new DVBSI::SatelliteDelivery; sd->Frequency = ((uint64_t)ntohl(sdd->Frequency)) * 10; + sd->TransportStreamId = nts->TransportStreamId; sd->OrbitalPosition = ntohs(sdd->OrbitalPosition); sd->WestEastFlag = sdd->WestEastFlag; sd->Polarization = sdd->Polarization; @@ -211,7 +215,7 @@ SiNetworkInformationParser::parseDescriptor_ServiceList(DVBSI::NetworkTransportS auto end = data + len; while (data < end) { auto d = reinterpret_cast<const ServiceListDescriptor *>(data); - nts->Services.push_back({ ntohs(d->ServiceId), d->ServiceType }); + nts->Services.push_back({ ntohs(d->ServiceId), nts->TransportStreamId, d->ServiceType }); data += sizeof(ServiceListDescriptor); } } diff --git a/p2pvr/lib/siParsers/programMap.cpp b/p2pvr/lib/siParsers/programMap.cpp index bb59017..61686dd 100644 --- a/p2pvr/lib/siParsers/programMap.cpp +++ b/p2pvr/lib/siParsers/programMap.cpp @@ -39,6 +39,7 @@ SiProgramMapParser::ParseSiTable(const struct ProgramMap * pm, DVBSI::ProgramMap DVBSI::StreamPtr s = new DVBSI::Stream(); s->Type = pms->stream_type; s->Id = HILO(pms->elementary_PID); + s->ServiceId = pmp->ServiceId; pmp->Streams.push_back(s); // Don't care what's in here, just need to move along pms = ParseDescriptors<ProgramMapStream>(pms->data, HILO(pms->ES_info_length)); diff --git a/p2pvr/lib/siParsers/service.cpp b/p2pvr/lib/siParsers/service.cpp index b8092af..56452e9 100644 --- a/p2pvr/lib/siParsers/service.cpp +++ b/p2pvr/lib/siParsers/service.cpp @@ -39,6 +39,7 @@ SiServicesParser::ParseSiTable(const TransportStreamDescriptor * tsd, DVBSI::Tra LoopOver<ServiceDescriptor>(tsd->data, HILO(tsd->header.section_length) - 12, [this,ts](const ServiceDescriptor * sd) { DVBSI::ServicePtr s = new DVBSI::Service(); s->ServiceId = ntohs(sd->ServiceId); + s->TransportStreamId = ts->TransportStreamId; s->EitSchedule = sd->EitSchedule; s->EitPresentFollowing = sd->EitPresentFollowing; s->RunningStatus = sd->RunningStatus; diff --git a/p2pvr/lib/singleIterator.h b/p2pvr/lib/singleIterator.h index c8b9a1e..1aac418 100644 --- a/p2pvr/lib/singleIterator.h +++ b/p2pvr/lib/singleIterator.h @@ -8,11 +8,10 @@ template <typename T> class SingleIterator : public IHaveSubTasks { public: - template <typename ... Parents> - SingleIterator(const T * i, const Parents & ... p) : + SingleIterator(const T * i) : SourceObject(__PRETTY_FUNCTION__), IHaveSubTasks(NULL), - binder(boost::bind(&BindColumns<T, Parents...>, _1, _2, p...)), + binder(boost::bind(&BindColumns<T>, _1, _2)), item(i) { } |