From: Felix Domke Date: Tue, 31 Mar 2009 13:53:09 +0000 (+0200) Subject: Merge branch 'tmbinc/FixTimingBugs' X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=commitdiff_plain;h=624cd1811f54808d23a50840bb35494e4e5ca3b6;hp=bce53d4a67d1655a496eebe5912c8573e880114e Merge branch 'tmbinc/FixTimingBugs' --- diff --git a/configure.ac b/configure.ac index cb0ace7..25f3ea3 100755 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,7 @@ TUXBOX_APPS_LIB_PKGCONFIG(SIGC,sigc++-1.2) TUXBOX_APPS_LIB_PKGCONFIG(DVBSI,libdvbsi++) _TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL(GSTREAMER,gstreamer,HAVE_GSTREAMER) _TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL(GSTREAMERPBUTILS,gstreamer-pbutils,HAVE_GSTSTREAMERPBUTILS) +_TUXBOX_APPS_LIB_PKGCONFIG_OPTIONAL(LIBXINE,libxine,HAVE_LIBXINE) AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no") JPEG_LIBS="-ljpeg" AC_SUBST(JPEG_LIBS) @@ -74,10 +75,10 @@ fi AM_CONDITIONAL(WITH_SDL, test "$WITH_SDL" = "yes") CPPFLAGS="$CPPFLAGS "'-I$(top_srcdir)' -CPPFLAGS="$CPPFLAGS -D_REENTRANT $PYTHON_CPPFLAGS $MD5SUM_CFLAGS $FREETYPE_CFLAGS $FRIBIDI_CFLAGS $ID3TAG_CFLAGS $MAD_CFLAGS $PLUGINS_CFLAGS $PNG_CFLAGS $SDL_CFLAGS $SIGC_CFLAGS $XMLTREE_CFLAGS $DVBSI_CFLAGS $GSTREAMER_CFLAGS $GSTREAMERPBUTILS_CFLAGS $LIBUNGIF_CLFAGS" +CPPFLAGS="$CPPFLAGS -D_REENTRANT $PYTHON_CPPFLAGS $MD5SUM_CFLAGS $FREETYPE_CFLAGS $FRIBIDI_CFLAGS $ID3TAG_CFLAGS $MAD_CFLAGS $PLUGINS_CFLAGS $PNG_CFLAGS $SDL_CFLAGS $SIGC_CFLAGS $XMLTREE_CFLAGS $DVBSI_CFLAGS $GSTREAMER_CFLAGS $GSTREAMERPBUTILS_CFLAGS $LIBXINE_CFLAGS $LIBUNGIF_CFLAGS" #CPPFLAGS="$CPPFLAGS -DMEMLEAK_CHECK" CXXFLAGS="$CXXFLAGS -fno-rtti -fno-exceptions -Wall" -LDFLAGS="$LDFLAGS -pthread $PYTHON_LDFLAGS $SDL_LDFLAGS $GSTREAMER_LDFLAGS $GSTREAMERPBUTILS_LDFLAGS $LIBUNGIF_LDFLAGS" +LDFLAGS="$LDFLAGS -pthread $PYTHON_LDFLAGS $SDL_LDFLAGS $GSTREAMER_LDFLAGS $GSTREAMERPBUTILS_LDFLAGS $LIBXINE_LDFLAGS $LIBUNGIF_LDFLAGS" #LDFLAGS="-rdynamic $LDFLAGS" TUXBOX_APPS_GETTEXT diff --git a/lib/dvb/sec.cpp b/lib/dvb/sec.cpp index d14acc8..a9426ff 100644 --- a/lib/dvb/sec.cpp +++ b/lib/dvb/sec.cpp @@ -60,6 +60,44 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite bool simulate = ((eDVBFrontend*)fe)->is_simulate(); bool direct_connected = m_not_linked_slot_mask & slot_id; int score=0, satcount=0; + long linked_prev_ptr=-1, linked_next_ptr=-1, linked_csw=-1, linked_ucsw=-1, linked_toneburst=-1, + satpos_depends_ptr=-1, rotor_pos=-1; + bool linked_in_use = false; + + eSecDebugNoSimulate("direct_connected %d", !!direct_connected); + + fe->getData(eDVBFrontend::LINKED_PREV_PTR, linked_prev_ptr); + fe->getData(eDVBFrontend::LINKED_NEXT_PTR, linked_next_ptr); + fe->getData(eDVBFrontend::SATPOS_DEPENDS_PTR, satpos_depends_ptr); + + // first we search the linkage base frontend and check if any tuner in prev direction is used + while (linked_prev_ptr != -1) + { + eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_prev_ptr; + if (linked_fe->m_inuse) + linked_in_use = true; + fe = linked_fe->m_frontend; + linked_fe->m_frontend->getData(eDVBFrontend::LINKED_PREV_PTR, (long&)linked_prev_ptr); + } + + fe->getData(eDVBFrontend::ROTOR_POS, rotor_pos); + + // now check also the linked tuners is in use + while (!linked_in_use && linked_next_ptr != -1) + { + eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_next_ptr; + if (linked_fe->m_inuse) + linked_in_use = true; + linked_fe->m_frontend->getData(eDVBFrontend::LINKED_NEXT_PTR, (long&)linked_next_ptr); + } + + // when a linked in use tuner is found we get the tuner data... + if (linked_in_use) + { + fe->getData(eDVBFrontend::CSW, linked_csw); + fe->getData(eDVBFrontend::UCSW, linked_ucsw); + fe->getData(eDVBFrontend::TONEBURST, linked_toneburst); + } if (highest_score_lnb) *highest_score_lnb = -1; @@ -85,17 +123,12 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite { bool diseqc=false; long band=0, - linked_prev_ptr=-1, - linked_next_ptr=-1, satpos_depends_ptr=-1, csw = di_param.m_committed_cmd, ucsw = di_param.m_uncommitted_cmd, - toneburst = di_param.m_toneburst_param, - curRotorPos; + toneburst = di_param.m_toneburst_param; eSecDebugNoSimulate("sat %d found", sat.orbital_position); - fe->getData(eDVBFrontend::LINKED_PREV_PTR, linked_prev_ptr); - fe->getData(eDVBFrontend::SATPOS_DEPENDS_PTR, satpos_depends_ptr); if ( sat.frequency > lnb_param.m_lof_threshold ) band |= 1; @@ -124,99 +157,64 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite eSecDebugNoSimulate("ret1 %d", ret); - if (direct_connected) // frontend with direct connection? + if (linked_in_use) { - long ocsw = -1, - oucsw = -1, - oToneburst = -1; - eSecDebugNoSimulate("direct"); - fe->getData(eDVBFrontend::ROTOR_POS, curRotorPos); - fe->getData(eDVBFrontend::LINKED_NEXT_PTR, linked_next_ptr); - fe->getData(eDVBFrontend::CSW, ocsw); - fe->getData(eDVBFrontend::UCSW, oucsw); - fe->getData(eDVBFrontend::TONEBURST, oToneburst); - while (ret && linked_prev_ptr != -1) // check for linked tuners.. + // compare tuner data + if ( (csw != linked_csw) || + ( diseqc && (ucsw != linked_ucsw || toneburst != linked_toneburst) ) || + ( rotor && rotor_pos != sat.orbital_position ) ) { - eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_prev_ptr; - if (linked_fe->m_inuse) - { - if ( (csw != ocsw) || - ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) || - ( rotor && curRotorPos != sat.orbital_position ) ) - { - ret=0; - } - } - linked_fe->m_frontend->getData(eDVBFrontend::LINKED_PREV_PTR, (long&)linked_prev_ptr); + ret=0; } eSecDebugNoSimulate("ret2 %d", ret); - while (ret && linked_next_ptr != -1) // check for linked tuners.. + if (ret) // special case when this tuner is linked to a satpos dependent tuner { - eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_next_ptr; - if (linked_fe->m_inuse) + long satpos_depends_ptr=-1; + fe->getData(eDVBFrontend::SATPOS_DEPENDS_PTR, satpos_depends_ptr); + if (satpos_depends_ptr != -1) { - if ( (csw != ocsw) || - ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) || - ( rotor && curRotorPos != sat.orbital_position ) ) + eDVBRegisteredFrontend *satpos_depends_to_fe = (eDVBRegisteredFrontend*) satpos_depends_ptr; + long satpos_depends_rotor_pos; + satpos_depends_to_fe->m_frontend->getData(eDVBFrontend::ROTOR_POS, satpos_depends_rotor_pos); + if (!rotor || satpos_depends_rotor_pos == -1 /* we dont know the rotor position yet */ + || satpos_depends_rotor_pos != sat.orbital_position ) // not the same orbital position? { - ret=0; + ret = 0; } } - linked_fe->m_frontend->getData(eDVBFrontend::LINKED_NEXT_PTR, (long&)linked_next_ptr); } eSecDebugNoSimulate("ret3 %d", ret); } - else // linked frontend.. + else if (satpos_depends_ptr != -1) { - long ocsw = -1, - oucsw = -1, - oToneburst = -1; - while (linked_prev_ptr != -1) + eSecDebugNoSimulate("satpos depends"); + eDVBRegisteredFrontend *satpos_depends_to_fe = (eDVBRegisteredFrontend*) satpos_depends_ptr; + if (direct_connected) // current fe is direct connected.. (can turn the rotor) { - eDVBRegisteredFrontend *linked_fe = (eDVBRegisteredFrontend*) linked_prev_ptr; - linked_fe->m_frontend->getData(eDVBFrontend::LINKED_PREV_PTR, (long&)linked_prev_ptr); - if (linked_prev_ptr == -1) + if (satpos_depends_to_fe->m_inuse) // if the dependent frontend is in use? { - iDVBFrontend *sec_fe = linked_fe->m_frontend; - sec_fe->getData(eDVBFrontend::ROTOR_POS, curRotorPos); - if (linked_fe->m_inuse) - { - sec_fe->getData(eDVBFrontend::CSW, ocsw); - sec_fe->getData(eDVBFrontend::UCSW, oucsw); - sec_fe->getData(eDVBFrontend::TONEBURST, oToneburst); - eSecDebug("(%ld != %ld) || \n(%d && (%ld != %ld || %ld != %ld) ) ||\n( %d && %ld != %d ) )", - csw, ocsw, diseqc, ucsw, oucsw, toneburst, oToneburst, rotor, curRotorPos, sat.orbital_position); - if ( (csw != ocsw) || - ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) || - ( rotor && curRotorPos != sat.orbital_position ) ) - { - ret=0; - } - } + if (!rotor || rotor_pos != sat.orbital_position) // new orbital position not equal to current orbital pos? + ret=0; } } - eSecDebugNoSimulate("ret4 %d", ret); - } - - if (ret) - if (satpos_depends_ptr != -1) + else // current fe is dependent of another tuner ... (so this fe can't turn the rotor!) { - eSecDebugNoSimulate("satpos depends"); - eDVBRegisteredFrontend *satpos_depends_to_fe = (eDVBRegisteredFrontend*) satpos_depends_ptr; - if ( satpos_depends_to_fe->m_inuse ) + // get current orb pos of the tuner with rotor connection + long satpos_depends_rotor_pos; + satpos_depends_to_fe->m_frontend->getData(eDVBFrontend::ROTOR_POS, satpos_depends_rotor_pos); + if (!rotor || satpos_depends_rotor_pos == -1 /* we dont know the rotor position yet */ + || satpos_depends_rotor_pos != sat.orbital_position ) // not the same orbital position? { - if (!direct_connected) - satpos_depends_to_fe->m_frontend->getData(eDVBFrontend::ROTOR_POS, curRotorPos); - if (!rotor || curRotorPos != sat.orbital_position) - ret=0; + ret = 0; } - eSecDebugNoSimulate("ret5 %d", ret); } + eSecDebugNoSimulate("ret4 %d", ret); + } - if (ret && rotor && curRotorPos != -1) - ret -= abs(curRotorPos-sat.orbital_position); + if (ret && rotor && rotor_pos != -1) + ret -= abs(rotor_pos-sat.orbital_position); - eSecDebugNoSimulate("ret6 %d", ret); + eSecDebugNoSimulate("ret5 %d", ret); if (ret) { @@ -314,7 +312,6 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA eDVBSatelliteSwitchParameters &sw_param = sit->second; bool doSetFrontend = true; bool doSetVoltageToneFrontend = true; - bool forceStaticMode = true; bool forceChanged = false; bool needDiSEqCReset = false; long band=0, @@ -922,12 +919,11 @@ RESULT eDVBSatelliteEquipmentControl::prepare(iDVBFrontend &frontend, FRONTENDPA sec_sequence.push_back( eSecCommand(eSecCommand::START_TUNE_TIMEOUT, tunetimeout) ); sec_sequence.push_back( eSecCommand(eSecCommand::SET_FRONTEND) ); } - - if (forceStaticMode) - { - sec_sequence.push_front( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) ); - sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) ); - } + + sec_sequence.push_front( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeStatic) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SLEEP, 500) ); + sec_sequence.push_back( eSecCommand(eSecCommand::SET_POWER_LIMITING_MODE, eSecCommand::modeDynamic) ); + frontend.setSecSequence(sec_sequence); return 0; diff --git a/lib/gui/elistboxcontent.cpp b/lib/gui/elistboxcontent.cpp index bf183f9..5baaba7 100644 --- a/lib/gui/elistboxcontent.cpp +++ b/lib/gui/elistboxcontent.cpp @@ -512,7 +512,63 @@ void eListboxPythonMultiContent::setSelectionClip(eRect &rect, bool update) m_listbox->entryChanged(m_cursor); } -static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *local_style, ePyObject pforeColor, ePyObject pforeColorSelected, ePyObject pbackColor, ePyObject pbackColorSelected, int selected, gRegion &rc, eRect &sel_clip) +static void clearRegionHelper(gPainter &painter, eListboxStyle *local_style, const ePoint &offset, ePyObject &pbackColor) +{ + if (pbackColor) + { + unsigned int color = PyInt_AsUnsignedLongMask(pbackColor); + painter.setBackgroundColor(gRGB(color)); + painter.clear(); + } + else if (local_style) + { + if (local_style && local_style->m_background_color_set) + painter.setBackgroundColor(local_style->m_background_color); + if (local_style->m_background) + { + if (local_style->m_transparent_background) + painter.blit(local_style->m_background, offset, eRect(), gPainter::BT_ALPHATEST); + else + painter.blit(local_style->m_background, offset, eRect(), 0); + } + else if (local_style->m_transparent_background) + ; + else + painter.clear(); + } + else + painter.clear(); +} + +static void clearRegionSelectedHelper(gPainter &painter, eListboxStyle *local_style, const ePoint &offset, ePyObject &pbackColorSelected) +{ + if (pbackColorSelected) + { + unsigned int color = PyInt_AsUnsignedLongMask(pbackColorSelected); + painter.setBackgroundColor(gRGB(color)); + painter.clear(); + } + else if (local_style) + { + if (local_style && local_style->m_background_color_selected_set) + painter.setBackgroundColor(local_style->m_background_color_selected); + if (local_style->m_background) + { + if (local_style->m_transparent_background) + painter.blit(local_style->m_background, offset, eRect(), gPainter::BT_ALPHATEST); + else + painter.blit(local_style->m_background, offset, eRect(), 0); + } + else if (local_style->m_transparent_background) + ; + else + painter.clear(); + } + else + painter.clear(); +} + +static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *local_style, ePyObject pforeColor, ePyObject pforeColorSelected, ePyObject pbackColor, ePyObject pbackColorSelected, int selected, gRegion &rc, eRect &sel_clip, const ePoint &offset) { if (selected && sel_clip.valid()) { @@ -521,18 +577,7 @@ static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *l { painter.clip(part); style.setStyle(painter, eWindowStyle::styleListboxNormal); - if (pbackColor) - { - unsigned int color = PyInt_AsUnsignedLongMask(pbackColor); - painter.setBackgroundColor(gRGB(color)); - } // transparent background? - // if we have a local background color set, use that. - else if (local_style && local_style->m_background_color_set) - painter.setBackgroundColor(local_style->m_background_color); - if (!pbackColor && local_style && local_style->m_transparent_background) - ; - else - painter.clear(); + clearRegionHelper(painter, local_style, offset, pbackColor); painter.clippop(); selected = 0; } @@ -541,49 +586,24 @@ static void clearRegion(gPainter &painter, eWindowStyle &style, eListboxStyle *l { painter.clip(part); style.setStyle(painter, eWindowStyle::styleListboxSelected); - if (pbackColorSelected) - { - unsigned int color = PyInt_AsUnsignedLongMask(pbackColorSelected); - painter.setBackgroundColor(gRGB(color)); - } - else if (local_style && local_style->m_background_color_selected_set) - painter.setBackgroundColor(local_style->m_background_color_selected); - painter.clear(); + clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected); painter.clippop(); selected = 1; } } + else if (selected) + { + style.setStyle(painter, eWindowStyle::styleListboxSelected); + clearRegionSelectedHelper(painter, local_style, offset, pbackColorSelected); + if (local_style && local_style->m_selection) + painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST); + } else { - if (selected) - { - style.setStyle(painter, eWindowStyle::styleListboxSelected); - if (pbackColorSelected) - { - unsigned int color = PyInt_AsUnsignedLongMask(pbackColorSelected); - painter.setBackgroundColor(gRGB(color)); - } - else if (local_style && local_style->m_background_color_selected_set) - painter.setBackgroundColor(local_style->m_background_color_selected); - painter.clear(); - } - else - { - style.setStyle(painter, eWindowStyle::styleListboxNormal); - if (pbackColor) - { - unsigned int color = PyInt_AsUnsignedLongMask(pbackColor); - painter.setBackgroundColor(gRGB(color)); - }/* if we have a local background color set, use that. */ - else if (local_style && local_style->m_background_color_set) - painter.setBackgroundColor(local_style->m_background_color); - /* if we have no transparent background */ - if (!pbackColor && local_style && local_style->m_transparent_background) - ; - else - painter.clear(); - } + style.setStyle(painter, eWindowStyle::styleListboxNormal); + clearRegionHelper(painter, local_style, offset, pbackColor); } + if (selected) { if (pforeColorSelected) @@ -645,7 +665,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c local_style = m_listbox->getLocalStyle(); painter.clip(itemregion); - clearRegion(painter, style, local_style, ePyObject(), ePyObject(), ePyObject(), ePyObject(), selected, itemregion, sel_clip); + clearRegion(painter, style, local_style, ePyObject(), ePyObject(), ePyObject(), ePyObject(), selected, itemregion, sel_clip, offset); ePyObject items, buildfunc_ret; @@ -803,7 +823,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c { gRegion rc(rect); - clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip); + clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip, offset); } painter.setFont(m_font[fnt]); @@ -902,7 +922,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c { gRegion rc(rect); - clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip); + clearRegion(painter, style, local_style, pforeColor, pforeColorSelected, pbackColor, pbackColorSelected, selected, rc, sel_clip, offset); } // border @@ -975,7 +995,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c { gRegion rc(rect); - clearRegion(painter, style, local_style, ePyObject(), ePyObject(), pbackColor, pbackColorSelected, selected, rc, sel_clip); + clearRegion(painter, style, local_style, ePyObject(), ePyObject(), pbackColor, pbackColorSelected, selected, rc, sel_clip, offset); } painter.blit(pixmap, rect.topLeft(), rect, (type == TYPE_PIXMAP_ALPHATEST) ? gPainter::BT_ALPHATEST : 0); @@ -989,7 +1009,7 @@ void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, c } } - if (selected) + if (selected && (sel_clip.valid() || (!local_style || !local_style->m_selection))) style.drawFrame(painter, eRect(offset, m_itemsize), eWindowStyle::frameListboxEntry); error_out: diff --git a/lib/python/Components/NimManager.py b/lib/python/Components/NimManager.py index aa91593..c5b2f8d 100644 --- a/lib/python/Components/NimManager.py +++ b/lib/python/Components/NimManager.py @@ -321,9 +321,9 @@ class SecConfigure: elif dm == "1_2": sec.setDiSEqCMode(diseqcParam.V1_2) - if self.satposdepends.has_key(slotid): - for slot in self.satposdepends[slotid]: - tunermask |= (1 << slot) + if self.satposdepends.has_key(slotid): + for slot in self.satposdepends[slotid]: + tunermask |= (1 << slot) if dm != "none": if currLnb.toneburst.value == "none":