aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-11-12 18:42:54 +0000
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>2007-11-12 18:42:54 +0000
commit99e6feec1546d5fa2ff8e5cdfdf84438db4281b3 (patch)
tree3d52309c89f8345fcc8e77d0b0a0117cc7dac00c /lib
parent233d539468f8a5b89782e9e92be224fcd7c21ab6 (diff)
downloadenigma2-99e6feec1546d5fa2ff8e5cdfdf84438db4281b3.tar.gz
enigma2-99e6feec1546d5fa2ff8e5cdfdf84438db4281b3.zip
add possibility to set tuner priority for alternative services in Customize
menu (just with expert usage level)
Diffstat (limited to 'lib')
-rw-r--r--lib/dvb/dvb.cpp35
-rw-r--r--lib/dvb/frontend.cpp2
-rw-r--r--lib/dvb/frontend.h3
-rw-r--r--lib/python/Components/UsageConfig.py14
-rw-r--r--lib/python/enigma_python.i8
-rw-r--r--lib/service/servicedvb.cpp25
6 files changed, 81 insertions, 6 deletions
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp
index 03c2aab6..b7d278cc 100644
--- a/lib/dvb/dvb.cpp
+++ b/lib/dvb/dvb.cpp
@@ -597,14 +597,41 @@ int eDVBResourceManager::canAllocateFrontend(ePtr<iDVBFrontendParameters> &fepar
return bestval;
}
+int tuner_type_channel_default(ePtr<iDVBChannelList> &channellist, const eDVBChannelID &chid)
+{
+ if (channellist)
+ {
+ ePtr<iDVBFrontendParameters> feparm;
+ if (!channellist->getChannelFrontendData(chid, feparm))
+ {
+ int system;
+ if (!feparm->getSystem(system))
+ {
+ switch(system)
+ {
+ case iDVBFrontend::feSatellite:
+ return 50000;
+ case iDVBFrontend::feCable:
+ return 40000;
+ case iDVBFrontend::feTerrestrial:
+ return 30000;
+ default:
+ break;
+ }
+ }
+ }
+ }
+ return 0;
+}
+
int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, const eDVBChannelID& ignore)
{
- int ret=30000;
+ int ret=0;
if (m_cached_channel)
{
eDVBChannel *cache_chan = (eDVBChannel*)&(*m_cached_channel);
if(channelid==cache_chan->getChannelID())
- return ret;
+ return tuner_type_channel_default(m_list, channelid);
}
/* first, check if a channel is already existing. */
@@ -615,7 +642,7 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
if (i->m_channel_id == channelid)
{
// eDebug("found shared channel..");
- return ret;
+ return tuner_type_channel_default(m_list, channelid);
}
}
@@ -685,14 +712,12 @@ int eDVBResourceManager::canAllocateChannel(const eDVBChannelID &channelid, cons
if (!m_list)
{
eDebug("no channel list set!");
- ret = 0;
goto error;
}
if (m_list->getChannelFrontendData(channelid, feparm))
{
eDebug("channel not found!");
- ret = 0;
goto error;
}
diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp
index 8b214130..6a26ae98 100644
--- a/lib/dvb/frontend.cpp
+++ b/lib/dvb/frontend.cpp
@@ -382,6 +382,8 @@ RESULT eDVBFrontendParameters::getHash(unsigned long &hash) const
DEFINE_REF(eDVBFrontend);
+int eDVBFrontend::PriorityOrder=0;
+
eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok)
:m_enabled(false), m_type(-1), m_dvbid(fe), m_slotid(fe)
,m_fd(-1), m_need_rotor_workaround(false), m_sn(0), m_timeout(0), m_tuneTimer(0)
diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h
index 2a180bab..5821e54d 100644
--- a/lib/dvb/frontend.h
+++ b/lib/dvb/frontend.h
@@ -97,6 +97,7 @@ class eDVBFrontend: public iDVBFrontend, public Object
int readInputpower();
bool setSecSequencePos(int steps);
void setRotorData(int pos, int cmd);
+ static int PriorityOrder;
public:
eDVBFrontend(int adap, int fe, int &ok);
virtual ~eDVBFrontend();
@@ -126,6 +127,8 @@ public:
int getDVBID() { return m_dvbid; }
int getSlotID() { return m_slotid; }
bool setSlotInfo(ePyObject obj); // get a tuple (slotid, slotdescr)
+ static void setTypePriorityOrder(int val) { PriorityOrder = val; }
+ static int getTypePriorityOrder() { return PriorityOrder; }
int openFrontend();
int closeFrontend();
diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py
index b3658018..71b0b60c 100644
--- a/lib/python/Components/UsageConfig.py
+++ b/lib/python/Components/UsageConfig.py
@@ -1,5 +1,5 @@
from config import ConfigSubsection, ConfigYesNo, config, ConfigSelection, ConfigText, ConfigInteger
-from enigma import Misc_Options
+from enigma import Misc_Options, setTunerTypePriorityOrder;
import os
def InitUsageConfig():
@@ -38,6 +38,18 @@ def InitUsageConfig():
("show_menu", _("show shutdown menu")),
("shutdown", _("immediate shutdown")) ] )
+ config.usage.alternatives_priority = ConfigSelection(default = "0", choices = [
+ ("0", "DVB-S/-C/-T"),
+ ("1", "DVB-S/-T/-C"),
+ ("2", "DVB-C/-S/-T"),
+ ("3", "DVB-C/-T/-S"),
+ ("4", "DVB-T/-C/-S"),
+ ("5", "DVB-T/-S/-C") ])
+
+ def TunerTypePriorityOrderChanged(configElement):
+ setTunerTypePriorityOrder(int(configElement.value))
+ config.usage.alternatives_priority.addNotifier(TunerTypePriorityOrderChanged)
+
def setHDDStandby(configElement):
os.system("hdparm -S" + configElement.value + " /dev/ide/host0/bus0/target0/lun0/disc")
config.usage.hdd_standby.addNotifier(setHDDStandby)
diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i
index bc2d5503..9ef269b2 100644
--- a/lib/python/enigma_python.i
+++ b/lib/python/enigma_python.i
@@ -297,6 +297,14 @@ PyObject *getBestPlayableServiceReference(const eServiceReference &bouquet_ref,
}
%}
+void setTunerTypePriorityOrder(int);
+%{
+void setTunerTypePriorityOrder(int order)
+{
+ eDVBFrontend::setTypePriorityOrder(order);
+}
+%}
+
/************** temp *****************/
/* need a better place for this, i agree. */
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index c66b3da1..53bc17a8 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -428,13 +428,38 @@ int eStaticServiceDVBBouquetInformation::isPlayable(const eServiceReference &ref
return 0;
}
+ int prio_order = eDVBFrontend::getTypePriorityOrder();
int cur=0;
eDVBChannelID chid, chid_ignore;
((const eServiceReferenceDVB&)ignore).getChannelID(chid_ignore);
for (std::list<eServiceReference>::iterator it(bouquet->m_services.begin()); it != bouquet->m_services.end(); ++it)
{
+ static unsigned char prio_map[6][3] = {
+ { 3, 2, 1 }, // -S -C -T
+ { 3, 1, 2 }, // -S -T -C
+ { 2, 3, 1 }, // -C -S -T
+ { 1, 3, 2 }, // -C -T -S
+ { 1, 2, 3 }, // -T -C -S
+ { 2, 1, 3 } // -T -S -C
+ };
((const eServiceReferenceDVB&)*it).getChannelID(chid);
int tmp=res->canAllocateChannel(chid, chid_ignore);
+ switch(tmp)
+ {
+ case 0:
+ break;
+ case 30000: // cached DVB-T channel
+ case 1: // DVB-T frontend
+ tmp = prio_map[prio_order][2];
+ break;
+ case 40000: // cached DVB-C channel
+ case 2:
+ tmp = prio_map[prio_order][1];
+ break;
+ default: // DVB-S
+ tmp = prio_map[prio_order][0];
+ break;
+ }
if (tmp > cur)
{
m_playable_service = *it;