aboutsummaryrefslogtreecommitdiff
path: root/lib/dvb/db.cpp
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-05-14 12:23:23 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-05-14 12:23:23 +0000
commit1f3788c5e1a47fa9b0412902acba38c86b53bb63 (patch)
treebb0c67a1ecf37d5f1ace92e33b8e10f34881a57f /lib/dvb/db.cpp
parent7f19468027d025ce8597318e7211995871f17376 (diff)
downloadenigma2-1f3788c5e1a47fa9b0412902acba38c86b53bb63.tar.gz
enigma2-1f3788c5e1a47fa9b0412902acba38c86b53bb63.zip
remove unneeded caching of caids, use an array for pidcache instead of std::map (safe memory)
prepare for different video stream types.. (H264) ( NOT for dm7025 )
Diffstat (limited to 'lib/dvb/db.cpp')
-rw-r--r--lib/dvb/db.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/lib/dvb/db.cpp b/lib/dvb/db.cpp
index 22b6267b..64ef6ed7 100644
--- a/lib/dvb/db.cpp
+++ b/lib/dvb/db.cpp
@@ -116,20 +116,29 @@ RESULT eBouquet::setListName(const std::string &name)
eDVBService::eDVBService()
:m_flags(0)
{
+ memset(m_cache, -1, sizeof(m_cache));
}
eDVBService::~eDVBService()
{
}
+bool eDVBService::cacheEmpty()
+{
+ for (int i=0; i < cacheMax; ++i)
+ if (m_cache[i] != -1)
+ return false;
+ return true;
+}
+
eDVBService &eDVBService::operator=(const eDVBService &s)
{
m_service_name = s.m_service_name;
m_service_name_sort = s.m_service_name_sort;
m_provider_name = s.m_provider_name;
m_flags = s.m_flags;
- m_ca = s.m_ca;
- m_cache = s.m_cache;
+// m_ca = s.m_ca;
+ memcpy(m_cache, s.m_cache, sizeof(m_cache));
return *this;
}
@@ -225,17 +234,14 @@ int eDVBService::checkFilter(const eServiceReferenceDVB &ref, const eDVBChannelQ
int eDVBService::getCachePID(cacheID id)
{
- std::map<int, int>::iterator it = m_cache.find(id);
- if ( it != m_cache.end() )
- return it->second;
- return -1;
+ if (id >= cacheMax)
+ return -1;
+ return m_cache[id];
}
void eDVBService::setCachePID(cacheID id, int pid)
{
- if (pid == -1)
- m_cache.erase(id);
- else
+ if (id < cacheMax)
m_cache[id] = pid;
}
@@ -421,12 +427,12 @@ void eDVBDB::reloadServicelist()
int cid, val;
sscanf(v.c_str(), "%02d%04x", &cid, &val);
s->m_cache[cid]=val;
- } else if (p == 'C')
+ }/* else if (p == 'C')
{
int val;
sscanf(v.c_str(), "%04x", &val);
s->m_ca.insert(val);
- }
+ }*/
}
addService(ref, s);
}
@@ -510,14 +516,16 @@ void eDVBDB::saveServicelist()
fprintf(f, "p:%s", i->second->m_provider_name.c_str());
// write cached pids
- for (std::map<int,int>::const_iterator ca(i->second->m_cache.begin());
- ca != i->second->m_cache.end(); ++ca)
- fprintf(f, ",c:%02d%04x", ca->first, ca->second);
+ for (int x=0; x < eDVBService::cacheMax; ++x)
+ if (i->second->m_cache[x] != -1)
+ fprintf(f, ",c:%02d%04x", x, i->second->m_cache[x]);
+/*
// write cached ca pids
for (std::set<int>::const_iterator ca(i->second->m_ca.begin());
ca != i->second->m_ca.end(); ++ca)
fprintf(f, ",C:%04x", *ca);
+*/
if (i->second->m_flags)
fprintf(f, ",f:%x", i->second->m_flags);