isupport animations
authormeo <lupomeo@hotmail.com>
Fri, 15 May 2015 13:10:53 +0000 (15:10 +0200)
committermeo <lupomeo@hotmail.com>
Fri, 15 May 2015 13:10:53 +0000 (15:10 +0200)
19 files changed:
configure.ac
lib/dvb/pmt.cpp
lib/gdi/gfbdc.cpp
lib/gdi/grc.cpp
lib/gdi/grc.h
lib/gui/ewidgetdesktop.cpp
lib/gui/ewidgetdesktop.h
lib/gui/ewindow.cpp
lib/gui/ewindow.h
lib/python/Components/VolumeControl.py
lib/python/Components/config.py
lib/python/Screens/ChannelSelection.py
lib/python/Screens/InfoBarGenerics.py
lib/python/Screens/Screen.py
lib/python/Screens/Wizard.py
lib/python/enigma_python.i
main/Makefile.am
main/enigma.cpp
skin.py

index f2a4770..c0c937b 100644 (file)
@@ -104,6 +104,15 @@ if test `echo "$BOXTYPE" | cut -b 1-2` == "vu"; then
        AC_DEFINE(FORCE_ADVANCED_REMOTE, 1,[define to fixup the input device identification when the remote control is actually an 'advanced' remote (with play/forward/rewind keys)])
 fi
 
+AC_ARG_WITH(libvugles2,
+       AS_HELP_STRING([--with-libvugles2],[use libvugles2, yes or no]),
+       [with_libvugles2=$withval],[with_libvugles2=no])
+if test "$with_libvugles2" = "yes"; then
+       PKG_CHECK_MODULES(LIBVUGLES2, [libvugles2])
+       GLES_CFLAGS="-DUSE_LIBVUGLES2"
+fi
+AM_CONDITIONAL(HAVE_LIBVUGLES2, test "$with_libvugles2" = "yes")
+
 AC_ARG_WITH(libsdl,
        AS_HELP_STRING([--with-libsdl],[use libsdl, yes or no]),
        [with_libsdl=$withval],[with_libsdl=no])
@@ -155,7 +164,7 @@ AC_SUBST(ENIGMA2_CFLAGS)
 
 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
 CFLAGS="$CFLAGS $DEBUG_CFLAGS -Wall"
