summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2017-08-04 00:58:07 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2017-08-04 00:58:07 +0100
commit3c8c471a72c93d73f49cd27abaf5fa5caf1e3a5f (patch)
treed01654fee4b8ac0cdde08939f12c886384228e5a
parentPrefer unique_ptr over shared_ptr for tmp strings (diff)
downloadp2pvr-3c8c471a72c93d73f49cd27abaf5fa5caf1e3a5f.tar.bz2
p2pvr-3c8c471a72c93d73f49cd27abaf5fa5caf1e3a5f.tar.xz
p2pvr-3c8c471a72c93d73f49cd27abaf5fa5caf1e3a5f.zip
Prefer unique_ptr for local SI tables, pass them around as const refs
-rw-r--r--p2pvr/dvb/siParsers/event.cpp2
-rw-r--r--p2pvr/dvb/siParsers/event.h2
-rw-r--r--p2pvr/dvb/siParsers/network.cpp2
-rw-r--r--p2pvr/dvb/siParsers/network.h2
-rw-r--r--p2pvr/dvb/siParsers/programAssociation.cpp4
-rw-r--r--p2pvr/dvb/siParsers/programAssociation.h4
-rw-r--r--p2pvr/dvb/siParsers/programMap.cpp2
-rw-r--r--p2pvr/dvb/siParsers/programMap.h2
-rw-r--r--p2pvr/dvb/siParsers/service.cpp4
-rw-r--r--p2pvr/dvb/siParsers/service.h2
-rw-r--r--p2pvr/dvb/siParsers/table.h2
-rw-r--r--p2pvr/lib/serviceStreamerCore.cpp4
-rw-r--r--p2pvr/lib/serviceStreamerCore.h4
13 files changed, 18 insertions, 18 deletions
diff --git a/p2pvr/dvb/siParsers/event.cpp b/p2pvr/dvb/siParsers/event.cpp
index 801b29a..a9ec158 100644
--- a/p2pvr/dvb/siParsers/event.cpp
+++ b/p2pvr/dvb/siParsers/event.cpp
@@ -239,7 +239,7 @@ operator<<(Common::DateTime & dt, const boost::posix_time::ptime & pt)
}
void
-SiEpgParser::ParseSiTable(const EventInformation * eit, ::DVBSI::EitInformationPtr ei)
+SiEpgParser::ParseSiTable(const EventInformation * eit, const ::DVBSI::EitInformationPtr & ei)
{
ei->ServiceId = ntohs(eit->header.content_id);
ei->TransportStreamId = ntohs(eit->TransportStreamId);
diff --git a/p2pvr/dvb/siParsers/event.h b/p2pvr/dvb/siParsers/event.h
index dc71a9e..73da292 100644
--- a/p2pvr/dvb/siParsers/event.h
+++ b/p2pvr/dvb/siParsers/event.h
@@ -22,7 +22,7 @@ class DLL_PUBLIC SiEpgParser : public SiTableParser<EventInformation, ::DVBSI::E
int SectionNumberShift() const override { return 3; }
uint8_t FirstTableId(const EventInformation * ei) override { return (ei->header.tableid >= 0x60 ? 0x60 : 0x50); }
uint8_t LastTableId(const EventInformation * ei) override { return ei->LastTableId; }
- void ParseSiTable(const EventInformation * eit, ::DVBSI::EitInformationPtr) override;
+ void ParseSiTable(const EventInformation * eit, const ::DVBSI::EitInformationPtr &) override;
bool HandleTable(const ::DVBSI::EitInformationPtr &) override;
virtual bool HandleTable(const ::DVBSI::EventPtr &) = 0;
diff --git a/p2pvr/dvb/siParsers/network.cpp b/p2pvr/dvb/siParsers/network.cpp
index 56b4396..9aa1525 100644
--- a/p2pvr/dvb/siParsers/network.cpp
+++ b/p2pvr/dvb/siParsers/network.cpp
@@ -145,7 +145,7 @@ SiNetworkInformationParser::CheckTableId(u_char tableId) const
}
void
-SiNetworkInformationParser::ParseSiTable(const struct NetworkInformation * nit, ::DVBSI::NetworkPtr n)
+SiNetworkInformationParser::ParseSiTable(const struct NetworkInformation * nit, const ::DVBSI::NetworkPtr & n)
{
n->NetworkId = ntohs(nit->header.content_id);
auto nsh = ParseDescriptors<NetworkStreamsHeader>(nit->data, HILO(nit->network_descriptor_length),
diff --git a/p2pvr/dvb/siParsers/network.h b/p2pvr/dvb/siParsers/network.h
index f466fe5..b6e7ecc 100644
--- a/p2pvr/dvb/siParsers/network.h
+++ b/p2pvr/dvb/siParsers/network.h
@@ -23,7 +23,7 @@ struct NetworkInformation {
class DLL_PUBLIC SiNetworkInformationParser : public SiTableParser<NetworkInformation, ::DVBSI::NetworkPtr, u_char> {
protected:
bool CheckTableId(u_char tableId) const override;
- void ParseSiTable(const struct NetworkInformation * nit, ::DVBSI::NetworkPtr) override;
+ void ParseSiTable(const struct NetworkInformation * nit, const ::DVBSI::NetworkPtr &) override;
private:
DLL_PRIVATE static void parseDescriptor_NetworkName(::DVBSI::NetworkPtr, const u_char *data, size_t len);
diff --git a/p2pvr/dvb/siParsers/programAssociation.cpp b/p2pvr/dvb/siParsers/programAssociation.cpp
index 709dba6..43ef79d 100644
--- a/p2pvr/dvb/siParsers/programAssociation.cpp
+++ b/p2pvr/dvb/siParsers/programAssociation.cpp
@@ -22,9 +22,9 @@ SiProgramAssociationParser::CheckTableId(u_char tableId) const
}
void
-SiProgramAssociationParser::ParseSiTable(const ProgramAssociationSection * pas, ProgramAssociationMapPtr pam)
+SiProgramAssociationParser::ParseSiTable(const ProgramAssociationSection * pas, const ProgramAssociationMapPtr & pam)
{
- LoopOverSection<ProgramAssociation>(pas->data, HILO(pas->header.section_length) - 12, [this,pam](const ProgramAssociation * sd) {
+ LoopOverSection<ProgramAssociation>(pas->data, HILO(pas->header.section_length) - 12, [this,&pam](const ProgramAssociation * sd) {
(*pam)[ntohs(sd->program_number)] = HILO(sd->pid);
});
}
diff --git a/p2pvr/dvb/siParsers/programAssociation.h b/p2pvr/dvb/siParsers/programAssociation.h
index 8651bf1..4395e1b 100644
--- a/p2pvr/dvb/siParsers/programAssociation.h
+++ b/p2pvr/dvb/siParsers/programAssociation.h
@@ -13,12 +13,12 @@ struct ProgramAssociationSection {
} __attribute__((packed));
typedef std::map<uint16_t, uint16_t> ProgramAssociationMap;
-typedef boost::shared_ptr<ProgramAssociationMap> ProgramAssociationMapPtr;
+typedef std::unique_ptr<ProgramAssociationMap> ProgramAssociationMapPtr;
class DLL_PUBLIC SiProgramAssociationParser : public SiTableParser<ProgramAssociationSection, ProgramAssociationMapPtr, int> {
protected:
bool CheckTableId(u_char tableId) const override;
- void ParseSiTable(const struct ProgramAssociationSection * pas, ProgramAssociationMapPtr) override;
+ void ParseSiTable(const struct ProgramAssociationSection * pas, const ProgramAssociationMapPtr &) override;
};
}
}
diff --git a/p2pvr/dvb/siParsers/programMap.cpp b/p2pvr/dvb/siParsers/programMap.cpp
index c2f9482..492c2c2 100644
--- a/p2pvr/dvb/siParsers/programMap.cpp
+++ b/p2pvr/dvb/siParsers/programMap.cpp
@@ -33,7 +33,7 @@ SiProgramMapParser::CheckTableId(u_char tableId) const
}
void
-SiProgramMapParser::ParseSiTable(const struct ProgramMap * pm, ::DVBSI::ProgramMapPtr pmp)
+SiProgramMapParser::ParseSiTable(const struct ProgramMap * pm, const ::DVBSI::ProgramMapPtr & pmp)
{
pmp->ServiceId = ntohs(pm->header.content_id);
auto pms = ParseDescriptors<ProgramMapStream>(pm->data, HILO(pm->program_info_len));
diff --git a/p2pvr/dvb/siParsers/programMap.h b/p2pvr/dvb/siParsers/programMap.h
index c665c93..6514816 100644
--- a/p2pvr/dvb/siParsers/programMap.h
+++ b/p2pvr/dvb/siParsers/programMap.h
@@ -31,7 +31,7 @@ struct ProgramMap {
class DLL_PUBLIC SiProgramMapParser : public SiTableParser<ProgramMap, ::DVBSI::ProgramMapPtr, u_char> {
protected:
bool CheckTableId(u_char tableId) const override;
- void ParseSiTable(const struct ProgramMap * nit, ::DVBSI::ProgramMapPtr) override;
+ void ParseSiTable(const struct ProgramMap * nit, const ::DVBSI::ProgramMapPtr &) override;
};
}
}
diff --git a/p2pvr/dvb/siParsers/service.cpp b/p2pvr/dvb/siParsers/service.cpp
index 4334b1c..a3fa464 100644
--- a/p2pvr/dvb/siParsers/service.cpp
+++ b/p2pvr/dvb/siParsers/service.cpp
@@ -35,11 +35,11 @@ SiServicesParser::CheckTableId(u_char tableId) const
}
void
-SiServicesParser::ParseSiTable(const TransportStreamDescriptor * tsd, ::DVBSI::TransportStreamPtr ts)
+SiServicesParser::ParseSiTable(const TransportStreamDescriptor * tsd, const ::DVBSI::TransportStreamPtr & ts)
{
ts->TransportStreamId = ntohs(tsd->header.content_id);
ts->OriginalNetworkId = ntohs(tsd->original_network_id);
- LoopOver<ServiceDescriptor>(tsd->data, HILO(tsd->header.section_length) - 12, [this,ts](const ServiceDescriptor * sd) {
+ 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;
diff --git a/p2pvr/dvb/siParsers/service.h b/p2pvr/dvb/siParsers/service.h
index 016e2eb..6834f52 100644
--- a/p2pvr/dvb/siParsers/service.h
+++ b/p2pvr/dvb/siParsers/service.h
@@ -17,7 +17,7 @@ struct TransportStreamDescriptor {
class DLL_PUBLIC SiServicesParser : public SiTableParser<TransportStreamDescriptor, ::DVBSI::TransportStreamPtr, int> {
protected:
bool CheckTableId(u_char tableId) const override;
- void ParseSiTable(const struct TransportStreamDescriptor * nit, ::DVBSI::TransportStreamPtr) override;
+ void ParseSiTable(const struct TransportStreamDescriptor * nit, const ::DVBSI::TransportStreamPtr &) override;
private:
DLL_PRIVATE static void parseDescriptor_Service(::DVBSI::ServicePtr, const u_char *data, size_t len);
diff --git a/p2pvr/dvb/siParsers/table.h b/p2pvr/dvb/siParsers/table.h
index a1a563e..ec74090 100644
--- a/p2pvr/dvb/siParsers/table.h
+++ b/p2pvr/dvb/siParsers/table.h
@@ -115,7 +115,7 @@ class SiTableParser : public SiTableParserBase {
static void LoopOverSection(const u_char * data, size_t len, const boost::function<void(const LoopContent *)> & parser);
virtual bool CheckTableId(u_char tableId) const = 0;
- virtual void ParseSiTable(const TableType *, TargetType) = 0;
+ virtual void ParseSiTable(const TableType *, const TargetType &) = 0;
virtual bool HandleTable(const TargetType & table) = 0;
private:
diff --git a/p2pvr/lib/serviceStreamerCore.cpp b/p2pvr/lib/serviceStreamerCore.cpp
index c6f637c..6299a89 100644
--- a/p2pvr/lib/serviceStreamerCore.cpp
+++ b/p2pvr/lib/serviceStreamerCore.cpp
@@ -25,7 +25,7 @@ ServiceStreamerCore::~ServiceStreamerCore()
}
bool
-ServiceStreamerCore::HandlePAT(DVBSI::ProgramAssociationMapPtr pam)
+ServiceStreamerCore::HandlePAT(const DVBSI::ProgramAssociationMapPtr & pam)
{
const auto p = pam->find(serviceId);
if (p != pam->end() && p->second != pmtStream) {
@@ -39,7 +39,7 @@ ServiceStreamerCore::HandlePAT(DVBSI::ProgramAssociationMapPtr pam)
}
bool
-ServiceStreamerCore::HandlePMT(::DVBSI::ProgramMapPtr pmp)
+ServiceStreamerCore::HandlePMT(const ::DVBSI::ProgramMapPtr & pmp)
{
Streams strms;
for (const auto & s : pmp->Streams) {
diff --git a/p2pvr/lib/serviceStreamerCore.h b/p2pvr/lib/serviceStreamerCore.h
index 233b8f5..f8ec1f6 100644
--- a/p2pvr/lib/serviceStreamerCore.h
+++ b/p2pvr/lib/serviceStreamerCore.h
@@ -22,8 +22,8 @@ class DLL_PUBLIC ServiceStreamerCore {
void Stop();
protected:
- bool HandlePAT(DVBSI::ProgramAssociationMapPtr pam);
- bool HandlePMT(::DVBSI::ProgramMapPtr pmp);
+ bool HandlePAT(const DVBSI::ProgramAssociationMapPtr & pam);
+ bool HandlePMT(const ::DVBSI::ProgramMapPtr & pmp);
void stopHandle(int & handle);
const Ice::ObjectAdapterPtr & adapter;