aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-05-09 20:54:29 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2006-05-09 20:54:29 +0000
commit056f4ed60ae323f41601b8acdc42794902eac0d1 (patch)
tree3fb38668c210687e43562a8d5a5e47d228050dc7 /lib
parent23cc33141cdf93dad750965ee559849aa99410a3 (diff)
downloadenigma2-056f4ed60ae323f41601b8acdc42794902eac0d1.tar.gz
enigma2-056f4ed60ae323f41601b8acdc42794902eac0d1.zip
implement SDT scan on enter transponder (on normale zapping)
this a) update changed service/provider names b) add new services to servicelist and mark it as new services to prevent change service_name it is possible to set the dxHoldName flag for this service to prevent change any parameter of a single service it is possible to set the dxNoSDT flag look at the eServiceDVB class declaration in lib/dvb/idvb.h
Diffstat (limited to 'lib')
-rw-r--r--lib/dvb/idvb.h6
-rw-r--r--lib/dvb/pmt.cpp47
-rw-r--r--lib/dvb/pmt.h8
-rw-r--r--lib/dvb/scan.cpp51
-rw-r--r--lib/dvb/scan.h4
5 files changed, 93 insertions, 23 deletions
diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h
index e9fb3cf0..0326c60f 100644
--- a/lib/dvb/idvb.h
+++ b/lib/dvb/idvb.h
@@ -240,13 +240,11 @@ public:
int m_flags;
enum
{
-#if 0 // not yet implemented
dxNoSDT=1, // don't get SDT
- dxDontshow=2,
+//nyi dxDontshow=2,
+ dxNoDVB=4, // dont use PMT for this service ( use cached pids )
dxHoldName=8,
-#endif
dxNewFound=64,
- dxNoDVB=4 // dont use PMT for this service ( use cached pids )
};
bool usePMT() const { return !(m_flags & dxNoDVB); }
diff --git a/lib/dvb/pmt.cpp b/lib/dvb/pmt.cpp
index 47251835..74042ed0 100644
--- a/lib/dvb/pmt.cpp
+++ b/lib/dvb/pmt.cpp
@@ -5,6 +5,7 @@
#include <lib/dvb/metaparser.h>
#include <lib/dvb_ci/dvbci.h>
#include <lib/dvb/epgcache.h>
+#include <lib/dvb/scan.h>
#include <dvbsi++/ca_descriptor.h>
#include <dvbsi++/ca_program_map_section.h>
#include <dvbsi++/teletext_descriptor.h>
@@ -13,7 +14,7 @@
#include <dvbsi++/stream_identifier_descriptor.h>
eDVBServicePMTHandler::eDVBServicePMTHandler()
- :m_ca_servicePtr(0), m_decode_demux_num(0xFF)
+ :m_ca_servicePtr(0), m_dvb_scan(0), m_decode_demux_num(0xFF)
{
m_use_decode_demux = 0;
m_pmt_pid = -1;
@@ -440,6 +441,39 @@ int eDVBServicePMTHandler::getPVRChannel(ePtr<iDVBPVRChannel> &pvr_channel)
return -1;
}
+void eDVBServicePMTHandler::SDTScanEvent(int event)
+{
+ eDebug("scan event %d!", event);
+
+ switch (event)
+ {
+ case eDVBScan::evtFinish:
+ {
+ ePtr<iDVBChannelList> db;
+ int err;
+ if ((err = m_resourceManager->getChannelList(db)) != 0)
+ eDebug("no channel list");
+ else
+ {
+ m_dvb_scan->insertInto(db);
+ eDebug("scan done!");
+ }
+ break;
+ }
+
+ case eDVBScan::evtNewService:
+ eDebug("scan new service");
+ break;
+
+ case eDVBScan::evtFail:
+ eDebug("scan failed.");
+ break;
+
+ default:
+ break;
+ }
+}
+
int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *cue)
{
RESULT res;
@@ -500,6 +534,13 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
m_channel->connectEvent(
slot(*this, &eDVBServicePMTHandler::channelEvent),
m_channelEvent_connection);
+
+ if (ref.path.empty())
+ {
+ delete m_dvb_scan;
+ m_dvb_scan = new eDVBScan(m_channel);
+ m_dvb_scan->connectEvent(slot(*this, &eDVBServicePMTHandler::SDTScanEvent), m_scan_event_connection);
+ }
} else
{
serviceEvent(eventTuneFailed);
@@ -517,6 +558,10 @@ int eDVBServicePMTHandler::tune(eServiceReferenceDVB &ref, int use_decode_demux,
void eDVBServicePMTHandler::free()
{
+ eDVBScan *tmp = m_dvb_scan;
+ m_dvb_scan = 0;
+ delete m_dvb_scan;
+
if (m_ca_servicePtr)
{
int demuxes[2] = {0,0};
diff --git a/lib/dvb/pmt.h b/lib/dvb/pmt.h
index 5149167c..6a5b00db 100644
--- a/lib/dvb/pmt.h
+++ b/lib/dvb/pmt.h
@@ -17,6 +17,7 @@
#include <fcntl.h>
class eDVBCAService;
+class eDVBScan;
typedef std::map<eServiceReferenceDVB, eDVBCAService*> CAServiceMap;
@@ -51,6 +52,7 @@ class eDVBServicePMTHandler: public Object
int m_last_channel_state;
eDVBCAService *m_ca_servicePtr;
+ eDVBScan *m_dvb_scan; // for sdt scan
eAUTable<eTable<ProgramMapSection> > m_PMT;
eAUTable<eTable<ProgramAssociationSection> > m_PAT;
@@ -64,13 +66,15 @@ class eDVBServicePMTHandler: public Object
ePtr<eConnection> m_channelStateChanged_connection;
void channelEvent(iDVBChannel *, int event);
ePtr<eConnection> m_channelEvent_connection;
+ void SDTScanEvent(int);
+ ePtr<eConnection> m_scan_event_connection;
void PMTready(int error);
void PATready(int error);
int m_use_decode_demux;
uint8_t m_decode_demux_num;
-
+
public:
eDVBServicePMTHandler();
~eDVBServicePMTHandler();
@@ -130,7 +134,7 @@ public:
int tune(eServiceReferenceDVB &ref, int use_decode_demux, eCueSheet *sg=0);
void free();
-
+
int m_pmt_pid;
};
diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp
index d0949a97..17c6b5c2 100644
--- a/lib/dvb/scan.cpp
+++ b/lib/dvb/scan.cpp
@@ -24,6 +24,10 @@ DEFINE_REF(eDVBScan);
eDVBScan::eDVBScan(iDVBChannel *channel): m_channel(channel)
{
+ m_ready = m_flags = 0;
+ m_ready_all = readySDT;
+ m_channel_state = iDVBChannel::state_idle;
+
if (m_channel->getDemux(m_demux))
SCAN_eDebug("scan: failed to allocate demux!");
m_channel->connectStateChange(slot(*this, &eDVBScan::stateChange), m_stateChanged_connection);
@@ -98,10 +102,10 @@ RESULT eDVBScan::nextChannel()
if (m_ch_toScan.empty())
{
- eDebug("no channels left to scan.");
- eDebug("%d channels scanned, %d were unavailable.",
+ SCAN_eDebug("no channels left to scan.");
+ SCAN_eDebug("%d channels scanned, %d were unavailable.",
m_ch_scanned.size(), m_ch_unavailable.size());
- eDebug("%d channels in database.", m_new_channels.size());
+ SCAN_eDebug("%d channels in database.", m_new_channels.size());
m_event(evtFinish);
return -ENOENT;
}
@@ -252,8 +256,14 @@ void eDVBScan::channelDone()
if (m_ready & validSDT)
{
unsigned long hash = 0;
- m_ch_current->getHash(hash);
-
+
+ ePtr<iDVBFrontendParameters> p = m_ch_current;
+
+ if (!p) // used in sdt scan
+ m_channel->getCurrentFrontendParameters(p);
+
+ p->getHash(hash);
+
eDVBNamespace dvbnamespace = buildNamespace(
(**m_SDT->getSections().begin()).getOriginalNetworkId(),
(**m_SDT->getSections().begin()).getTransportStreamId(),
@@ -339,7 +349,7 @@ void eDVBScan::channelDone()
if ( m_chid_current.dvbnamespace.get() != -1 &&
((ns.get() ^ m_chid_current.dvbnamespace.get()) & 0xFFFF0000))
- eDebug("dropping this transponder, it's on another satellite.");
+ SCAN_eDebug("dropping this transponder, it's on another satellite.");
else
{
addChannelToScan(
@@ -383,13 +393,17 @@ void eDVBScan::channelDone()
These are the reasons for adding the transponder
here, and not before.
*/
-
+
+ ePtr<iDVBFrontendParameters> p = m_ch_current;
+ if (!p)
+ m_channel->getCurrentFrontendParameters(p);
+
if (!m_chid_current)
eWarning("SCAN: the current channel's ID was not corrected - not adding channel.");
else
- addKnownGoodChannel(m_chid_current, m_ch_current);
-
- m_ch_scanned.push_back(m_ch_current);
+ addKnownGoodChannel(m_chid_current, p);
+
+ m_ch_scanned.push_back(p);
nextChannel();
}
@@ -421,7 +435,7 @@ void eDVBScan::start(const eSmartPtrList<iDVBFrontendParameters> &known_transpon
nextChannel();
}
-void eDVBScan::insertInto(iDVBChannelList *db)
+void eDVBScan::insertInto(iDVBChannelList *db, bool dontRemoveOldFlags)
{
if (m_flags & scanRemoveServices)
{
@@ -499,7 +513,7 @@ void eDVBScan::insertInto(iDVBChannelList *db)
eDVBChannelID chid;
if (m_flags & scanDontRemoveFeeds)
chid.dvbnamespace = eDVBNamespace((*x)<<16);
- eDebug("remove %d %08x", *x, chid.dvbnamespace.get());
+// eDebug("remove %d %08x", *x, chid.dvbnamespace.get());
db->removeServices(chid, *x);
}
}
@@ -513,8 +527,17 @@ void eDVBScan::insertInto(iDVBChannelList *db)
ePtr<eDVBService> dvb_service;
if (!db->getService(service->first, dvb_service))
{
- *dvb_service = *service->second;
- dvb_service->m_flags &= ~eDVBService::dxNewFound;
+ if (dvb_service->m_flags & eDVBService::dxNoSDT)
+ continue;
+ if (!(dvb_service->m_flags & eDVBService::dxHoldName))
+ {
+ dvb_service->m_service_name = service->second->m_service_name;
+ dvb_service->m_service_name_sort = service->second->m_service_name_sort;
+ }
+ dvb_service->m_provider_name = service->second->m_provider_name;
+
+ if (!dontRemoveOldFlags) // do not remove new found flags when not wished
+ dvb_service->m_flags &= ~eDVBService::dxNewFound;
}
else
{
diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h
index 0a7c6ada..1fc55e0f 100644
--- a/lib/dvb/scan.h
+++ b/lib/dvb/scan.h
@@ -67,13 +67,13 @@ private:
public:
eDVBScan(iDVBChannel *channel);
~eDVBScan();
-
+
enum { scanNetworkSearch = 1, scanSearchBAT = 2, scanRemoveServices = 4, scanDontRemoveFeeds=8 };
void start(const eSmartPtrList<iDVBFrontendParameters> &known_transponders, int flags);
enum { evtUpdate, evtNewService, evtFinish, evtFail };
RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &connection);
- void insertInto(iDVBChannelList *db);
+ void insertInto(iDVBChannelList *db, bool dontRemoveNewFlags=false);
void getStats(int &transponders_done, int &transponders_total, int &services);
void getLastServiceName(std::string &name);