-CXXFLAGS="$CXXFLAGS $DEBUG_CFLAGS -Wall $BASE_CFLAGS $ENIGMA2_CFLAGS $PTHREAD_CFLAGS $OPENMP_CFLAGS"
+CXXFLAGS="$CXXFLAGS $DEBUG_CFLAGS -Wall $BASE_CFLAGS $ENIGMA2_CFLAGS $PTHREAD_CFLAGS $OPENMP_CFLAGS $GLES_CFLAGS"
 
 AC_CONFIG_FILES([
 Makefile
index ceddf0a..2b0b12e 100644 (file)
@@ -199,6 +199,7 @@ void eDVBServicePMTHandler::PATready(int)
                        ProgramAssociationConstIterator program;
                        for (program = pat.getPrograms()->begin(); pmtpid == -1 && program != pat.getPrograms()->end(); ++program)
                        {
+                               ++cnt;
                                if (eServiceID((*program)->getProgramNumber()) == m_reference.getServiceID())
                                        pmtpid = (*program)->getProgramMapPid();
                                if (++cnt == 1 && pmtpid_single == -1 && pmtpid == -1)
index 0678ec6..b7fecb5 100644 (file)
@@ -6,6 +6,9 @@
 #include <lib/gdi/accel.h>
 
 #include <time.h>
+#ifdef USE_LIBVUGLES2
+#include <vuplus_gles.h>
+#endif
 
 gFBDC::gFBDC()
 {
@@ -143,8 +146,38 @@ void gFBDC::exec(const gOpcode *o)
                break;
        }
        case gOpcode::flush:
+#ifdef USE_LIBVUGLES2
+               if (gles_is_animation())
+                       gles_do_animation();
+               else
+                       fb->blit();
+#else
                fb->blit();
+#endif
+               break;
+       case gOpcode::sendShow:
+       {
+#ifdef USE_LIBVUGLES2
+               gles_set_buffer((unsigned int *)surface.data);
+               gles_set_animation(1, o->parm.setShowHideInfo->point.x(), o->parm.setShowHideInfo->point.y(), o->parm.setShowHideInfo->size.width(), o->parm.setShowHideInfo->size.height());
+#endif
+               break;
+       }
+       case gOpcode::sendHide:
+       {
+#ifdef USE_LIBVUGLES2
+               gles_set_buffer((unsigned int *)surface.data);
+               gles_set_animation(0, o->parm.setShowHideInfo->point.x(), o->parm.setShowHideInfo->point.y(), o->parm.setShowHideInfo->size.width(), o->parm.setShowHideInfo->size.height());
+#endif
                break;
+       }
+#ifdef USE_LIBVUGLES2
+       case gOpcode::setView:
+       {
+               gles_viewport(o->parm.setViewInfo->size.width(), o->parm.setViewInfo->size.height(), fb->Stride());
+               break;
+       }
+#endif
        default:
                gDC::exec(o);
                break;
index c2c9a4c..f70c84e 100644 (file)
@@ -3,6 +3,9 @@
 #include <lib/gdi/font.h>
 #include <lib/base/init.h>
 #include <lib/base/init_num.h>
+#ifdef USE_LIBVUGLES2
+#include <vuplus_gles.h>
+#endif
 
 #ifndef SYNC_PAINT
 void *gRC::thread_wrapper(void *ptr)
@@ -100,6 +103,12 @@ void gRC::submit(const gOpcode &o)
 void *gRC::thread()
 {
        int need_notify = 0;
+#ifdef USE_LIBVUGLES2
+       if (gles_open()) {
+               gles_state_open();
+               gles_viewport(720, 576, 720 * 4);
+       }
+#endif
 #ifndef SYNC_PAINT
        while (1)
        {
@@ -191,6 +200,10 @@ void *gRC::thread()
 #endif
                }
        }
+#ifdef USE_LIBVUGLES2
+       gles_state_close();
+       gles_close();
+#endif
 #ifndef SYNC_PAINT
        pthread_exit(0);
 #endif
@@ -606,6 +619,46 @@ void gPainter::end()
                return;
 }
 
+void gPainter::sendShow(ePoint point, eSize size)
+{
+       if ( m_dc->islocked() )
+               return;
+       gOpcode o;
+       o.opcode=gOpcode::sendShow;
+       o.dc = m_dc.grabRef();
+       o.parm.setShowHideInfo = new gOpcode::para::psetShowHideInfo;
+       o.parm.setShowHideInfo->point = point;
+       o.parm.setShowHideInfo->size = size;
+       m_rc->submit(o);
+}
+
+void gPainter::sendHide(ePoint point, eSize size)
+{
+       if ( m_dc->islocked() )
+               return;
+       gOpcode o;
+       o.opcode=gOpcode::sendHide;
+       o.dc = m_dc.grabRef();
+       o.parm.setShowHideInfo = new gOpcode::para::psetShowHideInfo;
+       o.parm.setShowHideInfo->point = point;
+       o.parm.setShowHideInfo->size = size;
+       m_rc->submit(o);
+}
+
+#ifdef USE_LIBVUGLES2
+void gPainter::setView(eSize size)
+{
+       if ( m_dc->islocked() )
+               return;
+       gOpcode o;
+       o.opcode=gOpcode::setView;
+       o.dc = m_dc.grabRef();
+       o.parm.setViewInfo = new gOpcode::para::psetViewInfo;
+       o.parm.setViewInfo->size = size;
+       m_rc->submit(o);
+}
+#endif
+
 gDC::gDC()
 {
        m_spinner_pic = 0;
@@ -817,6 +870,14 @@ void gDC::exec(const gOpcode *o)
                break;
        case gOpcode::flush:
                break;
+       case gOpcode::sendShow:
+               break;
+       case gOpcode::sendHide:
+               break;
+#ifdef USE_LIBVUGLES2
+       case gOpcode::setView:
+               break;
+#endif
        case gOpcode::enableSpinner:
                enableSpinner();
                break;
index 0625ef9..553c6d8 100644 (file)
@@ -64,6 +64,11 @@ struct gOpcode
                shutdown,
 
                setCompositing,
+               sendShow,
+               sendHide,
+#ifdef USE_LIBVUGLES2
+               setView,
+#endif
        } opcode;
 
        gDC *dc;
@@ -144,6 +149,18 @@ struct gOpcode
                } *setOffset;
 
                gCompositingData *setCompositing;
+               
+               struct psetShowHideInfo
+               {
+                       ePoint point;
+                       eSize size;
+               } *setShowHideInfo;
+#ifdef USE_LIBVUGLES2
+               struct psetViewInfo
+               {
+                       eSize size;
+               } *setViewInfo;
+#endif
        } parm;
 };
 
