recipes/tuxbox/tuxbox-tuxtxt-32bpp.bb: make tuxtxt a standalone application again...
authorghost <andreas.monzner@multimedia-labs.de>
Wed, 10 Feb 2010 20:24:18 +0000 (21:24 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Thu, 11 Feb 2010 10:54:29 +0000 (11:54 +0100)
TODO: fix sometimes realy slow screen clearing

recipes/tuxbox/tuxbox-tuxtxt-32bpp.bb
recipes/tuxbox/tuxbox-tuxtxt-32bpp/allow_different_demux.diff
recipes/tuxbox/tuxbox-tuxtxt-32bpp/makelib.diff [deleted file]
recipes/tuxbox/tuxbox-tuxtxt-32bpp/plugin.py

index d4b0058..4c96f11 100644 (file)
@@ -12,11 +12,10 @@ SRC_URI = "cvs://anoncvs@cvs.tuxbox.org/cvs/tuxbox;module=apps/tuxbox/plugins/tu
        file://32bpp.diff;patch=1;pnum=1 \
        file://add_new_default_conf.diff;patch=1;pnum=1 \
        file://add_advanced_rc.diff;patch=1 \
-       file://makelib.diff;patch=1 \
        file://allow_different_demux.diff;patch=1 \
        file://plugin.py"
 
-FILES_${PN} = "/usr/lib/libtuxtxt32bpp.so* /usr/share/fonts /usr/lib/enigma2/python/Plugins/Extensions/Tuxtxt /etc/tuxtxt"
+FILES_${PN} = "/usr/bin/tuxtxt /usr/share/fonts /usr/lib/enigma2/python/Plugins/Extensions/Tuxtxt /etc/tuxtxt"
 
 S = "${WORKDIR}/tuxtxt"
 
@@ -35,6 +34,5 @@ do_configure_prepend() {
 }
 
 do_stage() {
-       oe_libinstall -so -C .libs libtuxtxt32bpp ${STAGING_LIBDIR}
        install -m 0644 tuxtxt.h ${STAGING_INCDIR}/
 }
index a62fe67..b2881f7 100644 (file)
@@ -1,18 +1,41 @@
-diff -u tuxtxt_orig/tuxtxt.c tuxtxt/tuxtxt.c
---- tuxtxt_orig/tuxtxt.c       2009-01-29 21:52:19.000000000 +0100
-+++ tuxtxt/tuxtxt.c    2009-01-29 21:54:31.000000000 +0100
-@@ -168,7 +168,7 @@
-  * plugin_exec                                                                *
-  ******************************************************************************/
--int tuxtxt_run_ui(int pid)
-+int tuxtxt_run_ui(int pid, int demux)
+--- tuxtxt-org/tuxtxt.c        2010-02-10 20:48:39.000000000 +0100
++++ tuxtxt/tuxtxt.c    2010-02-10 20:52:39.000000000 +0100
+@@ -172,6 +172,7 @@
  {
        char cvs_revision[] = "$Revision: 1.108 $";
  
-@@ -180,6 +180,12 @@
-               tuxtxt_cache.page = 0x100;
- #endif
++      int demux = 0;
+       int cnt=0;
+       int rc_num = 0;
+ #if !TUXTXT_CFG_STANDALONE
+@@ -187,18 +188,31 @@
+       tuxtxt_SetRenderingDefaults(&renderinfo);
+       /* get params */
+-      tuxtxt_cache.vtxtpid = renderinfo.fb = lcd = renderinfo.sx = renderinfo.ex = renderinfo.sy = renderinfo.ey = -1;
++      tuxtxt_cache.vtxtpid = 0;
++      renderinfo.fb = lcd = renderinfo.sx = renderinfo.ex = renderinfo.sy = renderinfo.ey = -1;
+       if (argc==1)
+       {
+-              printf("\nUSAGE: tuxtxt vtpid\n");
+-              printf("No PID given, so scanning for PIDs ...\n\n");
+-              tuxtxt_cache.vtxtpid=0;
++              printf("\nUSAGE: tuxtxt [demux] [vtpid]\n");
++              printf("No Demux and PID given, so using demux0 and scanning for PIDs ...\n\n");
+       }
+-      else 
++      else
+       {
+-              tuxtxt_cache.vtxtpid = atoi(argv[1]);
++              demux = atoi(argv[1]);
++              if (argc > 2)
++                      tuxtxt_cache.vtxtpid = atoi(argv[2]);
++              else
++              {
++                      printf("\nUSAGE: tuxtxt [demux] [vtpid]\n");
++                      printf("No PID given, so scanning for PIDs ...\n\n");
++              }
+       }
  
 +#if HAVE_DVB_API_VERSION < 3
 +      snprintf(tuxtxt_cache.demux, 64, "/dev/dvb/card0/demux%d", demux);
@@ -20,10 +43,10 @@ diff -u tuxtxt_orig/tuxtxt.c tuxtxt/tuxtxt.c
 +      snprintf(tuxtxt_cache.demux, 64, "/dev/dvb/adapter0/demux%d", demux);
 +#endif
 +
-       /* show versioninfo */
-       sscanf(cvs_revision, "%*s %s", versioninfo);
-       printf("TuxTxt %s\n", versioninfo);
-@@ -612,7 +618,7 @@
+       /* open Framebuffer */
+       if ((renderinfo.fb=open("/dev/fb/0", O_RDWR)) == -1)
+       {
+@@ -616,7 +630,7 @@
        tuxtxt_init_demuxer();
        tuxtxt_start_thread();
  #else
@@ -32,7 +55,7 @@ diff -u tuxtxt_orig/tuxtxt.c tuxtxt/tuxtxt.c
  #endif
  
  
-@@ -1817,7 +1823,7 @@
+@@ -1821,7 +1835,7 @@
                                                                tuxtxt_cache.vtxtpid = pid_table[current_pid].vtxt_pid;
                                                                tuxtxt_start_thread();
  #else
@@ -41,9 +64,8 @@ diff -u tuxtxt_orig/tuxtxt.c tuxtxt/tuxtxt.c
  #endif
                                                        }
  //                                                    tuxtxt_cache.pageupdate = 1;
-diff -u tuxtxt_orig/tuxtxt.h tuxtxt/tuxtxt.h
---- tuxtxt_orig/tuxtxt.h       2009-01-29 21:44:29.000000000 +0100
-+++ tuxtxt/tuxtxt.h    2009-01-29 21:54:31.000000000 +0100
+--- tuxtxt-org/tuxtxt.h        2010-02-10 20:48:39.000000000 +0100
++++ tuxtxt/tuxtxt.h    2010-02-10 20:49:07.000000000 +0100
 @@ -63,7 +63,7 @@
  extern tstPageAttr tuxtxt_atrtable[];
  extern int tuxtxt_init();
diff --git a/recipes/tuxbox/tuxbox-tuxtxt-32bpp/makelib.diff b/recipes/tuxbox/tuxbox-tuxtxt-32bpp/makelib.diff
deleted file mode 100644 (file)
index 94a29a0..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-diff -u tuxtxt_orig/Makefile.am tuxtxt/Makefile.am
---- tuxtxt_orig/Makefile.am    2009-01-29 21:36:10.000000000 +0100
-+++ tuxtxt/Makefile.am 2009-01-29 21:52:19.000000000 +0100
-@@ -6,13 +6,14 @@
-       @FREETYPE_CFLAGS@ \
-       -funsigned-char \
-       -I$(top_srcdir)/include \
--      -I$(prefix)/$(includedir)/tuxbox/tuxtxt 
-+      -I$(prefix)/$(includedir)/tuxbox/tuxtxt
--bin_PROGRAMS = tuxtxt
--tuxtxt_LDADD = -lpthread -lz \
-+libtuxtxt32bpp_la_LIBADD = -lpthread -lz \
-       @FREETYPE_LIBS@ \
-       @TUXTXT_LIBS@
--tuxtxt_SOURCES = tuxtxt.c
-+lib_LTLIBRARIES = libtuxtxt32bpp.la
-+
-+libtuxtxt32bpp_la_SOURCES = tuxtxt.c
- install_DATA = tuxtxt2.conf
-diff -u tuxtxt_orig/configure.ac tuxtxt/configure.ac
---- tuxtxt_orig/configure.ac   2009-01-29 21:36:10.000000000 +0100
-+++ tuxtxt/configure.ac        2009-01-29 21:52:19.000000000 +0100
-@@ -1,5 +1,9 @@
--AC_INIT(tuxbox-tuxtxt-32bpp,1.96)
--AM_INIT_AUTOMAKE(tuxbox-tuxtxt-32bpp,1.96)
-+AC_INIT(libtuxtxt32bpp,1.96)
-+AM_INIT_AUTOMAKE(libtuxtxt32bpp,1.96)
-+
-+AM_PROG_LIBTOOL
-+
-+AC_DISABLE_STATIC
- TUXBOX_APPS
- TUXBOX_APPS_DIRECTORY
-diff -u tuxtxt_orig/tuxtxt.c tuxtxt/tuxtxt.c
---- tuxtxt_orig/tuxtxt.c       2009-01-29 21:44:29.000000000 +0100
-+++ tuxtxt/tuxtxt.c    2009-01-29 21:52:19.000000000 +0100
-@@ -168,7 +168,7 @@
-  * plugin_exec                                                                *
-  ******************************************************************************/
--int main(int argc, char **argv)
-+int tuxtxt_run_ui(int pid)
- {
-       char cvs_revision[] = "$Revision: 1.108 $";
-@@ -187,17 +187,8 @@
-       tuxtxt_SetRenderingDefaults(&renderinfo);
-       /* get params */
--      tuxtxt_cache.vtxtpid = renderinfo.fb = lcd = renderinfo.sx = renderinfo.ex = renderinfo.sy = renderinfo.ey = -1;
--      if (argc==1)
--      {
--              printf("\nUSAGE: tuxtxt vtpid\n");
--              printf("No PID given, so scanning for PIDs ...\n\n");
--              tuxtxt_cache.vtxtpid=0;
--      }
--      else 
--      {
--              tuxtxt_cache.vtxtpid = atoi(argv[1]);
--      }
-+      renderinfo.fb = lcd = renderinfo.sx = renderinfo.ex = renderinfo.sy = renderinfo.ey = -1;
-+      tuxtxt_cache.vtxtpid = pid;
-       /* open Framebuffer */
-       if ((renderinfo.fb=open("/dev/fb/0", O_RDWR)) == -1)
-@@ -462,11 +453,13 @@
-       //page_atrb[32] = transp<<4 | transp;
--
--      for (magazine = 1; magazine < 9; magazine++)
-+      if (!tuxtxt_cache.thread_starting && !tuxtxt_cache.receiving)
-       {
--              tuxtxt_cache.current_page  [magazine] = -1;
--              tuxtxt_cache.current_subpage [magazine] = -1;
-+              for (magazine = 1; magazine < 9; magazine++)
-+              {
-+                      tuxtxt_cache.current_page  [magazine] = -1;
-+                      tuxtxt_cache.current_subpage [magazine] = -1;
-+              }
-       }
- #if TUXTXT_CFG_STANDALONE
- /* init data */
-@@ -489,13 +482,16 @@
-       tuxtxt_cache.page       = 0x100;
- #endif
-       lastpage   = tuxtxt_cache.page;
--      tuxtxt_cache.subpage    = tuxtxt_cache.subpagetable[tuxtxt_cache.page];
--      if (tuxtxt_cache.subpage == 0xff)
--      tuxtxt_cache.subpage    = 0;
--      
--      tuxtxt_cache.pageupdate = 0;
-+      if (!tuxtxt_cache.thread_starting && !tuxtxt_cache.receiving)
-+      {
-+              tuxtxt_cache.subpage    = tuxtxt_cache.subpagetable[tuxtxt_cache.page];
-+              if (tuxtxt_cache.subpage == 0xff)
-+                      tuxtxt_cache.subpage    = 0;
--      tuxtxt_cache.zap_subpage_manual = 0;
-+              tuxtxt_cache.pageupdate = 0;
-+
-+              tuxtxt_cache.zap_subpage_manual = 0;
-+      }
-       /* init lcd */
-       UpdateLCD();
index 40b56a2..1612c10 100644 (file)
@@ -1,8 +1,56 @@
-from enigma import eTuxtxtApp
+from enigma import eConsoleAppContainer, iServiceInformation, fbClass, eRCInput, eDBoxLCD
+from Screens.Screen import Screen
 from Plugins.Plugin import PluginDescriptor
+from os import symlink, mkdir, remove, rmdir, path
+
+class ShellStarter(Screen):
+       skin = """
+               <screen position="1,1" size="1,1" title="TuxTXT" >
+                </screen>"""
+       faked_lcd = False
+
+       def __init__(self, session, args = None):
+               self.skin = ShellStarter.skin
+               Screen.__init__(self, session)
+               self.container=eConsoleAppContainer()
+               self.container.appClosed.append(self.finished)
+               self.runapp()
+
+       def runapp(self):
+               service = self.session.nav.getCurrentService()
+               info = service and service.info()
+               txtpid = info and "%d" %(info.getInfo(iServiceInformation.sTXTPID)) or ""
+
+               stream = service and service.stream()
+               demux = stream and stream.getStreamingData()
+               demux = demux and demux.get("demux", -1)
+               demux = demux > -1 and "%d" %(demux) or ""
+
+               eDBoxLCD.getInstance().lock()
+               eRCInput.getInstance().lock()
+               fbClass.getInstance().lock()
+
+               self.faked_lcd = not path.exists("/dev/dbox")
+               if self.faked_lcd:
+                       mkdir("/dev/dbox")
+                       symlink("/dev/null", "/dev/dbox/lcd0")
+
+               if self.container.execute("/usr/bin/tuxtxt " + demux + " " + txtpid):
+                       self.finished(-1)
+
+       def finished(self,retval):
+               fbClass.getInstance().unlock()
+               eRCInput.getInstance().unlock()
+               eDBoxLCD.getInstance().unlock()
+
+               if self.faked_lcd:
+                       remove("/dev/dbox/lcd0")
+                       rmdir("/dev/dbox")
+
+               self.close()
 
 def main(session, **kwargs):
-       eTuxtxtApp.getInstance().startUi()
+       session.open(ShellStarter)
 
 def Plugins(**kwargs):
        return PluginDescriptor(name="TuxTXT", description="Videotext", where = PluginDescriptor.WHERE_TELETEXT, fnc=main)