diff options
| author | Fraxinas <andreas.frisch@multimedia-labs.de> | 2010-04-09 08:25:08 +0200 |
|---|---|---|
| committer | Fraxinas <andreas.frisch@multimedia-labs.de> | 2010-04-09 08:25:08 +0200 |
| commit | 98c7a787df63a93f868548c2b1e357c0d873ebbe (patch) | |
| tree | e8258f3e175e540e6106e0b7202abcf550b825d1 /lib/dvb | |
| parent | ae60e9e3642949a91b7ea4f77374495fec9a51ed (diff) | |
| parent | 76250cdc36d0f0e84505d5654066229b846f035f (diff) | |
| download | enigma2-98c7a787df63a93f868548c2b1e357c0d873ebbe.tar.gz enigma2-98c7a787df63a93f868548c2b1e357c0d873ebbe.zip | |
Merge branch 'experimental' of git.opendreambox.org:/git/enigma2 into experimental
Diffstat (limited to 'lib/dvb')
| -rw-r--r-- | lib/dvb/dvb.cpp | 20 | ||||
| -rw-r--r-- | lib/dvb/frontend.cpp | 7 | ||||
| -rw-r--r-- | lib/dvb/frontend.h | 1 | ||||
| -rw-r--r-- | lib/dvb/idvb.h | 2 | ||||
| -rw-r--r-- | lib/dvb/scan.cpp | 98 | ||||
| -rw-r--r-- | lib/dvb/scan.h | 2 |
6 files changed, 111 insertions, 19 deletions
diff --git a/lib/dvb/dvb.cpp b/lib/dvb/dvb.cpp index 6eaadb04..17712dde 100644 --- a/lib/dvb/dvb.cpp +++ b/lib/dvb/dvb.cpp @@ -1324,16 +1324,6 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off return; } - m_cue->m_lock.RdLock(); - if (!m_cue->m_decoding_demux) - { - start = current_offset; - size = max; - eDebug("getNextSourceSpan, no decoding demux. forcing normal play"); - m_cue->m_lock.Unlock(); - return; - } - if (m_skipmode_n) { eDebug("skipmode %d:%d (x%d)", m_skipmode_m, m_skipmode_n, m_skipmode_frames); @@ -1341,7 +1331,6 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off } eDebug("getNextSourceSpan, current offset is %08llx, m_skipmode_m = %d!", current_offset, m_skipmode_m); - int frame_skip_success = 0; if (m_skipmode_m) @@ -1386,6 +1375,8 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off } } + m_cue->m_lock.RdLock(); + while (!m_cue->m_seek_requests.empty()) { std::pair<int, pts_t> seek = m_cue->m_seek_requests.front(); @@ -1410,6 +1401,13 @@ void eDVBChannel::getNextSourceSpan(off_t current_offset, size_t bytes_read, off eDebug("decoder getPTS failed, can't seek relative"); continue; } + if (!m_cue->m_decoding_demux) + { + eDebug("getNextSourceSpan, no decoding demux. couldn't seek to %llx... ignore request!", pts); + start = current_offset; + size = max; + continue; + } if (getCurrentPosition(m_cue->m_decoding_demux, now, 1)) { eDebug("seekTo: getCurrentPosition failed!"); diff --git a/lib/dvb/frontend.cpp b/lib/dvb/frontend.cpp index f85a37fe..bc3a88da 100644 --- a/lib/dvb/frontend.cpp +++ b/lib/dvb/frontend.cpp @@ -483,6 +483,13 @@ eDVBFrontend::eDVBFrontend(int adap, int fe, int &ok, bool simulate) closeFrontend(); } +void eDVBFrontend::reopenFrontend() +{ + sleep(1); + m_type = -1; + openFrontend(); +} + int eDVBFrontend::openFrontend() { if (m_state != stateClosed) diff --git a/lib/dvb/frontend.h b/lib/dvb/frontend.h index 4cf05081..bc31755c 100644 --- a/lib/dvb/frontend.h +++ b/lib/dvb/frontend.h @@ -146,6 +146,7 @@ public: static void setTypePriorityOrder(int val) { PriorityOrder = val; } static int getTypePriorityOrder() { return PriorityOrder; } + void reopenFrontend(); int openFrontend(); int closeFrontend(bool force=false); const char *getDescription() const { return m_description; } diff --git a/lib/dvb/idvb.h b/lib/dvb/idvb.h index 4ef7efad..d20829bf 100644 --- a/lib/dvb/idvb.h +++ b/lib/dvb/idvb.h @@ -459,6 +459,8 @@ class iDVBFrontend: public iDVBFrontend_ENUMS, public iObject public: virtual RESULT getFrontendType(int &SWIG_OUTPUT)=0; virtual RESULT tune(const iDVBFrontendParameters &where)=0; + virtual int closeFrontend(bool force = false)=0; + virtual void reopenFrontend()=0; #ifndef SWIG virtual RESULT connectStateChange(const Slot1<void,iDVBFrontend*> &stateChange, ePtr<eConnection> &connection)=0; #endif diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index fd29617a..b37aa714 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -12,6 +12,7 @@ #include <lib/dvb/frontend.h> #include <lib/base/eerror.h> #include <lib/base/estring.h> +#include <lib/python/python.h> #include <errno.h> #define SCAN_eDebug(x...) do { if (m_scan_debug) eDebug(x); } while(0) @@ -23,37 +24,118 @@ eDVBScan::eDVBScan(iDVBChannel *channel, bool usePAT, bool debug) :m_channel(channel), m_channel_state(iDVBChannel::state_idle) ,m_ready(0), m_ready_all(usePAT ? (readySDT|readyPAT) : readySDT) ,m_pmt_running(false), m_abort_current_pmt(false), m_flags(0) - ,m_usePAT(usePAT), m_scan_debug(debug) + ,m_usePAT(usePAT), m_scan_debug(debug), m_show_add_tsid_onid_check_failed_msg(true) { if (m_channel->getDemux(m_demux)) SCAN_eDebug("scan: failed to allocate demux!"); m_channel->connectStateChange(slot(*this, &eDVBScan::stateChange), m_stateChanged_connection); + FILE *f = fopen("/etc/enigma2/scan_tp_valid_check.py", "r"); + if (f) + { + char code[16384]; + size_t rd = fread(code, 1, 16383, f); + if (rd) + { + code[rd]=0; + m_additional_tsid_onid_check_func = Py_CompileString(code, "/etc/enigma2/scan_tp_valid_check.py", Py_file_input); + } + fclose(f); + } } eDVBScan::~eDVBScan() { + if (m_additional_tsid_onid_check_func) + Py_DECREF(m_additional_tsid_onid_check_func); } int eDVBScan::isValidONIDTSID(int orbital_position, eOriginalNetworkID onid, eTransportStreamID tsid) { + int ret; switch (onid.get()) { case 0: case 0x1111: - return 0; + ret=0; + break; case 0x13E: // workaround for 11258H and 11470V on hotbird with same ONID/TSID (0x13E/0x578) - return orbital_position != 130 || tsid != 0x578; + ret = orbital_position != 130 || tsid != 0x578; + break; case 1: - return orbital_position == 192; + ret = orbital_position == 192; + break; case 0x00B1: - return tsid != 0x00B0; + ret = tsid != 0x00B0; + break; case 0x00eb: - return tsid != 0x4321; + ret = tsid != 0x4321; + break; case 0x0002: - return abs(orbital_position-282) < 6; + ret = abs(orbital_position-282) < 6 && tsid != 2019; + // 12070H and 10936V have same tsid/onid.. but even the same services are provided + break; + case 0x2000: + ret = tsid != 0x1000; + break; + case 0x5E: // Sirius 4.8E 12322V and 12226H + ret = abs(orbital_position-48) < 3 && tsid != 1; + break; + case 10100: // Eutelsat W7 36.0E 11644V and 11652V + ret = orbital_position != 360 || tsid != 10187; + break; + case 42: // Tuerksat 42.0E + ret = orbital_position != 420 || ( + tsid != 8 && // 11830V 12729V + tsid != 5 && // 12679V 12685H + tsid != 2 && // 11096V 12015H + tsid != 55); // 11996V 11716V + break; + case 100: // Intelsat 10 68.5E 3808V 3796V 4012V, Amos 4.0W 10723V 11571H + ret = (orbital_position != 685 && orbital_position != 3560) || tsid != 1; + break; + case 70: // Thor 0.8W 11862H 12341V + ret = abs(orbital_position-3592) < 3 && tsid != 46; + break; + case 32: // NSS 806 (40.5W) 4059R, 3774L + ret = orbital_position != 3195 || tsid != 21; + break; default: - return onid.get() < 0xFF00; + ret = onid.get() < 0xFF00; + break; + } + if (ret && m_additional_tsid_onid_check_func) + { + bool failed = true; + ePyObject dict = PyDict_New(); + extern void PutToDict(ePyObject &, const char *, long); + PyDict_SetItemString(dict, "__builtins__", PyEval_GetBuiltins()); + PutToDict(dict, "orbpos", orbital_position); + PutToDict(dict, "tsid", tsid.get()); + PutToDict(dict, "onid", onid.get()); + ePyObject r = PyEval_EvalCode((PyCodeObject*)(PyObject*)m_additional_tsid_onid_check_func, dict, dict); + if (r) + { + ePyObject o = PyDict_GetItemString(dict, "ret"); + if (o) + { + if (PyInt_Check(o)) + { + ret = PyInt_AsLong(o); + failed = false; + } + } + Py_DECREF(r); + } + if (failed && m_show_add_tsid_onid_check_failed_msg) + { + eDebug("execing /etc/enigma2/scan_tp_valid_check failed!\n" + "usable global variables in scan_tp_valid_check.py are 'orbpos', 'tsid', 'onid'\n" + "the return value must be stored in a global var named 'ret'"); + m_show_add_tsid_onid_check_failed_msg=false; + } + Py_DECREF(dict); } + return ret; } eDVBNamespace eDVBScan::buildNamespace(eOriginalNetworkID onid, eTransportStreamID tsid, unsigned long hash) diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index 2f3ac34a..8f64abe5 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -92,6 +92,8 @@ class eDVBScan: public Object, public iObject int m_flags; bool m_usePAT; bool m_scan_debug; + ePyObject m_additional_tsid_onid_check_func; + bool m_show_add_tsid_onid_check_failed_msg; public: eDVBScan(iDVBChannel *channel, bool usePAT=true, bool debug=true ); ~eDVBScan(); |