@@ -272,6 +289,11 @@ public:
        void setCompositing(gCompositingData *comp);
 
        void flush();
+       void sendShow(ePoint point, eSize size);
+       void sendHide(ePoint point, eSize size);
+#ifdef USE_LIBVUGLES2
+       void setView(eSize size);
+#endif
 };
 
 class gDC: public iObject
index f1e3653..9ba9f18 100644 (file)
@@ -523,8 +523,31 @@ void eWidgetDesktop::resize(eSize size)
 {
        m_screen.m_dirty_region = gRegion(eRect(ePoint(0, 0), size));
        m_screen.m_screen_size = size;
+#ifdef USE_LIBVUGLES2
+       gPainter painter(m_screen.m_dc);
+       painter.setView(size);
+#endif 
 }
 
+void eWidgetDesktop::sendShow(ePoint point, eSize size)
+{
+       if(m_style_id!=0)
+               return;
+
+       gPainter painter(m_screen.m_dc);
+       painter.sendShow(point, size);
+}
+
+void eWidgetDesktop::sendHide(ePoint point, eSize size)
+{
+       if(m_style_id!=0)
+               return;
+
+       gPainter painter(m_screen.m_dc);
+       painter.sendHide(point, size);
+}
+
+
 eRect eWidgetDesktop::bounds() const
 {
        const eSize size = m_screen.m_screen_size;
index 719dda2..9917128 100644 (file)
@@ -73,6 +73,8 @@ public:
 
        void resize(eSize size);
        eSize size() const { return m_screen.m_screen_size; }
+       void sendShow(ePoint point, eSize size);
+       void sendHide(ePoint point, eSize size);
        eRect bounds() const; // returns area inside margins
        eRect margins() const { return m_margins; }
        void setMargins(const eRect& value) { m_margins = value; }
index ff29b20..bbd688a 100644 (file)
@@ -9,6 +9,7 @@
 eWindow::eWindow(eWidgetDesktop *desktop, int z): eWidget(0)
 {
        m_flags = 0;
+       m_animation_mode = 0x11;
        m_desktop = desktop;
                /* ask style manager for current style */
        ePtr<eWindowStyleManager> mgr;
@@ -114,3 +115,27 @@ int eWindow::event(int event, void *data, void *data2)
        return eWidget::event(event, data, data2);
 }
 
+void eWindow::show()
+{
+       if (m_animation_mode & 0x01)
+               m_desktop->sendShow(position(), size());
+       eWidget::show();
+}
+
+void eWindow::hide()
+{
+       if (m_animation_mode & 0x10)
+               m_desktop->sendHide(position(), size());
+       eWidget::hide();
+}
+
+void eWindow::setAnimationMode(int mode)
+{
+       /*
+        * 0x00 = animation off
+        * 0x01 = show on
+        * 0x10 = hide on
+        * 0x11 = animation on
+        */
+       m_animation_mode = mode;
+}
index 8ce34d2..fdc2ba1 100644 (file)
@@ -15,6 +15,9 @@ public:
        void setTitle(const std::string &string);
        std::string getTitle() const;
        eWidget *child() { return m_child; }
+       
+       void show();
+       void hide();
 
        enum {
                wfNoBorder = 1
@@ -24,6 +27,7 @@ public:
 
        void setFlag(int flags);
        void clearFlag(int flags);
+       void setAnimationMode(int mode);
 protected:
        enum eWindowEvents
        {
@@ -35,6 +39,7 @@ private:
        eWidget *m_child;
        int m_flags;
        eWidgetDesktop *m_desktop;
+       int m_animation_mode;
 };
 
 #endif
index e28a7cd..7f955d3 100644 (file)
@@ -24,7 +24,9 @@ class VolumeControl:
                config.audio.volume = ConfigInteger(default = 50, limits = (0, 100))
 
                self.volumeDialog = session.instantiateDialog(Volume)
+               self.volumeDialog.setAnimationMode(0)
                self.muteDialog = session.instantiateDialog(Mute)
+               self.muteDialog.setAnimationMode(0)
 
                self.hideVolTimer = eTimer()
                self.hideVolTimer.callback.append(self.volHide)
index b32a041..e3df416 100644 (file)
@@ -991,6 +991,7 @@ class ConfigText(ConfigElement, NumericalTextInput):
                if session is not None:
                        from Screens.NumericalTextInputHelpDialog import NumericalTextInputHelpDialog
                        self.help_window = session.instantiateDialog(NumericalTextInputHelpDialog, self)
+                       self.help_window.setAnimationMode(0)
                        self.help_window.show()
 
        def onDeselect(self, session):
index 183bda0..d5d9112 100644 (file)
@@ -460,6 +460,7 @@ class ChannelContextMenu(Screen):
                if self.session.pipshown:
                        del self.session.pip
                self.session.pip = self.session.instantiateDialog(PictureInPicture)
+               self.session.pip.setAnimationMode(0)
                self.session.pip.show()
                newservice = self.csel.servicelist.getCurrent()
                currentBouquet = self.csel.servicelist and self.csel.servicelist.getRoot()
@@ -2308,6 +2309,7 @@ class ChannelSelectionRadio(ChannelSelectionBase, ChannelSelectionEdit, ChannelS
                self.onLayoutFinish.append(self.onCreate)
 
                self.info = session.instantiateDialog(RadioInfoBar) # our simple infobar
+               self.info.setAnimationMode(0)
 
                self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions"],
                        {
index fab0f59..8b236e5 100644 (file)
@@ -125,10 +125,12 @@ resumePointCacheLast = int(time())
 class InfoBarDish:
        def __init__(self):
                self.dishDialog = self.session.instantiateDialog(Dish)
+               self.dishDialog.setAnimationMode(0)
 
 class InfoBarUnhandledKey:
        def __init__(self):
                self.unhandledKeyDialog = self.session.instantiateDialog(UnhandledKey)
+               self.unhandledKeyDialog.setAnimationMode(0)
                self.hideUnhandledKeySymbolTimer = eTimer()
                self.hideUnhandledKeySymbolTimer.callback.append(self.unhandledKeyDialog.hide)
                self.checkUnusedTimer = eTimer()
@@ -1131,6 +1133,7 @@ class InfoBarRdsDecoder:
        """provides RDS and Rass support/display"""
        def __init__(self):
                self.rds_display = self.session.instantiateDialog(RdsInfoDisplay)
+               self.rds_display.setAnimationMode(0)
                self.session.instantiateSummaryDialog(self.rds_display)
                self.rass_interactive = None
 
@@ -1577,6 +1580,7 @@ class InfoBarPVRState:
        def __init__(self, screen=PVRState, force_show = False):
                self.onPlayStateChanged.append(self.__playStateChanged)
                self.pvrStateDialog = self.session.instantiateDialog(screen)
+               self.pvrStateDialog.setAnimationMode(0)
                self.onShow.append(self._mayShow)
                self.onHide.append(self.pvrStateDialog.hide)
                self.force_show = force_show
@@ -2143,6 +2147,7 @@ class InfoBarPiP:
                                self.ScreenSaverTimerStart()
                else:
                        self.session.pip = self.session.instantiateDialog(PictureInPicture)
+                       self.session.pip.setAnimationMode(0)
                        self.session.pip.show()
                        newservice = self.lastPiPService or self.session.nav.getCurrentlyPlayingServiceReference() or self.servicelist.servicelist.getCurrent()
                        if self.session.pip.playService(newservice):
@@ -3122,6 +3127,7 @@ class InfoBarSubtitleSupport(object):
                        from Screens.InfoBar import InfoBar
                        self.subtitle_window = InfoBar.instance.subtitle_window
 
+               self.subtitle_window.setAnimationMode(0)
                self.subtitle_window.hide()
 
                self.__event_tracker = ServiceEventTracker(screen=self, eventmap=
index 49f8be5..2039a1a 100644 (file)
@@ -168,6 +168,10 @@ class Screen(dict, GUISkin):
                        if isinstance(val, GUIComponent) or isinstance(val, Source):
                                val.onHide()
 
+       def setAnimationMode(self, mode):
+               if self.instance:
+                       self.instance.setAnimationMode(mode)
+
        def __repr__(self):
                return str(type(self))
 
index 0091631..901fbd0 100644 (file)
@@ -593,6 +593,7 @@ class Wizard(Screen):
                                                        self.configInstance = self.session.instantiateDialog(self.wizard[self.currStep]["config"]["screen"])
                                                else:
                                                        self.configInstance = self.session.instantiateDialog(self.wizard[self.currStep]["config"]["screen"], eval(self.wizard[self.currStep]["config"]["args"]))
+                                               self.configInstance.setAnimationMode(0)
                                                self["config"].l.setList(self.configInstance["config"].list)
                                                callbacks = self.configInstance["config"].onSelectionChanged
                                                self.configInstance["config"].destroy()
index 18ebdfb..d23095e 100644 (file)
@@ -421,6 +421,8 @@ extern const char *getEnigmaVersionString();
 extern const char *getBoxType();
 extern const char *getGStreamerVersionString();
 extern void dump_malloc_stats(void);
+extern void setAnimation_current(int a);
+extern void setAnimation_speed(int speed);
 %}
 
 extern void addFont(const char *filename, const char *alias, int scale_factor, int is_replacement, int renderflags = 0);
@@ -432,6 +434,8 @@ extern const char *getEnigmaVersionString();
 extern const char *getBoxType();
 extern const char *getGStreamerVersionString();
 extern void dump_malloc_stats(void);
+extern void setAnimation_current(int a);
+extern void setAnimation_speed(int speed);
 
 %include <lib/python/python_console.i>
 %include <lib/python/python_base.i>
index 03121cc..4357617 100644 (file)
@@ -45,6 +45,7 @@ enigma2_LDADD = \
        @BASE_LIBS@ \
        @LIBGIF_LIBS@ \
        @LIBJPEG_LIBS@ \
+       @LIBVUGLES2_LIBS@ \
        @LIBSDL_LIBS@ \
        @LIBXINE_LIBS@ \
        @LIBXMLCCWRAP_LIBS@ \
index afc57da..33fcaef 100644 (file)
@@ -340,3 +340,20 @@ void dump_malloc_stats(void)
        struct mallinfo mi = mallinfo();
        eDebug("MALLOC: %d total", mi.uordblks);
 }
+
+#ifdef USE_LIBVUGLES2
+#include <vuplus_gles.h>
+
+void setAnimation_current(int a)
+{
+       gles_set_animation_func(a);
+}
+
+void setAnimation_speed(int speed)
+{
+       gles_set_animation_speed(speed);
+}
+#else
+void setAnimation_current(int a) {}
+void setAnimation_speed(int speed) {}
+#endif
diff --git a/skin.py b/skin.py
index 2bc7a8a..f25e9f4 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -399,7 +399,17 @@ class AttributeParser:
 
 def applySingleAttribute(guiObject, desktop, attrib, value, scale = ((1,1),(1,1))):
        # Someone still using applySingleAttribute?
-       AttributeParser(guiObject, desktop, scale).applyOne(attrib, value)
+       if attrib == 'animationMode':
+                       guiObject.setAnimationMode(
+                               { "disable": 0x00,
+                                       "off": 0x00,
+                                       "offshow": 0x10,
+                                       "offhide": 0x01,
+                                       "onshow": 0x01,
+                                       "onhide": 0x10,
+                               }[value])
+       else:
+               AttributeParser(guiObject, desktop, scale).applyOne(attrib, value)
 
 def applyAllAttributes(guiObject, desktop, attributes, scale):
        AttributeParser(guiObject, desktop, scale).applyAll(attributes)