Advertisement
Guest User

enigma2-pli-nightly.0.diff

a guest
Jan 15th, 2014
943
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 270.74 KB | None | 0 0
  1. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/configure.ac enigma2-nightly.patched/configure.ac
  2. --- enigma2-nightly.org/configure.ac    2013-08-11 08:11:18.750306141 +0200
  3. +++ enigma2-nightly.patched/configure.ac    2013-10-26 03:02:25.477604825 +0200
  4. @@ -33,10 +33,50 @@
  5.     AS_HELP_STRING([--with-gstversion],[use gstreamer version (major.minor)]),
  6.     [GST_MAJORMINOR=$withval],[GST_MAJORMINOR=0.10])
  7.  
  8. -PKG_CHECK_MODULES(BASE, [freetype2 fribidi gstreamer-$GST_MAJORMINOR gstreamer-pbutils-$GST_MAJORMINOR libdvbsi++ libpng libxml-2.0 sigc++-1.2 libssl libcrypto])
  9. +AC_ARG_ENABLE(libeplayer3,
  10. +   [  --enable-libeplayer3          enable TDT libeplayer3 as player engine supportt],
  11. +   [AC_DEFINE(ENABLE_LIBEPLAYER3,1,[enable TDT libeplayer3 as player engine support])])
  12. +
  13. +AM_CONDITIONAL(ENABLE_LIBEPLAYER3,test "$enable_libeplayer3" = "yes")
  14. +if test "$enable_libeplayer3" = "yes"; then
  15. +   AC_DEFINE(ENABLE_LIBEPLAYER3,1,[include TDT libeplayer3 as player engine support])
  16. +fi
  17. +
  18. +AC_ARG_ENABLE(mediafwgstreamer,
  19. +   [  --enable-mediafwgstreamer      enable gstreamer as player engine supportt],
  20. +   [AC_DEFINE(ENABLE_MEDIAFWGSTREAMER,1,[enable gstreamer as player engine support])])
  21. +
  22. +AM_CONDITIONAL(ENABLE_MEDIAFWGSTREAMER,test "$enable_mediafwgstreamer" = "yes")
  23. +if test "$enable_mediafwgstreamer" = "yes"; then
  24. +   AC_DEFINE(ENABLE_MEDIAFWGSTREAMER,1,[include gstreamer as player engine support])
  25. +fi
  26. +
  27. +if test "$enable_mediafwgstreamer" = "yes"; then
  28. +   PKG_CHECK_MODULES(BASE, [freetype2 fribidi gstreamer-$GST_MAJORMINOR gstreamer-pbutils-$GST_MAJORMINOR libdvbsi++ libpng libxml-2.0 sigc++-1.2 libssl libcrypto])
  29. +else
  30. +   PKG_CHECK_MODULES(BASE, [freetype2 fribidi libdvbsi++ libpng libxml-2.0 sigc++-1.2 libssl libcrypto])
  31. +fi
  32.  PKG_CHECK_MODULES(LIBDDVD, libdreamdvd, HAVE_LIBDDVD="yes", HAVE_LIBDDVD="no")
  33.  AM_CONDITIONAL(HAVE_LIBDDVD, test "$HAVE_LIBDDVD" = "yes")
  34.  
  35. +AC_ARG_ENABLE([tf7700],
  36. +   [AS_HELP_STRING(--enable-tf7700,    enable topfield tf7700 stuff)],
  37. +   [case "${enableval}" in
  38. +       yes) enable_tf7700=true ;;
  39. +       no) enable_tf7700=false ;;
  40. +       *) AC_MSG_ERROR([bad value ${enableval} for --enable-tf7700]) ;;
  41. +   esac])
  42. +AM_CONDITIONAL([ENABLE_TF7700], [test x$enable_tf7700 = xtrue])
  43. +
  44. +AC_ARG_ENABLE([cuberevo],
  45. +   [AS_HELP_STRING(--enable-cuberevo,    enable cuberevo stuff)],
  46. +   [case "${enableval}" in
  47. +       yes) enable_cuberevo=true ;;
  48. +       no) enable_cuberevo=false ;;
  49. +       *) AC_MSG_ERROR([bad value ${enableval} for --enable-cuberevo]) ;;
  50. +   esac])
  51. +AM_CONDITIONAL([ENABLE_CUBEREVO], [test x$enable_cuberevo = xtrue])
  52. +
  53.  AC_CHECK_LIB([dl], [dlopen], [LIBDL_LIBS="-ldl"], [AC_MSG_ERROR([Could not find libdl])])
  54.  AC_SUBST(LIBDL_LIBS)
  55.  AC_CHECK_LIB([jpeg], [jpeg_set_defaults], [LIBJPEG_LIBS="-ljpeg"], [AC_MSG_ERROR([Could not find libjpeg])])
  56. @@ -85,6 +125,15 @@
  57.  fi
  58.  AM_CONDITIONAL(HAVE_COLORLCD, test x"$withcolorlcd" != xno)
  59.  
  60. +AC_ARG_WITH(graphlcd,
  61. +   AC_HELP_STRING([--with-graphlcd], [use GraphLCD color display, yes or no]),
  62. +   [[withgraphlcd=$withval]],
  63. +   [[withgraphlcd=no]]
  64. +)
  65. +if test x"$withgraphlcd" != xno ; then
  66. +   AC_DEFINE(HAVE_GRAPHLCD, 1,[Define when using a GraphLCD color display device])
  67. +fi
  68. +AM_CONDITIONAL(HAVE_GRAPHLCD, test x"$withgraphlcd" != xno)
  69.  
  70.  AC_ARG_WITH(oldpvr,
  71.     AC_HELP_STRING([--with-oldpvr], [use /dev/misc/pvr instead of /dev/dvb/adapterX/dvrX, yes or no]),
  72. @@ -203,15 +252,12 @@
  73.  lib/python/Plugins/Extensions/MediaPlayer/meta/Makefile
  74.  lib/python/Plugins/Extensions/MediaScanner/Makefile
  75.  lib/python/Plugins/Extensions/MediaScanner/meta/Makefile
  76. -lib/python/Plugins/Extensions/Modem/Makefile
  77.  lib/python/Plugins/Extensions/PicturePlayer/Makefile
  78.  lib/python/Plugins/Extensions/PicturePlayer/meta/Makefile
  79.  lib/python/Plugins/Extensions/PicturePlayer/data/Makefile
  80.  lib/python/Plugins/Extensions/SocketMMI/Makefile
  81.  lib/python/Plugins/Extensions/SocketMMI/meta/Makefile
  82.  lib/python/Plugins/Extensions/SocketMMI/src/Makefile
  83. -lib/python/Plugins/Extensions/TuxboxPlugins/Makefile
  84. -lib/python/Plugins/Extensions/TuxboxPlugins/meta/Makefile
  85.  lib/python/Plugins/PLi/Makefile
  86.  lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/Makefile
  87.  lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/meta/Makefile
  88. @@ -248,6 +294,10 @@
  89.  lib/python/Plugins/SystemPlugins/Videomode/meta/Makefile
  90.  lib/python/Plugins/SystemPlugins/WirelessLan/Makefile
  91.  lib/python/Plugins/SystemPlugins/WirelessLan/meta/Makefile
  92. +lib/python/Plugins/Extensions/TopfieldVFD/Makefile
  93. +lib/python/Plugins/Extensions/CuberevoVFD/Makefile
  94. +lib/python/Plugins/SystemPlugins/VFD-Icons/Makefile
  95. +lib/python/Plugins/SystemPlugins/VFD-Icons/meta/Makefile
  96.  lib/python/Tools/Makefile
  97.  po/Makefile
  98.  main/Makefile
  99. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/base/eptrlist.h enigma2-nightly.patched/lib/base/eptrlist.h
  100. --- enigma2-nightly.org/lib/base/eptrlist.h 2013-08-11 08:11:19.054306134 +0200
  101. +++ enigma2-nightly.patched/lib/base/eptrlist.h 2013-10-26 03:02:25.641604822 +0200
  102. @@ -175,7 +175,7 @@
  103.     {
  104.         // added a new item to the list... in order
  105.         // returns a iterator to the new item
  106. -       return insert( std::lower_bound( std::list<T*>::begin(), std::list<T*>::end(), e, less()), e );
  107. +       return this->insert( std::lower_bound( std::list<T*>::begin(), std::list<T*>::end(), e, less()), e );
  108.     }
  109.  
  110.  };
  111. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/base/etpm.cpp enigma2-nightly.patched/lib/base/etpm.cpp
  112. --- enigma2-nightly.org/lib/base/etpm.cpp   2013-08-11 08:11:19.054306134 +0200
  113. +++ enigma2-nightly.patched/lib/base/etpm.cpp   2013-10-26 03:02:25.641604822 +0200
  114. @@ -6,14 +6,17 @@
  115.  #include <string.h>
  116.  #include <sys/un.h>
  117.  #include <unistd.h>
  118. +#if not defined(__sh__) // we dont have a tpm chip, and we dont want one
  119.  #include <openssl/bn.h>
  120.  #include <openssl/sha.h>
  121. +#endif
  122.  #include <lib/base/eerror.h>
  123.  
  124.  #include "etpm.h"
  125.  
  126.  eTPM::eTPM()
  127.  {
  128. +#if not defined(__sh__) // we dont have a tpm chip, and we dont want one
  129.     struct sockaddr_un addr;
  130.     unsigned char buf[8];
  131.     unsigned int tag;
  132. @@ -53,6 +56,7 @@
  133.  
  134.     parse_data(val, len);
  135.     free(val);
  136. +#endif
  137.  }
  138.  
  139.  eTPM::~eTPM()
  140. @@ -63,6 +67,7 @@
  141.  
  142.  bool eTPM::send_cmd(enum tpmd_cmd cmd, const void *data, size_t len)
  143.  {
  144. +#if not defined(__sh__) // we dont have a tpm chip, and we dont want one
  145.     unsigned char buf[len + 4];
  146.  
  147.     buf[0] = (cmd >> 8) & 0xff;
  148. @@ -77,11 +82,13 @@
  149.         return false;
  150.     }
  151.  
  152. +#endif
  153.     return true;
  154.  }
  155.  
  156.  void* eTPM::recv_cmd(unsigned int *tag, size_t *len)
  157.  {
  158. +#if not defined(__sh__) // we dont have a tpm chip, and we dont want one
  159.     unsigned char buf[4];
  160.     void *val;
  161.  
  162. @@ -111,10 +118,14 @@
  163.     }
  164.  
  165.     return val;
  166. +#else
  167. +   return NULL;
  168. +#endif
  169.  }
  170.  
  171.  void eTPM::parse_data(const unsigned char *data, size_t datalen)
  172.  {
  173. +#if not defined(__sh__) // we dont have a tpm chip, and we dont want one
  174.     unsigned int i;
  175.     unsigned int tag;
  176.     unsigned int len;
  177. @@ -140,19 +151,23 @@
  178.             break;
  179.         }
  180.     }
  181. +#endif
  182.  }
  183.  
  184.  std::string eTPM::getCert(cert_type type)
  185.  {
  186. +#if not defined(__sh__) // we dont have a tpm chip, and we dont want one
  187.     if (type == TPMD_DT_LEVEL2_CERT && level2_cert_read)
  188.         return std::string((char*)level2_cert, 210);
  189.     else if (type == TPMD_DT_LEVEL3_CERT && level3_cert_read)
  190.         return std::string((char*)level3_cert, 210);
  191. +#endif
  192.     return "";
  193.  }
  194.  
  195.  std::string eTPM::challenge(std::string rnd)
  196.  {
  197. +#if not defined(__sh__) // we dont have a tpm chip, and we dont want one
  198.     if (rnd.length() == 8)
  199.     {
  200.         if (!send_cmd(TPMD_CMD_COMPUTE_SIGNATURE, rnd.c_str(), 8))
  201. @@ -169,5 +184,6 @@
  202.         free(val);
  203.         return ret;
  204.     }
  205. +#endif
  206.     return "";
  207.  }
  208. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/base/filepush.cpp enigma2-nightly.patched/lib/base/filepush.cpp
  209. --- enigma2-nightly.org/lib/base/filepush.cpp   2013-08-11 08:11:19.054306134 +0200
  210. +++ enigma2-nightly.patched/lib/base/filepush.cpp   2013-10-26 03:02:25.645604821 +0200
  211. @@ -4,6 +4,15 @@
  212.  #include <fcntl.h>
  213.  #include <sys/ioctl.h>
  214.  
  215. +#if defined(__sh__) // this allows filesystem tasks to be prioritised
  216. +#include <sys/vfs.h>
  217. +#define USBDEVICE_SUPER_MAGIC 0x9fa2
  218. +#define EXT2_SUPER_MAGIC      0xEF53
  219. +#define EXT3_SUPER_MAGIC      0xEF53
  220. +#define SMB_SUPER_MAGIC       0x517B
  221. +#define NFS_SUPER_MAGIC       0x6969
  222. +#define MSDOS_SUPER_MAGIC     0x4d44 /* MD */
  223. +#endif
  224.  //#define SHOW_WRITE_TIME
  225.  
  226.  eFilePushThread::eFilePushThread(int io_prio_class, int io_prio_level, int blocksize, size_t buffersize)
  227. @@ -57,10 +66,30 @@
  228.     off_t current_span_offset = 0;
  229.     size_t current_span_remaining = 0;
  230.  
  231. +#if defined(__sh__)
  232. +// opens video device for the reverse playback workaround
  233. +// Changes in this file are cause e2 doesnt tell the player to play reverse
  234. +   int fd_video = open("/dev/dvb/adapter0/video0", O_RDONLY);
  235. +// Fix to ensure that event evtEOF is called at end of playbackl part 1/3
  236. +   bool already_empty = false;
  237. +#endif
  238. +
  239.     while (!m_stop)
  240.     {
  241.         if (m_sg && !current_span_remaining)
  242.         {
  243. +#if defined (__sh__) // tells the player to play in reverse
  244. +#define VIDEO_DISCONTINUITY                   _IO('o', 84)
  245. +#define DVB_DISCONTINUITY_SKIP                0x01
  246. +#define DVB_DISCONTINUITY_CONTINUOUS_REVERSE  0x02
  247. +           if ((m_sg->getSkipMode() != 0))
  248. +           {
  249. +               // inform the player about the jump in the stream data
  250. +               // this only works if the video device allows the discontinuity ioctl in read-only mode (patched)
  251. +               int param = DVB_DISCONTINUITY_SKIP; // | DVB_DISCONTINUITY_CONTINUOUS_REVERSE;
  252. +               int rc = ioctl(fd_video, VIDEO_DISCONTINUITY, (void*)param);
  253. +           }
  254. +#endif
  255.             m_sg->getNextSourceSpan(m_current_position, bytes_read, current_span_offset, current_span_remaining);
  256.             ASSERT(!(current_span_remaining % m_blocksize));
  257.             m_current_position = current_span_offset;
  258. @@ -127,7 +156,19 @@
  259.                 {
  260.                     case 0:
  261.                         eDebug("wait for driver eof timeout");
  262. +#if defined(__sh__) // Fix to ensure that event evtEOF is called at end of playbackl part 2/3
  263. +                       if (already_empty)
  264. +                       {
  265. +                           break;
  266. +                       }
  267. +                       else
  268. +                       {
  269. +                           already_empty = true;
  270. +                           continue;
  271. +                       }
  272. +#else
  273.                         continue;
  274. +#endif
  275.                     case 1:
  276.                         eDebug("wait for driver eof ok");
  277.                         break;
  278. @@ -190,12 +231,18 @@
  279.             }
  280.  
  281.             eofcount = 0;
  282. +#if defined(__sh__) // Fix to ensure that event evtEOF is called at end of playbackl part 3/3
  283. +           already_empty = false;
  284. +#endif
  285.             m_current_position += buf_end;
  286.             bytes_read += buf_end;
  287.             if (m_sg)
  288.                 current_span_remaining -= buf_end;
  289.         }
  290.     }
  291. +#if defined(__sh__) // closes video device for the reverse playback workaround
  292. +   close(fd_video);
  293. +#endif
  294.     sendEvent(evtStopped);
  295.  
  296.     { /* mutex lock scope */
  297. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/base/filepush.h enigma2-nightly.patched/lib/base/filepush.h
  298. --- enigma2-nightly.org/lib/base/filepush.h 2013-08-11 08:11:19.054306134 +0200
  299. +++ enigma2-nightly.patched/lib/base/filepush.h 2013-10-26 03:02:25.645604821 +0200
  300. @@ -13,6 +13,10 @@
  301.  public:
  302.     virtual void getNextSourceSpan(off_t current_offset, size_t bytes_read, off_t &start, size_t &size)=0;
  303.     virtual ~iFilePushScatterGather() {}
  304. +#if defined(__sh__)
  305. +   //Changes in this file are cause e2 doesnt tell the player to play reverse
  306. +   virtual int getSkipMode() = 0;
  307. +#endif
  308.  };
  309.  
  310.  class eFilePushThread: public eThread, public Object
  311. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/base/freesatv2.cpp enigma2-nightly.patched/lib/base/freesatv2.cpp
  312. --- enigma2-nightly.org/lib/base/freesatv2.cpp  2013-08-11 08:11:19.058306134 +0200
  313. +++ enigma2-nightly.patched/lib/base/freesatv2.cpp  2013-10-26 03:02:25.645604821 +0200
  314. @@ -84,27 +84,32 @@
  315.  */
  316.  static unsigned char resolveChar(const char *str)
  317.  {
  318. -   const unsigned char*p = str;
  319. -   unsigned c0 = *p++, c1 = *p++;
  320. -   if (c1)
  321. -       switch(c0|c1<<8)
  322. +   if (str[1] == 0)
  323. +       return str[0];
  324. +
  325. +   switch(str[0])
  326. +   {
  327. +       case '0':
  328.         {
  329. -           case '0'|'x'<<8:
  330. -               if ( sscanf(p,"%02x", &c1) == 1 )
  331. -                   c0 = c1;
  332. -               break;
  333. -           case 'E'|'S'<<8:
  334. -               if ( !strcmp(p,"CAPE") )
  335. -                   c0 = ESCAPE;
  336. -               break;
  337. -           case 'S'|'T'<<8:
  338. -               if ( !strcmp(p,"OP") )
  339. -                   c0 = STOP;
  340. -               else if ( !strcmp(p,"ART") )
  341. -                   c0 = START;
  342. -               break;
  343. +           int val;
  344. +           if ( sscanf(str,"0x%02x", &val) == 1 )
  345. +           {
  346. +               return val;
  347. +           }
  348.         }
  349. -   return c0;
  350. +       break;
  351. +       case 'E':
  352. +           if ( strcmp(str,"ESCAPE") == 0 )
  353. +               return ESCAPE;
  354. +           break;
  355. +       case 'S':
  356. +           if ( strcmp(str,"STOP") == 0 )
  357. +               return STOP;
  358. +           if ( strcmp(str,"START") == 0 )
  359. +               return START;
  360. +           break;
  361. +   }
  362. +   return str[0];
  363.  }
  364.  
  365.  
  366. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/base/ioprio.cpp enigma2-nightly.patched/lib/base/ioprio.cpp
  367. --- enigma2-nightly.org/lib/base/ioprio.cpp 2013-08-11 08:11:19.058306134 +0200
  368. +++ enigma2-nightly.patched/lib/base/ioprio.cpp 2013-10-26 03:02:25.645604821 +0200
  369. @@ -28,6 +28,9 @@
  370.  #elif defined(__mips__)
  371.  #define __NR_ioprio_set        4284
  372.  #define __NR_ioprio_get        4285
  373. +#elif defined(__sh__) // the correct values for our kernel
  374. +#define __NR_ioprio_set        288
  375. +#define __NR_ioprio_get        289
  376.  #else
  377.  #error "Unsupported arch"
  378.  #endif
  379. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/base/object.h enigma2-nightly.patched/lib/base/object.h
  380. --- enigma2-nightly.org/lib/base/object.h   2013-08-11 08:11:19.058306134 +0200
  381. +++ enigma2-nightly.patched/lib/base/object.h   2013-10-26 03:02:25.645604821 +0200
  382. @@ -1,7 +1,9 @@
  383.  #ifndef __base_object_h
  384.  #define __base_object_h
  385.  
  386. +#if !defined(__sh__)
  387.  #include <ext/atomicity.h>
  388. +#endif
  389.  
  390.  #include <assert.h>
  391.  #include <lib/base/smartptr.h>
  392. @@ -34,23 +36,39 @@
  393.  
  394.  class oRefCount
  395.  {
  396. +#if defined(__sh__)
  397. +   int ref;
  398. +#else
  399.     mutable _Atomic_word ref;
  400. +#endif
  401.  public:
  402.     oRefCount(): ref(0) {}
  403.  
  404.     int operator++()
  405.     {
  406. +#if defined(__sh__)
  407. +       return ++ref;
  408. +#else
  409.         return __gnu_cxx::__exchange_and_add(&ref, 1) + 1;
  410. +#endif
  411.     }
  412.  
  413.     int operator--()
  414.     {
  415. +#if defined(__sh__)
  416. +       return --ref;
  417. +#else
  418.         return __gnu_cxx::__exchange_and_add(&ref, -1) - 1;
  419. +#endif
  420.     }
  421.  
  422.     operator int() const
  423.     {
  424. +#if defined(__sh__)
  425. +       return ref;
  426. +#else
  427.         return __gnu_cxx::__exchange_and_add(&ref, 0);
  428. +#endif
  429.     }
  430.  };
  431.  
  432. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/driver/Makefile.inc enigma2-nightly.patched/lib/driver/Makefile.inc
  433. --- enigma2-nightly.org/lib/driver/Makefile.inc 2013-08-11 08:11:19.094306135 +0200
  434. +++ enigma2-nightly.patched/lib/driver/Makefile.inc 2013-10-26 03:02:25.645604821 +0200
  435. @@ -9,7 +9,8 @@
  436.     driver/rc.cpp \
  437.     driver/rcinput.cpp \
  438.     driver/rfmod.cpp \
  439. -   driver/hdmi_cec.cpp
  440. +   driver/hdmi_cec.cpp \
  441. +   driver/vfd.cpp
  442.  
  443.  driverincludedir = $(pkgincludedir)/lib/driver
  444.  driverinclude_HEADERS = \
  445. @@ -24,7 +25,8 @@
  446.     driver/rcinput.h \
  447.     driver/rcinput_swig.h \
  448.     driver/rfmod.h \
  449. -   driver/hdmi_cec.h
  450. +   driver/hdmi_cec.h \
  451. +   driver/vfd.h
  452.  
  453.  if HAVE_LIBSDL
  454.  driver_libenigma_driver_a_SOURCES += \
  455. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/driver/rc.cpp enigma2-nightly.patched/lib/driver/rc.cpp
  456. --- enigma2-nightly.org/lib/driver/rc.cpp   2013-08-11 08:11:19.094306135 +0200
  457. +++ enigma2-nightly.patched/lib/driver/rc.cpp   2013-10-26 03:02:25.645604821 +0200
  458. @@ -151,6 +151,9 @@
  459.  #ifdef VUPLUS_RC_WORKAROUND
  460.     return(false);
  461.  #else
  462. +   if (getDeviceName().find("RC") != std::string::npos)
  463. +       return false;
  464. +
  465.     /* check whether the input device has KEY_A, in which case we assume it is a keyboard */
  466.     return hasCap(keyCaps, KEY_A);
  467.  #endif
  468. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/driver/vfd.cpp enigma2-nightly.patched/lib/driver/vfd.cpp
  469. --- enigma2-nightly.org/lib/driver/vfd.cpp  1970-01-01 01:00:00.000000000 +0100
  470. +++ enigma2-nightly.patched/lib/driver/vfd.cpp  2013-10-26 03:02:25.645604821 +0200
  471. @@ -0,0 +1,553 @@
  472. +#include <stdarg.h>
  473. +#include <stdlib.h>
  474. +#include <unistd.h>
  475. +#include <string.h>
  476. +#include <fcntl.h>
  477. +#include <errno.h>
  478. +#include <sys/ioctl.h>
  479. +#include <ctype.h>
  480. +#include <sys/stat.h>
  481. +#include  <pthread.h>
  482. +
  483. +#include <lib/base/eerror.h>
  484. +#include <lib/driver/vfd.h>
  485. +
  486. +#ifdef PLATFORM_TF7700
  487. +#include "../../misc/tools/tffpctl/frontpanel.h"
  488. +#endif
  489. +
  490. +#define VFD_DEVICE "/dev/vfd"
  491. +#define VFDICONDISPLAYONOFF   0xc0425a0a
  492. +#define VFDDISPLAYCHARS       0xc0425a00
  493. +#define VFDBRIGHTNESS         0xc0425a03
  494. +//light on off
  495. +#define VFDDISPLAYWRITEONOFF  0xc0425a05
  496. +
  497. +bool startloop_running = false;
  498. +static bool icon_onoff[32];
  499. +static pthread_t thread_start_loop = 0;
  500. +void * start_loop (void *arg);
  501. +bool blocked = false;
  502. +bool requested = false;
  503. +bool VFD_CENTER = false;
  504. +bool scoll_loop = false;
  505. +int VFD_SCROLL = 1;
  506. +
  507. +char chars[64];
  508. +char g_str[64];
  509. +
  510. +struct vfd_ioctl_data
  511. +{
  512. +   unsigned char start;
  513. +   unsigned char data[64];
  514. +   unsigned char length;
  515. +};
  516. +
  517. +#ifdef PLATFORM_HS7810A
  518. +   #define VFDLENGTH 4
  519. +#elif defined (PLATFORM_OCTAGON1008) || defined(PLATFORM_SPARK7162)
  520. +   #define VFDLENGTH 8
  521. +#elif defined (PLATFORM_FORTIS_HDBOX) || defined(PLATFORM_ATEVIO7500)
  522. +   #define VFDLENGTH 12
  523. +#else
  524. +   #define VFDLENGTH 16
  525. +#endif
  526. +
  527. +evfd* evfd::instance = NULL;
  528. +
  529. +evfd* evfd::getInstance()
  530. +{
  531. +   if (instance == NULL)
  532. +       instance = new evfd;
  533. +   return instance;
  534. +}
  535. +
  536. +evfd::evfd()
  537. +{
  538. +   file_vfd = 0;
  539. +   memset ( chars, ' ', 63 );
  540. +}
  541. +
  542. +void evfd::init()
  543. +{
  544. +   pthread_create (&thread_start_loop, NULL, &start_loop, NULL);
  545. +   return;
  546. +}
  547. +
  548. +evfd::~evfd()
  549. +{
  550. +   //close (file_vfd);
  551. +}
  552. +
  553. +#ifdef PLATFORM_TF7700
  554. +char * getProgress()
  555. +{
  556. +   int n;
  557. +   static char progress[20] = "0";
  558. +   int fd = open ("/proc/progress", O_RDONLY);
  559. +
  560. +   if (fd < 0)
  561. +       return 0;
  562. +
  563. +   n = read(fd, progress, sizeof(progress));
  564. +   close(fd);
  565. +
  566. +   if (n < 0)
  567. +       n = 0;
  568. +   else if((n > 1) && (progress[n-1] == 0xa))
  569. +       n--;
  570. +
  571. +   progress[n] = 0;
  572. +   return progress;
  573. +}
  574. +
  575. +#define MAX_CHARS 8
  576. +
  577. +void * start_loop (void *arg)
  578. +{
  579. +   int fplarge = open ("/dev/fplarge", O_WRONLY);
  580. +   int fpsmall = open ("/dev/fpsmall", O_WRONLY);
  581. +   int fpc = open ("/dev/fpc", O_WRONLY);
  582. +
  583. +   if ((fplarge < 0) || (fpsmall < 0) || (fpc < 0))
  584. +   {
  585. +       printf("Failed opening devices (%d, %d, %d)\n", fplarge, fpsmall, fpc);
  586. +       return NULL;
  587. +   }
  588. +
  589. +   blocked = true;
  590. +
  591. +   // set scroll mode
  592. +   //frontpanel_ioctl_scrollmode scrollMode = {2, 10, 15};
  593. +   //ioctl(fpc, FRONTPANELSCROLLMODE, &scrollMode);
  594. +
  595. +   // display string
  596. +   char str[] = "        SH4 Git ENIGMA2";
  597. +   int length = strlen(str);
  598. +   char dispData[MAX_CHARS + 1];
  599. +   int offset = 0;
  600. +   int i;
  601. +
  602. +   frontpanel_ioctl_icons icons = {0, 0, 0xf};
  603. +
  604. +   // start the display loop
  605. +   char * progress = getProgress();
  606. +   int index = 2;
  607. +   while (!requested)
  608. +   {
  609. +       // display the CD segments
  610. +       icons.Icons2 = (((1 << index) - 1)) & 0x1ffe;
  611. +       ioctl(fpc, FRONTPANELICON, &icons);
  612. +       index++;
  613. +       if (index > 13)
  614. +       {
  615. +           index = 2;
  616. +           icons.BlinkMode = (~icons.BlinkMode) & 0xf;
  617. +       }
  618. +
  619. +       // display the visible part of the string
  620. +       for (i = 0; i < MAX_CHARS; i++)
  621. +       {
  622. +           dispData[i] = str[(offset + i) % length];
  623. +       }
  624. +       offset++;
  625. +       write(fplarge, dispData, sizeof(dispData));
  626. +       usleep(200000);
  627. +       if ((index % 4) == 0)
  628. +       {
  629. +           // display progress
  630. +           progress = getProgress();
  631. +           write(fpsmall, progress, strlen(progress) + 1);
  632. +           if (strncmp("100", progress, 3) == 0)
  633. +               break;
  634. +       }
  635. +   }
  636. +   // clear all icons
  637. +   frontpanel_ioctl_icons iconsOff = {0xffffffff, 0xffffffff, 0x0};
  638. +   ioctl(fpc, FRONTPANELICON, &iconsOff);
  639. +
  640. +   // clear display
  641. +   write(fpsmall, "    ", 5);
  642. +   write(fplarge, "        ", MAX_CHARS);
  643. +
  644. +   close(fplarge);
  645. +   close(fpsmall);
  646. +   close(fpc);
  647. +   blocked = false;
  648. +
  649. +   return NULL;
  650. +}
  651. +#else
  652. +
  653. +void * start_loop (void *arg)
  654. +{
  655. +   evfd vfd;
  656. +   blocked = true;
  657. +   //vfd.vfd_clear_icons();
  658. +   vfd.vfd_write_string("SH4 Git ENIGMA2", true);
  659. +   //run 2 times through all icons
  660. +   for (int vloop = 0; vloop < 128; vloop++)
  661. +   {
  662. +#if !defined(PLATFORM_FORTIS_HDBOX) && !defined(PLATFORM_OCTAGON1008) && !defined(PLATFORM_ATEVIO7500) && !defined(PLATFORM_CUBEREVO) && !defined(PLATFORM_CUBEREVO_MINI) && !defined(PLATFORM_CUBEREVO_MINI2) && !defined(PLATFORM_CUBEREVO_MINI_FTA) && !defined(PLATFORM_CUBEREVO_250HD) && !defined(PLATFORM_CUBEREVO_2000HD) && !defined(PLATFORM_CUBEREVO_9500HD) && !defined(PLATFORM_HS7810A) && !defined(PLATFORM_SPARK) && !defined(PLATFORM_SPARK7162)
  663. +       if (vloop%2 == 1)
  664. +       {
  665. +           vfd.vfd_set_icon( (tvfd_icon) (((vloop%32)/2)%16), ICON_OFF, true);
  666. +           //usleep(1000);
  667. +           vfd.vfd_set_icon( (tvfd_icon) ((((vloop%32)/2)%16)+1), ICON_ON, true);
  668. +       }
  669. +#ifdef PLATFORM_SPARK7162
  670. +       vfd.vfd_set_icon( (tvfd_icon) (41), ICON_ON, true);
  671. +       if (vloop%3 == 0 ) {
  672. +         vfd.vfd_set_icon( (tvfd_icon) (38), ICON_OFF, true);
  673. +         vfd.vfd_set_icon( (tvfd_icon) (39), ICON_OFF, true);
  674. +         vfd.vfd_set_icon( (tvfd_icon) (40), ICON_ON, true);
  675. +       }
  676. +       else if (vloop%3 == 1 ) {
  677. +         vfd.vfd_set_icon( (tvfd_icon) (38), ICON_OFF, true);
  678. +         vfd.vfd_set_icon( (tvfd_icon) (39), ICON_ON, true);
  679. +         vfd.vfd_set_icon( (tvfd_icon) (40), ICON_OFF, true);
  680. +       }
  681. +       else if (vloop%3 == 2 ) {
  682. +         vfd.vfd_set_icon( (tvfd_icon) (38), ICON_ON, true);
  683. +         vfd.vfd_set_icon( (tvfd_icon) (39), ICON_OFF, true);
  684. +         vfd.vfd_set_icon( (tvfd_icon) (40), ICON_OFF, true);
  685. +       }
  686. +#else
  687. +       if (vloop%14 == 0 )
  688. +           vfd.vfd_set_brightness(1);
  689. +       else if (vloop%14 == 1 )
  690. +           vfd.vfd_set_brightness(2);
  691. +       else if (vloop%14 == 2 )
  692. +           vfd.vfd_set_brightness(3);
  693. +       else if (vloop%14 == 3 )
  694. +           vfd.vfd_set_brightness(4);
  695. +       else if (vloop%14 == 4 )
  696. +           vfd.vfd_set_brightness(5);
  697. +       else if (vloop%14 == 5 )
  698. +           vfd.vfd_set_brightness(6);
  699. +       else if (vloop%14 == 6 )
  700. +           vfd.vfd_set_brightness(7);
  701. +       else if (vloop%14 == 7 )
  702. +           vfd.vfd_set_brightness(6);
  703. +       else if (vloop%14 == 8 )
  704. +           vfd.vfd_set_brightness(5);
  705. +       else if (vloop%14 == 9 )
  706. +           vfd.vfd_set_brightness(4);
  707. +       else if (vloop%14 == 10 )
  708. +           vfd.vfd_set_brightness(3);
  709. +       else if (vloop%14 == 11 )
  710. +           vfd.vfd_set_brightness(2);
  711. +       else if (vloop%14 == 12 )
  712. +           vfd.vfd_set_brightness(1);
  713. +       else if (vloop%14 == 13 )
  714. +           vfd.vfd_set_brightness(0);
  715. +#endif
  716. +#endif
  717. +       usleep(75000);
  718. +   }
  719. +   vfd.vfd_set_brightness(7);
  720. +#if !defined(PLATFORM_FORTIS_HDBOX) && !defined(PLATFORM_OCTAGON1008) && !defined(PLATFORM_ATEVIO7500) && !defined(PLATFORM_CUBEREVO) && !defined(PLATFORM_CUBEREVO_MINI) && !defined(PLATFORM_CUBEREVO_MINI2) && !defined(PLATFORM_CUBEREVO_MINI_FTA) && !defined(PLATFORM_CUBEREVO_250HD) && !defined(PLATFORM_CUBEREVO_2000HD) && !defined(PLATFORM_CUBEREVO_9500HD) && !defined(PLATFORM_HS7810A) && !defined(PLATFORM_SPARK7162) && !defined(PLATFORM_SPARK)
  721. +   //set all blocked icons
  722. +   for (int id = 0x10; id < 0x20; id++)
  723. +   {
  724. +       vfd.vfd_set_icon((tvfd_icon)id, icon_onoff[id]);
  725. +   }
  726. +#endif
  727. +#ifdef PLATFORM_SPARK7162
  728. +   vfd.vfd_set_icon( (tvfd_icon) (38), ICON_OFF, true);
  729. +   vfd.vfd_set_icon( (tvfd_icon) (39), ICON_OFF, true);
  730. +   vfd.vfd_set_icon( (tvfd_icon) (40), ICON_OFF, true);
  731. +   vfd.vfd_set_icon( (tvfd_icon) (41), ICON_OFF, true);
  732. +#endif
  733. +   blocked = false;
  734. +   return NULL;
  735. +}
  736. +#endif
  737. +
  738. +#if defined(PLATFORM_FORTIS_HDBOX) || defined(PLATFORM_OCTAGON1008) || defined(PLATFORM_ATEVIO7500) || defined(PLATFORM_CUBEREVO) || defined(PLATFORM_CUBEREVO_MINI) || defined(PLATFORM_CUBEREVO_MINI2) || defined(PLATFORM_CUBEREVO_MINI_FTA) || defined(PLATFORM_CUBEREVO_250HD) || defined(PLATFORM_CUBEREVO_2000HD) || defined(PLATFORM_CUBEREVO_9500HD) || defined(PLATFORM_HS7110)
  739. +void evfd::vfd_write_string_scrollText(char* text)
  740. +{
  741. +   return;
  742. +}
  743. +
  744. +//we can not use a member function (vfd_write_string_scrollText) in pthread, so we use a second (same content) non member function (vfd_write_string_scrollText1)
  745. +static void *vfd_write_string_scrollText1(void *arg)
  746. +{
  747. +   pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
  748. +   bool scoll_loop = true;
  749. +   char out[VFDLENGTH+1];
  750. +   int i, len;
  751. +   evfd vfd;
  752. +   len = strlen((char *) g_str);
  753. +   memset(out, 0, VFDLENGTH+1);
  754. +   while (scoll_loop && (len > VFDLENGTH))
  755. +   {
  756. +       if (blocked)
  757. +       {
  758. +           usleep(250000);
  759. +       }
  760. +       else
  761. +       {
  762. +           scoll_loop = false;
  763. +       }
  764. +       for (i=0; i<=(len-VFDLENGTH); i++)
  765. +       {
  766. +           if (blocked)
  767. +           {
  768. +               memset(out, ' ', VFDLENGTH);
  769. +               memcpy(out, g_str+i, VFDLENGTH);
  770. +               vfd.vfd_write_string(out,true);
  771. +               usleep(250000);
  772. +           }
  773. +           else
  774. +           {
  775. +               scoll_loop = false;
  776. +               i = len-VFDLENGTH;
  777. +           }
  778. +       }
  779. +       for (i=1; i < VFDLENGTH; i++)
  780. +       {
  781. +           if (blocked)
  782. +           {
  783. +               memset(out, ' ', VFDLENGTH);
  784. +               memcpy(out, g_str+len+i-VFDLENGTH, VFDLENGTH-i);
  785. +               vfd.vfd_write_string(out,true);
  786. +               usleep(250000);
  787. +           }
  788. +           else
  789. +           {
  790. +               scoll_loop = false;
  791. +               i = VFDLENGTH;
  792. +           }
  793. +       }
  794. +       memcpy(out, g_str, VFDLENGTH);
  795. +       vfd.vfd_write_string(out,true);
  796. +       if (VFD_SCROLL != 2 || !blocked)
  797. +           scoll_loop = false;
  798. +   }
  799. +   blocked = false;
  800. +   return NULL;
  801. +}
  802. +
  803. +void evfd::vfd_write_string(char * str)
  804. +{
  805. +   int i = strlen(str);
  806. +   if (blocked)
  807. +   {
  808. +       pthread_cancel(thread_start_loop);
  809. +       pthread_join(thread_start_loop, NULL);
  810. +       blocked=false;
  811. +   }
  812. +   memset(g_str,0,64);
  813. +   strcpy(g_str,str);
  814. +   vfd_write_string(str, false);
  815. +   if (i > VFDLENGTH && VFD_SCROLL)
  816. +   {
  817. +       blocked = true;
  818. +       pthread_create(&thread_start_loop, NULL, vfd_write_string_scrollText1, (void *)str);
  819. +       pthread_detach(thread_start_loop);
  820. +   }
  821. +}
  822. +
  823. +void evfd::vfd_write_string(char * str, bool force)
  824. +{
  825. +   int ws = 0;
  826. +   int i = strlen(str);
  827. +   if (VFD_CENTER)
  828. +   {
  829. +       if (i < VFDLENGTH)
  830. +           ws=(VFDLENGTH-i)/2;
  831. +       else
  832. +           ws=0;
  833. +   }
  834. +   if (i > VFDLENGTH) i = VFDLENGTH;
  835. +   struct vfd_ioctl_data data;
  836. +   memset(data.data, ' ', VFDLENGTH);
  837. +   if (VFD_CENTER)
  838. +       memcpy(data.data+ws, str, VFDLENGTH-ws);
  839. +   else
  840. +       memcpy(data.data, str, i);
  841. +   data.start = 0;
  842. +   if (VFD_CENTER)
  843. +       data.length = i+ws<=VFDLENGTH?i+ws:VFDLENGTH;
  844. +   else
  845. +       data.length = i;
  846. +       file_vfd = open (VFD_DEVICE, O_WRONLY);
  847. +       write(file_vfd,data.data,data.length);
  848. +       close (file_vfd);
  849. +   return;
  850. +}
  851. +
  852. +#else
  853. +
  854. +void evfd::vfd_write_string(char * str)
  855. +{
  856. +   vfd_write_string(str, false);
  857. +}
  858. +
  859. +void evfd::vfd_write_string(char * str, bool force)
  860. +{
  861. +   int i;
  862. +   i = strlen ( str );
  863. +   if ( i > 63 ) i = 63;
  864. +   memset ( chars, ' ', 63 );
  865. +   memcpy ( chars, str, i);
  866. +#ifdef PLATFORM_TF7700
  867. +   // request the display to cancel the start loop
  868. +   requested = true;
  869. +   while(blocked) usleep(200000);
  870. +   {
  871. +#else
  872. +   if (!blocked || force)
  873. +   {
  874. +#endif
  875. +       struct vfd_ioctl_data data;
  876. +       memset ( data.data, ' ', 63 );
  877. +       memcpy ( data.data, str, i );
  878. +
  879. +       data.start = 0;
  880. +       data.length = i;
  881. +
  882. +       file_vfd = open (VFD_DEVICE, O_WRONLY);
  883. +       ioctl ( file_vfd, VFDDISPLAYCHARS, &data );
  884. +       close (file_vfd);
  885. +   }
  886. +   return;
  887. +}
  888. +
  889. +void evfd::vfd_write_string_scrollText(char* text)
  890. +{
  891. +   if (!blocked)
  892. +   {
  893. +       int i, len = strlen(text);
  894. +       char* out = (char *) malloc(16);
  895. +       for (i=0; i<=(len-16); i++)
  896. +       { // scroll text till end
  897. +           memset(out, ' ', 16);
  898. +           memcpy(out, text+i, 16);
  899. +           vfd_write_string(out);
  900. +           usleep(200000);
  901. +       }
  902. +       for (i=1; i<16; i++)
  903. +       { // scroll text with whitespaces from right
  904. +           memset(out, ' ', 16);
  905. +           memcpy(out, text+len+i-16, 16-i);
  906. +           vfd_write_string(out);
  907. +           usleep(200000);
  908. +       }
  909. +       memcpy(out, text, 16); // display first 16 chars after scrolling
  910. +       vfd_write_string(out);
  911. +       free (out);
  912. +   }
  913. +   return;
  914. +}
  915. +#endif
  916. +void evfd::vfd_clear_string()
  917. +{
  918. +   vfd_write_string("                ");
  919. +   return;
  920. +}
  921. +
  922. +void evfd::vfd_set_icon(tvfd_icon id, bool onoff)
  923. +{
  924. +   vfd_set_icon(id, onoff, false);
  925. +   return;
  926. +}
  927. +
  928. +void evfd::vfd_set_icon(tvfd_icon id, bool onoff, bool force)
  929. +{
  930. +   icon_onoff[id] = onoff;
  931. +   if (!blocked || force)
  932. +   {
  933. +       struct vfd_ioctl_data data;
  934. +       if (!startloop_running)
  935. +       {
  936. +           memset(&data, 0, sizeof(struct vfd_ioctl_data));
  937. +
  938. +           data.start = 0x00;
  939. +           data.data[0] = id;
  940. +           data.data[4] = onoff;
  941. +           data.length = 5;
  942. +
  943. +           file_vfd = open (VFD_DEVICE, O_WRONLY);
  944. +           ioctl(file_vfd, VFDICONDISPLAYONOFF, &data);
  945. +           close (file_vfd);
  946. +       }
  947. +   }
  948. +   return;
  949. +}
  950. +
  951. +void evfd::vfd_clear_icons()
  952. +{
  953. +   for (int id = 0x10; id < 0x20; id++)
  954. +   {
  955. +       vfd_set_icon((tvfd_icon)id, false);
  956. +   }
  957. +   return;
  958. +}
  959. +
  960. +void evfd::vfd_set_brightness(unsigned char setting)
  961. +{
  962. +   struct vfd_ioctl_data data;
  963. +
  964. +   memset(&data, 0, sizeof(struct vfd_ioctl_data));
  965. +
  966. +   data.start = setting & 0x07;
  967. +   data.length = 0;
  968. +
  969. +   file_vfd = open (VFD_DEVICE, O_WRONLY);
  970. +   ioctl ( file_vfd, VFDBRIGHTNESS, &data );
  971. +   close (file_vfd);
  972. +
  973. +   return;
  974. +}
  975. +
  976. +void evfd::vfd_set_light(bool onoff)
  977. +{
  978. +   struct vfd_ioctl_data data;
  979. +
  980. +   memset(&data, 0, sizeof(struct vfd_ioctl_data));
  981. +
  982. +   if (onoff)
  983. +       data.start = 0x01;
  984. +   else
  985. +       data.start = 0x00;
  986. +       data.length = 0;
  987. +
  988. +   file_vfd = open (VFD_DEVICE, O_WRONLY);
  989. +   ioctl(file_vfd, VFDDISPLAYWRITEONOFF, &data);
  990. +
  991. +   close (file_vfd);
  992. +   return;
  993. +}
  994. +
  995. +void evfd::vfd_set_fan(bool onoff)
  996. +{
  997. +#if defined(PLATFORM_CUBEREVO) || defined(PLATFORM_CUBEREVO_MINI) || defined(PLATFORM_CUBEREVO_MINI2) || defined(PLATFORM_CUBEREVO_MINI_FTA) || defined(PLATFORM_CUBEREVO_250HD) || defined(PLATFORM_CUBEREVO_2000HD) || defined(PLATFORM_CUBEREVO_9500HD)
  998. +   struct vfd_ioctl_data data;
  999. +
  1000. +   memset(&data, 0, sizeof(struct vfd_ioctl_data));
  1001. +
  1002. +   if (onoff)
  1003. +       data.start = 0x01;
  1004. +   else
  1005. +       data.start = 0x00;
  1006. +       data.length = 0;
  1007. +
  1008. +   file_vfd = open (VFD_DEVICE, O_WRONLY);
  1009. +   ioctl(file_vfd, 0xc0425af8, &data);
  1010. +
  1011. +   close (file_vfd);
  1012. +#endif
  1013. +   return;
  1014. +}
  1015. +
  1016. +void evfd::vfd_set_SCROLL(int id)
  1017. +{
  1018. +   VFD_SCROLL=id;
  1019. +}
  1020. +
  1021. +void evfd::vfd_set_CENTER(bool id)
  1022. +{
  1023. +   VFD_CENTER=id;
  1024. +}
  1025. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/driver/vfd.h enigma2-nightly.patched/lib/driver/vfd.h
  1026. --- enigma2-nightly.org/lib/driver/vfd.h    1970-01-01 01:00:00.000000000 +0100
  1027. +++ enigma2-nightly.patched/lib/driver/vfd.h    2013-10-26 03:02:25.649604820 +0200
  1028. @@ -0,0 +1,49 @@
  1029. +#ifndef VFD_H_
  1030. +#define VFD_H_
  1031. +
  1032. +#define ICON_ON  1
  1033. +#define ICON_OFF 0
  1034. +
  1035. +#ifndef PLATFORM_HDBOX
  1036. +typedef enum { USB = 0x10, HD, HDD, LOCK, BT, MP3, MUSIC, DD, MAIL, MUTE, PLAY, PAUSE, FF, FR, REC, CLOCK } tvfd_icon;
  1037. +#else
  1038. +typedef enum { USB = 0x10, STANDBY, SAT, REC, TIMESHIFT, TIMER, HD, LOCK, DD, MUTE, TUNER1, TUNER2, MP3, REPEAT,
  1039. +               PLAY, PAUSE, TER, FILE, 480i, 480p, 576i, 576p, 720p, 1080i, 1080p } tvfd_icon;
  1040. +#endif
  1041. +
  1042. +class evfd
  1043. +{
  1044. +protected:
  1045. +   static evfd *instance;
  1046. +   int file_vfd;
  1047. +   int vfd_type;
  1048. +#ifdef SWIG
  1049. +   evfd();
  1050. +   ~evfd();
  1051. +#endif
  1052. +public:
  1053. +#ifndef SWIG
  1054. +   evfd();
  1055. +   ~evfd();
  1056. +#endif
  1057. +   void init();
  1058. +   static evfd* getInstance();
  1059. +
  1060. +   int getVfdType() { return vfd_type; }
  1061. +   void vfd_set_SCROLL(int id);
  1062. +   void vfd_set_CENTER(bool id);
  1063. +   void vfd_set_icon(tvfd_icon id, bool onoff);
  1064. +   void vfd_set_icon(tvfd_icon id, bool onoff, bool force);
  1065. +   void vfd_clear_icons();
  1066. +
  1067. +   void vfd_write_string(char * string);
  1068. +   void vfd_write_string(char * str, bool force);
  1069. +   void vfd_write_string_scrollText(char* text);
  1070. +   void vfd_clear_string();
  1071. +  
  1072. +   void vfd_set_brightness(unsigned char setting);
  1073. +   void vfd_set_light(bool onoff);
  1074. +   void vfd_set_fan(bool onoff);
  1075. +};
  1076. +
  1077. +#endif
  1078. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb/decoder.cpp enigma2-nightly.patched/lib/dvb/decoder.cpp
  1079. --- enigma2-nightly.org/lib/dvb/decoder.cpp 2013-08-11 08:11:19.122306128 +0200
  1080. +++ enigma2-nightly.patched/lib/dvb/decoder.cpp 2013-10-26 03:02:25.649604820 +0200
  1081. @@ -62,7 +62,11 @@
  1082.             pes.pes_type = DMX_PES_AUDIO3;
  1083.             break;
  1084.         }
  1085. +#if defined(__sh__) // increases zapping speed
  1086. +       pes.flags    = DMX_IMMEDIATE_START;
  1087. +#else
  1088.         pes.flags    = 0;
  1089. +#endif
  1090.         eDebugNoNewLine("DMX_SET_PES_FILTER(0x%02x) - audio - ", pid);
  1091.         if (::ioctl(m_fd_demux, DMX_SET_PES_FILTER, &pes) < 0)
  1092.         {
  1093. @@ -70,6 +74,7 @@
  1094.             return -errno;
  1095.         }
  1096.         eDebug("ok");
  1097. +#if not defined(__sh__) // already startet cause of DMX_IMMEDIATE_START
  1098.         eDebugNoNewLine("DEMUX_START - audio - ");
  1099.         if (::ioctl(m_fd_demux, DMX_START) < 0)
  1100.         {
  1101. @@ -77,6 +82,7 @@
  1102.             return -errno;
  1103.         }
  1104.         eDebug("ok");
  1105. +#endif
  1106.     }
  1107.  
  1108.     if (m_fd >= 0)
  1109. @@ -116,7 +122,9 @@
  1110.             eDebug("failed (%m)");
  1111.         else
  1112.             eDebug("ok");
  1113. +#if not defined(__sh__) // this is a hack which only matters for dm drivers
  1114.         freeze();  // why freeze here?!? this is a problem when only a pid change is requested... because of the unfreeze logic in Decoder::setState
  1115. +#endif
  1116.         eDebugNoNewLine("AUDIO_PLAY - ");
  1117.         if (::ioctl(m_fd, AUDIO_PLAY) < 0)
  1118.             eDebug("failed (%m)");
  1119. @@ -336,7 +344,11 @@
  1120.             pes.pes_type = DMX_PES_VIDEO3;
  1121.             break;
  1122.         }
  1123. +#if defined(__sh__) // increases zapping speed
  1124. +       pes.flags    = DMX_IMMEDIATE_START;
  1125. +#else
  1126.         pes.flags    = 0;
  1127. +#endif
  1128.         eDebugNoNewLine("DMX_SET_PES_FILTER(0x%02x) - video - ", pid);
  1129.         if (::ioctl(m_fd_demux, DMX_SET_PES_FILTER, &pes) < 0)
  1130.         {
  1131. @@ -344,6 +356,7 @@
  1132.             return -errno;
  1133.         }
  1134.         eDebug("ok");
  1135. +#if not defined(__sh__) // already startet cause of DMX_IMMEDIATE_START
  1136.         eDebugNoNewLine("DEMUX_START - video - ");
  1137.         if (::ioctl(m_fd_demux, DMX_START) < 0)
  1138.         {
  1139. @@ -351,11 +364,14 @@
  1140.             return -errno;
  1141.         }
  1142.         eDebug("ok");
  1143. +#endif
  1144.     }
  1145.  
  1146.     if (m_fd >= 0)
  1147.     {
  1148. +#if not defined(__sh__) // this is a hack which only matters for dm drivers
  1149.         freeze();  // why freeze here?!? this is a problem when only a pid change is requested... because of the unfreeze logic in Decoder::setState
  1150. +#endif
  1151.         eDebugNoNewLine("VIDEO_PLAY - ");
  1152.         if (::ioctl(m_fd, VIDEO_PLAY) < 0)
  1153.             eDebug("failed (%m)");
  1154. @@ -640,7 +656,11 @@
  1155.         pes.pes_type = DMX_PES_PCR3;
  1156.         break;
  1157.     }
  1158. +#if defined(__sh__) // increases zapping speed
  1159. +   pes.flags    = DMX_IMMEDIATE_START;
  1160. +#else
  1161.     pes.flags    = 0;
  1162. +#endif
  1163.     eDebugNoNewLine("DMX_SET_PES_FILTER(0x%02x) - pcr - ", pid);
  1164.     if (::ioctl(m_fd_demux, DMX_SET_PES_FILTER, &pes) < 0)
  1165.     {
  1166. @@ -648,6 +668,7 @@
  1167.         return -errno;
  1168.     }
  1169.     eDebug("ok");
  1170. +#if not defined(__sh__) // already startet cause of DMX_IMMEDIATE_START
  1171.     eDebugNoNewLine("DEMUX_START - pcr - ");
  1172.     if (::ioctl(m_fd_demux, DMX_START) < 0)
  1173.     {
  1174. @@ -655,6 +676,7 @@
  1175.         return -errno;
  1176.     }
  1177.     eDebug("ok");
  1178. +#endif
  1179.     return 0;
  1180.  }
  1181.  
  1182. @@ -709,7 +731,11 @@
  1183.         pes.pes_type = DMX_PES_TELETEXT3;
  1184.         break;
  1185.     }
  1186. +#if defined(__sh__) // increases zapping speed
  1187. +   pes.flags    = DMX_IMMEDIATE_START;
  1188. +#else
  1189.     pes.flags    = 0;
  1190. +#endif
  1191.  
  1192.     eDebugNoNewLine("DMX_SET_PES_FILTER(0x%02x) - ttx - ", pid);
  1193.     if (::ioctl(m_fd_demux, DMX_SET_PES_FILTER, &pes) < 0)
  1194. @@ -718,6 +744,7 @@
  1195.         return -errno;
  1196.     }
  1197.     eDebug("ok");
  1198. +#if not defined(__sh__) // already startet cause of DMX_IMMEDIATE_START
  1199.     eDebugNoNewLine("DEMUX_START - ttx - ");
  1200.     if (::ioctl(m_fd_demux, DMX_START) < 0)
  1201.     {
  1202. @@ -725,6 +752,7 @@
  1203.         return -errno;
  1204.     }
  1205.     eDebug("ok");
  1206. +#endif
  1207.     return 0;
  1208.  }
  1209.  
  1210. @@ -860,12 +888,28 @@
  1211.         int *s = state_table[m_state];
  1212.         if (changed & (changeState|changeVideo) && m_video)
  1213.         {
  1214. +#if not defined(__sh__) // see comment below
  1215.             m_video->setSlowMotion(s[1]);
  1216.             m_video->setFastForward(s[2]);
  1217. +#endif
  1218.             if (s[0])
  1219.                 m_video->unfreeze();
  1220.             else
  1221.                 m_video->freeze();
  1222. +#if defined(__sh__)
  1223. +// the VIDEO_CONTINUE would reset the FASTFORWARD  command so we
  1224. +// execute the FASTFORWARD after the VIDEO_CONTINUE
  1225. +           if (s[1])
  1226. +           {
  1227. +               m_video->setFastForward(s[2]);
  1228. +               m_video->setSlowMotion(s[1]);
  1229. +           }
  1230. +           else
  1231. +           {
  1232. +               m_video->setSlowMotion(s[1]);
  1233. +               m_video->setFastForward(s[2]);
  1234. +           }
  1235. +#endif
  1236.         }
  1237.         if (changed & (changeState|changeAudio) && m_audio)
  1238.         {
  1239. @@ -1166,6 +1210,10 @@
  1240.         {
  1241.             struct stat s;
  1242.             fstat(f, &s);
  1243. +#if defined(__sh__) // our driver has a different behaviour for iframes
  1244. +           if (m_video_clip_fd >= 0)
  1245. +               finishShowSinglePic();
  1246. +#endif
  1247.             if (m_video_clip_fd == -1)
  1248.                 m_video_clip_fd = open("/dev/dvb/adapter0/video0", O_WRONLY);
  1249.             if (m_video_clip_fd >= 0)
  1250. @@ -1186,8 +1234,10 @@
  1251.  
  1252.                 if (ioctl(m_video_clip_fd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY) < 0)
  1253.                     eDebug("VIDEO_SELECT_SOURCE MEMORY failed (%m)");
  1254. +#if not defined(__sh__)
  1255.                 if (ioctl(m_video_clip_fd, VIDEO_SET_STREAMTYPE, streamtype) < 0)
  1256.                     eDebug("VIDEO_SET_STREAMTYPE failed(%m)");
  1257. +#endif
  1258.                 if (ioctl(m_video_clip_fd, VIDEO_PLAY) < 0)
  1259.                     eDebug("VIDEO_PLAY failed (%m)");
  1260.                 if (ioctl(m_video_clip_fd, VIDEO_CONTINUE) < 0)
  1261. @@ -1204,7 +1254,9 @@
  1262.                 if (!seq_end_avail)
  1263.                     write(m_video_clip_fd, seq_end, sizeof(seq_end));
  1264.                 writeAll(m_video_clip_fd, stuffing, 8192);
  1265. +#if not defined(__sh__)
  1266.                 m_showSinglePicTimer->start(150, true);
  1267. +#endif
  1268.             }
  1269.             close(f);
  1270.         }
  1271. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb/demux.cpp enigma2-nightly.patched/lib/dvb/demux.cpp
  1272. --- enigma2-nightly.org/lib/dvb/demux.cpp   2013-08-11 08:11:19.122306128 +0200
  1273. +++ enigma2-nightly.patched/lib/dvb/demux.cpp   2013-10-26 03:02:25.649604820 +0200
  1274. @@ -18,12 +18,36 @@
  1275.     }
  1276.     unsigned int megabytes = si.totalram >> 20;
  1277.     int result;
  1278. +#if defined(__sh__)
  1279. +   int fd = open("/proc/stb/info/model", O_RDONLY);
  1280. +   char tmp[16];
  1281. +   int rd = fd >= 0 ? read(fd, tmp, sizeof(tmp)) : 0;
  1282. +   if (fd >= 0)
  1283. +       close(fd);
  1284. +   else if (!strncmp(tmp, "ufs912\n", rd))
  1285. +       result = 16; // 128mb
  1286. +   else if (!strncmp(tmp, "ufs913\n", rd))
  1287. +       result = 16; // 128mb
  1288. +   else if (!strncmp(tmp, "spark\n", rd))
  1289. +       result = 8; // 128mb
  1290. +   else if (!strncmp(tmp, "spark7162\n", rd))
  1291. +       result = 8; // 128mb
  1292. +   else if (!strncmp(tmp, "atevio7500\n", rd))
  1293. +       result = 16; // 128mb
  1294. +   else if (!strncmp(tmp, "hs7810a\n", rd))
  1295. +       result = 16; // 128mb
  1296. +   else if (!strncmp(tmp, "hs7110\n", rd))
  1297. +       result = 16; // 128mb
  1298. +   else
  1299. +       result = 8; // weniger als 128mb   
  1300. +#else
  1301.     if (megabytes > 200)
  1302.         result = 20; // 512MB systems: Use 4MB IO buffers (et9x00, vuultimo, ...)
  1303.     else if (megabytes > 100)
  1304.         result = 16; // 256MB systems: Use 3MB demux buffers (dm8000, et5x00, vuduo)
  1305.     else
  1306.         result = 8; // Smaller boxes: Use 1.5MB buffer (dm7025)
  1307. +#endif
  1308.     return result;
  1309.  }
  1310.  
  1311. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb/dvb.cpp enigma2-nightly.patched/lib/dvb/dvb.cpp
  1312. --- enigma2-nightly.org/lib/dvb/dvb.cpp 2013-08-11 08:11:19.122306128 +0200
  1313. +++ enigma2-nightly.patched/lib/dvb/dvb.cpp 2013-10-26 03:02:25.653604820 +0200
  1314. @@ -115,6 +115,64 @@
  1315.         m_boxtype = DM800SE;
  1316.     else if (!strncmp(tmp, "dm7020hd\n", rd))
  1317.         m_boxtype = DM7020HD;
  1318. +#if defined(__sh__)
  1319. +   else if (!strncmp(tmp, "adb_box\n", rd))
  1320. +       m_boxtype = ADB_BOX;
  1321. +   else if (!strncmp(tmp, "ufs910\n", rd))
  1322. +       m_boxtype = UFS910;
  1323. +   else if (!strncmp(tmp, "ufs912\n", rd))
  1324. +       m_boxtype = UFS912;
  1325. +   else if (!strncmp(tmp, "ufs913\n", rd))
  1326. +       m_boxtype = UFS913;
  1327. +   else if (!strncmp(tmp, "ufs922\n", rd))
  1328. +       m_boxtype = UFS922;
  1329. +   else if (!strncmp(tmp, "ufc960\n", rd))
  1330. +       m_boxtype = UFC960;
  1331. +   else if (!strncmp(tmp, "tf7700hdpvr\n", rd))
  1332. +       m_boxtype = TF7700HDPVR;
  1333. +   else if (!strncmp(tmp, "hdbox\n", rd))
  1334. +       m_boxtype = HDBOX;
  1335. +   else if (!strncmp(tmp, "hl101\n", rd))
  1336. +       m_boxtype = HL101;
  1337. +   else if (!strncmp(tmp, "spark\n", rd))
  1338. +       m_boxtype = SPARK;
  1339. +   else if (!strncmp(tmp, "spark7162\n", rd))
  1340. +       m_boxtype = SPARK7162;
  1341. +   else if (!strncmp(tmp, "vip1-v2\n", rd))
  1342. +       m_boxtype = VIP1_V2;
  1343. +   else if (!strncmp(tmp, "vip2-v1\n", rd))
  1344. +       m_boxtype = VIP2_V1;
  1345. +   else if (!strncmp(tmp, "cuberevo\n", rd))
  1346. +       m_boxtype = CUBEREVO;
  1347. +   else if (!strncmp(tmp, "cuberevo-9500hd\n", rd))
  1348. +       m_boxtype = CUBEREVO_9500HD;
  1349. +   else if (!strncmp(tmp, "cuberevo-mini\n", rd))
  1350. +       m_boxtype = CUBEREVO_MINI;
  1351. +   else if (!strncmp(tmp, "cuberevo-mini2\n", rd))
  1352. +       m_boxtype = CUBEREVO_MINI2;
  1353. +   else if (!strncmp(tmp, "cuberevo-2000hd\n", rd))
  1354. +       m_boxtype = CUBEREVO_2000HD;
  1355. +   else if (!strncmp(tmp, "cuberevo-250hd\n", rd))
  1356. +       m_boxtype = CUBEREVO_250HD;
  1357. +   else if (!strncmp(tmp, "cuberevo-mini-fta\n", rd))
  1358. +       m_boxtype = CUBEREVO_MINI_FTA;
  1359. +   else if (!strncmp(tmp, "ipbox9900\n", rd))
  1360. +       m_boxtype = IPBOX9900;
  1361. +   else if (!strncmp(tmp, "ipbox99\n", rd))
  1362. +       m_boxtype = IPBOX99;
  1363. +   else if (!strncmp(tmp, "ipbox55\n", rd))
  1364. +       m_boxtype = IPBOX55;
  1365. +   else if (!strncmp(tmp, "octagon1008\n", rd))
  1366. +       m_boxtype = OCTAGON1008;
  1367. +   else if (!strncmp(tmp, "hs7810a\n", rd))
  1368. +       m_boxtype = HS7810A;
  1369. +   else if (!strncmp(tmp, "hs7110\n", rd))
  1370. +       m_boxtype = HS7110;
  1371. +   else if (!strncmp(tmp, "whitebox\n", rd))
  1372. +       m_boxtype = WHITEBOX;
  1373. +   else if (!strncmp(tmp, "atevio7500\n", rd))
  1374. +       m_boxtype = ATEVIO7500;
  1375. +#else
  1376.     else {
  1377.         eDebug("boxtype detection via /proc/stb/info not possible... use fallback via demux count!\n");
  1378.         if (m_demux.size() == 3)
  1379. @@ -124,7 +182,7 @@
  1380.         else
  1381.             m_boxtype = DM8000;
  1382.     }
  1383. -
  1384. +#endif
  1385.     eDebug("found %zd adapter, %zd frontends(%zd sim) and %zd demux, boxtype %d",
  1386.         m_adapter.size(), m_frontend.size(), m_simulate_frontend.size(), m_demux.size(), m_boxtype);
  1387.  
  1388. @@ -963,6 +1021,58 @@
  1389.             }
  1390.         }
  1391.     }
  1392. +#if defined(__sh__) // we use our own algo for demux detection
  1393. +   else if (m_boxtype == ADB_BOX || m_boxtype == UFS910 || m_boxtype == UFS912 || m_boxtype == UFS913 || m_boxtype == UFS922 || m_boxtype == UFC960 || m_boxtype == SPARK || m_boxtype == SPARK7162 || m_boxtype == TF7700HDPVR || m_boxtype == HDBOX ||
  1394. +       m_boxtype == HL101 || m_boxtype == CUBEREVO || m_boxtype == CUBEREVO_MINI || m_boxtype == CUBEREVO_MINI2 || m_boxtype == VIP1_V2 || m_boxtype == VIP2_V1 || m_boxtype == HS7810A || m_boxtype == HS7110 || m_boxtype == WHITEBOX ||
  1395. +       m_boxtype == CUBEREVO_MINI_FTA || m_boxtype == CUBEREVO_250HD || m_boxtype == CUBEREVO_2000HD || m_boxtype == CUBEREVO_9500HD || m_boxtype == OCTAGON1008 || m_boxtype == ATEVIO7500 ||
  1396. +       m_boxtype == IPBOX9900 || m_boxtype == IPBOX99 || m_boxtype == IPBOX55)
  1397. +   {
  1398. +       int n=0;
  1399. +       for (; i != m_demux.end(); ++i, ++n)
  1400. +       {
  1401. +           if(fe)
  1402. +           {
  1403. +               if (!i->m_inuse)
  1404. +               {
  1405. +                   if (!unused)
  1406. +                   {
  1407. +                       // take the first unused
  1408. +                       //eDebug("\nallocate demux b = %d\n",n);
  1409. +                       unused = i;
  1410. +                   }
  1411. +               }
  1412. +               else if (i->m_adapter == fe->m_adapter && i->m_demux->getSource() == fe->m_frontend->getDVBID())
  1413. +               {
  1414. +                   // take the demux allocated to the same
  1415. +                   // frontend,  just create a new reference
  1416. +                   demux = new eDVBAllocatedDemux(i);
  1417. +                   //eDebug("\nallocate demux b = %d\n",n);
  1418. +                   return 0;
  1419. +               }
  1420. +           }
  1421. +           else if(n == (m_demux.size() - 1))
  1422. +           {
  1423. +               // Always use the last demux for PVR
  1424. +               // it is assumed that the last demux is not
  1425. +               // attached to a frontend. That is, there
  1426. +               // should be one instance of dvr & demux
  1427. +               // devices more than of frontend devices.
  1428. +               // Otherwise, playback and timeshift might
  1429. +               // interfere recording.
  1430. +               if (i->m_inuse)
  1431. +               {
  1432. +                   // just create a new reference
  1433. +                   demux = new eDVBAllocatedDemux(i);
  1434. +                   //eDebug("\nallocate demux c = %d\n",n);
  1435. +                   return 0;
  1436. +               }
  1437. +               unused = i;
  1438. +               //eDebug("\nallocate demux d = %d\n", n);
  1439. +               break;
  1440. +           }
  1441. +       }
  1442. +   }
  1443. +#endif
  1444.     else
  1445.     {
  1446.         iDVBAdapter *adapter = fe ? fe->m_adapter : m_adapter.begin(); /* look for a demux on the same adapter as the frontend, or the first adapter for dvr playback */
  1447. @@ -2118,6 +2228,12 @@
  1448.             return -ENODEV;
  1449.         }
  1450.  #else
  1451. +#if defined(__sh__) // our pvr device is called dvr
  1452. +       char dvrDev[128];
  1453. +       int dvrIndex = m_mgr->m_adapter.begin()->getNumDemux() - 1;
  1454. +       sprintf(dvrDev, "/dev/dvb/adapter0/dvr%d", dvrIndex);
  1455. +       m_pvr_fd_dst = open(dvrDev, O_WRONLY);
  1456. +#else
  1457.         ePtr<eDVBAllocatedDemux> &demux = m_demux ? m_demux : m_decoder_demux;
  1458.         if (demux)
  1459.         {
  1460. @@ -2134,6 +2250,7 @@
  1461.             return -ENODEV;
  1462.         }
  1463.  #endif
  1464. +#endif
  1465.     }
  1466.  
  1467.     m_pvr_thread = new eDVBChannelFilePush(m_source->getPacketSize());
  1468. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb/dvb.h enigma2-nightly.patched/lib/dvb/dvb.h
  1469. --- enigma2-nightly.org/lib/dvb/dvb.h   2013-08-11 08:11:19.126306130 +0200
  1470. +++ enigma2-nightly.patched/lib/dvb/dvb.h   2013-10-26 03:02:25.817604818 +0200
  1471. @@ -161,7 +161,11 @@
  1472.     DECLARE_REF(eDVBResourceManager);
  1473.     int avail, busy;
  1474.  
  1475. +#if not defined(__sh__)
  1476.     enum { DM7025, DM800, DM500HD, DM800SE, DM8000, DM7020HD };
  1477. +#else
  1478. +   enum { DM7025, DM800, DM500HD, DM800SE, DM8000, DM7020HD, ADB_BOX, UFS910, UFS912, UFS913, UFS922, UFC960, TF7700HDPVR, HDBOX, HL101, CUBEREVO, CUBEREVO_MINI, CUBEREVO_MINI2, CUBEREVO_MINI_FTA, CUBEREVO_250HD, CUBEREVO_9500HD, CUBEREVO_2000HD, IPBOX9900, IPBOX99, IPBOX55, OCTAGON1008, VIP1_V2, VIP2_V1, SPARK, SPARK7162, ATEVIO7500, HS7810A, HS7110, WHITEBOX};
  1479. +#endif
  1480.  
  1481.     int m_boxtype;
  1482.  
  1483. @@ -273,6 +277,9 @@
  1484.         /* cannot be used for PVR channels. */
  1485.     RESULT setChannel(const eDVBChannelID &id, ePtr<iDVBFrontendParameters> &feparam);
  1486.     eDVBChannelID getChannelID() { return m_channel_id; }
  1487. +#if defined(__sh__) //see filepush.h
  1488. +   int getSkipMode() { return m_skipmode_m; }
  1489. +#endif
  1490.  
  1491.     RESULT connectStateChange(const Slot1<void,iDVBChannel*> &stateChange, ePtr<eConnection> &connection);
  1492.     RESULT connectEvent(const Slot2<void,iDVBChannel*,int> &eventChange, ePtr<eConnection> &connection);
  1493. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb/epgcache.cpp enigma2-nightly.patched/lib/dvb/epgcache.cpp
  1494. --- enigma2-nightly.org/lib/dvb/epgcache.cpp    2013-08-11 08:11:19.130306132 +0200
  1495. +++ enigma2-nightly.patched/lib/dvb/epgcache.cpp    2013-10-26 03:02:25.821604816 +0200
  1496. @@ -221,10 +221,22 @@
  1497.     int tmp = ByteSize - 10;
  1498.     memcpy(data, EITdata, 10);
  1499.     unsigned int descriptors_length = 0;
  1500. +#ifndef __sh__
  1501.     __u32 *p = (__u32*)(EITdata + 10);
  1502. +#else
  1503. +   // Dagobert: fix not aligned access
  1504. +   __u8 *p = (__u8*)(EITdata+10);
  1505. +#endif
  1506.     while (tmp > 3)
  1507.     {
  1508. +#ifndef __sh__
  1509.         descriptorMap::iterator it = descriptors.find(*p++);
  1510. +#else
  1511. +       __u32 index = p[3] << 24 | p[2] << 16 | p[1] << 8 | p[0];
  1512. +       // eDebug("index %d %x, %x %x %x %x\n", index, index, p[0], p[1], p[2], p[3]);
  1513. +       descriptorMap::iterator it = descriptors.find(index);
  1514. +       p += 4;
  1515. +#endif
  1516.         if (it != descriptors.end())
  1517.         {
  1518.             unsigned int b = it->second.second[1] + 2;
  1519. @@ -249,12 +261,23 @@
  1520.     if ( ByteSize )
  1521.     {
  1522.         CacheSize -= ByteSize;
  1523. +#ifndef __sh__
  1524.         __u32 *d = (__u32*)(EITdata+10);
  1525. +#else  // Dagobert: fix not aligned access
  1526. +       __u8 *d = (__u8*)(EITdata+10);
  1527. +#endif
  1528.         ByteSize -= 10;
  1529.         while(ByteSize>3)
  1530.         {
  1531. +#ifndef __sh__
  1532.             descriptorMap::iterator it =
  1533.                 descriptors.find(*d++);
  1534. +#else
  1535. +           __u32 index = d[3] << 24 | d[2] << 16 | d[1] << 8 | d[0];
  1536. +           // eDebug("index %d %x, %x %x %x %x\n", index, index, d[0], d[1], d[2], d[3]);
  1537. +           descriptorMap::iterator it = descriptors.find(index);
  1538. +           d += 4;
  1539. +#endif
  1540.             if ( it != descriptors.end() )
  1541.             {
  1542.                 descriptorPair &p = it->second;
  1543. @@ -1790,6 +1813,45 @@
  1544.  {
  1545.     int map;
  1546.     iDVBSectionReader *reader = NULL;
  1547. +#ifdef __sh__
  1548. +/* Dagobert: this is still very hacky, but currently I cant find
  1549. + * the origin of the readData call. I think the caller is
  1550. + * responsible for the unaligned data pointer in this call.
  1551. + * So we malloc our own memory here which _should_ be aligned.
  1552. + *
  1553. + * TODO: We should search for the origin of this call. As I
  1554. + * said before I need an UML Diagram or must try to import
  1555. + * e2 and all libs into an IDE for better overview ;)
  1556. + *
  1557. + */
  1558. +   const __u8 *aligned_data;
  1559. +   bool isNotAligned = false;
  1560. +
  1561. +   if ((unsigned int) data % 4 != 0)
  1562. +       isNotAligned = true;
  1563. +
  1564. +   if (isNotAligned)
  1565. +   {
  1566. +       /* see HILO macro and eit.h */
  1567. +       int len = ((data[1] & 0x0F) << 8 | data[2]) -1;
  1568. +
  1569. +       /*eDebug("len %d %x, %x %x\n", len, len, data[1], data[2]);*/
  1570. +
  1571. +       if ( EIT_SIZE >= len )
  1572. +           return;
  1573. +
  1574. +       aligned_data = (const __u8 *) malloc(len);
  1575. +
  1576. +       if ((unsigned int)aligned_data % 4 != 0)
  1577. +       {
  1578. +           eDebug("eEPGCache::channel_data::readData: ERRORERRORERROR: unaligned data pointer %p\n", aligned_data);
  1579. +       }
  1580. +
  1581. +       /*eDebug("%p %p\n", aligned_data, data); */
  1582. +       memcpy((void *) aligned_data, (const __u8 *) data, len);
  1583. +       data = aligned_data;
  1584. +   }
  1585. +#endif
  1586.     switch (source)
  1587.     {
  1588.         case NOWNEXT:
  1589. @@ -1894,6 +1956,10 @@
  1590.             cache->sectionRead(data, source, this);
  1591.         }
  1592.     }
  1593. +#ifdef __sh__
  1594. +   if (isNotAligned)
  1595. +       free((void *)aligned_data);
  1596. +#endif
  1597.  }
  1598.  
  1599.  #if ENABLE_FREESAT
  1600. @@ -2979,11 +3045,20 @@
  1601.                         {
  1602.                             __u8 *data = evData->EITdata;
  1603.                             int tmp = evData->ByteSize-10;
  1604. +#ifndef __sh__
  1605.                             __u32 *p = (__u32*)(data+10);
  1606. +#else  // Dagobert: Alignment fix
  1607. +                           __u8 *p = (__u8*)(data+10);
  1608. +#endif
  1609.                             // search short and extended event descriptors
  1610.                             while(tmp>3)
  1611.                             {
  1612. +#ifndef __sh__
  1613.                                 __u32 crc = *p++;
  1614. +#else  // Dagobert: Alignment fix
  1615. +                               __u32 crc = p[3] << 24 | p[2] << 16 | p[1] << 8 | p[0];
  1616. +                               p += 4;
  1617. +#endif
  1618.                                 descriptorMap::iterator it =
  1619.                                     eventData::descriptors.find(crc);
  1620.                                 if (it != eventData::descriptors.end())
  1621. @@ -3162,12 +3237,21 @@
  1622.                 }
  1623.                 __u8 *data = evit->second->EITdata;
  1624.                 int tmp = evit->second->ByteSize-10;
  1625. +#ifndef __sh__
  1626.                 __u32 *p = (__u32*)(data+10);
  1627. +#else  // Dagobert: Alignment fix
  1628. +               __u8 *p = (__u8*)(data+10);
  1629. +#endif
  1630.                 // check if any of our descriptor used by this event
  1631.                 int cnt=-1;
  1632.                 while(tmp>3)
  1633.                 {
  1634. +#ifndef __sh__
  1635.                     __u32 crc32 = *p++;
  1636. +#else  // Dagobert: Alignment fix
  1637. +                   __u32 crc32 = p[3] << 24 | p[2] << 16 | p[1] << 8 | p[0];
  1638. +                   p += 4;
  1639. +#endif
  1640.                     for ( int i=0; i <= descridx; ++i)
  1641.                     {
  1642.                         if (descr[i] == crc32)  // found...
  1643. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb/pmt.cpp enigma2-nightly.patched/lib/dvb/pmt.cpp
  1644. --- enigma2-nightly.org/lib/dvb/pmt.cpp 2013-08-11 08:11:19.138306132 +0200
  1645. +++ enigma2-nightly.patched/lib/dvb/pmt.cpp 2013-10-26 03:02:27.181604845 +0200
  1646. @@ -744,6 +744,11 @@
  1647.             eDVBCIInterfaces::getInstance()->addPMTHandler(this);
  1648.     } else if (!simulate) // no simulation of playback services
  1649.     {
  1650. +       if (m_service_type == streamclient)
  1651. +       {
  1652. +           eDebug("force setServiceID(1)");
  1653. +           m_reference.setServiceID(1);
  1654. +       }
  1655.         if (!ref.getServiceID().get() /* incorrect sid in meta file or recordings.epl*/ )
  1656.         {
  1657.             eDVBTSTools tstools;
  1658. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb/volume.cpp enigma2-nightly.patched/lib/dvb/volume.cpp
  1659. --- enigma2-nightly.org/lib/dvb/volume.cpp  2013-08-11 08:11:19.146306132 +0200
  1660. +++ enigma2-nightly.patched/lib/dvb/volume.cpp  2013-10-26 03:02:27.185604816 +0200
  1661. @@ -34,7 +34,9 @@
  1662.     openMixer();
  1663.  #endif
  1664.     volumeUnMute();
  1665. +#if not defined (__sh__) // dont reset volume on start
  1666.     setVolume(100, 100);
  1667. +#endif
  1668.  }
  1669.  
  1670.  int eDVBVolumecontrol::openMixer()
  1671. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb_ci/dvbci_appmgr.cpp enigma2-nightly.patched/lib/dvb_ci/dvbci_appmgr.cpp
  1672. --- enigma2-nightly.org/lib/dvb_ci/dvbci_appmgr.cpp 2013-08-11 08:11:19.150306132 +0200
  1673. +++ enigma2-nightly.patched/lib/dvb_ci/dvbci_appmgr.cpp 2013-10-26 03:02:27.185604816 +0200
  1674. @@ -94,6 +94,9 @@
  1675.     eDebug("in appmanager -> startmmi()");
  1676.     const unsigned char tag[3]={0x9F, 0x80, 0x22};  // Tenter_menu
  1677.     sendAPDU(tag);
  1678. +#ifdef __sh__
  1679. +   slot->mmiOpened();
  1680. +#endif
  1681.     return 0;
  1682.  }
  1683.  
  1684. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb_ci/dvbci.cpp enigma2-nightly.patched/lib/dvb_ci/dvbci.cpp
  1685. --- enigma2-nightly.org/lib/dvb_ci/dvbci.cpp    2013-08-11 08:11:19.150306132 +0200
  1686. +++ enigma2-nightly.patched/lib/dvb_ci/dvbci.cpp    2013-10-26 03:02:27.185604816 +0200
  1687. @@ -18,6 +18,11 @@
  1688.  
  1689.  #include <dvbsi++/ca_program_map_section.h>
  1690.  
  1691. +#ifdef __sh__
  1692. +#include <linux/dvb/ca.h>
  1693. +//#define x_debug
  1694. +#endif
  1695. +
  1696.  //#define CIDEBUG 1
  1697.  
  1698.  #ifdef CIDEBUG
  1699. @@ -28,6 +33,229 @@
  1700.  
  1701.  eDVBCIInterfaces *eDVBCIInterfaces::instance = 0;
  1702.  
  1703. +#ifdef __sh__
  1704. +bool eDVBCISlot::checkQueueSize()
  1705. +{
  1706. +   return (sendqueue.size() > 0);
  1707. +}
  1708. +
  1709. +/* from dvb-apps */
  1710. +int asn_1_decode(uint16_t * length, unsigned char * asn_1_array,
  1711. +        uint32_t asn_1_array_len)
  1712. +{
  1713. +   uint8_t length_field;
  1714. +
  1715. +   if (asn_1_array_len < 1)
  1716. +       return -1;
  1717. +   length_field = asn_1_array[0];
  1718. +
  1719. +   if (length_field < 0x80) {
  1720. +       // there is only one word
  1721. +       *length = length_field & 0x7f;
  1722. +       return 1;
  1723. +   } else if (length_field == 0x81) {
  1724. +       if (asn_1_array_len < 2)
  1725. +           return -1;
  1726. +
  1727. +       *length = asn_1_array[1];
  1728. +       return 2;
  1729. +   } else if (length_field == 0x82) {
  1730. +       if (asn_1_array_len < 3)
  1731. +           return -1;
  1732. +
  1733. +       *length = (asn_1_array[1] << 8) | asn_1_array[2];
  1734. +       return 3;
  1735. +   }
  1736. +
  1737. +   return -1;
  1738. +}
  1739. +
  1740. +//send some data on an fd, for a special slot and connection_id
  1741. +eData eDVBCISlot::sendData(unsigned char* data, int len)
  1742. +{
  1743. +#ifdef x_debug
  1744. +   printf("%s: %p, %d\n", __func__, data, len);
  1745. +#endif
  1746. +
  1747. +   unsigned char *d = (unsigned char*) malloc(len + 5);
  1748. +
  1749. +   /* should we send a data last ? */
  1750. +   if (data != NULL)
  1751. +   {
  1752. +       if ((data[2] >= T_SB) && (data[2] <= T_NEW_T_C))
  1753. +       {
  1754. +           memcpy(d, data, len);
  1755. +       }
  1756. +       else
  1757. +       {
  1758. +           //send data_last and data
  1759. +           memcpy(d + 5, data, len);
  1760. +           d[0] = getSlotID();
  1761. +           d[1] = connection_id;
  1762. +           d[2] = T_DATA_LAST;
  1763. +           d[3] = len + 1;         /* len */
  1764. +           d[4] = connection_id;   /* transport connection identifier*/
  1765. +           len += 5;
  1766. +       }
  1767. +   }
  1768. +   else
  1769. +   {
  1770. +       //send a data last only
  1771. +       d[0] = getSlotID();
  1772. +       d[1] = connection_id;
  1773. +       d[2] = T_DATA_LAST;
  1774. +       d[3] = len + 1;         /* len */
  1775. +       d[4] = connection_id;   /* transport connection identifier*/
  1776. +       len = 5;
  1777. +   }
  1778. +
  1779. +#ifdef x_debug
  1780. +   printf("write (%d): > ", getSlotID());
  1781. +   for (int i=0; i < len; i++)
  1782. +       printf("%02x ",d[i]);
  1783. +   printf("\n");
  1784. +#endif
  1785. +
  1786. +#ifdef direct_write
  1787. +   res = write(fd, d, len);
  1788. +
  1789. +   free(d);
  1790. +   if (res < 0 || res != len)
  1791. +   {
  1792. +       printf("error writing data to fd %d, slot %d: %m\n", fd, getSlotID());
  1793. +       return eDataError;
  1794. +   }
  1795. +#else
  1796. +   sendqueue.push( queueData(d, len) );
  1797. +#endif
  1798. +   return eDataReady;
  1799. +}
  1800. +
  1801. +//send a transport connection create request
  1802. +bool eDVBCISlot::sendCreateTC()
  1803. +{
  1804. +   //printf("%s:%s >\n", FILENAME, __FUNCTION__);
  1805. +   unsigned char* data = (unsigned char*) malloc(sizeof(char) * 5);
  1806. +   tx_time.tv_sec = 0;
  1807. +   data[0] = getSlotID();
  1808. +   data[1] = getSlotID() + 1;  /* conid */
  1809. +   data[2] = T_CREATE_T_C;
  1810. +   data[3] = 1;
  1811. +   data[4] = getSlotID() + 1   /*conid*/;
  1812. +   write(fd, data, 5);
  1813. +   //printf("%s:%s <\n", FILENAME, __FUNCTION__);
  1814. +   return true;
  1815. +}
  1816. +
  1817. +void eDVBCISlot::process_tpdu(unsigned char tpdu_tag, __u8* data, int asn_data_length, int con_id)
  1818. +{
  1819. +   switch (tpdu_tag)
  1820. +   {
  1821. +       case T_C_T_C_REPLY:
  1822. +           printf("Got CTC Replay (slot %d, con %d)\n", getSlotID(), connection_id);
  1823. +
  1824. +           tx_time.tv_sec = 0;
  1825. +
  1826. +           state = stateInserted;
  1827. +
  1828. +           //answer with data last (and if we have with data)
  1829. +           sendData(NULL, 0);
  1830. +
  1831. +           break;
  1832. +       case T_DELETE_T_C:
  1833. +//FIXME: close sessions etc; reset ?
  1834. +//we must answer here with t_c_replay
  1835. +           printf("Got \"Delete Transport Connection\" from module ->currently not handled!\n");
  1836. +           break;
  1837. +       case T_D_T_C_REPLY:
  1838. +           printf("Got \"Delete Transport Connection Replay\" from module!\n");
  1839. +           break;
  1840. +       case T_REQUEST_T_C:
  1841. +           printf("Got \"Request Transport Connection\" from Module ->currently not handled!\n");
  1842. +           break;
  1843. +       case T_DATA_MORE:
  1844. +       {
  1845. +           int new_data_length = receivedLen + asn_data_length;
  1846. +           printf("Got \"Data More\" from Module\n");
  1847. +           __u8 *new_data_buffer = (__u8*) realloc(receivedData, new_data_length);
  1848. +           receivedData = new_data_buffer;
  1849. +           memcpy(receivedData + receivedLen, data, asn_data_length);
  1850. +           receivedLen = new_data_length;
  1851. +           tx_time.tv_sec = 0;
  1852. +           break;
  1853. +       }
  1854. +       case T_DATA_LAST:
  1855. +#ifdef x_debug
  1856. +           printf("Got \"Data Last\" from Module\n");
  1857. +#endif
  1858. +           tx_time.tv_sec = 0;
  1859. +           /* single package */
  1860. +           if (receivedData == NULL)
  1861. +           {
  1862. +               printf("->single package\n");
  1863. +#ifdef x_debug
  1864. +               printf("calling receiveData with data (len %d)> ", asn_data_length);
  1865. +               for (int i = 0;i < asn_data_length; i++)
  1866. +                   printf("%02x ", data[i]);
  1867. +               printf("\n");
  1868. +#endif
  1869. +               eDVBCISession::receiveData(this, data, asn_data_length);
  1870. +               eDVBCISession::pollAll();
  1871. +           }
  1872. +           else
  1873. +           {
  1874. +               /* chained package */
  1875. +               int new_data_length = receivedLen + asn_data_length;
  1876. +               printf("->chained data\n");
  1877. +               __u8 *new_data_buffer = (__u8*) realloc(receivedData, new_data_length);
  1878. +               receivedData = new_data_buffer;
  1879. +               memcpy(receivedData + receivedLen, data, asn_data_length);
  1880. +               receivedLen = new_data_length;
  1881. +#ifdef x_debug
  1882. +               printf("calling receiveData with data (len %d)> ", asn_data_length);
  1883. +               for (int i = 0;i < receivedLen; i++)
  1884. +                   printf("%02x ", receivedData[i]);
  1885. +               printf("\n");
  1886. +#endif
  1887. +               eDVBCISession::receiveData(this, receivedData, receivedLen);
  1888. +               eDVBCISession::pollAll();
  1889. +//fixme: must also be moved in e2 behind the data processing ;)
  1890. +               free(receivedData);
  1891. +               receivedData = NULL;
  1892. +               receivedLen = 0;
  1893. +           }
  1894. +           break;
  1895. +       case T_SB:
  1896. +       {
  1897. +#ifdef x_debug
  1898. +           printf("Got \"SB\" from Module\n");
  1899. +#endif
  1900. +           if (data[0] & 0x80)
  1901. +           {
  1902. +               printf("->data ready (%d)\n", getSlotID());
  1903. +               // send the RCV and ask for the data
  1904. +               unsigned char send_data[5];
  1905. +               send_data[0] = getSlotID();
  1906. +               send_data[1] = connection_id;
  1907. +               send_data[2] = T_RCV;
  1908. +               send_data[3] = 1;
  1909. +               send_data[4] = connection_id;
  1910. +               write(fd, send_data, 5);
  1911. +               gettimeofday(&tx_time, 0);
  1912. +           }
  1913. +           else
  1914. +           {
  1915. +               tx_time.tv_sec = 0;
  1916. +           }
  1917. +           break;
  1918. +       }
  1919. +       default:
  1920. +           printf("unhandled tpdu_tag 0x%0x\n", tpdu_tag);
  1921. +   }
  1922. +}
  1923. +
  1924. +#endif
  1925. +
  1926.  eDVBCIInterfaces::eDVBCIInterfaces()
  1927.  {
  1928.     int num_ci = 0;
  1929. @@ -39,7 +267,11 @@
  1930.     while (1)
  1931.     {
  1932.         char filename[128];
  1933. +#ifdef __sh__
  1934. +       sprintf(filename, "/dev/dvb/adapter0/ci%d", num_ci);
  1935. +#else
  1936.         sprintf(filename, "/dev/ci%d", num_ci);
  1937. +#endif
  1938.  
  1939.         if (::access(filename, R_OK) < 0) break;
  1940.  
  1941. @@ -954,8 +1186,13 @@
  1942.     {
  1943.         unsigned char *d = new unsigned char[len];
  1944.         memcpy(d, data, len);
  1945. +#ifdef __sh__
  1946. +       sendData(d, len);
  1947. +       notifier->setRequested(eSocketNotifier::Read | eSocketNotifier::Priority | eSocketNotifier::Write);
  1948. +#else
  1949.         sendqueue.push( queueData(d, len) );
  1950.         notifier->setRequested(eSocketNotifier::Read | eSocketNotifier::Priority | eSocketNotifier::Write);
  1951. +#endif
  1952.     }
  1953.  
  1954.     return res;
  1955. @@ -964,6 +1201,7 @@
  1956.  void eDVBCISlot::data(int what)
  1957.  {
  1958.     eDebugCI("CISlot %d what %d\n", getSlotID(), what);
  1959. +#ifndef __sh__
  1960.     if(what == eSocketNotifier::Priority) {
  1961.         if(state != stateRemoved) {
  1962.             state = stateRemoved;
  1963. @@ -1019,6 +1257,166 @@
  1964.         else
  1965.             notifier->setRequested(eSocketNotifier::Read|eSocketNotifier::Priority);
  1966.     }
  1967. +#else
  1968. +   unsigned char data[1024];
  1969. +   int len = 1024;
  1970. +   unsigned char* d;
  1971. +   eData status;
  1972. +   ca_slot_info_t info;
  1973. +
  1974. +   if (what & eSocketNotifier::Read)
  1975. +   {
  1976. +       eDebugCI("eSocketNotifier::Read\n");
  1977. +       status = eDataReady;
  1978. +       len = ::read(fd, data, len);
  1979. +   }
  1980. +   else if (what & eSocketNotifier::Write)
  1981. +   {
  1982. +       eDebugCI("eSocketNotifier::Write\n");
  1983. +       status = eDataWrite;
  1984. +   }
  1985. +   else if (what & eSocketNotifier::Priority)
  1986. +   {
  1987. +       eDebugCI("eSocketNotifier::Priority\n");
  1988. +       status = eDataStatusChanged;
  1989. +   }
  1990. +
  1991. +   switch (getState())
  1992. +   {
  1993. +       case stateInvalid:
  1994. +       {
  1995. +           if (status == eDataStatusChanged)
  1996. +           {
  1997. +               info.num = getSlotID();
  1998. +
  1999. +               if (ioctl(fd, CA_GET_SLOT_INFO, &info) < 0)
  2000. +                   printf("IOCTL CA_GET_SLOT_INFO failed for slot %d\n", getSlotID());
  2001. +
  2002. +               if (info.flags & CA_CI_MODULE_READY)
  2003. +               {
  2004. +                   printf("1. cam status changed ->cam now present\n");
  2005. +                   state = stateInserted;
  2006. +                   mmi_active = false;
  2007. +                   tx_time.tv_sec = 0;
  2008. +                   application_manager = 0;
  2009. +                   ca_manager = 0;
  2010. +                   sendCreateTC();
  2011. +                   eDVBCI_UI::getInstance()->setState(getSlotID(),1);
  2012. +               }
  2013. +           }
  2014. +           else
  2015. +           {
  2016. +               usleep(100000);
  2017. +           }
  2018. +       }
  2019. +       break;
  2020. +       case stateInserted:
  2021. +       {
  2022. +           if (status == eDataReady)
  2023. +           {
  2024. +               eDebugCI("received data - len %d\n", len);
  2025. +               //int s_id = data[0];
  2026. +               //int c_id = data[1];
  2027. +               //printf("%d: s_id = %d, c_id = %d\n", slot->slot, s_id, c_id);
  2028. +               d = data;
  2029. +               /* taken from the dvb-apps */
  2030. +               int data_length = len - 2;
  2031. +               d += 2; /* remove leading slot and connection id */
  2032. +               while (data_length > 0)
  2033. +               {
  2034. +                   unsigned char tpdu_tag = d[0];
  2035. +                   unsigned short asn_data_length;
  2036. +                   int length_field_len;
  2037. +                   if ((length_field_len = asn_1_decode(&asn_data_length, d + 1, data_length - 1)) < 0)
  2038. +                   {
  2039. +                       printf("Received data with invalid asn from module on slot %02x\n", getSlotID());
  2040. +                       break;
  2041. +                   }
  2042. +
  2043. +                   if ((asn_data_length < 1) || (asn_data_length > (data_length - (1 + length_field_len))))
  2044. +                   {
  2045. +                       printf("Received data with invalid length from module on slot %02x\n", getSlotID());
  2046. +                       break;
  2047. +                   }
  2048. +                   connection_id = d[1 + length_field_len];
  2049. +                   //printf("Setting connection_id from received data to %d\n", slot->connection_id);
  2050. +                   d += 1 + length_field_len + 1;
  2051. +                   data_length -= (1 + length_field_len + 1);
  2052. +                   asn_data_length--;
  2053. +                   process_tpdu(tpdu_tag, d, asn_data_length, connection_id);
  2054. +                   // skip over the consumed data
  2055. +                   d += asn_data_length;
  2056. +                   data_length -= asn_data_length;
  2057. +               } // while (data_length)
  2058. +           } /* data ready */
  2059. +           else if (status == eDataWrite)
  2060. +           {
  2061. +               if (!sendqueue.empty() && (tx_time.tv_sec == 0))
  2062. +               {
  2063. +                   const queueData &qe = sendqueue.top();
  2064. +                   int res = write(fd, qe.data, qe.len);
  2065. +                   if (res >= 0 && (unsigned int)res == qe.len)
  2066. +                   {
  2067. +                       delete [] qe.data;
  2068. +                       sendqueue.pop();
  2069. +                       gettimeofday(&tx_time, 0);
  2070. +                   }
  2071. +                   else
  2072. +                   {
  2073. +                       printf("r = %d, %m\n", res);
  2074. +                   }
  2075. +               }
  2076. +               /* the spec say's that we _must_ poll the connection
  2077. +                * if the transport connection is in active state
  2078. +                */
  2079. +               if ((tx_time.tv_sec == 0) && (!checkQueueSize()) && (time_after(last_poll_time, 1000)))
  2080. +               {
  2081. +                   sendData(NULL, 0);
  2082. +                   clock_gettime(CLOCK_MONOTONIC, &last_poll_time);
  2083. +               }
  2084. +           }
  2085. +           else if (status == eDataStatusChanged)
  2086. +           {
  2087. +               info.num = getSlotID();
  2088. +               if (ioctl(fd, CA_GET_SLOT_INFO, &info) < 0)
  2089. +                   printf("IOCTL CA_GET_SLOT_INFO failed for slot %d\n", getSlotID());
  2090. +
  2091. +               if (info.flags & CA_CI_MODULE_READY)
  2092. +               {
  2093. +                   printf("2. cam status changed ->cam now present\n");
  2094. +                   mmi_active = false;
  2095. +                   state = stateInvalid;
  2096. +                   application_manager = 0;
  2097. +                   ca_manager = 0;
  2098. +                   tx_time.tv_sec = 0;
  2099. +                   eDVBCI_UI::getInstance()->setState(getSlotID(),1);
  2100. +               }
  2101. +               else if (!(info.flags & CA_CI_MODULE_READY))
  2102. +               {
  2103. +                   printf("cam status changed ->cam now _not_ present\n");
  2104. +                   eDVBCISession::deleteSessions(this);
  2105. +                   mmi_active = false;
  2106. +                   state = stateInvalid;
  2107. +                   application_manager = 0;
  2108. +                   ca_manager = 0;
  2109. +                   tx_time.tv_sec = 0;
  2110. +                   eDVBCIInterfaces::getInstance()->ciRemoved(this);
  2111. +                   eDVBCI_UI::getInstance()->setState(getSlotID(),0);
  2112. +                   while (sendqueue.size())
  2113. +                   {
  2114. +                       delete [] sendqueue.top().data;
  2115. +                       sendqueue.pop();
  2116. +                   }
  2117. +               }
  2118. +           }
  2119. +       }
  2120. +       break;
  2121. +       default:
  2122. +           printf("unknown state %d\n", state);
  2123. +       break;
  2124. +   }
  2125. +   notifier->setRequested(eSocketNotifier::Read | eSocketNotifier::Priority | eSocketNotifier::Write);
  2126. +#endif
  2127. }
  2128.  
  2129. DEFINE_REF(eDVBCISlot);
  2130. @@ -1037,7 +1435,11 @@
  2131.    
  2132.     slotid = nr;
  2133.  
  2134. +#ifdef __sh__
  2135. +   sprintf(filename, "/dev/dvb/adapter0/ci%d", nr);
  2136. +#else
  2137.     sprintf(filename, "/dev/ci%d", nr);
  2138. +#endif
  2139.  
  2140.  // possible_caids.insert(0x1702);
  2141.  // possible_providers.insert(providerPair("PREMIERE", 0xC00000));
  2142. @@ -1048,10 +1450,24 @@
  2143.     eDebugCI("CI Slot %d has fd %d", getSlotID(), fd);
  2144.     state = stateInvalid;
  2145.  
  2146. +#ifdef __sh__
  2147. +   receivedLen = 0;
  2148. +   receivedData = NULL;
  2149. +#endif
  2150.     if (fd >= 0)
  2151.     {
  2152. +#ifdef __sh__
  2153. +       connection_id = slotid + 1;
  2154. +       tx_time.tv_sec = 0;
  2155. +       tx_time.tv_usec = 0;
  2156. +       last_poll_time.tv_sec = 0;
  2157. +       last_poll_time.tv_nsec = 0;
  2158. +#endif
  2159.         notifier = eSocketNotifier::create(context, fd, eSocketNotifier::Read | eSocketNotifier::Priority | eSocketNotifier::Write);
  2160.         CONNECT(notifier->activated, eDVBCISlot::data);
  2161. +#ifdef __sh__
  2162. +       reset();
  2163. +#endif
  2164.     } else
  2165.     {
  2166.         perror(filename);
  2167. @@ -1087,6 +1503,13 @@
  2168. {
  2169.     eDebug("CI Slot %d: reset requested", getSlotID());
  2170.  
  2171. +#ifdef __sh__
  2172. +   state = stateInvalid;
  2173. +   mmi_active = false;
  2174. +   eDVBCI_UI::getInstance()->setAppName(getSlotID(), "");
  2175. +   eDVBCISession::deleteSessions(this);
  2176. +   eDVBCIInterfaces::getInstance()->ciRemoved(this);
  2177. +#else
  2178.     if (state == stateInvalid)
  2179.     {
  2180.         unsigned char buf[256];
  2181. @@ -1094,6 +1517,7 @@
  2182.         while(::read(fd, buf, 256)>0);
  2183.         state = stateResetted;
  2184.     }
  2185. +#endif
  2186.  
  2187.     while(sendqueue.size())
  2188.     {
  2189. @@ -1101,7 +1525,12 @@
  2190.         sendqueue.pop();
  2191.     }
  2192.  
  2193. +#ifdef __sh__
  2194. +   if (ioctl(fd, CA_RESET, getSlotID()) < 0)
  2195. +       eDebug("IOCTL CA_RESET failed for slot %d\n", slotid);
  2196. +#else
  2197.     ioctl(fd, 0);
  2198. +#endif
  2199.  
  2200.     return 0;
  2201. }
  2202. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb_ci/dvbci.h enigma2-nightly.patched/lib/dvb_ci/dvbci.h
  2203. --- enigma2-nightly.org/lib/dvb_ci/dvbci.h  2013-08-11 08:11:19.150306132 +0200
  2204. +++ enigma2-nightly.patched/lib/dvb_ci/dvbci.h  2013-10-26 03:02:27.185604816 +0200
  2205. @@ -5,6 +5,9 @@
  2206.  
  2207. #include <lib/base/ebase.h>
  2208. #include <lib/service/iservice.h>
  2209. +#ifdef __sh__
  2210. +#include <lib/base/thread.h>
  2211. +#endif
  2212. #include <lib/python/python.h>
  2213. #include <set>
  2214. #include <queue>
  2215. @@ -43,6 +46,42 @@
  2216. typedef std::set<uint16_t> caidSet;
  2217. typedef std::set<eServiceReference> serviceSet;
  2218.  
  2219. +#ifdef __sh__
  2220. +/* ********************************** */
  2221. +/* constants taken from dvb-apps
  2222. + */
  2223. +#define T_SB                0x80   // sb                           primitive   h<--m
  2224. +#define T_RCV               0x81   // receive                      primitive   h-->m
  2225. +#define T_CREATE_T_C        0x82   // create transport connection  primitive   h-->m
  2226. +#define T_C_T_C_REPLY       0x83   // ctc reply                    primitive   h<--m
  2227. +#define T_DELETE_T_C        0x84   // delete tc                    primitive   h<->m
  2228. +#define T_D_T_C_REPLY       0x85   // dtc reply                    primitive   h<->m
  2229. +#define T_REQUEST_T_C       0x86   // request transport connection primitive   h<--m
  2230. +#define T_NEW_T_C           0x87   // new tc / reply to t_request  primitive   h-->m
  2231. +#define T_T_C_ERROR         0x77   // error creating tc            primitive   h-->m
  2232. +#define T_DATA_LAST         0xA0   // convey data from higher      constructed h<->m
  2233. +                // layers
  2234. +#define T_DATA_MORE         0xA1   // convey data from higher      constructed h<->m
  2235. +                // layers
  2236. +
  2237. +typedef enum {eDataTimeout, eDataError, eDataReady, eDataWrite, eDataStatusChanged} eData;
  2238. +
  2239. +static inline int time_after(struct timespec oldtime, uint32_t delta_ms)
  2240. +{
  2241. +   // calculate the oldtime + add on the delta
  2242. +   uint64_t oldtime_ms = (oldtime.tv_sec * 1000) + (oldtime.tv_nsec / 1000000);
  2243. +   oldtime_ms += delta_ms;
  2244. +
  2245. +   // calculate the nowtime
  2246. +   struct timespec nowtime;
  2247. +   clock_gettime(CLOCK_MONOTONIC, &nowtime);
  2248. +   uint64_t nowtime_ms = (nowtime.tv_sec * 1000) + (nowtime.tv_nsec / 1000000);
  2249. +
  2250. +   // check
  2251. +   return nowtime_ms > oldtime_ms;
  2252. +}
  2253. +#endif
  2254. +
  2255. class eDVBCISlot: public iObject, public Object
  2256. {
  2257.     friend class eDVBCIInterfaces;
  2258. @@ -66,6 +105,13 @@
  2259.     bool user_mapped;
  2260.     void data(int);
  2261.     bool plugged;
  2262. +#ifdef __sh__
  2263. +   //dagobert
  2264. +   char connection_id;
  2265. +   bool mmi_active;
  2266. +   int receivedLen;
  2267. +   unsigned char* receivedData;
  2268. +#endif
  2269. public:
  2270.     enum {stateRemoved, stateInserted, stateInvalid, stateResetted};
  2271.     eDVBCISlot(eMainloop *context, int nr);
  2272. @@ -95,6 +141,17 @@
  2273.     int getNumOfServices() { return running_services.size(); }
  2274.     int setSource(data_source source);
  2275.     int setClockRate(int);
  2276. +#ifdef __sh__
  2277. +   bool checkQueueSize();
  2278. +   void thread();
  2279. +   void mmiOpened() { mmi_active = true; };
  2280. +   void mmiClosed() { mmi_active = false; };
  2281. +   void process_tpdu(unsigned char tpdu_tag, __u8* data, int asn_data_length, int con_id);
  2282. +   bool sendCreateTC();
  2283. +   eData sendData(unsigned char* data, int len);
  2284. +   struct timeval tx_time;
  2285. +   struct timespec last_poll_time;
  2286. +#endif
  2287. };
  2288.  
  2289. struct CIPmtHandler
  2290. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb_ci/dvbci_mmi.cpp enigma2-nightly.patched/lib/dvb_ci/dvbci_mmi.cpp
  2291. --- enigma2-nightly.org/lib/dvb_ci/dvbci_mmi.cpp    2013-08-11 08:11:19.150306132 +0200
  2292. +++ enigma2-nightly.patched/lib/dvb_ci/dvbci_mmi.cpp    2013-10-26 03:02:27.185604816 +0200
  2293. @@ -25,6 +25,9 @@
  2294.  
  2295. eDVBCIMMISession::~eDVBCIMMISession()
  2296. {
  2297. +#ifdef __sh__
  2298. +   slot->mmiClosed();
  2299. +#endif
  2300.     slot->setMMIManager(NULL);
  2301.     eDVBCI_UI::getInstance()->mmiSessionDestroyed(slot->getSlotID());
  2302. }
  2303. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb_ci/dvbci_resmgr.cpp enigma2-nightly.patched/lib/dvb_ci/dvbci_resmgr.cpp
  2304. --- enigma2-nightly.org/lib/dvb_ci/dvbci_resmgr.cpp 2013-08-11 08:11:19.150306132 +0200
  2305. +++ enigma2-nightly.patched/lib/dvb_ci/dvbci_resmgr.cpp 2013-10-26 03:02:27.189604791 +0200
  2306. @@ -5,7 +5,12 @@
  2307.  
  2308. int eDVBCIResourceManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
  2309. {
  2310. +#ifdef __sh__
  2311. +   eDebug("eDVBCIResourceManagerSession::%s >", __func__);
  2312. +   eDebugNoNewLine("SESSION(%d) %02x %02x %02x (len = %d): ", session_nb, tag[0], tag[1], tag[2], len);
  2313. +#else
  2314.     eDebugNoNewLine("SESSION(%d) %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
  2315. +#endif
  2316.     for (int i=0; i<len; i++)
  2317.         eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
  2318.     eDebug("");
  2319. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/dvb_ci/dvbci_session.cpp enigma2-nightly.patched/lib/dvb_ci/dvbci_session.cpp
  2320. --- enigma2-nightly.org/lib/dvb_ci/dvbci_session.cpp    2013-08-11 08:11:19.150306132 +0200
  2321. +++ enigma2-nightly.patched/lib/dvb_ci/dvbci_session.cpp    2013-10-26 03:02:27.189604791 +0200
  2322. @@ -257,6 +257,12 @@
  2323.         if ((!session_nb) || (session_nb >= SLMS))
  2324.         {
  2325.             eDebug("PROTOCOL: illegal session number %x", session_nb);
  2326. +#ifdef __sh__
  2327. +           //Dagobert during start-up we seems to have some problems
  2328. +           //on some modules which "looses" the connection. So reset it
  2329. +           deleteSessions(slot);
  2330. +           slot->reset();
  2331. +#endif
  2332.             return;
  2333.         }
  2334.        
  2335. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/accel.cpp enigma2-nightly.patched/lib/gdi/accel.cpp
  2336. --- enigma2-nightly.org/lib/gdi/accel.cpp   2013-08-11 08:11:19.150306132 +0200
  2337. +++ enigma2-nightly.patched/lib/gdi/accel.cpp   2013-10-26 03:02:27.189604791 +0200
  2338. @@ -15,8 +15,25 @@
  2339. // #define ACCEL_DEBUG
  2340.  
  2341. gAccel *gAccel::instance;
  2342. +#if not defined(__sh__)
  2343. #define BCM_ACCEL
  2344. +#else
  2345. +#define STMFB_ACCEL
  2346. +#endif
  2347.  
  2348. +#ifdef STMFB_ACCEL
  2349. +extern int stmfb_accel_init(void);
  2350. +extern void stmfb_accel_close(void);
  2351. +extern void stmfb_accel_blit(
  2352. +       int src_addr, int src_width, int src_height, int src_stride, int src_format,
  2353. +       int dst_addr, int dst_width, int dst_height, int dst_stride,
  2354. +       int src_x, int src_y, int width, int height,
  2355. +       int dst_x, int dst_y, int dwidth, int dheight);
  2356. +extern void stmfb_accel_fill(
  2357. +       int dst_addr, int dst_width, int dst_height, int dst_stride,
  2358. +       int x, int y, int width, int height,
  2359. +       unsigned long color);
  2360. +#endif
  2361. #ifdef ATI_ACCEL
  2362. extern int ati_accel_init(void);
  2363. extern void ati_accel_close(void);
  2364. @@ -53,6 +70,9 @@
  2365. {
  2366.     instance = this;
  2367.  
  2368. +#ifdef STMFB_ACCEL
  2369. +   stmfb_accel_init();
  2370. +#endif
  2371.  #ifdef ATI_ACCEL  
  2372.     ati_accel_init();
  2373. #endif
  2374. @@ -63,6 +83,9 @@
  2375.  
  2376. gAccel::~gAccel()
  2377. {
  2378. +#ifdef STMFB_ACCEL
  2379. +   stmfb_accel_close();
  2380. +#endif
  2381. #ifdef ATI_ACCEL
  2382.     ati_accel_close();
  2383. #endif
  2384. @@ -146,6 +169,76 @@
  2385.  
  2386. int gAccel::blit(gUnmanagedSurface *dst, gUnmanagedSurface *src, const eRect &p, const eRect &area, int flags)
  2387. {
  2388. +#ifdef STMFB_ACCEL
  2389. +   //eDebug( "src: %4d %4d %4d %4d\tdst: %4d %4d %4d %4d\n"
  2390. +   //      "area: %4d %4d %4d %4d\tp: %4d %4d %4d %4d\n",
  2391. +   //      src->data_phys, src->x, src->y, src->stride,
  2392. +   //      dst->data_phys, dst->x, dst->y, dst->stride,
  2393. +   //      area.left(), area.top(), area.width(), area.height(),
  2394. +   //      p.x(), p.y(), p.width(), p.height());
  2395. +
  2396. +   int src_format = 0;
  2397. +   gUnmanagedSurface *surfaceTmp = new gUnmanagedSurface(area.width(), area.height(), dst->bpp);
  2398. +
  2399. +   if (src->bpp == 32)
  2400. +       src_format = 0;
  2401. +   else if ((src->bpp == 8) && (dst->bpp == 32))
  2402. +   {
  2403. +       src_format = 1;
  2404. +       if (accelAlloc(surfaceTmp))
  2405. +           return -1;
  2406. +
  2407. +       __u8 *srcptr=(__u8*)src->data;
  2408. +       __u8 *dstptr=(__u8*)surfaceTmp->data;
  2409. +       __u32 pal[256];
  2410. +
  2411. +       for (int i=0; i<256; ++i)
  2412. +       {
  2413. +           if (src->clut.data && (i<src->clut.colors))
  2414. +               pal[i]=(src->clut.data[i].a<<24)|(src->clut.data[i].r<<16)|(src->clut.data[i].g<<8)|(src->clut.data[i].b);
  2415. +           else
  2416. +               pal[i]=0x010101*i;
  2417. +           if ((pal[i]&0xFF000000) >= 0xE0000000)
  2418. +               pal[i] = 0xFF000000;
  2419. +           pal[i]^=0xFF000000;
  2420. +       }
  2421. +       srcptr+=area.left()*src->bypp+area.top()*src->stride;
  2422. +
  2423. +       for (int y=0; y<area.height(); y++)
  2424. +       {
  2425. +           int width=area.width();
  2426. +           unsigned char *psrc=(unsigned char*)srcptr;
  2427. +           __u32 *pdst=(__u32*)dstptr;
  2428. +
  2429. +           while (width--)
  2430. +               *pdst++=pal[*psrc++];
  2431. +
  2432. +           srcptr+=src->stride;
  2433. +           dstptr+=area.width() * 4;
  2434. +       }
  2435. +   } else {
  2436. +       if (surfaceTmp->data_phys)
  2437. +           accelFree(surfaceTmp);
  2438. +       return -1;
  2439. +   }
  2440. +
  2441. +   if (surfaceTmp->data_phys)
  2442. +   {
  2443. +       stmfb_accel_blit(
  2444. +           surfaceTmp->data_phys, 0, 0, area.width() * 4, src_format,
  2445. +           dst->data_phys, dst->x, dst->y, dst->stride,
  2446. +           0, 0, area.width(), area.height(),
  2447. +           p.x(), p.y(), p.width(), p.height());
  2448. +       accelFree(surfaceTmp);
  2449. +   } else {
  2450. +       stmfb_accel_blit(
  2451. +           src->data_phys, src->x, src->y, src->stride, src_format,
  2452. +           dst->data_phys, dst->x, dst->y, dst->stride,
  2453. +           area.left(), area.top(), area.width(), area.height(),
  2454. +           p.x(), p.y(), p.width(), p.height());
  2455. +   }
  2456. +   return 0;
  2457. +#endif
  2458. #ifdef ATI_ACCEL
  2459.     ati_accel_blit(
  2460.         src->data_phys, src->x, src->y, src->stride,
  2461. @@ -274,9 +367,8 @@
  2462.  
  2463. void gAccel::accelFree(gUnmanagedSurface* surface)
  2464. {
  2465. -   int phys_addr = surface->data_phys;
  2466. -   if (phys_addr != 0)
  2467. -   {
  2468. +   if(surface != 0 && surface->data_phys != 0) {
  2469. +       int phys_addr = surface->data_phys;
  2470. #ifdef ACCEL_DEBUG
  2471.         eDebug("[%s] %p->%x %dx%d:%d", __func__, surface, surface->data_phys, surface->x, surface->y, surface->bpp);
  2472. #endif
  2473. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/fb.cpp enigma2-nightly.patched/lib/gdi/fb.cpp
  2474. --- enigma2-nightly.org/lib/gdi/fb.cpp  2013-08-11 08:11:19.154306132 +0200
  2475. +++ enigma2-nightly.patched/lib/gdi/fb.cpp  2013-10-26 03:02:27.189604791 +0200
  2476. @@ -8,6 +8,9 @@
  2477. #include <linux/kd.h>
  2478.  
  2479. #include <lib/gdi/fb.h>
  2480. +#ifdef __sh__
  2481. +#include <linux/stmfb.h>
  2482. +#endif
  2483.  
  2484. #ifndef FBIO_WAITFORVSYNC
  2485. #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32)
  2486. @@ -47,11 +50,13 @@
  2487.     }
  2488.  
  2489.  
  2490. +#if not defined(__sh__)
  2491.     if (ioctl(fbFd, FBIOGET_VSCREENINFO, &screeninfo)<0)
  2492.     {
  2493.         perror("FBIOGET_VSCREENINFO");
  2494.         goto nolfb;
  2495.     }
  2496. +#endif
  2497.  
  2498.     fb_fix_screeninfo fix;
  2499.     if (ioctl(fbFd, FBIOGET_FSCREENINFO, &fix)<0)
  2500. @@ -62,8 +67,17 @@
  2501.  
  2502.     available=fix.smem_len;
  2503.     m_phys_mem = fix.smem_start;
  2504. +#if defined(__sh__)
  2505. +   eDebug("%dk total video mem", available/1024);
  2506. +   // The first 1920x1080x4 bytes are reserved
  2507. +   // After that we can take 1280x720x4 bytes for our virtual framebuffer
  2508. +   available -= 1920*1080*4;
  2509. +   eDebug("%dk usable video mem", available/1024);
  2510. +   lfb=(unsigned char*)mmap(0, available, PROT_WRITE|PROT_READ, MAP_SHARED, fbFd, 1920*1080*4);
  2511. +#else
  2512.     eDebug("%dk video mem", available/1024);
  2513.     lfb=(unsigned char*)mmap(0, available, PROT_WRITE|PROT_READ, MAP_SHARED, fbFd, 0);
  2514. +#endif
  2515.     if (!lfb)
  2516.     {
  2517.         perror("mmap");
  2518. @@ -86,6 +100,7 @@
  2519.  
  2520. int fbClass::showConsole(int state)
  2521. {
  2522. +#if not defined(__sh__)
  2523.     int fd=open("/dev/tty0", O_RDWR);
  2524.     if(fd>=0)
  2525.     {
  2526. @@ -95,11 +110,19 @@
  2527.         }
  2528.         close(fd);
  2529.     }
  2530. +#endif
  2531.     return 0;
  2532. }
  2533.  
  2534. int fbClass::SetMode(int nxRes, int nyRes, int nbpp)
  2535. {
  2536. +#if defined(__sh__)
  2537. +   xRes=nxRes;
  2538. +   yRes=nyRes;
  2539. +   bpp=32;
  2540. +   m_number_of_pages = 1;
  2541. +   topDiff=bottomDiff=leftDiff=rightDiff = 0;
  2542. +#else
  2543.     screeninfo.xres_virtual=screeninfo.xres=nxRes;
  2544.     screeninfo.yres_virtual=(screeninfo.yres=nyRes)*2;
  2545.     screeninfo.height=0;
  2546. @@ -132,6 +155,7 @@
  2547.         break;
  2548.     }
  2549.  
  2550. +
  2551.     if (ioctl(fbFd, FBIOPUT_VSCREENINFO, &screeninfo)<0)
  2552.     {
  2553.         // try single buffering
  2554. @@ -146,11 +170,18 @@
  2555.         eDebug(" - double buffering not available.");
  2556.     } else
  2557.         eDebug(" - double buffering available!");
  2558. +
  2559.    
  2560.     m_number_of_pages = screeninfo.yres_virtual / nyRes;
  2561.    
  2562. +#endif
  2563.     ioctl(fbFd, FBIOGET_VSCREENINFO, &screeninfo);
  2564.    
  2565. +#if defined(__sh__)
  2566. +   xResSc=screeninfo.xres;
  2567. +   yResSc=screeninfo.yres;
  2568. +   stride=xRes*4;
  2569. +#else
  2570.     if ((screeninfo.xres!=nxRes) && (screeninfo.yres!=nyRes) && (screeninfo.bits_per_pixel!=nbpp))
  2571.     {
  2572.         eDebug("SetMode failed: wanted: %dx%dx%d, got %dx%dx%d",
  2573. @@ -168,15 +199,22 @@
  2574.     }
  2575.     stride=fix.line_length;
  2576.     memset(lfb, 0, stride*yRes);
  2577. +#endif
  2578.     blit();
  2579.     return 0;
  2580. }
  2581.  
  2582. void fbClass::getMode(int &xres, int &yres, int &bpp)
  2583. {
  2584. +#if defined(__sh__)
  2585. +   xres = xRes;
  2586. +   yres = yRes;
  2587. +   bpp = 32;
  2588. +#else
  2589.     xres = screeninfo.xres;
  2590.     yres = screeninfo.yres;
  2591.     bpp = screeninfo.bits_per_pixel;
  2592. +#endif
  2593. }
  2594.  
  2595. int fbClass::setOffset(int off)
  2596. @@ -194,10 +232,93 @@
  2597.  
  2598. void fbClass::blit()
  2599. {
  2600. +#if defined(__sh__)
  2601. +   int modefd=open("/proc/stb/video/3d_mode", O_RDWR);
  2602. +   char buf[16] = "off";
  2603. +   if (modefd > 0)
  2604. +   {
  2605. +       read(modefd, buf, 15);
  2606. +       buf[15]='\0';
  2607. +       close(modefd);
  2608. +   }
  2609. +
  2610. +   STMFBIO_BLT_DATA    bltData;
  2611. +   memset(&bltData, 0, sizeof(STMFBIO_BLT_DATA));
  2612. +   bltData.operation  = BLT_OP_COPY;
  2613. +   bltData.srcOffset  = 1920*1080*4;
  2614. +   bltData.srcPitch   = xRes * 4;
  2615. +   bltData.dstOffset  = 0;
  2616. +   bltData.dstPitch   = xResSc*4;
  2617. +   bltData.src_top    = 0;
  2618. +   bltData.src_left   = 0;
  2619. +   bltData.src_right  = xRes;
  2620. +   bltData.src_bottom = yRes;
  2621. +   bltData.srcFormat  = SURF_BGRA8888;
  2622. +   bltData.dstFormat  = SURF_BGRA8888;
  2623. +   bltData.srcMemBase = STMFBGP_FRAMEBUFFER;
  2624. +   bltData.dstMemBase = STMFBGP_FRAMEBUFFER;
  2625. +
  2626. +   if (strncmp(buf,"sbs",3)==0)
  2627. +   {
  2628. +       bltData.dst_top    = 0 + topDiff;
  2629. +       bltData.dst_left   = 0 + leftDiff/2;
  2630. +       bltData.dst_right  = xResSc/2 + rightDiff/2;
  2631. +       bltData.dst_bottom = yResSc + bottomDiff;
  2632. +       if (ioctl(fbFd, STMFBIO_BLT, &bltData ) < 0)
  2633. +       {
  2634. +           perror("STMFBIO_BLT");
  2635. +       }
  2636. +       bltData.dst_top    = 0 + topDiff;
  2637. +       bltData.dst_left   = xResSc/2 + leftDiff/2;
  2638. +       bltData.dst_right  = xResSc + rightDiff/2;
  2639. +       bltData.dst_bottom = yResSc + bottomDiff;
  2640. +       if (ioctl(fbFd, STMFBIO_BLT, &bltData ) < 0)
  2641. +       {
  2642. +           perror("STMFBIO_BLT");
  2643. +       }
  2644. +   }
  2645. +   else if (strncmp(buf,"tab",3)==0)
  2646. +   {
  2647. +       bltData.dst_top    = 0 + topDiff/2;
  2648. +       bltData.dst_left   = 0 + leftDiff;
  2649. +       bltData.dst_right  = xResSc + rightDiff;
  2650. +       bltData.dst_bottom = yResSc/2 + bottomDiff/2;
  2651. +       if (ioctl(fbFd, STMFBIO_BLT, &bltData ) < 0)
  2652. +       {
  2653. +           perror("STMFBIO_BLT");
  2654. +       }
  2655. +       bltData.dst_top    = yResSc/2 + topDiff/2;
  2656. +       bltData.dst_left   = 0 + leftDiff;
  2657. +       bltData.dst_right  = xResSc + rightDiff;
  2658. +       bltData.dst_bottom = yResSc + bottomDiff/2;
  2659. +       if (ioctl(fbFd, STMFBIO_BLT, &bltData ) < 0)
  2660. +       {
  2661. +           perror("STMFBIO_BLT");
  2662. +       }
  2663. +   }
  2664. +   else
  2665. +   {
  2666. +       bltData.dst_top    = 0 + topDiff;
  2667. +       bltData.dst_left   = 0 + leftDiff;
  2668. +       bltData.dst_right  = xResSc + rightDiff;
  2669. +       bltData.dst_bottom = yResSc + bottomDiff;
  2670. +       if (ioctl(fbFd, STMFBIO_BLT, &bltData ) < 0)
  2671. +       {
  2672. +           perror("STMFBIO_BLT");
  2673. +       }
  2674. +  
  2675. +   }
  2676. +
  2677. +   if (ioctl(fbFd, STMFBIO_SYNC_BLITTER) < 0)
  2678. +   {
  2679. +       perror("STMFBIO_SYNC_BLITTER");
  2680. +   }
  2681. +#else
  2682.     if (m_manual_blit == 1) {
  2683.         if (ioctl(fbFd, FBIO_BLIT) < 0)
  2684.             perror("FBIO_BLIT");
  2685.     }
  2686. +#endif
  2687. }
  2688.  
  2689. fbClass::~fbClass()
  2690. @@ -232,6 +353,26 @@
  2691.     }
  2692.     else
  2693.         locked = 1;
  2694. +
  2695. +#if defined(__sh__)
  2696. +   outcfg.outputid = STMFBIO_OUTPUTID_MAIN;
  2697. +   if (ioctl( fbFd, STMFBIO_GET_OUTPUT_CONFIG, &outcfg ) < 0)
  2698. +       perror("STMFBIO_GET_OUTPUT_CONFIG\n");
  2699. +
  2700. +   outinfo.outputid = STMFBIO_OUTPUTID_MAIN;
  2701. +   if (ioctl( fbFd, STMFBIO_GET_OUTPUTINFO, &outinfo ) < 0)
  2702. +       perror("STMFBIO_GET_OUTPUTINFO\n");
  2703. +
  2704. +   //if (ioctl( fbFd, STMFBIO_GET_VAR_SCREENINFO_EX, &infoex ) < 0)
  2705. +   //  printf("ERROR\n");
  2706. +
  2707. +   planemode.layerid = 0;
  2708. +   if (ioctl( fbFd, STMFBIO_GET_PLANEMODE, &planemode ) < 0)
  2709. +       perror("STMFBIO_GET_PLANEMODE\n");
  2710. +
  2711. +   if (ioctl( fbFd, STMFBIO_GET_VAR_SCREENINFO_EX, &infoex ) < 0)
  2712. +       perror("STMFBIO_GET_VAR_SCREENINFO_EX\n");
  2713. +#endif
  2714.     return fbFd;
  2715. }
  2716.  
  2717. @@ -242,25 +383,88 @@
  2718.     if (locked == 2)  // re-enable manualBlit
  2719.         enableManualBlit();
  2720.     locked=0;
  2721. +
  2722. +#if defined(__sh__)
  2723. +   if (ioctl( fbFd, STMFBIO_SET_VAR_SCREENINFO_EX, &infoex ) < 0)
  2724. +       perror("STMFBIO_SET_VAR_SCREENINFO_EX\n");
  2725. +
  2726. +   if (ioctl( fbFd, STMFBIO_SET_PLANEMODE, &planemode ) < 0)
  2727. +       perror("STMFBIO_SET_PLANEMODE\n");
  2728. +
  2729. +   if (ioctl( fbFd, STMFBIO_SET_VAR_SCREENINFO_EX, &infoex ) < 0)
  2730. +       perror("STMFBIO_SET_VAR_SCREENINFO_EX\n");
  2731. +
  2732. +   if (ioctl( fbFd, STMFBIO_SET_OUTPUTINFO, &outinfo ) < 0)
  2733. +       perror("STMFBIO_SET_OUTPUTINFO\n");
  2734. +
  2735. +   if (ioctl( fbFd, STMFBIO_SET_OUTPUT_CONFIG, &outcfg ) < 0)
  2736. +       perror("STMFBIO_SET_OUTPUT_CONFIG\n");
  2737. +
  2738. +   memset(lfb, 0, stride*yRes);
  2739. +#endif
  2740. +
  2741.     SetMode(xRes, yRes, bpp);
  2742.     PutCMAP();
  2743. }
  2744.  
  2745. void fbClass::enableManualBlit()
  2746. {
  2747. +#if not defined(__sh__)
  2748.     unsigned char tmp = 1;
  2749.     if (ioctl(fbFd,FBIO_SET_MANUAL_BLIT, &tmp)<0)
  2750.         perror("FBIO_SET_MANUAL_BLIT");
  2751.     else
  2752.         m_manual_blit = 1;
  2753. +#endif
  2754. }
  2755.  
  2756. void fbClass::disableManualBlit()
  2757. {
  2758. +#if not defined(__sh__)
  2759.     unsigned char tmp = 0;
  2760.     if (ioctl(fbFd,FBIO_SET_MANUAL_BLIT, &tmp)<0)
  2761.         perror("FBIO_SET_MANUAL_BLIT");
  2762.     else
  2763.         m_manual_blit = 0;
  2764. +#endif
  2765. +}
  2766. +
  2767. +#if defined(__sh__)
  2768. +void fbClass::clearFBblit()
  2769. +{
  2770. +   //set real frambuffer transparent
  2771. +// memset(lfb, 0x00, xRes * yRes * 4);
  2772. +   blit();
  2773. +}
  2774. +
  2775. +int fbClass::getFBdiff(int ret)
  2776. +{
  2777. +   if(ret == 0)
  2778. +       return topDiff;
  2779. +   else if(ret == 1)
  2780. +       return leftDiff;
  2781. +   else if(ret == 2)
  2782. +       return rightDiff;
  2783. +   else if(ret == 3)
  2784. +       return bottomDiff;
  2785. +   else
  2786. +       return -1;
  2787. }
  2788.  
  2789. +void fbClass::setFBdiff(int top, int left, int right, int bottom)
  2790. +{
  2791. +   if(top < 0) top = 0;
  2792. +   if(top > yRes) top = yRes;
  2793. +   topDiff = top;
  2794. +   if(left < 0) left = 0;
  2795. +   if(left > xRes) left = xRes;
  2796. +   leftDiff = left;
  2797. +   if(right > 0) right = 0;
  2798. +   if(-right > xRes) right = -xRes;
  2799. +   rightDiff = right;
  2800. +   if(bottom > 0) bottom = 0;
  2801. +   if(-bottom > yRes) bottom = -yRes;
  2802. +   bottomDiff = bottom;
  2803. +}
  2804. +#endif
  2805. +
  2806. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/fb.h enigma2-nightly.patched/lib/gdi/fb.h
  2807. --- enigma2-nightly.org/lib/gdi/fb.h    2013-08-11 08:11:19.154306132 +0200
  2808. +++ enigma2-nightly.patched/lib/gdi/fb.h    2013-10-26 03:02:27.197604774 +0200
  2809. @@ -3,11 +3,26 @@
  2810.  
  2811. #include <lib/base/eerror.h>
  2812. #include <linux/fb.h>
  2813. +#if defined(__sh__)
  2814. +   #include <linux/stmfb.h>
  2815. +#endif
  2816.  
  2817. class fbClass
  2818. {
  2819.     int fbFd;
  2820.     int xRes, yRes, stride, bpp;
  2821. +#if defined(__sh__)
  2822. +   struct stmfbio_output_configuration outcfg;
  2823. +   struct stmfbio_outputinfo outinfo;
  2824. +   struct stmfbio_planeinfo planemode;
  2825. +   struct stmfbio_var_screeninfo_ex infoex;
  2826. +
  2827. +   int xResSc, yResSc;
  2828. +   int topDiff, leftDiff, rightDiff, bottomDiff;
  2829. +#endif
  2830. +#ifdef ENABLE_LIBEPLAYER3
  2831. +// unsigned char *lfb_direct;
  2832. +#endif
  2833.     int available;
  2834.     struct fb_var_screeninfo screeninfo;
  2835.     fb_cmap cmap;
  2836. @@ -49,6 +64,19 @@
  2837.     int PutCMAP();
  2838. #endif
  2839.     static fbClass *getInstance();
  2840. +#ifdef ENABLE_LIBEPLAYER3
  2841. +//---> "hack" for libeplayer3 fb access
  2842. +   int getFD() { return fbFd; }
  2843. +   unsigned char * getLFB_Direct() { return lfb; }
  2844. +   int getScreenResX() { return xRes; }
  2845. +   int getScreenResY() { return yRes; }
  2846. +//---<
  2847. +#endif
  2848. +#if defined(__sh__)
  2849. +   void clearFBblit();
  2850. +   int getFBdiff(int ret);
  2851. +   void setFBdiff(int top, int right, int left, int bottom);
  2852. +#endif
  2853.  
  2854.     int lock();
  2855.     void unlock();
  2856. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/gfbdc.cpp enigma2-nightly.patched/lib/gdi/gfbdc.cpp
  2857. --- enigma2-nightly.org/lib/gdi/gfbdc.cpp   2013-08-11 08:11:19.154306132 +0200
  2858. +++ enigma2-nightly.patched/lib/gdi/gfbdc.cpp   2013-10-26 03:02:27.221604786 +0200
  2859. @@ -177,14 +177,36 @@
  2860.  
  2861. void gFBDC::setResolution(int xres, int yres, int bpp)
  2862. {
  2863. +#if defined(__sh__)
  2864. +   /* if xres and yres are negative call SetMode with the lates xres and yres
  2865. +    * we need that to read the new screen dimesnions after a resolution change
  2866. +    * without changing the frambuffer dimensions
  2867. +    */
  2868. +   int m_xres;
  2869. +   int m_yres;
  2870. +   int m_bpp;
  2871. +   fb->getMode(m_xres, m_yres, m_bpp);
  2872. +
  2873. +   if (xres<0 && yres<0 ) {
  2874. +       fb->SetMode(m_xres, m_yres, bpp);
  2875. +       return;
  2876. +   }
  2877. +#else
  2878.     if (m_pixmap && (surface.x == xres) && (surface.y == yres) && (surface.bpp == bpp))
  2879.         return;
  2880. +#endif
  2881.  
  2882.     if (gAccel::getInstance())
  2883.         gAccel::getInstance()->releaseAccelMemorySpace();
  2884.  
  2885.     fb->SetMode(xres, yres, bpp);
  2886.  
  2887. +#if defined(__sh__)
  2888. +
  2889. +   for (int y = 0; y<yres; y++) { // make whole screen transparent
  2890. +       memset(fb->lfb+y*fb->Stride(), 0x00, fb->Stride());
  2891. +   }
  2892. +#endif
  2893.     surface.x = xres;
  2894.     surface.y = yres;
  2895.     surface.bpp = bpp;
  2896. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/glcddc.cpp enigma2-nightly.patched/lib/gdi/glcddc.cpp
  2897. --- enigma2-nightly.org/lib/gdi/glcddc.cpp  2013-08-11 08:11:19.154306132 +0200
  2898. +++ enigma2-nightly.patched/lib/gdi/glcddc.cpp  2013-10-26 03:02:27.221604786 +0200
  2899. @@ -5,6 +5,21 @@
  2900.  
  2901. gLCDDC *gLCDDC::instance;
  2902.  
  2903. +#ifdef HAVE_GRAPHLCD
  2904. +static inline int time_after(struct timespec oldtime, uint32_t delta_ms)
  2905. +{
  2906. +   // calculate the oldtime + add on the delta
  2907. +   uint64_t oldtime_ms = (oldtime.tv_sec * 1000) + (oldtime.tv_nsec / 1000000);
  2908. +   oldtime_ms += delta_ms;
  2909. +   // calculate the nowtime
  2910. +   struct timespec nowtime;
  2911. +   clock_gettime(CLOCK_MONOTONIC, &nowtime);
  2912. +   uint64_t nowtime_ms = (nowtime.tv_sec * 1000) + (nowtime.tv_nsec / 1000000);
  2913. +   // check
  2914. +   return nowtime_ms > oldtime_ms;
  2915. +}
  2916. +#endif
  2917. +
  2918. gLCDDC::gLCDDC()
  2919. {
  2920.     lcd = new eDBoxLCD();
  2921. @@ -23,11 +38,18 @@
  2922.     eDebug("LCD resolution: %d x %d x %d (stride: %d)", surface.x, surface.y, surface.bpp, surface.stride);
  2923.  
  2924.     m_pixmap = new gPixmap(&surface);
  2925. +#ifdef HAVE_GRAPHLCD
  2926. +   clock_gettime(CLOCK_MONOTONIC, &last_update);
  2927. +#endif
  2928. }
  2929.  
  2930. gLCDDC::~gLCDDC()
  2931. {
  2932. +#ifndef HAVE_GRAPHLCD
  2933. +//konfetti: not sure why, but calling the destructor if external lcd (pearl) is selected
  2934. +//e2 crashes. this is also true if the destructor does not contain any code !!!
  2935.     delete lcd;
  2936. +#endif
  2937.     instance = 0;
  2938. }
  2939.  
  2940. @@ -46,8 +68,16 @@
  2941.         break;
  2942. #endif
  2943.     case gOpcode::flush:
  2944. +#ifdef HAVE_GRAPHLCD
  2945. +       if (update)
  2946. +       {
  2947. +           lcd->update();
  2948. +           clock_gettime(CLOCK_MONOTONIC, &last_update);
  2949. +       }
  2950. +#else
  2951.  //     if (update)
  2952.             lcd->update();
  2953. +#endif
  2954.     default:
  2955.         gDC::exec(o);
  2956.         break;
  2957. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/glcddc.h enigma2-nightly.patched/lib/gdi/glcddc.h
  2958. --- enigma2-nightly.org/lib/gdi/glcddc.h    2013-08-11 08:11:19.154306132 +0200
  2959. +++ enigma2-nightly.patched/lib/gdi/glcddc.h    2013-10-26 03:02:27.221604786 +0200
  2960. @@ -11,6 +11,9 @@
  2961.     int update;
  2962.     void exec(const gOpcode *opcode);
  2963.     gUnmanagedSurface surface;
  2964. +#ifdef HAVE_GRAPHLCD
  2965. +   struct timespec last_update;
  2966. +#endif
  2967. public:
  2968.     gLCDDC();
  2969.     ~gLCDDC();
  2970. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/gpixmap.cpp enigma2-nightly.patched/lib/gdi/gpixmap.cpp
  2971. --- enigma2-nightly.org/lib/gdi/gpixmap.cpp 2013-08-11 08:11:19.154306132 +0200
  2972. +++ enigma2-nightly.patched/lib/gdi/gpixmap.cpp 2013-10-26 03:02:27.225604784 +0200
  2973. @@ -200,6 +200,9 @@
  2974.             if (surface->clut.data && color < surface->clut.colors)
  2975.                 col = surface->clut.data[color].argb();
  2976.             else
  2977. +#if defined(__sh__)
  2978. +if ((col&0xFF000000) == 0xFF000000) col = 0xFF000000;
  2979. +#endif
  2980.                 col = 0x10101 * color;
  2981.            
  2982.             col^=0xFF000000;
  2983. @@ -234,6 +237,9 @@
  2984.             __u32 col;
  2985.  
  2986.             col = color.argb();
  2987. +#if defined(__sh__)
  2988. +if ((col&0xFF000000) == 0xFF000000) col = 0xFF000000;
  2989. +#endif
  2990.             col^=0xFF000000;
  2991.  
  2992. #ifdef GPIXMAP_DEBUG
  2993. @@ -833,11 +839,20 @@
  2994.  
  2995.     if (surface->bpp == 16)
  2996.     {
  2997. +
  2998. +#if defined(__sh__)
  2999. +#if BYTE_ORDER == LITTLE_ENDIAN
  3000. +       col = bswap_16(((col & 0xFF) >> 3) << 11 | ((col & 0xFF00) >> 10) << 5 | (col & 0xFF0000) >> 19);
  3001. +#else
  3002. +       col = ((col & 0xFF) >> 3) << 11 | ((col & 0xFF00) >> 10) << 5 | (col & 0xFF0000) >> 19;
  3003. +#endif
  3004. +#else
  3005. #if BYTE_ORDER == LITTLE_ENDIAN
  3006.         col = bswap_16(((col & 0xFF) >> 3) << 11 | ((col & 0xFF00) >> 10) << 5 | (col & 0xFF0000) >> 19);
  3007. #else
  3008.         col = ((col & 0xFF) >> 3) << 11 | ((col & 0xFF00) >> 10) << 5 | (col & 0xFF0000) >> 19;
  3009. #endif
  3010. +#endif
  3011.     }
  3012.     line(clip, start, dst, col);
  3013. }
  3014. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/lcd.cpp enigma2-nightly.patched/lib/gdi/lcd.cpp
  3015. --- enigma2-nightly.org/lib/gdi/lcd.cpp 2013-08-11 08:11:19.154306132 +0200
  3016. +++ enigma2-nightly.patched/lib/gdi/lcd.cpp 2013-10-26 03:02:27.225604784 +0200
  3017. @@ -60,6 +60,7 @@
  3018. }
  3019. #endif
  3020.  
  3021. +#ifndef HAVE_GRAPHLCD
  3022. eDBoxLCD::eDBoxLCD()
  3023. {
  3024.     int xres=132, yres=64, bpp=8;
  3025. @@ -301,3 +302,141 @@
  3026.     }
  3027. #endif
  3028. }
  3029. +
  3030. +#else
  3031. +
  3032. +void eDBoxLCD::setFlipped(bool onoff)
  3033. +{
  3034. +   flipped = onoff;
  3035. +   update();
  3036. +}
  3037. +
  3038. +/* **************************************************************** */
  3039. +/* Pearl LCD */
  3040. +
  3041. +eDBoxLCD::eDBoxLCD()
  3042. +{
  3043. +   eDebug("eDBoxLCD::eDBoxLCD >");
  3044. +
  3045. +   displayNumber = 0;
  3046. +   is_oled = 1;
  3047. +
  3048. +   instance=this;
  3049. +
  3050. +   if (GLCD::Config.Load("/etc/graphlcd.conf") == false)
  3051. +   {
  3052. +       eDebug("Error loading config file!\n");
  3053. +       return;
  3054. +   }
  3055. +   if (GLCD::Config.driverConfigs.size() <= 0)
  3056. +   {
  3057. +       eDebug("ERROR: No displays specified in config file!\n");
  3058. +   }
  3059. +
  3060. +   GLCD::Config.driverConfigs[displayNumber].upsideDown ^= 0;
  3061. +   GLCD::Config.driverConfigs[displayNumber].invert ^= 0;
  3062. +
  3063. +   lcd = GLCD::CreateDriver(GLCD::Config.driverConfigs[displayNumber].id, &GLCD::Config.driverConfigs[displayNumber]);
  3064. +
  3065. +   if (!lcd)
  3066. +   {
  3067. +       eDebug("ERROR: Failed creating display object\n");
  3068. +       return;
  3069. +   }
  3070. +   if (lcd->Init() != 0)
  3071. +   {
  3072. +#if 0
  3073. +   // Returning an error here will break the code at various other places
  3074. +       eDebug("ERROR: Failed initializing display\n");
  3075. +       delete lcd;
  3076. +       lcd = NULL;
  3077. +       return;
  3078. +#endif
  3079. +   }
  3080. +   lcd->SetBrightness(GLCD::Config.driverConfigs[displayNumber].brightness);
  3081. +
  3082. +   lcd->GetFeature((std::string) "depth", depth);
  3083. +   width = GLCD::Config.driverConfigs[displayNumber].width;
  3084. +   height = GLCD::Config.driverConfigs[displayNumber].height;
  3085. +
  3086. +   eDebug("config -> (w %d, h %d)", width, height);
  3087. +
  3088. +   bitmap = new GLCD::cBitmap(width, height);
  3089. +   bitmap->Clear();
  3090. +
  3091. +   lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height());
  3092. +   lcd->Refresh(true);
  3093. +
  3094. +   lcdfd = 1; //needed for detected()
  3095. +   setSize(width, height, depth);
  3096. +
  3097. +   eDebug("eDBoxLCD::eDBoxLCD (w %d, h %d, depth %d)<", width, height, depth);
  3098. +}
  3099. +
  3100. +void eDBoxLCD::setInverted(unsigned char inv)
  3101. +{
  3102. +   eDebug("eDBoxLCD::setInverted");
  3103. +   inverted = inv;
  3104. +   update();
  3105. +}
  3106. +
  3107. +int eDBoxLCD::setLCDContrast(int contrast)
  3108. +{
  3109. +   eDebug("[LCD] setLCDContrast not supported");
  3110. +   return(0);
  3111. +}
  3112. +
  3113. +int eDBoxLCD::setLCDBrightness(int brightness)
  3114. +{
  3115. +   eDebug("eDBoxLCD::setLCDBrightness");
  3116. +/* fixme range check */
  3117. +   lcd->SetBrightness(brightness);
  3118. +   return(0);
  3119. +}
  3120. +
  3121. +eDBoxLCD::~eDBoxLCD()
  3122. +{
  3123. +   eDebug("eDBoxLCD::~eDBoxLCD");
  3124. +}
  3125. +
  3126. +eDBoxLCD *eDBoxLCD::getInstance()
  3127. +{
  3128. +   eDebug("eDBoxLCD::getInstance");
  3129. +   return instance;
  3130. +}
  3131. +
  3132. +void eDBoxLCD::update()
  3133. +{
  3134. +   if (lcdfd == 1)
  3135. +   {
  3136. +       bitmap->Clear();
  3137. +       for (int x = 0; x < width; x++)
  3138. +           for (int y = 0; y < height; y++)
  3139. +           {
  3140. +               __u16 *buf16  = (__u16*) _buffer;
  3141. +#if BYTE_ORDER == LITTLE_ENDIAN
  3142. +               __u16 col16 = bswap_16(*((__u16*)(((__u16*)buf16) + y * width + x)));
  3143. +#else
  3144. +               __u16 col16 = *((__u16*)(((__u16*)buf16) + y * width + x));
  3145. +#endif
  3146. +               __u8 red, green, blue, alpha;
  3147. +               __u32 color32;
  3148. +
  3149. +               /* BBBBB GGGGGG RRRRR */
  3150. +               blue  = ((col16 & 0xF800) >> 11) * ( 255 / 31);
  3151. +               green = ((col16 & 0x7E0) >> 5) * (255 / 63);
  3152. +               red   = (col16 & 0x1f) * (255 / 31);
  3153. +               alpha = 255;
  3154. +
  3155. +               color32 = alpha << 24 | red << 16 | green << 8 | blue;
  3156. +
  3157. +               if (inverted)
  3158. +                   color32 = 0xFFFFFF - color32;
  3159. +
  3160. +               bitmap->DrawPixel(x, y, color32);
  3161. +           }
  3162. +       lcd->SetScreen(bitmap->Data(), bitmap->Width(), bitmap->Height());
  3163. +       lcd->Refresh(false); /* partial update */
  3164. +   }
  3165. +}
  3166. +#endif
  3167. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/lcd.h enigma2-nightly.patched/lib/gdi/lcd.h
  3168. --- enigma2-nightly.org/lib/gdi/lcd.h   2013-08-11 08:11:19.154306132 +0200
  3169. +++ enigma2-nightly.patched/lib/gdi/lcd.h   2013-10-26 03:02:27.225604784 +0200
  3170. @@ -5,6 +5,17 @@
  3171. #include <lib/gdi/esize.h>
  3172. #include <lib/gdi/erect.h>
  3173.  
  3174. +#ifdef HAVE_GRAPHLCD
  3175. +#include <glcdgraphics/bitmap.h>
  3176. +#include <glcdgraphics/glcd.h>
  3177. +#include <glcdgraphics/image.h>
  3178. +#include <glcddrivers/config.h>
  3179. +#include <glcddrivers/driver.h>
  3180. +#include <glcddrivers/drivers.h>
  3181. +#include <glcdgraphics/extformats.h>
  3182. +#include <byteswap.h>
  3183. +#endif
  3184. +
  3185. #define LCD_CONTRAST_MIN 0
  3186. #define LCD_CONTRAST_MAX 63
  3187. #define LCD_BRIGHTNESS_MIN 0
  3188. @@ -48,6 +59,13 @@
  3189.     unsigned char inverted;
  3190.     bool flipped;
  3191.     int is_oled;
  3192. +#ifdef HAVE_GRAPHLCD
  3193. +   GLCD::cDriver * lcd;
  3194. +   GLCD::cBitmap * bitmap;
  3195. +   int displayNumber;
  3196. +   int depth;
  3197. +   int width, height;
  3198. +#endif
  3199. #ifdef SWIG
  3200.     eDBoxLCD();
  3201.     ~eDBoxLCD();
  3202. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/Makefile.inc enigma2-nightly.patched/lib/gdi/Makefile.inc
  3203. --- enigma2-nightly.org/lib/gdi/Makefile.inc    2013-08-11 08:11:19.150306132 +0200
  3204. +++ enigma2-nightly.patched/lib/gdi/Makefile.inc    2013-10-26 03:02:27.225604784 +0200
  3205. @@ -19,7 +19,8 @@
  3206.     gdi/lcd.cpp \
  3207.     gdi/picexif.cpp \
  3208.     gdi/picload.cpp \
  3209. -   gdi/region.cpp
  3210. +   gdi/region.cpp \
  3211. +   gdi/stmfb.cpp
  3212.  
  3213. gdiincludedir = $(pkgincludedir)/lib/gdi
  3214. gdiinclude_HEADERS = \
  3215. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/picload.cpp enigma2-nightly.patched/lib/gdi/picload.cpp
  3216. --- enigma2-nightly.org/lib/gdi/picload.cpp 2013-08-11 08:11:19.158306132 +0200
  3217. +++ enigma2-nightly.patched/lib/gdi/picload.cpp 2013-10-26 03:02:27.225604784 +0200
  3218. @@ -4,6 +4,7 @@
  3219.  
  3220. #include <lib/gdi/picload.h>
  3221. #include <lib/gdi/picexif.h>
  3222. +#include "libmmeimage/libmmeimage.h"
  3223.  
  3224. extern "C" {
  3225. #include <jpeglib.h>
  3226. @@ -663,7 +664,45 @@
  3227.  
  3228. void ePicLoad::decodePic()
  3229. {
  3230. -   eDebug("[Picload] decode picture... %s",m_filepara->file);
  3231. +   if (m_filepara->id == F_JPEG)
  3232. +   {
  3233. +       eDebug("[Picload] hardware decode picture... %s",m_filepara->file);
  3234. +       m_filepara->pic_buffer = NULL;
  3235. +       FILE *fp;
  3236. +
  3237. +       if (!(fp = fopen(m_filepara->file, "rb")))
  3238. +           return; // software decode won't find the file either...
  3239. +      
  3240. +       if (get_jpeg_img_size(fp, (unsigned int *)&m_filepara->ox, (unsigned int *)&m_filepara->oy) == LIBMMEIMG_SUCCESS)
  3241. +       {
  3242. +           int imx, imy;
  3243. +
  3244. +           if ((m_conf.aspect_ratio * m_filepara->oy * m_filepara->max_x / m_filepara->ox) <= m_filepara->max_y)
  3245. +           {
  3246. +               imx = m_filepara->max_x;
  3247. +               imy = (int)(m_conf.aspect_ratio * m_filepara->oy * m_filepara->max_x / m_filepara->ox);
  3248. +           }
  3249. +           else
  3250. +           {
  3251. +               imx = (int)((1.0/m_conf.aspect_ratio) * m_filepara->ox * m_filepara->max_y / m_filepara->oy);
  3252. +               imy = m_filepara->max_y;
  3253. +           }
  3254. +          
  3255. +           if (decode_jpeg(fp, m_filepara->ox, m_filepara->oy, imx, imy, (char **)&m_filepara->pic_buffer) == LIBMMEIMG_SUCCESS)
  3256. +           {
  3257. +               m_filepara->ox = imx;
  3258. +               m_filepara->oy = imy;
  3259. +               fclose(fp);
  3260. +               return;
  3261. +           }
  3262. +       }
  3263. +      
  3264. +       eDebug("hardware decode error");
  3265. +      
  3266. +       fclose(fp);
  3267. +   }
  3268. +
  3269. +   eDebug("[Picload] software decode picture... %s",m_filepara->file);
  3270.  
  3271.     switch(m_filepara->id)
  3272.     {
  3273. @@ -748,12 +787,56 @@
  3274.         }
  3275.     }
  3276.  
  3277. -   switch(m_filepara->id)
  3278. +   int hw_decoded = 0;
  3279. +   if (m_filepara->id == F_JPEG)
  3280.     {
  3281. -       case F_PNG: png_load(m_filepara, m_conf.background); break;
  3282. -       case F_JPEG:    m_filepara->pic_buffer = jpeg_load(m_filepara->file, &m_filepara->ox, &m_filepara->oy, m_filepara->max_x, m_filepara->max_y);   break;
  3283. -       case F_BMP: m_filepara->pic_buffer = bmp_load(m_filepara->file, &m_filepara->ox, &m_filepara->oy)break;
  3284. -       case F_GIF: gif_load(m_filepara); break;
  3285. +       eDebug("[Picload] hardware decode picture... %s",m_filepara->file);
  3286. +       m_filepara->pic_buffer = NULL;
  3287. +       FILE *fp;
  3288. +
  3289. +       if (!(fp = fopen(m_filepara->file, "rb")))
  3290. +           return; // software decode won't find the file either...
  3291. +      
  3292. +       if (get_jpeg_img_size(fp, (unsigned int *)&m_filepara->ox, (unsigned int *)&m_filepara->oy) == LIBMMEIMG_SUCCESS)
  3293. +       {
  3294. +           int imx, imy;
  3295. +           if (m_filepara->ox <= m_filepara->oy)
  3296. +           {
  3297. +               imy = m_conf.thumbnailsize;
  3298. +               imx = (int)( (m_conf.thumbnailsize * ((double)m_filepara->ox)) / ((double)m_filepara->oy) );
  3299. +           }
  3300. +           else
  3301. +           {
  3302. +               imx = m_conf.thumbnailsize;
  3303. +               imy = (int)( (m_conf.thumbnailsize * ((double)m_filepara->oy)) / ((double)m_filepara->ox) );
  3304. +           }
  3305. +          
  3306. +           if (decode_jpeg(fp, m_filepara->ox, m_filepara->oy, imx, imy, (char **)&m_filepara->pic_buffer) == LIBMMEIMG_SUCCESS)
  3307. +           {
  3308. +               m_filepara->ox = imx;
  3309. +               m_filepara->oy = imy;
  3310. +               fclose(fp);
  3311. +               hw_decoded = 1;
  3312. +           }
  3313. +       }
  3314. +
  3315. +       if (!hw_decoded)
  3316. +       {
  3317. +           eDebug("hardware decode error");
  3318. +      
  3319. +           fclose(fp);
  3320. +       }
  3321. +   }
  3322. +
  3323. +   if (!hw_decoded)
  3324. +   {
  3325. +       switch(m_filepara->id)
  3326. +       {
  3327. +           case F_PNG: png_load(m_filepara, m_conf.background); break;
  3328. +           case F_JPEG: m_filepara->pic_buffer = jpeg_load(m_filepara->file, &m_filepara->ox, &m_filepara->oy, m_filepara->max_x, m_filepara->max_y); break;
  3329. +           case F_BMP: m_filepara->pic_buffer = bmp_load(m_filepara->file, &m_filepara->ox, &m_filepara->oy); break;
  3330. +           case F_GIF: gif_load(m_filepara); break;
  3331. +       }
  3332.     }
  3333.  
  3334.     if(exif_thumbnail)
  3335. @@ -768,21 +851,25 @@
  3336.                 ::mkdir(cachedir.c_str(), 0755);
  3337.  
  3338.             //resize for Thumbnail
  3339. -           int imx, imy;
  3340. -           if (m_filepara->ox <= m_filepara->oy)
  3341. -           {
  3342. -               imy = m_conf.thumbnailsize;
  3343. -               imx = (int)( (m_conf.thumbnailsize * ((double)m_filepara->ox)) / ((double)m_filepara->oy) );
  3344. -           }
  3345. -           else
  3346. +           if(!hw_decoded)
  3347.             {
  3348. -               imx = m_conf.thumbnailsize;
  3349. -               imy = (int)( (m_conf.thumbnailsize * ((double)m_filepara->oy)) / ((double)m_filepara->ox) );
  3350. -           }
  3351. +          
  3352. +               int imx, imy;
  3353. +               if (m_filepara->ox <= m_filepara->oy)
  3354. +               {
  3355. +                   imy = m_conf.thumbnailsize;
  3356. +                   imx = (int)( (m_conf.thumbnailsize * ((double)m_filepara->ox)) / ((double)m_filepara->oy) );
  3357. +               }
  3358. +               else
  3359. +               {
  3360. +                   imx = m_conf.thumbnailsize;
  3361. +                   imy = (int)( (m_conf.thumbnailsize * ((double)m_filepara->oy)) / ((double)m_filepara->ox) );
  3362. +               }
  3363.  
  3364. -           m_filepara->pic_buffer = color_resize(m_filepara->pic_buffer, m_filepara->ox, m_filepara->oy, imx, imy);
  3365. -           m_filepara->ox = imx;
  3366. -           m_filepara->oy = imy;
  3367. +               m_filepara->pic_buffer = color_resize(m_filepara->pic_buffer, m_filepara->ox, m_filepara->oy, imx, imy);
  3368. +               m_filepara->ox = imx;
  3369. +               m_filepara->oy = imy;
  3370. +           }
  3371.  
  3372.             if(jpeg_save(cachefile.c_str(), m_filepara->ox, m_filepara->oy, m_filepara->pic_buffer))
  3373.                 eDebug("[Picload] error saving cachefile");
  3374. @@ -1225,3 +1312,65 @@
  3375.  
  3376.     return 0;
  3377. }
  3378. +
  3379. +#if defined(__sh__)
  3380. +//---------------------------------------------------------------------------------------------
  3381. +
  3382. +PyObject *getExif(const char *filename)
  3383. +{
  3384. +   ePyObject list;
  3385. +   Cexif exif;
  3386. +   if(exif.DecodeExif(filename))
  3387. +   {
  3388. +       if(exif.m_exifinfo->IsExif)
  3389. +       {
  3390. +           int pos=0;
  3391. +           char tmp[256];
  3392. +           list = PyList_New(22);
  3393. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->Version));
  3394. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->CameraMake));
  3395. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->CameraModel));
  3396. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->DateTime));
  3397. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->Comments));
  3398. +           PyList_SET_ITEM(list, pos++,  PyString_FromFormat("%d x %d", exif.m_exifinfo->Width, exif.m_exifinfo->Height));
  3399. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->Orientation));
  3400. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->MeteringMode));
  3401. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->ExposureProgram));
  3402. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->LightSource));
  3403. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->FlashUsed));
  3404. +           PyList_SET_ITEM(list, pos++,  PyString_FromFormat("%d", exif.m_exifinfo->CompressionLevel));
  3405. +           PyList_SET_ITEM(list, pos++,  PyString_FromFormat("%d", exif.m_exifinfo->ISOequivalent));
  3406. +           sprintf(tmp, "%.2f", exif.m_exifinfo->Xresolution);
  3407. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(tmp));
  3408. +           sprintf(tmp, "%.2f", exif.m_exifinfo->Yresolution);
  3409. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(tmp));
  3410. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(exif.m_exifinfo->ResolutionUnit));
  3411. +           sprintf(tmp, "%.2f", exif.m_exifinfo->Brightness);
  3412. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(tmp));
  3413. +           sprintf(tmp, "%.5f sec.", exif.m_exifinfo->ExposureTime);
  3414. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(tmp));
  3415. +           sprintf(tmp, "%.5f", exif.m_exifinfo->ExposureBias);
  3416. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(tmp));
  3417. +           sprintf(tmp, "%.5f", exif.m_exifinfo->Distance);
  3418. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(tmp));
  3419. +           sprintf(tmp, "%.5f", exif.m_exifinfo->CCDWidth);
  3420. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(tmp));
  3421. +           sprintf(tmp, "%.2f", exif.m_exifinfo->ApertureFNumber);
  3422. +           PyList_SET_ITEM(list, pos++,  PyString_FromString(tmp));
  3423. +       }
  3424. +       else
  3425. +       {
  3426. +           list = PyList_New(1);
  3427. +           PyList_SET_ITEM(list, 0, PyString_FromString(exif.m_szLastError));
  3428. +       }
  3429. +       exif.ClearExif();
  3430. +   }
  3431. +   else
  3432. +   {
  3433. +       list = PyList_New(1);
  3434. +       PyList_SET_ITEM(list, 0, PyString_FromString(exif.m_szLastError));
  3435. +   }
  3436. +
  3437. +   return list ? (PyObject*)list : (PyObject*)PyList_New(0);
  3438. +}
  3439. +#endif
  3440. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/gdi/stmfb.cpp enigma2-nightly.patched/lib/gdi/stmfb.cpp
  3441. --- enigma2-nightly.org/lib/gdi/stmfb.cpp   1970-01-01 01:00:00.000000000 +0100
  3442. +++ enigma2-nightly.patched/lib/gdi/stmfb.cpp   2013-10-26 03:02:27.229604784 +0200
  3443. @@ -0,0 +1,75 @@
  3444. +/*
  3445. +  Interface to the Dreambox dm800/dm8000 proprietary accel interface.
  3446. +*/
  3447. +
  3448. +#include <stdio.h>
  3449. +#include <stdlib.h>
  3450. +#include <fcntl.h>
  3451. +#include <unistd.h>
  3452. +#include <linux/fb.h>
  3453. +#include <sys/mman.h>
  3454. +#include <sys/ioctl.h>
  3455. +#include <linux/stmfb.h>
  3456. +
  3457. +
  3458. +#include <lib/base/ebase.h>
  3459. +
  3460. +static int fb_fd;
  3461. +static int exec_list(void);
  3462. +
  3463. +int stmfb_accel_init(void)
  3464. +{
  3465. +   fb_fd = open("/dev/fb0", O_RDWR);
  3466. +   if (fb_fd < 0)
  3467. +   {
  3468. +       perror("/dev/fb0");
  3469. +       return 1;
  3470. +   }
  3471. +   eDebug("STMFB accel interface available\n");
  3472. +   return 0;
  3473. +}
  3474. +
  3475. +void stmfb_accel_close(void)
  3476. +{
  3477. +   close(fb_fd);
  3478. +}
  3479. +
  3480. +void stmfb_accel_blit(
  3481. +       int src_addr, int src_width, int src_height, int src_stride, int src_format,
  3482. +       int dst_addr, int dst_width, int dst_height, int dst_stride,
  3483. +       int src_x, int src_y, int width, int height,
  3484. +       int dst_x, int dst_y, int dwidth, int dheight)
  3485. +{
  3486. +   STMFBIO_BLT_DATA bltData;
  3487. +   memset(&bltData, 0, sizeof(STMFBIO_BLT_DATA));
  3488. +
  3489. +   bltData.operation  = BLT_OP_COPY;
  3490. +   bltData.srcOffset  = (src_addr - dst_addr) + (1920*1080*4);
  3491. +   bltData.srcPitch   = src_stride;
  3492. +   bltData.src_left   = src_x;
  3493. +   bltData.src_top    = src_y;
  3494. +   bltData.src_right  = src_x + width;
  3495. +   bltData.src_bottom = src_y + height;
  3496. +   bltData.srcFormat  = SURF_BGRA8888;
  3497. +
  3498. +   bltData.dstOffset  = 1920*1080*4;
  3499. +   bltData.dstPitch   = dst_stride;
  3500. +   bltData.dst_left   = dst_x;
  3501. +   bltData.dst_top    = dst_y;
  3502. +   bltData.dst_right  = dst_x + dwidth;
  3503. +   bltData.dst_bottom = dst_y + dheight;
  3504. +   bltData.dstFormat  = SURF_BGRA8888;
  3505. +
  3506. +   if (ioctl(fb_fd, STMFBIO_BLT, &bltData ) < 0)
  3507. +   {
  3508. +       eDebug("Error ioctl FBIO_BLIT");
  3509. +   }
  3510. +}
  3511. +
  3512. +void stmfb_accel_fill(
  3513. +       int dst_addr, int dst_width, int dst_height, int dst_stride,
  3514. +       int x, int y, int width, int height,
  3515. +       unsigned long color)
  3516. +{
  3517. +// printf("unimplemented bcm_accel_fill\n");
  3518. +}
  3519. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/Makefile.am enigma2-nightly.patched/lib/Makefile.am
  3520. --- enigma2-nightly.org/lib/Makefile.am 2013-08-11 08:11:19.050306134 +0200
  3521. +++ enigma2-nightly.patched/lib/Makefile.am 2013-10-26 03:02:27.229604784 +0200
  3522. @@ -7,6 +7,11 @@
  3523.     -include Python.h \
  3524.     -include $(top_builddir)/enigma2_config.h
  3525.  
  3526. +if ENABLE_LIBEPLAYER3
  3527. +AM_CPPFLAGS += \
  3528. +   -I$(top_srcdir)/../misc/tools/libeplayer3/include
  3529. +endif
  3530. +
  3531. # initialize these, to be filled with targets in the included files
  3532. noinst_LIBRARIES=
  3533. BUILT_SOURCES=
  3534. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Components/Converter/RemainingToText.py enigma2-nightly.patched/lib/python/Components/Converter/RemainingToText.py
  3535. --- enigma2-nightly.org/lib/python/Components/Converter/RemainingToText.py  2013-08-11 08:11:19.170306132 +0200
  3536. +++ enigma2-nightly.patched/lib/python/Components/Converter/RemainingToText.py  2013-10-26 03:02:27.229604784 +0200
  3537. @@ -8,6 +8,9 @@
  3538.     IN_SECONDS = 3
  3539.     PROGRESS = 4
  3540.     WITH_SECONDSPROGRESS = 5
  3541. +#+++>
  3542. +   FOLLOW = 6
  3543. +#+++<
  3544.  
  3545.     def __init__(self, type):
  3546.         Converter.__init__(self, type)
  3547. @@ -21,6 +24,10 @@
  3548.             self.type = self.PROGRESS
  3549.         elif type == "WithSecondsProgress":
  3550.             self.type = self.WITH_SECONDSPROGRESS
  3551. +#+++>
  3552. +       elif type == "FOLLOW":
  3553. +           self.type = self.FOLLOW
  3554. +#+++<
  3555.         else:
  3556.             self.type = self.DEFAULT
  3557.  
  3558. @@ -58,6 +65,13 @@
  3559.             return "%s%d:%02d" % (prefix, hours, minutes)
  3560.         elif self.type == self.IN_SECONDS:
  3561.             return prefix+str(tsecs)
  3562. +#+++>
  3563. +       elif self.type == self.FOLLOW:
  3564. +           if remaining is not None:
  3565. +               return "in %d min" % (remaining / 60)
  3566. +           else:
  3567. +               return "%d min" % (duration / 60)
  3568. +#+++<
  3569.         elif self.type == self.DEFAULT:
  3570.             if remaining <= duration:
  3571.                 prefix = "+"
  3572. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Components/Harddisk.py enigma2-nightly.patched/lib/python/Components/Harddisk.py
  3573. --- enigma2-nightly.org/lib/python/Components/Harddisk.py   2013-08-11 08:11:19.170306132 +0200
  3574. +++ enigma2-nightly.patched/lib/python/Components/Harddisk.py   2013-10-26 03:02:27.229604784 +0200
  3575. @@ -71,21 +71,11 @@
  3576.             self.dev_path = '/dev/' + self.device
  3577.             self.disk_path = self.dev_path
  3578.  
  3579. +#+++>
  3580.         elif self.type == DEVTYPE_DEVFS:
  3581. -           tmp = readFile(self.sysfsPath('dev')).split(':')
  3582. -           s_major = int(tmp[0])
  3583. -           s_minor = int(tmp[1])
  3584. -           for disc in os.listdir("/dev/discs"):
  3585. -               dev_path = os.path.realpath('/dev/discs/' + disc)
  3586. -               disk_path = dev_path + '/disc'
  3587. -               try:
  3588. -                   rdev = os.stat(disk_path).st_rdev
  3589. -               except OSError:
  3590. -                   continue
  3591. -               if s_major == os.major(rdev) and s_minor == os.minor(rdev):
  3592. -                   self.dev_path = dev_path
  3593. -                   self.disk_path = disk_path
  3594. -                   break
  3595. +           self.dev_path = '/dev/' + self.device
  3596. +           self.disk_path = self.dev_path
  3597. +#+++<
  3598.  
  3599.         print "new Harddisk", self.device, '->', self.dev_path, '->', self.disk_path
  3600.         if not removable:
  3601. @@ -679,6 +669,12 @@
  3602.         for item in getProcMounts():
  3603.             if item[0] == dev:
  3604.                 return item[1]
  3605. +#+++>
  3606. +       #Check if has autofs mountpoint
  3607. +       mount = self.getAutofsMountpoint(device)
  3608. +       if mount:
  3609. +           return mount
  3610. +#+++<
  3611.         return None
  3612.  
  3613.     def addHotplugPartition(self, device, physdev = None):
  3614. @@ -694,6 +690,10 @@
  3615.         error, blacklisted, removable, is_cdrom, partitions, medium_found = self.getBlockDevInfo(device)
  3616.         if not blacklisted and medium_found:
  3617.             description = self.getUserfriendlyDeviceName(device, physdev)
  3618. +#+++>
  3619. +           if description.startswith("External Storage"):
  3620. +               return False, False, False, False, [], False
  3621. +#+++<
  3622.             p = Partition(mountpoint = self.getMountpoint(device), description = description, force_mounted = True, device = device)
  3623.             self.partitions.append(p)
  3624.             if p.mountpoint: # Plugins won't expect unmounted devices
  3625. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Components/NimManager.py enigma2-nightly.patched/lib/python/Components/NimManager.py
  3626. --- enigma2-nightly.org/lib/python/Components/NimManager.py 2013-08-11 08:11:19.174306131 +0200
  3627. +++ enigma2-nightly.patched/lib/python/Components/NimManager.py 2013-10-26 03:02:27.229604784 +0200
  3628. @@ -20,6 +20,10 @@
  3629.  import xml.etree.cElementTree
  3630.  
  3631.  def getConfigSatlist(orbpos, satlist):
  3632. +#+++>  CAUSE OF CRASH!
  3633. +   if not satlist:
  3634. +       return None
  3635. +#+++<
  3636.     default_orbpos = None
  3637.     for x in satlist:
  3638.         if x[0] == orbpos:
  3639. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Components/Renderer/Makefile.am enigma2-nightly.patched/lib/python/Components/Renderer/Makefile.am
  3640. --- enigma2-nightly.org/lib/python/Components/Renderer/Makefile.am  2013-08-11 08:11:19.182306131 +0200
  3641. +++ enigma2-nightly.patched/lib/python/Components/Renderer/Makefile.am  2013-10-26 03:02:27.229604784 +0200
  3642. @@ -3,4 +3,5 @@
  3643.  install_PYTHON = \
  3644.     __init__.py Label.py Progress.py Listbox.py Renderer.py Pixmap.py \
  3645.     FixedLabel.py PositionGauge.py Canvas.py Picon.py Pig.py \
  3646. -   FrontpanelLed.py ChannelNumber.py VideoSize.py NextEpgInfo.py
  3647. +   FrontpanelLed.py ChannelNumber.py VideoSize.py NextEpgInfo.py \
  3648. +   SingleEpgList.py
  3649. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Components/Renderer/Progress.py enigma2-nightly.patched/lib/python/Components/Renderer/Progress.py
  3650. --- enigma2-nightly.org/lib/python/Components/Renderer/Progress.py  2013-08-11 08:11:19.182306131 +0200
  3651. +++ enigma2-nightly.patched/lib/python/Components/Renderer/Progress.py  2013-10-26 03:02:27.229604784 +0200
  3652. @@ -13,25 +13,40 @@
  3653.     GUI_WIDGET = eSlider
  3654.  
  3655.     def changed(self, what):
  3656. -       if what[0] == self.CHANGED_CLEAR:
  3657. -           (self.range, self.value) = ((0, 1), 0)
  3658. -           return
  3659. -
  3660. -       range = self.source.range or 100
  3661. -       value = self.source.value
  3662. -       if value is None:
  3663. -           value = 0
  3664. -       (self.range, self.value) = ((0, range), value)
  3665. +#+++>
  3666. +       try:
  3667. +           if what[0] == self.CHANGED_CLEAR:
  3668. +               (self.range, self.value) = ((0, 1), 0)
  3669. +               return
  3670. +
  3671. +           range = (self.source and self.source.range) or 100
  3672. +           value = (self.source and self.source.value) or 0
  3673. +           if value is None:
  3674. +               value = 0
  3675. +           (self.range, self.value) = ((0, range), value)
  3676. +       except:
  3677. +           None
  3678. +#+++<
  3679.  
  3680.     GUI_WIDGET = eSlider
  3681.  
  3682.     def postWidgetCreate(self, instance):
  3683. -       instance.setRange(self.__start, self.__end)
  3684. +#+++>
  3685. +       try:
  3686. +           instance.setRange(self.__start, self.__end)
  3687. +       except:
  3688. +           None
  3689. +#+++<
  3690.  
  3691.     def setRange(self, range):
  3692. -       (self.__start, self.__end) = range
  3693. -       if self.instance is not None:
  3694. -           self.instance.setRange(self.__start, self.__end)
  3695. +#+++>
  3696. +       try:
  3697. +           (self.__start, self.__end) = range
  3698. +           if self.instance is not None:
  3699. +               self.instance.setRange(self.__start, self.__end)
  3700. +       except:
  3701. +           None
  3702. +#+++<
  3703.  
  3704.     def getRange(self):
  3705.         return (self.__start, self.__end)
  3706. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Components/Renderer/SingleEpgList.py enigma2-nightly.patched/lib/python/Components/Renderer/SingleEpgList.py
  3707. --- enigma2-nightly.org/lib/python/Components/Renderer/SingleEpgList.py 1970-01-01 01:00:00.000000000 +0100
  3708. +++ enigma2-nightly.patched/lib/python/Components/Renderer/SingleEpgList.py 2013-10-26 03:02:27.233604785 +0200
  3709. @@ -0,0 +1,39 @@
  3710. +from Components.VariableText import VariableText
  3711. +from enigma import eLabel, eEPGCache
  3712. +from Renderer import Renderer
  3713. +from time import localtime
  3714. +
  3715. +class SingleEpgList(Renderer, VariableText):
  3716. +   def __init__(self):
  3717. +       Renderer.__init__(self)
  3718. +       VariableText.__init__(self)
  3719. +       self.epgcache = eEPGCache.getInstance()
  3720. +
  3721. +   GUI_WIDGET = eLabel
  3722. +
  3723. +   def changed(self, what):
  3724. +       event = self.source.event
  3725. +
  3726. +       if event is None:
  3727. +           self.text = ""
  3728. +           return
  3729. +       service = self.source.service
  3730. +       text = ""
  3731. +       evt = None
  3732. +
  3733. +       if self.epgcache is not None:
  3734. +           evt = self.epgcache.lookupEvent(['IBDCT', (service.toString(), 0, -1, -1)])
  3735. +
  3736. +       if evt:
  3737. +           maxx = 0
  3738. +           for x in evt:
  3739. +               if maxx > 0:
  3740. +                   if x[4]:
  3741. +                       t = localtime(x[1])
  3742. +                       text = text + "%02d:%02d %s\n" % (t[3], t[4], x[4])
  3743. +                   else:
  3744. +                       text = text + "n/a\n"
  3745. +               maxx += 1
  3746. +               if maxx > 4:
  3747. +                   break
  3748. +       self.text = text
  3749. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Components/UsageConfig.py enigma2-nightly.patched/lib/python/Components/UsageConfig.py
  3750. --- enigma2-nightly.org/lib/python/Components/UsageConfig.py    2013-08-11 08:11:19.186306131 +0200
  3751. +++ enigma2-nightly.patched/lib/python/Components/UsageConfig.py    2013-10-26 03:02:27.233604785 +0200
  3752. @@ -174,7 +174,7 @@
  3753.     config.usage.frontend_priority = ConfigSelection(default = "-1", choices = nims)
  3754.     config.misc.disable_background_scan = ConfigYesNo(default = False)
  3755.  
  3756. -   config.usage.show_event_progress_in_servicelist = ConfigSelection(default = 'barright', choices = [
  3757. +   config.usage.show_event_progress_in_servicelist = ConfigSelection(default = 'barleft', choices = [
  3758.         ('barleft', _("Progress bar left")),
  3759.         ('barright', _("Progress bar right")),
  3760.         ('percleft', _("Percentage left")),
  3761. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Components/VolumeControl.py enigma2-nightly.patched/lib/python/Components/VolumeControl.py
  3762. --- enigma2-nightly.org/lib/python/Components/VolumeControl.py  2013-08-11 08:11:19.186306131 +0200
  3763. +++ enigma2-nightly.patched/lib/python/Components/VolumeControl.py  2013-10-26 03:02:27.237604785 +0200
  3764. @@ -72,12 +72,24 @@
  3765.  
  3766.     def volMute(self, showMuteSymbol=True, force=False):
  3767.         vol = self.volctrl.getVolume()
  3768. +#+++>
  3769. +       if config.audio.volume.value != 0:
  3770. +           vol = config.audio.volume.value
  3771. +       else:
  3772. +           vol = self.volctrl.getVolume()
  3773. +#+++<
  3774.         if vol or force:
  3775.             self.volctrl.volumeToggleMute()
  3776.             if self.volctrl.isMuted():
  3777.                 if showMuteSymbol:
  3778.                     self.muteDialog.show()
  3779.                 self.volumeDialog.setValue(0)
  3780. +#+++>
  3781. +               self.volctrl.setVolume(0,0)
  3782. +#+++<
  3783.             else:
  3784.                 self.muteDialog.hide()
  3785.                 self.volumeDialog.setValue(vol)
  3786. +#+++>
  3787. +               self.volctrl.setVolume(vol, vol)
  3788. +#+++<
  3789. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/enigma_python.i enigma2-nightly.patched/lib/python/enigma_python.i
  3790. --- enigma2-nightly.org/lib/python/enigma_python.i  2013-08-11 08:11:19.334306128 +0200
  3791. +++ enigma2-nightly.patched/lib/python/enigma_python.i  2013-10-26 03:02:27.241604785 +0200
  3792. @@ -108,6 +108,7 @@
  3793.  #include <lib/python/python.h>
  3794.  #include <lib/python/python_helpers.h>
  3795.  #include <lib/gdi/picload.h>
  3796. +#include <lib/driver/vfd.h>
  3797.  %}
  3798.  
  3799.  %feature("ref")   iObject "$this->AddRef(); /* eDebug(\"AddRef (%s:%d)!\", __FILE__, __LINE__); */ "
  3800. @@ -250,6 +251,7 @@
  3801.  %include <lib/python/python.h>
  3802.  %include <lib/python/pythonconfig.h>
  3803.  %include <lib/gdi/picload.h>
  3804. +%include <lib/driver/vfd.h>
  3805.  /**************  eptr  **************/
  3806.  
  3807.  /**************  signals  **************/
  3808. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Makefile.inc enigma2-nightly.patched/lib/python/Makefile.inc
  3809. --- enigma2-nightly.org/lib/python/Makefile.inc 2013-08-11 08:11:19.190306131 +0200
  3810. +++ enigma2-nightly.patched/lib/python/Makefile.inc 2013-10-26 03:02:27.241604785 +0200
  3811. @@ -32,7 +32,7 @@
  3812.  @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/python/enigma_python.Pcpp@am__quote@
  3813.  
  3814.  .i.cpp:
  3815. -   $(AM_V_GEN)$(SWIG) $(AX_SWIG_PYTHON_OPT) -MT $@ -MD -MF $(DEPDIR)/$*.Tpo -I$(top_srcdir) -O -nortti -nothreads -o $@ $<
  3816. +   $(AM_V_GEN)$(SWIG) $(AX_SWIG_PYTHON_OPT) -MT $@ -MD -MF $(DEPDIR)/$*.Tpo -I$(top_srcdir) -D__sh__ -O -nortti -nothreads -o $@ $<
  3817.     $(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Pcpp
  3818.     $(AM_V_at)$(PYTHON) $(srcdir)/python/enigma_py_patcher.py python/enigma.py
  3819.  
  3820. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/Extensions/CuberevoVFD/__init__.py enigma2-nightly.patched/lib/python/Plugins/Extensions/CuberevoVFD/__init__.py
  3821. --- enigma2-nightly.org/lib/python/Plugins/Extensions/CuberevoVFD/__init__.py   1970-01-01 01:00:00.000000000 +0100
  3822. +++ enigma2-nightly.patched/lib/python/Plugins/Extensions/CuberevoVFD/__init__.py   2013-10-26 03:02:27.245604785 +0200
  3823. @@ -0,0 +1,2 @@
  3824. +
  3825. +
  3826. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/Extensions/CuberevoVFD/Makefile.am enigma2-nightly.patched/lib/python/Plugins/Extensions/CuberevoVFD/Makefile.am
  3827. --- enigma2-nightly.org/lib/python/Plugins/Extensions/CuberevoVFD/Makefile.am   1970-01-01 01:00:00.000000000 +0100
  3828. +++ enigma2-nightly.patched/lib/python/Plugins/Extensions/CuberevoVFD/Makefile.am   2013-10-26 03:02:27.245604785 +0200
  3829. @@ -0,0 +1,5 @@
  3830. +installdir = $(pkglibdir)/python/Plugins/Extensions/CuberevoVFD
  3831. +
  3832. +install_PYTHON = \
  3833. +   __init__.py \
  3834. +   plugin.py
  3835. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/Extensions/CuberevoVFD/plugin.py enigma2-nightly.patched/lib/python/Plugins/Extensions/CuberevoVFD/plugin.py
  3836. --- enigma2-nightly.org/lib/python/Plugins/Extensions/CuberevoVFD/plugin.py 1970-01-01 01:00:00.000000000 +0100
  3837. +++ enigma2-nightly.patched/lib/python/Plugins/Extensions/CuberevoVFD/plugin.py 2013-10-26 03:02:27.245604785 +0200
  3838. @@ -0,0 +1,317 @@
  3839. +from Screens.Screen import Screen
  3840. +from Screens.MessageBox import MessageBox
  3841. +from Plugins.Plugin import PluginDescriptor
  3842. +from Tools import Notifications
  3843. +from Components.Pixmap import Pixmap, MovingPixmap
  3844. +from Components.ActionMap import ActionMap, NumberActionMap
  3845. +from Components.Label import Label
  3846. +from Components.Button import Button
  3847. +from Components.Console import Console
  3848. +from Components.ConfigList import ConfigList
  3849. +from Components.config import config, configfile, ConfigSubsection, ConfigEnableDisable, \
  3850. +     getConfigListEntry, ConfigInteger, ConfigSelection
  3851. +from Components.ConfigList import ConfigListScreen
  3852. +from Plugins.Plugin import PluginDescriptor
  3853. +import ServiceReference
  3854. +from enigma import *
  3855. +from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
  3856. +from re import compile as re_compile, search as re_search
  3857. +
  3858. +import os
  3859. +
  3860. +my_global_session = None
  3861. +
  3862. +config.plugins.CuberevoVFD = ConfigSubsection()
  3863. +config.plugins.CuberevoVFD.scroll = ConfigSelection(default = "once", choices = [("never"), ("once"), ("always")])
  3864. +config.plugins.CuberevoVFD.brightness = ConfigSelection(default = "bright", choices = [("dark"), ("medium"), ("bright")])
  3865. +config.plugins.CuberevoVFD.showClock = ConfigEnableDisable(default = True)
  3866. +#config.plugins.CuberevoVFD.setDaylight = ConfigEnableDisable(default = False)
  3867. +config.plugins.CuberevoVFD.timeMode = ConfigSelection(default = "24h", choices = [("12h"),("24h")])
  3868. +config.plugins.CuberevoVFD.setLed = ConfigEnableDisable(default = False)
  3869. +config.plugins.CuberevoVFD.setFan = ConfigEnableDisable(default = True)
  3870. +
  3871. +class CuberevoVFDSetup(ConfigListScreen, Screen):
  3872. +   skin = """
  3873. +       <screen position="100,100" size="550,400" title="CuberevoVFD Setup" >
  3874. +       <widget name="config" position="20,10" size="460,350" scrollbarMode="showOnDemand" />
  3875. +       <ePixmap position="140,350" size="140,40" pixmap="skin_default/buttons/green.png" alphatest="on" />
  3876. +       <ePixmap position="280,350" size="140,40" pixmap="skin_default/buttons/red.png" alphatest="on" />
  3877. +       <widget name="key_green" position="140,350" size="140,40" font="Regular;20" backgroundColor="#1f771f" zPosition="2" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
  3878. +       <widget name="key_red" position="280,350" size="140,40" font="Regular;20" backgroundColor="#9f1313" zPosition="2" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
  3879. +       </screen>"""
  3880. +
  3881. +   def __init__(self, session, args = None):
  3882. +       Screen.__init__(self, session)
  3883. +       self.onClose.append(self.abort)
  3884. +
  3885. +       # create elements for the menu list
  3886. +       self.list = [ ]
  3887. +       self.list.append(getConfigListEntry(_("Show clock"), config.plugins.CuberevoVFD.showClock))
  3888. +       self.list.append(getConfigListEntry(_("Time mode"), config.plugins.CuberevoVFD.timeMode))
  3889. +       self.list.append(getConfigListEntry(_("Set led"), config.plugins.CuberevoVFD.setLed))
  3890. +       self.list.append(getConfigListEntry(_("Brightness"), config.plugins.CuberevoVFD.brightness))
  3891. +       self.list.append(getConfigListEntry(_("Scroll long strings"), config.plugins.CuberevoVFD.scroll))
  3892. +       self.list.append(getConfigListEntry(_("Set fan"), config.plugins.CuberevoVFD.setFan))
  3893. +       ConfigListScreen.__init__(self, self.list)
  3894. +
  3895. +       self.Console = Console()
  3896. +       self["key_red"] = Button(_("Cancel"))
  3897. +       self["key_green"] = Button(_("Save"))
  3898. +
  3899. +       # DO NOT ASK.
  3900. +       self["setupActions"] = ActionMap(["SetupActions"],
  3901. +       {
  3902. +           "save": self.save,
  3903. +           "cancel": self.cancel,
  3904. +           "ok": self.save,
  3905. +       }, -2)
  3906. +
  3907. +   def abort(self):
  3908. +       print "aborting"
  3909. +
  3910. +   def save(self):
  3911. +       # save all settings
  3912. +       for x in self["config"].list:
  3913. +           x[1].save()
  3914. +
  3915. +       if config.plugins.CuberevoVFD.showClock.getValue():
  3916. +           cubeVfd.enableClock()
  3917. +       else:
  3918. +           cubeVfd.disableClock()
  3919. +
  3920. +#      if config.plugins.CuberevoVFD.setDaylight.getValue():
  3921. +#          cubeVfd.enableDaylight()
  3922. +#      else:
  3923. +#          cubeVfd.disableDaylight()
  3924. +
  3925. +       if config.plugins.CuberevoVFD.timeMode.value == "24h":
  3926. +           cubeVfd.enableTimeMode()
  3927. +       else:
  3928. +           cubeVfd.disableTimeMode()
  3929. +
  3930. +       # enable/disable fan activity
  3931. +       if config.plugins.CuberevoVFD.setFan.getValue():
  3932. +           cubeVfd.enableFan()
  3933. +       else:
  3934. +           cubeVfd.disableFan()
  3935. +
  3936. +       # enable/disable led activity
  3937. +       if config.plugins.CuberevoVFD.setLed.getValue():
  3938. +           cubeVfd.enableLed()
  3939. +       else:
  3940. +           cubeVfd.disableLed()
  3941. +
  3942. +   # set the brightness
  3943. +       brightness = 3
  3944. +       if config.plugins.CuberevoVFD.brightness.getValue() == "dark":
  3945. +           brightness = 1
  3946. +       elif config.plugins.CuberevoVFD.brightness.getValue() == "bright":
  3947. +           brightness = 7
  3948. +       evfd.getInstance().vfd_set_brightness(brightness)
  3949. +
  3950. +       configfile.save()
  3951. +       self.close()
  3952. +
  3953. +   def cancel(self):
  3954. +       for x in self["config"].list:
  3955. +           x[1].cancel()
  3956. +       self.close()
  3957. +
  3958. +class CuberevoVFD:
  3959. +   def __init__(self, session):
  3960. +       #print "CuberevoVFD initializing"
  3961. +       global showmenuorpanel
  3962. +       showmenuorpanel = False
  3963. +       self.showtimer = eTimer()
  3964. +       self.session = session
  3965. +       self.service = None
  3966. +       self.onClose = [ ]
  3967. +       self.__event_tracker = ServiceEventTracker(screen=self,eventmap=
  3968. +           {
  3969. +               iPlayableService.evSeekableStatusChanged: self.__evSeekableStatusChanged,
  3970. +               iPlayableService.evStart: self.__evStart,
  3971. +           })
  3972. +       self.Console = Console()
  3973. +       self.tsEnabled = False
  3974. +       self.timer = eTimer()
  3975. +       self.timer.callback.append(self.handleTimer)
  3976. +       self.timer.start(1000, False)
  3977. +       self.fanEnabled = config.plugins.CuberevoVFD.setFan.getValue()
  3978. +       self.ledEnabled = config.plugins.CuberevoVFD.setLed.getValue()
  3979. +       self.clockEnabled = config.plugins.CuberevoVFD.showClock.getValue()
  3980. +       if config.plugins.CuberevoVFD.timeMode.value == "24h":
  3981. +           self.timeModeEnabled = 1
  3982. +       else:
  3983. +           self.timeModeEnabled = 0
  3984. +       if self.fanEnabled == False:
  3985. +           self.disableFan()
  3986. +       else:
  3987. +           self.enableFan()
  3988. +       if self.ledEnabled == False:
  3989. +           self.disableLed()
  3990. +       else:
  3991. +           self.enableLed()
  3992. +
  3993. +   def handleTimer(self):
  3994. +       global showmenuorpanel
  3995. +       try:
  3996. +           from Plugins.Extensions.Aafpanel.plugin import inAAFPanel
  3997. +           showPanel = inAAFPanel
  3998. +       except:
  3999. +           #print '[CuberevoVFD] Error showPanel'
  4000. +           showPanel = None
  4001. +       try:
  4002. +           from Screens.Menu import inMenu
  4003. +           showMenu = inMenu
  4004. +       except:
  4005. +           #print '[CuberevoVFD] Error showMenu'
  4006. +           showMenu = None
  4007. +       if showMenu or showPanel:
  4008. +           self.showtimer.start(4000, True)
  4009. +       self.showtimer.callback.append(self.setshowmenuorpanel)
  4010. +       if not showMenu and not showPanel and showmenuorpanel is True:
  4011. +           showmenuorpanel = False
  4012. +           self.service = self.session.nav.getCurrentlyPlayingServiceReference()
  4013. +           if not self.service is None:
  4014. +               service = self.service.toCompareString()
  4015. +               servicename = ServiceReference.ServiceReference(service).getServiceName().replace('\xc2\x87', '').replace('\xc2\x86', '').ljust(16)
  4016. +               subservice = self.service.toString().split("::")
  4017. +               if subservice[0].count(':') == 9:
  4018. +                   servicename =subservice[1].replace('\xc2\x87', '').replace('\xc3\x9f', 'ss').replace('\xc2\x86', '').ljust(16)
  4019. +               else:
  4020. +                   servicename=servicename
  4021. +               evfd.getInstance().vfd_write_string(servicename[0:17])
  4022. +
  4023. +   def setshowmenuorpanel(self):
  4024. +       global showmenuorpanel
  4025. +       showmenuorpanel = True
  4026. +       self.showtimer.stop()
  4027. +
  4028. +   def enableClock(self):
  4029. +       self.clockEnabled = True
  4030. +       try:
  4031. +           os.popen("/bin/fp_control -dt 1")
  4032. +       except OSError:
  4033. +           print "no memory"
  4034. +
  4035. +   def disableClock(self):
  4036. +       self.clockEnabled = False
  4037. +       try:
  4038. +           os.popen("/bin/fp_control -dt 0")
  4039. +       except OSError:
  4040. +           print "no memory"
  4041. +
  4042. +   def enableTimeMode(self):
  4043. +       self.timeModeEnabled = 1
  4044. +       try:
  4045. +           os.popen("/bin/fp_control -tm 1")
  4046. +       except OSError:
  4047. +           print "no memory"
  4048. +
  4049. +   def disableTimeMode(self):
  4050. +       self.timeModeEnabled = 0
  4051. +       try:
  4052. +           os.popen("/bin/fp_control -tm 0")
  4053. +       except OSError:
  4054. +           print "no memory"
  4055. +
  4056. +   def enableLed(self):
  4057. +       self.ledEnabled = True
  4058. +       try:
  4059. +           os.popen("/bin/fp_control -l 0 1")
  4060. +       except OSError:
  4061. +           print "no memory"
  4062. +
  4063. +   def disableLed(self):
  4064. +       self.ledEnabled = False
  4065. +       try:
  4066. +           os.popen("/bin/fp_control -l 0 0")
  4067. +       except OSError:
  4068. +           print "no memory"
  4069. +
  4070. +   def enableFan(self):
  4071. +       self.fanEnabled = True
  4072. +       try:
  4073. +           os.popen("/bin/fp_control -sf 1")
  4074. +       except OSError:
  4075. +           print "no memory"
  4076. +
  4077. +   def disableFan(self):
  4078. +       self.fanEnabled = False
  4079. +       try:
  4080. +           os.popen("/bin/fp_control -sf 0")
  4081. +       except OSError:
  4082. +           print "no memory"
  4083. +
  4084. +   def regExpMatch(self, pattern, string):
  4085. +       if string is None:
  4086. +           return None
  4087. +       try:
  4088. +           return pattern.search(string).group()
  4089. +       except AttributeError:
  4090. +           None
  4091. +
  4092. +   def __evStart(self):
  4093. +       self.__evSeekableStatusChanged()
  4094. +
  4095. +   def getTimeshiftState(self):
  4096. +       service = self.session.nav.getCurrentService()
  4097. +       if service is None:
  4098. +           return False
  4099. +       timeshift = service.timeshift()
  4100. +       if timeshift is None:
  4101. +           return False
  4102. +       return True
  4103. +
  4104. +   def __evSeekableStatusChanged(self):
  4105. +       tmp = self.getTimeshiftState()
  4106. +       if tmp == self.tsEnabled:
  4107. +           return
  4108. +       if tmp:
  4109. +           print "[Timeshift enabled]"
  4110. +           evfd.getInstance().vfd_set_icon(0x1A,True)
  4111. +       else:
  4112. +           print "[Timeshift disabled]"
  4113. +           evfd.getInstance().vfd_set_icon(0x1A,False)
  4114. +       self.tsEnabled = tmp
  4115. +      
  4116. +   def shutdown(self):
  4117. +       self.abort()
  4118. +
  4119. +   def abort(self):
  4120. +       print "CuberevoVFD aborting"
  4121. +
  4122. +def main(session, **kwargs):
  4123. +   session.open(CuberevoVFDSetup)
  4124. +
  4125. +cubeVfd = None
  4126. +gReason = -1
  4127. +mySession = None
  4128. +
  4129. +def controlcubeVfd():
  4130. +   global cubeVfd
  4131. +   global gReason
  4132. +   global mySession
  4133. +
  4134. +   if gReason == 0 and mySession != None and cubeVfd == None:
  4135. +       print "Starting CuberevoVFD"
  4136. +       cubeVfd = CuberevoVFD(mySession)
  4137. +   elif gReason == 1 and cubeVfd != None:
  4138. +       print "Stopping CuberevoVFD"
  4139. +       cubeVfd = None
  4140. +
  4141. +def autostart(reason, **kwargs):
  4142. +   global cubeVfd
  4143. +   global gReason
  4144. +   global mySession
  4145. +
  4146. +   if kwargs.has_key("session"):
  4147. +       global my_global_session
  4148. +       mySession = kwargs["session"]
  4149. +   else:
  4150. +       gReason = reason
  4151. +   controlcubeVfd()
  4152. +
  4153. +def Plugins(**kwargs):
  4154. +   return [ PluginDescriptor(name="CuberevoVFD", description="Change VFD display settings", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main),
  4155. +       PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART, PluginDescriptor.WHERE_AUTOSTART], fnc = autostart) ]
  4156. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/Extensions/Makefile.am enigma2-nightly.patched/lib/python/Plugins/Extensions/Makefile.am
  4157. --- enigma2-nightly.org/lib/python/Plugins/Extensions/Makefile.am   2013-08-11 08:11:19.234306130 +0200
  4158. +++ enigma2-nightly.patched/lib/python/Plugins/Extensions/Makefile.am   2013-10-26 03:02:27.245604785 +0200
  4159. @@ -1,6 +1,14 @@
  4160. installdir = $(pkglibdir)/python/Plugins/Extensions
  4161.  
  4162. -SUBDIRS = TuxboxPlugins CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDBurn Modem
  4163. +SUBDIRS = CutListEditor PicturePlayer MediaScanner MediaPlayer GraphMultiEPG SocketMMI DVDBurn
  4164. +
  4165. +if ENABLE_TF7700
  4166. +SUBDIRS += TopfieldVFD
  4167. +endif
  4168. +
  4169. +if ENABLE_CUBEREVO
  4170. +SUBDIRS += CuberevoVFD
  4171. +endif
  4172.  
  4173. if HAVE_LIBDDVD
  4174. SUBDIRS += DVDPlayer
  4175. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/Extensions/TopfieldVFD/__init__.py enigma2-nightly.patched/lib/python/Plugins/Extensions/TopfieldVFD/__init__.py
  4176. --- enigma2-nightly.org/lib/python/Plugins/Extensions/TopfieldVFD/__init__.py   1970-01-01 01:00:00.000000000 +0100
  4177. +++ enigma2-nightly.patched/lib/python/Plugins/Extensions/TopfieldVFD/__init__.py   2013-10-26 03:02:27.245604785 +0200
  4178. @@ -0,0 +1,2 @@
  4179. +
  4180. +
  4181. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/Extensions/TopfieldVFD/Makefile.am enigma2-nightly.patched/lib/python/Plugins/Extensions/TopfieldVFD/Makefile.am
  4182. --- enigma2-nightly.org/lib/python/Plugins/Extensions/TopfieldVFD/Makefile.am   1970-01-01 01:00:00.000000000 +0100
  4183. +++ enigma2-nightly.patched/lib/python/Plugins/Extensions/TopfieldVFD/Makefile.am   2013-10-26 03:02:27.245604785 +0200
  4184. @@ -0,0 +1,5 @@
  4185. +installdir = $(pkglibdir)/python/Plugins/Extensions/TopfieldVFD
  4186. +
  4187. +install_PYTHON = \
  4188. +   __init__.py \
  4189. +   plugin.py
  4190. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/Extensions/TopfieldVFD/plugin.py enigma2-nightly.patched/lib/python/Plugins/Extensions/TopfieldVFD/plugin.py
  4191. --- enigma2-nightly.org/lib/python/Plugins/Extensions/TopfieldVFD/plugin.py 1970-01-01 01:00:00.000000000 +0100
  4192. +++ enigma2-nightly.patched/lib/python/Plugins/Extensions/TopfieldVFD/plugin.py 2013-10-26 03:02:27.245604785 +0200
  4193. @@ -0,0 +1,458 @@
  4194. +from Screens.Screen import Screen
  4195. +from Screens.MessageBox import MessageBox
  4196. +from Plugins.Plugin import PluginDescriptor
  4197. +from Tools import Notifications
  4198. +from Components.Pixmap import Pixmap, MovingPixmap
  4199. +from Components.ActionMap import ActionMap, NumberActionMap
  4200. +from Components.Label import Label
  4201. +from Components.Button import Button
  4202. +from Components.Console import Console
  4203. +from Components.ConfigList import ConfigList
  4204. +from Components.config import config, ConfigSubsection, ConfigEnableDisable, \
  4205. +   getConfigListEntry, ConfigInteger, ConfigSelection
  4206. +from Components.ConfigList import ConfigListScreen
  4207. +from Plugins.Plugin import PluginDescriptor
  4208. +import ServiceReference
  4209. +from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation
  4210. +from enigma import evfd
  4211. +import time, fcntl, struct
  4212. +from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
  4213. +from enigma import eTimer
  4214. +from re import compile as re_compile, search as re_search
  4215. +from time import time, localtime, strftime
  4216. +from Components.UsageConfig import defaultMoviePath
  4217. +from os import statvfs
  4218. +import array
  4219. +
  4220. +my_global_session = None
  4221. +debug = False
  4222. +
  4223. +config.plugins.TopfieldVFD = ConfigSubsection()
  4224. +config.plugins.TopfieldVFD.allCaps = ConfigEnableDisable(default = False)
  4225. +config.plugins.TopfieldVFD.scroll = ConfigSelection(choices = [("never"), ("once"), ("always")])
  4226. +config.plugins.TopfieldVFD.brightness = ConfigSelection(default = "medium", choices = [("dark"), ("medium"), ("bright")])
  4227. +config.plugins.TopfieldVFD.scrollPause = ConfigInteger(default = 100, limits = (1, 255))
  4228. +config.plugins.TopfieldVFD.scrollDelay = ConfigInteger(default = 10, limits = (1, 255))
  4229. +config.plugins.TopfieldVFD.typematicDelay = ConfigInteger(default = 3, limits = (0, 255))
  4230. +config.plugins.TopfieldVFD.typematicRate = ConfigInteger(default = 10, limits = (0, 255))
  4231. +config.plugins.TopfieldVFD.rcCommandSet = ConfigSelection(default = "TF7700 & Masterpiece", choices = [("TF7700"), ("Masterpiece"), ("TF7700 & Masterpiece")])
  4232. +config.plugins.TopfieldVFD.showClock = ConfigEnableDisable(default = True)
  4233. +config.plugins.TopfieldVFD.showEthernet = ConfigEnableDisable(default = True)
  4234. +
  4235. +# ioctl definitions for the VFD
  4236. +ioBootReason = 0x40003a0b
  4237. +ioOffFlush = struct.pack('LLB', 0x2, 0x0, 0x6)
  4238. +ioRec1Flush = struct.pack('LLB', 0x1000, 0x0, 0x6)
  4239. +ioRec2Flush = struct.pack('LLB', 0x2000, 0x0, 0x6)
  4240. +ioRecBothFlush = struct.pack('LLB', 0x3000, 0x0, 0x6)
  4241. +ioClockFlush = struct.pack('LLB', 0x20, 0x0, 0x6)
  4242. +ioClockOff = struct.pack('LLB', 0x20, 0x0, 0x0)
  4243. +ioHddClear =    struct.pack('LLB', 0x0, 0xff8000,0x0)
  4244. +ioHddUsage = (  struct.pack('LLB', 0x0, 0x006000,0xf),  # HDD empty
  4245. +                struct.pack('LLB', 0x0, 0x00e000,0xf),
  4246. +                struct.pack('LLB', 0x0, 0x01e000,0xf),
  4247. +                struct.pack('LLB', 0x0, 0x03e000,0xf),
  4248. +                struct.pack('LLB', 0x0, 0x07e000,0xf),
  4249. +                struct.pack('LLB', 0x0, 0x0fe000,0xf),
  4250. +                struct.pack('LLB', 0x0, 0x1fe000,0xf),
  4251. +                struct.pack('LLB', 0x0, 0x3fe000,0xf),
  4252. +                struct.pack('LLB', 0x0, 0x7fe000,0xf))  # HDD full
  4253. +ioHddFull = struct.pack('LLB', 0x0, 0x800000,0x6)       # "HDD full" flashing
  4254. +hddCheckPeriod = 60 # check every 60 seconds
  4255. +ioIconCmd = 0x400b3a20
  4256. +ioTimeshiftOn = struct.pack('LLB', 0x80, 0x0, 0xf)
  4257. +ioTimeshiftOff = struct.pack('LLB', 0x80, 0x0, 0x0)
  4258. +ioRec1On = struct.pack('LLB', 0x1000, 0x0, 0xf)
  4259. +ioRec1Off = struct.pack('LLB', 0x1000, 0x0, 0x0)
  4260. +ioRec2On = struct.pack('LLB', 0x2000, 0x0, 0xf)
  4261. +ioRec2Off = struct.pack('LLB', 0x2000, 0x0, 0x0)
  4262. +ioRecBothOn = struct.pack('LLB', 0x3000, 0x0, 0xf)
  4263. +ioRecBothOff = struct.pack('LLB', 0x3000, 0x0, 0x0)
  4264. +ioEthBothOff = struct.pack('LLB', 0x0c000000, 0x0, 0x0)
  4265. +ioEthLeftOn = struct.pack('LLB', 0x08000000, 0x0, 0xe)
  4266. +ioEthRightOn = struct.pack('LLB', 0x04000000, 0x0,0xb)
  4267. +
  4268. +ioColonOn = struct.pack('LLB', 0x4, 0x0,0x3)
  4269. +ioColonOff = struct.pack('LLB', 0x4, 0x0,0x0)
  4270. +ioBrightnessCmd = 0x40013a05
  4271. +ioIrFilter1Cmd = 0x40003a06
  4272. +ioIrFilter4Cmd = 0x40003a09
  4273. +ioTypematicDelayCmd = 0x40013a0d
  4274. +ioTypematicRateCmd = 0x40013a0e
  4275. +ioScrollModeCmd = 0x40033a15
  4276. +ioAllcapsCmd = 0x40013a14
  4277. +
  4278. +class TopfieldVFDSetup(ConfigListScreen, Screen):
  4279. +   skin = """
  4280. +       <screen position="100,100" size="550,400" title="TopfieldVFD Setup" >
  4281. +       <widget name="config" position="20,10" size="460,350" scrollbarMode="showOnDemand" />
  4282. +       <ePixmap position="140,350" size="140,40" pixmap="skin_default/buttons/green.png" alphatest="on" />
  4283. +       <ePixmap position="280,350" size="140,40" pixmap="skin_default/buttons/red.png" alphatest="on" />
  4284. +       <widget name="key_green" position="140,350" size="140,40" font="Regular;20" backgroundColor="#1f771f" zPosition="2" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
  4285. +       <widget name="key_red" position="280,350" size="140,40" font="Regular;20" backgroundColor="#9f1313" zPosition="2" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
  4286. +       </screen>"""
  4287. +
  4288. +   def __init__(self, session, args = None):
  4289. +       Screen.__init__(self, session)
  4290. +       self.onClose.append(self.abort)
  4291. +
  4292. +       # create elements for the menu list
  4293. +       self.list = [ ]
  4294. +       self.list.append(getConfigListEntry(_("Show clock"), config.plugins.TopfieldVFD.showClock))
  4295. +       self.list.append(getConfigListEntry(_("Show Ethernet activity"), config.plugins.TopfieldVFD.showEthernet))
  4296. +       self.list.append(getConfigListEntry(_("Brightness"), config.plugins.TopfieldVFD.brightness))
  4297. +       self.list.append(getConfigListEntry(_("All caps"), config.plugins.TopfieldVFD.allCaps))
  4298. +       self.list.append(getConfigListEntry(_("Scroll long strings"), config.plugins.TopfieldVFD.scroll))
  4299. +       self.list.append(getConfigListEntry(_("Scroll pause"), config.plugins.TopfieldVFD.scrollPause))
  4300. +       self.list.append(getConfigListEntry(_("Scroll delay"), config.plugins.TopfieldVFD.scrollDelay))
  4301. +       self.list.append(getConfigListEntry(_("Typematic delay"), config.plugins.TopfieldVFD.typematicDelay))
  4302. +       self.list.append(getConfigListEntry(_("Typematic rate"), config.plugins.TopfieldVFD.typematicRate))
  4303. +       self.list.append(getConfigListEntry(_("RC command set"), config.plugins.TopfieldVFD.rcCommandSet))
  4304. +       ConfigListScreen.__init__(self, self.list)
  4305. +
  4306. +       self.Console = Console()
  4307. +       self["key_red"] = Button(_("Cancel"))
  4308. +       self["key_green"] = Button(_("Save"))
  4309. +
  4310. +       # DO NOT ASK.
  4311. +       self["setupActions"] = ActionMap(["SetupActions"],
  4312. +       {
  4313. +           "save": self.save,
  4314. +           "cancel": self.cancel,
  4315. +           "ok": self.save,
  4316. +           }, -2)
  4317. +
  4318. +   def abort(self):
  4319. +       print "aborting"
  4320. +
  4321. +   def save(self):
  4322. +       # save all settings
  4323. +       for x in self["config"].list:
  4324. +           x[1].save()
  4325. +       tfVfd.setValues()
  4326. +       self.close()
  4327. +
  4328. +   def cancel(self):
  4329. +       for x in self["config"].list:
  4330. +           x[1].cancel()
  4331. +       self.close()
  4332. +
  4333. +class TopfieldVFD:
  4334. +   def __init__(self, session):
  4335. +       #print "TopfieldVFD initializing"
  4336. +       self.session = session
  4337. +       self.service = None
  4338. +       self.onClose = [ ]
  4339. +       self.__event_tracker = ServiceEventTracker(screen=self,eventmap=
  4340. +       {
  4341. +           iPlayableService.evSeekableStatusChanged: self.__evSeekableStatusChanged,
  4342. +           iPlayableService.evStart: self.__evStart,
  4343. +       })
  4344. +       session.nav.record_event.append(self.gotRecordEvent)
  4345. +       self.Console = Console()
  4346. +       self.tsEnabled = False
  4347. +       self.recNum = 0
  4348. +       self.timer = eTimer()
  4349. +       self.timer.callback.append(self.handleTimer)
  4350. +       self.timer.start(1000, False)
  4351. +       self.txCount = 0
  4352. +       self.clock = 0
  4353. +       self.valuesSet = 0
  4354. +       self.hddUsed = 10 # initialize with an invalid value
  4355. +       self.hddCheckCounter = hddCheckPeriod
  4356. +       self.ethEnabled = config.plugins.TopfieldVFD.showEthernet.getValue()
  4357. +       self.clockEnabled = config.plugins.TopfieldVFD.showClock.getValue()
  4358. +       self.setValues()
  4359. +
  4360. +   def setValues(self):
  4361. +       #print "\nTopfiledVFD.setValues()\n"
  4362. +       if config.plugins.TopfieldVFD.showClock.value:
  4363. +           self.enableClock()
  4364. +       else:
  4365. +           self.disableClock()
  4366. +
  4367. +       # enable/disable displaying Ethernet activity
  4368. +       if config.plugins.TopfieldVFD.showEthernet.getValue():
  4369. +           self.enableEthernet()
  4370. +       else:
  4371. +           self.disableEthernet()
  4372. +
  4373. +       try:
  4374. +           fd = open("/dev/fpc")
  4375. +
  4376. +           # set the brightness
  4377. +           brightness = 3
  4378. +           if config.plugins.TopfieldVFD.brightness.getValue() == "dark":
  4379. +               brightness = 1
  4380. +           elif config.plugins.TopfieldVFD.brightness.getValue() == "bright":
  4381. +               brightness = 5
  4382. +           fcntl.ioctl(fd.fileno(), ioBrightnessCmd, struct.pack('B', brightness))
  4383. +
  4384. +           # set the the scroll mode
  4385. +           if config.plugins.TopfieldVFD.scroll.value == "once":
  4386. +               scrollMode = 1
  4387. +           elif config.plugins.TopfieldVFD.scroll.value == "always":
  4388. +               scrollMode = 2
  4389. +           else: # set to never by default
  4390. +               scrollMode = 0
  4391. +           scrollOpts = struct.pack('BBB', scrollMode,
  4392. +                       int(config.plugins.TopfieldVFD.scrollPause.value),
  4393. +                       int(config.plugins.TopfieldVFD.scrollDelay.value))
  4394. +           fcntl.ioctl(fd.fileno(), ioScrollModeCmd, scrollOpts)
  4395. +
  4396. +           # set the typematic values
  4397. +           tmp = struct.pack('B', int(config.plugins.TopfieldVFD.typematicRate.value))
  4398. +           fcntl.ioctl(fd.fileno(), ioTypematicRateCmd, tmp)
  4399. +           tmp = struct.pack('B', int(config.plugins.TopfieldVFD.typematicDelay.value))
  4400. +           fcntl.ioctl(fd.fileno(), ioTypematicDelayCmd, tmp)
  4401. +
  4402. +           # set the IR filters
  4403. +           if config.plugins.TopfieldVFD.rcCommandSet.getValue() == "Masterpiece":
  4404. +               fcntl.ioctl(fd.fileno(), ioIrFilter1Cmd, struct.pack('B', 1))
  4405. +               fcntl.ioctl(fd.fileno(), ioIrFilter4Cmd, struct.pack('B', 0))
  4406. +           elif config.plugins.TopfieldVFD.rcCommandSet.getValue() == "TF7700":
  4407. +               fcntl.ioctl(fd.fileno(), ioIrFilter1Cmd, struct.pack('B', 0))
  4408. +               fcntl.ioctl(fd.fileno(), ioIrFilter4Cmd, struct.pack('B', 1))
  4409. +           else: # enable both by default
  4410. +               fcntl.ioctl(fd.fileno(), ioIrFilter1Cmd, struct.pack('B', 1))
  4411. +               fcntl.ioctl(fd.fileno(), ioIrFilter4Cmd, struct.pack('B', 1))
  4412. +
  4413. +           # set the allcaps parameter
  4414. +           if config.plugins.TopfieldVFD.allCaps.value:
  4415. +               fcntl.ioctl(fd.fileno(), ioAllcapsCmd, struct.pack('B', 1))
  4416. +           else:
  4417. +               fcntl.ioctl(fd.fileno(), ioAllcapsCmd, struct.pack('B', 0))
  4418. +
  4419. +           buf = array.array('h', [0])
  4420. +           fcntl.ioctl(fd.fileno(),ioBootReason,buf,1)
  4421. +           if buf[0] == 2:
  4422. +               fcntl.ioctl(fd.fileno(), ioIconCmd, ioOffFlush)
  4423. +
  4424. +           fd.close()
  4425. +           self.valuesSet = 1
  4426. +       except IOError,e:
  4427. +           if debug:
  4428. +               print "TopfieldVFD: setValues ", e
  4429. +
  4430. +   def enableEthernet(self):
  4431. +       self.ethEnabled = True
  4432. +
  4433. +   def disableEthernet(self):
  4434. +       self.ethEnabled = False
  4435. +       try:
  4436. +           fd = open("/dev/fpc")
  4437. +           fcntl.ioctl(fd.fileno(), ioIconCmd, ioEthBothOff)
  4438. +           fd.close()
  4439. +       except IOError,e:
  4440. +           if debug:
  4441. +               print "TopfieldVFD: disableEthernet ", e
  4442. +
  4443. +   def enableClock(self):
  4444. +       self.clockEnabled = True
  4445. +       self.clock = " "
  4446. +       try:
  4447. +           fd = open("/dev/fpc")
  4448. +           fcntl.ioctl(fd.fileno(), ioIconCmd, ioColonOn)
  4449. +           fd.close()
  4450. +       except IOError,e:
  4451. +           if debug:
  4452. +               print "TopfieldVFD: enableClock ", e
  4453. +
  4454. +   def disableClock(self):
  4455. +       self.clockEnabled = False
  4456. +       self.clock = " "
  4457. +       try:
  4458. +           fd = open("/dev/fpc")
  4459. +           fcntl.ioctl(fd.fileno(), ioIconCmd, ioColonOff)
  4460. +           fd.close()
  4461. +           open("/dev/fpsmall", "w").write("     ")
  4462. +       except IOError,e:
  4463. +           if debug:
  4464. +               print "TopfieldVFD: disableClock ", e
  4465. +
  4466. +   def regExpMatch(self, pattern, string):
  4467. +       if string is None:
  4468. +           return None
  4469. +       try:
  4470. +           return pattern.search(string).group()
  4471. +       except AttributeError:
  4472. +           None
  4473. +
  4474. +   def displayHddUsed(self):
  4475. +       if debug:
  4476. +           print "TopfieldVFD: determine HDD usage"
  4477. +
  4478. +       # determine the HDD usage
  4479. +       used = 0;
  4480. +       try:
  4481. +           f = statvfs(defaultMoviePath())
  4482. +           # there are 8 HDD segments in the VFD
  4483. +           used = (f.f_blocks - f.f_bavail) * 8 / f.f_blocks
  4484. +       except:
  4485. +           used = 0;
  4486. +
  4487. +       if self.hddUsed != used:
  4488. +           try:
  4489. +               fd = open("/dev/fpc")
  4490. +               if self.hddUsed > used:
  4491. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioHddClear)
  4492. +               fcntl.ioctl(fd.fileno(), ioIconCmd, ioHddUsage[used])
  4493. +               if used == 8:
  4494. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioHddFull)
  4495. +               fd.close();
  4496. +           except IOError,e:
  4497. +               self.hddUsed = used # dummy operation
  4498. +           self.hddUsed = used
  4499. +
  4500. +   def handleTimer(self):
  4501. +       #print "[ TopfieldVFD timer ]"
  4502. +       if self.valuesSet == 0:
  4503. +           self.setValues()
  4504. +
  4505. +       if self.clockEnabled:
  4506. +           clock = strftime("%k%M",localtime(time()))
  4507. +           if clock != self.clock:
  4508. +               self.clock = clock
  4509. +               try:
  4510. +                   open("/dev/fpsmall", "w").write(clock + "\0")
  4511. +               except IOError,e:
  4512. +                   if debug:
  4513. +                       print "TopfieldVFD: handleTimer (clock) ", e
  4514. +
  4515. +       # check HDD periodically
  4516. +       if self.hddCheckCounter < hddCheckPeriod:
  4517. +           self.hddCheckCounter += 1
  4518. +       else:
  4519. +           self.hddCheckCounter = 0
  4520. +           self.displayHddUsed()
  4521. +
  4522. +       if self.ethEnabled == False:
  4523. +           return
  4524. +
  4525. +       result = open("/proc/net/dev").readlines()
  4526. +       numRegExp = "[0-9]+"
  4527. +       numPattern = re_compile(numRegExp)
  4528. +       txPattern = re_compile("eth0:[ ]*" + numRegExp)
  4529. +       for item in result:
  4530. +           tmp = self.regExpMatch(txPattern, item)
  4531. +           if tmp != None:
  4532. +               tmp = tmp[5:].lstrip()
  4533. +               try:
  4534. +                   fd = open("/dev/fpc")
  4535. +                   if self.txCount != tmp:
  4536. +                       fcntl.ioctl(fd.fileno(), ioIconCmd, ioEthLeftOn)
  4537. +                       fcntl.ioctl(fd.fileno(), ioIconCmd, ioEthRightOn)
  4538. +                       self.txCount = tmp
  4539. +                   else:
  4540. +                       fcntl.ioctl(fd.fileno(), ioIconCmd, ioEthBothOff)
  4541. +                   fd.close()
  4542. +               except IOError,e:
  4543. +                   if debug:
  4544. +                       print "TopfieldVFD: handleTimer (Ethernet) ", e
  4545. +                   break
  4546. +
  4547. +   def __evStart(self):
  4548. +       self.__evSeekableStatusChanged()
  4549. +
  4550. +   def getTimeshiftState(self):
  4551. +       service = self.session.nav.getCurrentService()
  4552. +       if service is None:
  4553. +           return False
  4554. +       timeshift = service.timeshift()
  4555. +       if timeshift is None:
  4556. +           return False
  4557. +       return True
  4558. +
  4559. +   def __evSeekableStatusChanged(self):
  4560. +       tmp = self.getTimeshiftState()
  4561. +       if tmp == self.tsEnabled:
  4562. +           return
  4563. +       try:
  4564. +           fd = open("/dev/fpc")
  4565. +           if tmp:
  4566. +               print "[Timeshift enabled]"
  4567. +               fcntl.ioctl(fd.fileno(), ioIconCmd, ioTimeshiftOn)
  4568. +           else:
  4569. +               print "[Timeshift disabled]"
  4570. +               fcntl.ioctl(fd.fileno(), ioIconCmd, ioTimeshiftOff)
  4571. +           fd.close()
  4572. +       except IOError,e:
  4573. +           if debug:
  4574. +               print "TopfieldVFD: __evSeekableStatusChanged ", e
  4575. +           self.tsEnabled = tmp
  4576. +
  4577. +   def gotRecordEvent(self, service, event):
  4578. +       recs = self.session.nav.getRecordings()
  4579. +       nrecs = len(recs)
  4580. +       if nrecs == self.recNum:
  4581. +           return
  4582. +       try:
  4583. +           fd = open("/dev/fpc")
  4584. +           if config.usage.blinking_display_clock_during_recording.value:
  4585. +               if nrecs > 1: # set rec 1+2 symbols
  4586. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioRecBothFlush)
  4587. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioClockFlush)
  4588. +               elif nrecs > 0: # set rec 1 symbol
  4589. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioRecBothOff)
  4590. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioClockFlush)
  4591. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioRec1Flush)
  4592. +               else:
  4593. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioClockOff)
  4594. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioRecBothOff)
  4595. +           else:
  4596. +               fcntl.ioctl(fd.fileno(), ioIconCmd, ioClockOff)
  4597. +               if nrecs > 1: # set rec 1+2 symbols
  4598. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioRecBothOn)
  4599. +               elif nrecs > 0: # set rec 1 symbol
  4600. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioRecBothOff)
  4601. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioRec1On)
  4602. +               else:
  4603. +                   fcntl.ioctl(fd.fileno(), ioIconCmd, ioRecBothOff)
  4604. +
  4605. +           fd.close()
  4606. +       except IOError,e:
  4607. +           if debug:
  4608. +               print "TopfieldVFD: gotRecordEvent ", e
  4609. +       self.recNum = nrecs
  4610. +
  4611. +   def shutdown(self):
  4612. +       self.abort()
  4613. +
  4614. +   def abort(self):
  4615. +       print "TopfieldVFD aborting"
  4616. +
  4617. +def main(session, **kwargs):
  4618. +   session.open(TopfieldVFDSetup)
  4619. +
  4620. +tfVfd = None
  4621. +gReason = -1
  4622. +mySession = None
  4623. +
  4624. +def controlTfVfd():
  4625. +   global tfVfd
  4626. +   global gReason
  4627. +   global mySession
  4628. +
  4629. +   if gReason == 0 and mySession != None and tfVfd == None:
  4630. +       print "Starting TopfieldVFD"
  4631. +       tfVfd = TopfieldVFD(mySession)
  4632. +   elif gReason == 1 and tfVfd != None:
  4633. +       print "Stopping TopfieldVFD"
  4634. +       tfVfd.disableClock()
  4635. +       tfVfd = None
  4636. +
  4637. +def autostart(reason, **kwargs):
  4638. +   global tfVfd
  4639. +   global gReason
  4640. +   global mySession
  4641. +
  4642. +   if kwargs.has_key("session"):
  4643. +       global my_global_session
  4644. +       mySession = kwargs["session"]
  4645. +   else:
  4646. +       gReason = reason
  4647. +   controlTfVfd()
  4648. +
  4649. +def Plugins(**kwargs):
  4650. +   return [ PluginDescriptor(name="TopfieldVFD", description="Change VFD display settings", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main),
  4651. +       PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART, PluginDescriptor.WHERE_AUTOSTART], fnc = autostart) ]
  4652. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/HdmiCEC/plugin.py enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/HdmiCEC/plugin.py
  4653. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/HdmiCEC/plugin.py  2013-08-11 08:11:19.258306130 +0200
  4654. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/HdmiCEC/plugin.py  2013-10-26 03:02:27.245604785 +0200
  4655. @@ -106,7 +106,7 @@
  4656.  
  4657. def Plugins(**kwargs):
  4658.     from os import path
  4659. -   if path.exists("/dev/hdmi_cec") or path.exists("/dev/misc/hdmi_cec0"):
  4660. +   if path.exists("/dev/hdmi_cec") or path.exists("/lib/modules/cec.ko"):
  4661.         import Components.HdmiCec
  4662.         from Plugins.Plugin import PluginDescriptor
  4663.         return [PluginDescriptor(name = "HDMI CEC setup", description = _("Adjust HDMI CEC settings"), where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main)]
  4664. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py
  4665. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py  2013-08-11 08:11:19.258306130 +0200
  4666. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/Hotplug/plugin.py  2013-10-26 03:02:27.245604785 +0200
  4667. @@ -9,6 +9,8 @@
  4668.     action = v.get("ACTION")
  4669.     device = v.get("DEVPATH")
  4670.     physdevpath = v.get("PHYSDEVPATH")
  4671. +   if physdevpath == "-":
  4672. +       physdevpath = None
  4673.     media_state = v.get("X_E2_MEDIA_STATUS")
  4674.  
  4675.     dev = device.split('/')[-1]
  4676. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/Makefile.am enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/Makefile.am
  4677. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/Makefile.am    2013-08-11 08:11:19.258306130 +0200
  4678. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/Makefile.am    2013-10-26 03:02:27.249604784 +0200
  4679. @@ -2,9 +2,9 @@
  4680.  
  4681. SUBDIRS = SoftwareManager PositionerSetup Satfinder \
  4682.     SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug \
  4683. -   DefaultServicesScanner DiseqcTester CommonInterfaceAssignment \
  4684. +   DefaultServicesScanner DiseqcTester \
  4685.     CableScan FastScan OSDPositionSetup OSD3DSetup HdmiCEC VideoClippingSetup \
  4686. -   VideoEnhancement WirelessLan NetworkWizard
  4687. +   VideoEnhancement WirelessLan NetworkWizard VFD-Icons
  4688.  
  4689. if HAVE_TEMPFANCONTROL
  4690. SUBDIRS += TempFanControl
  4691. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/__init__.py enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/__init__.py
  4692. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/__init__.py  1970-01-01 01:00:00.000000000 +0100
  4693. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/__init__.py  2013-10-26 03:02:27.249604784 +0200
  4694. @@ -0,0 +1,2 @@
  4695. +
  4696. +
  4697. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/LICENSE enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/LICENSE
  4698. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/LICENSE  1970-01-01 01:00:00.000000000 +0100
  4699. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/LICENSE  2013-10-26 03:02:27.249604784 +0200
  4700. @@ -0,0 +1,9 @@
  4701. +This plugin is licensed under the Creative Commons
  4702. +Attribution-NonCommercial-ShareAlike 3.0 Unported
  4703. +License. To view a copy of this license, visit
  4704. +http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative
  4705. +Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
  4706. +
  4707. +This plugin is NOT free software. It is open source, you are allowed to
  4708. +modify it (if you keep the license), but it may not be commercially
  4709. +distributed other than under the conditions noted above.
  4710. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/Makefile.am enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/Makefile.am
  4711. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/Makefile.am  1970-01-01 01:00:00.000000000 +0100
  4712. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/Makefile.am  2013-10-26 03:02:27.249604784 +0200
  4713. @@ -0,0 +1,9 @@
  4714. +installdir = $(pkglibdir)/python/Plugins/SystemPlugins/VFD-Icons
  4715. +
  4716. +SUBDIRS = meta
  4717. +
  4718. +install_PYTHON = \
  4719. +   __init__.py \
  4720. +   plugin.py
  4721. +
  4722. +dist_install_DATA = LICENSE
  4723. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/meta/Makefile.am enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/meta/Makefile.am
  4724. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/meta/Makefile.am 1970-01-01 01:00:00.000000000 +0100
  4725. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/meta/Makefile.am 2013-10-26 03:02:27.249604784 +0200
  4726. @@ -0,0 +1,3 @@
  4727. +installdir = $(datadir)/meta
  4728. +
  4729. +dist_install_DATA = plugin_vfd-icons.xml
  4730. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/meta/plugin_vfd-icons.xml enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/meta/plugin_vfd-icons.xml
  4731. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/meta/plugin_vfd-icons.xml    1970-01-01 01:00:00.000000000 +0100
  4732. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/meta/plugin_vfd-icons.xml    2013-10-26 03:02:27.249604784 +0200
  4733. @@ -0,0 +1,20 @@
  4734. +<default>
  4735. +   <prerequisites>
  4736. +       <hardware type="dm8000" />
  4737. +       <tag type="System" />
  4738. +   </prerequisites>
  4739. +   <info>
  4740. +       <author>Team Ducktales</author>
  4741. +       <name>VFD-Icons</name>
  4742. +       <packagename>enigma2-plugin-systemplugins-vfd-icons</packagename>
  4743. +       <packagetype>public</packagetype> <!-- internal/public , public is default, internal metas are not displayed inside plugin manager -->
  4744. +       <shortdescription>Displays text on vfd</shortdescription>
  4745. +       <description>Displays text on vfd.
  4746. +       </description>
  4747. +   </info>
  4748. +
  4749. +   <files type="package"> <!-- without version, without .ipk -->
  4750. +       <file type="package" name="enigma2-plugin-systemplugins-vfd-icons" />
  4751. +   </files>
  4752. +
  4753. +</default>
  4754. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/plugin.py enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/plugin.py
  4755. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/VFD-Icons/plugin.py    1970-01-01 01:00:00.000000000 +0100
  4756. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/VFD-Icons/plugin.py    2013-10-26 03:02:27.249604784 +0200
  4757. @@ -0,0 +1,152 @@
  4758. +# -*- coding: utf-8 -*-
  4759. +from Plugins.Plugin import PluginDescriptor
  4760. +import ServiceReference
  4761. +from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation
  4762. +from enigma import evfd
  4763. +import time
  4764. +from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
  4765. +
  4766. +class VFDIcons:
  4767. +   def __init__(self, session):
  4768. +       # Save Session&Servicelist, Create Timer, Init Services
  4769. +       self.session = session
  4770. +       self.service = None
  4771. +       self.onClose = [ ]
  4772. +       self.__event_tracker = ServiceEventTracker(screen=self,eventmap=
  4773. +           {
  4774. +               iPlayableService.evUpdatedInfo: self.__evUpdatedInfo,
  4775. +               iPlayableService.evUpdatedEventInfo: self.__evUpdatedEventInfo,
  4776. +               iPlayableService.evVideoSizeChanged: self.__evVideoSizeChanged,
  4777. +               iPlayableService.evSeekableStatusChanged: self.__evSeekableStatusChanged,
  4778. +               iPlayableService.evStart: self.__evStart,
  4779. +           })
  4780. +       session.nav.record_event.append(self.gotRecordEvent)
  4781. +       self.mp3Available = False
  4782. +       self.dolbyAvailable = False
  4783. +      
  4784. +   def __evStart(self):
  4785. +       print "[__evStart]"
  4786. +       self.__evSeekableStatusChanged()
  4787. +
  4788. +   def __evUpdatedInfo(self):
  4789. +       print "[__evUpdatedInfo]"
  4790. +       self.checkAudioTracks()
  4791. +       self.writeChannelName()
  4792. +       self.showCrypted()
  4793. +       self.showDolby()
  4794. +       self.showMp3()
  4795. +
  4796. +   def writeChannelName(self):
  4797. +       print "[writeChannelName]"
  4798. +       servicename = ""
  4799. +       currPlay = self.session.nav.getCurrentService()
  4800. +       if currPlay != None and self.mp3Available:
  4801. +           # show the MP3 tag
  4802. +           servicename = currPlay.info().getInfoString(iServiceInformation.sTagTitle)
  4803. +       else:
  4804. +           # show the service name
  4805. +           self.service = self.session.nav.getCurrentlyPlayingServiceReference()
  4806. +           if not self.service is None:
  4807. +               service = self.service.toCompareString()
  4808. +               servicename = ServiceReference.ServiceReference(service).getServiceName().replace('\xc2\x87', '').replace('\xc2\x86', '').ljust(16)
  4809. +               subservice = self.service.toString().split("::")
  4810. +               if subservice[0].count(':') == 9:
  4811. +                   servicename = subservice[1].replace('\xc2\x87', '').replace('\xc3\x9f', 'ss').replace('\xc2\x86', '').ljust(16)
  4812. +               else:
  4813. +                   servicename=servicename
  4814. +           else:
  4815. +               print "no Service found"
  4816. +
  4817. +       print "vfd display text:", servicename[0:63]
  4818. +       evfd.getInstance().vfd_write_string(servicename[0:63])
  4819. +       return 1
  4820. +
  4821. +   def showCrypted(self):
  4822. +       print "[showCrypted]"
  4823. +       service=self.session.nav.getCurrentService()
  4824. +       if service is not None:
  4825. +           info=service.info()
  4826. +           crypted = info and info.getInfo(iServiceInformation.sIsCrypted) or -1
  4827. +           if crypted == 1 : #set crypt symbol
  4828. +               evfd.getInstance().vfd_set_icon(0x13,1)
  4829. +           else:
  4830. +               evfd.getInstance().vfd_set_icon(0x13,0)
  4831. +
  4832. +   def checkAudioTracks(self):
  4833. +       self.dolbyAvailable = False
  4834. +       self.mp3Available = False
  4835. +       service=self.session.nav.getCurrentService()
  4836. +       if service is not None:
  4837. +           audio = service.audioTracks()
  4838. +           if audio:
  4839. +               n = audio.getNumberOfTracks()
  4840. +               for x in range(n):
  4841. +                   i = audio.getTrackInfo(x)
  4842. +                   description = i.getDescription();
  4843. +                   if description.find("MP3") != -1:
  4844. +                       self.mp3Available = True
  4845. +                   if description.find("AC3") != -1 or description.find("DTS") != -1:
  4846. +                       self.dolbyAvailable = True
  4847. +
  4848. +   def showDolby(self):
  4849. +       print "[showDolby]"
  4850. +       if self.dolbyAvailable:
  4851. +           evfd.getInstance().vfd_set_icon(0x17,1)
  4852. +       else:
  4853. +           evfd.getInstance().vfd_set_icon(0x17,0)
  4854. +
  4855. +   def showMp3(self):
  4856. +       print "[showMp3]"
  4857. +       if self.mp3Available:
  4858. +           evfd.getInstance().vfd_set_icon(0x15,1)
  4859. +       else:
  4860. +           evfd.getInstance().vfd_set_icon(0x15,0)
  4861. +
  4862. +   def __evUpdatedEventInfo(self):
  4863. +       print "[__evUpdatedEventInfo]"
  4864. +
  4865. +   def getSeekState(self):
  4866. +       service = self.session.nav.getCurrentService()
  4867. +       if service is None:
  4868. +           return False
  4869. +       seek = service.seek()
  4870. +       if seek is None:
  4871. +           return False
  4872. +       return seek.isCurrentlySeekable()
  4873. +
  4874. +   def __evSeekableStatusChanged(self):
  4875. +       print "[__evSeekableStatusChanged]"
  4876. +       if self.getSeekState():
  4877. +           evfd.getInstance().vfd_set_icon(0x1A,1)
  4878. +       else:
  4879. +           evfd.getInstance().vfd_set_icon(0x1A,0)
  4880. +
  4881. +   def __evVideoSizeChanged(self):
  4882. +       print "[__evVideoSizeChanged]"
  4883. +       service=self.session.nav.getCurrentService()
  4884. +       if service is not None:
  4885. +           info=service.info()
  4886. +           height = info and info.getInfo(iServiceInformation.sVideoHeight) or -1
  4887. +           if height > 576 : #set HD symbol
  4888. +               evfd.getInstance().vfd_set_icon(0x11,1)
  4889. +           else:
  4890. +               evfd.getInstance().vfd_set_icon(0x11,0)
  4891. +
  4892. +   def gotRecordEvent(self, service, event):
  4893. +       recs = self.session.nav.getRecordings()
  4894. +       nrecs = len(recs)
  4895. +       if nrecs > 0: #set rec symbol
  4896. +           evfd.getInstance().vfd_set_icon(0x1e,1)
  4897. +       else:
  4898. +           evfd.getInstance().vfd_set_icon(0x1e,0)
  4899. +
  4900. +VFDIconsInstance = None
  4901. +
  4902. +def main(session, **kwargs):
  4903. +   # Create Instance if none present, show Dialog afterwards
  4904. +   global VFDIconsInstance
  4905. +   if VFDIconsInstance is None:
  4906. +       VFDIconsInstance = VFDIcons(session)
  4907. +
  4908. +def Plugins(**kwargs):
  4909. +   return [ PluginDescriptor(name="VFDIcons", description="Icons in VFD", where = PluginDescriptor.WHERE_SESSIONSTART, fnc=main ) ]
  4910. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/Videomode/plugin.py enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/Videomode/plugin.py
  4911. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/Videomode/plugin.py    2013-08-11 08:11:19.310306128 +0200
  4912. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/Videomode/plugin.py    2013-10-26 03:02:27.249604784 +0200
  4913. @@ -67,6 +67,9 @@
  4914.                 self.list.append(getConfigListEntry(_("Resolution"), config.av.videorate[config.av.videomode[config.av.videoport.value].value], _("Configure the screen resolution in PC output mode.")))
  4915.             else:
  4916.                 self.list.append(getConfigListEntry(_("Refresh rate"), config.av.videorate[config.av.videomode[config.av.videoport.value].value], _("Configure the refresh rate of the screen.")))
  4917. +#+++>
  4918. +       self.list.append(getConfigListEntry(_("3D Mode"), config.av.threedmode))
  4919. +#+++<
  4920.  
  4921.         port = config.av.videoport.value
  4922.         if port not in config.av.videomode:
  4923. @@ -90,6 +93,14 @@
  4924.  
  4925.  #      if config.av.videoport.value == "DVI":
  4926.  #          self.list.append(getConfigListEntry(_("Allow Unsupported Modes"), config.av.edid_override))
  4927. +#+++>
  4928. +       if config.av.videoport.value == "Component":
  4929. +           self.list.append(getConfigListEntry(_("Color Format"), config.av.colorformat_yuv))
  4930. +
  4931. +       if config.av.videoport.value == "HDMI":
  4932. +           self.list.append(getConfigListEntry(_("Color Format"), config.av.colorformat_hdmi))
  4933. +           self.list.append(getConfigListEntry(_("Audio Source"), config.av.hdmi_audio_source))
  4934. +#+++<
  4935.         if config.av.videoport.value == "Scart":
  4936.             self.list.append(getConfigListEntry(_("Color format"), config.av.colorformat, _("Configure which color format should be used on the SCART output.")))
  4937.             if level >= 1:
  4938. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py
  4939. --- enigma2-nightly.org/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py 2013-08-11 08:11:19.306306129 +0200
  4940. +++ enigma2-nightly.patched/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py 2013-10-26 03:02:27.249604784 +0200
  4941. @@ -14,54 +14,36 @@
  4942.  
  4943.     modes = { }  # a list of (high-level) modes for a certain port.
  4944.  
  4945. -   rates["PAL"] =          { "50Hz":   { 50: "pal" },
  4946. -                               "60Hz":     { 60: "pal60" },
  4947. -                               "multi":    { 50: "pal", 60: "pal60" } }
  4948. +   rates["PAL"] =          { "50Hz":   { 50: "pal" } }
  4949.  
  4950. -   rates["NTSC"] =         { "60Hz":   { 60: "ntsc" } }
  4951. +   rates["576i"] =         { "50Hz":   { 50: "576i50" } }
  4952.  
  4953. -   rates["Multi"] =        { "multi":  { 50: "pal", 60: "ntsc" } }
  4954. +   rates["576p"] =         { "50Hz":   { 50: "576p50" } }
  4955.  
  4956. -   rates["480i"] =         { "60Hz":   { 60: "480i" } }
  4957. -
  4958. -   rates["576i"] =         { "50Hz":   { 50: "576i" } }
  4959. -
  4960. -   rates["480p"] =         { "60Hz":   { 60: "480p" } }
  4961. -
  4962. -   rates["576p"] =         { "50Hz":   { 50: "576p" } }
  4963. -
  4964. -   rates["720p"] =         { "50Hz":   { 50: "720p50" },
  4965. -                               "60Hz":     { 60: "720p" },
  4966. -                               "multi":    { 50: "720p50", 60: "720p" } }
  4967. +   rates["720p"] =         { "50Hz":   { 50: "720p50" },
  4968. +                               "60Hz": { 60: "720p60" } }
  4969.  
  4970.     rates["1080i"] =        { "50Hz":   { 50: "1080i50" },
  4971. -                               "60Hz":     { 60: "1080i" },
  4972. -                               "multi":    { 50: "1080i50", 60: "1080i" } }
  4973. +                               "60Hz": { 60: "1080i60" } }
  4974.  
  4975. -   rates["1080p"] =        { "50Hz":   { 50: "1080p50" },
  4976. -                               "60Hz":     { 60: "1080p" },
  4977. -                               "multi":    { 50: "1080p50", 60: "1080p" } }
  4978. +   rates["1080p"] =        { "23Hz":   { 50: "1080p23" },
  4979. +                               "24Hz": { 60: "1080p24" },
  4980. +                               "25Hz": { 60: "1080p25" },
  4981. +                               "29Hz": { 60: "1080p29" },
  4982. +                               "30Hz": { 60: "1080p30" },
  4983. +                               "50Hz": { 60: "1080p50" },
  4984. +                               "60Hz": { 60: "1080p60" } }
  4985.  
  4986.     rates["PC"] = {
  4987. -       "1024x768": { 60: "1024x768" }, # not possible on DM7025
  4988. -       "800x600" : { 60: "800x600" },  # also not possible
  4989. -       "720x480" : { 60: "720x480" },
  4990. -       "720x576" : { 60: "720x576" },
  4991. -       "1280x720": { 60: "1280x720" },
  4992. -       "1280x720 multi": { 50: "1280x720_50", 60: "1280x720" },
  4993. -       "1920x1080": { 60: "1920x1080"},
  4994. -       "1920x1080 multi": { 50: "1920x1080", 60: "1920x1080_50" },
  4995. -       "1280x1024" : { 60: "1280x1024"},
  4996. -       "1366x768" : { 60: "1366x768"},
  4997. -       "1366x768 multi" : { 50: "1366x768", 60: "1366x768_50" },
  4998. -       "1280x768": { 60: "1280x768" },
  4999. -       "640x480" : { 60: "640x480" }
  5000. +       "1024x768"  : { 60: "1024x768_60", 70: "1024x768_70", 75: "1024x768_75", 90: "1024x768_90", 100: "1024x768_100" }, #43 60 70 72 75 90 100
  5001. +       "1280x1024" : { 60: "1280x1024_60", 70: "1280x1024_70", 75: "1280x1024_75" }, #43 47 60 70 74 75
  5002. +       "1600x1200" : { 60: "1600x1200_60" }, #60 66 76
  5003.     }
  5004.  
  5005. -   modes["Scart"] = ["PAL", "NTSC", "Multi"]
  5006. -   modes["YPbPr"] = ["720p", "1080i", "576p", "480p", "576i", "480i"]
  5007. -   modes["DVI"] = ["720p", "1080p", "1080i", "576p", "480p", "576i", "480i"]
  5008. -   modes["DVI-PC"] = ["PC"]
  5009. +   modes["Scart"] = ["PAL"]
  5010. +   modes["Component"] = ["720p", "1080p", "1080i", "576p", "576i"]
  5011. +   modes["HDMI"] = ["720p", "1080p", "1080i", "576p", "576i"]
  5012. +   modes["HDMI-PC"] = ["PC"]
  5013.  
  5014.     def getOutputAspect(self):
  5015.         ret = (16,9)
  5016. @@ -109,14 +91,14 @@
  5017.         portlist = self.getPortList()
  5018.         has1080p50 = False
  5019.         for port in portlist:
  5020. -           if port == 'DVI' and HardwareInfo().has_hdmi():
  5021. +           if port == 'HDMI' and HardwareInfo().has_hdmi():
  5022.                 if "1080p50" in self.modes_available:
  5023.                     has1080p50 = True
  5024.  
  5025.         if has1080p50:
  5026. -           self.widescreen_modes = set(["720p", "1080i", "1080p"])
  5027. +           self.widescreen_modes = set(["576i", "576p", "720p", "1080i", "1080p"])
  5028.         else:
  5029. -           self.widescreen_modes = set(["720p", "1080i"])
  5030. +           self.widescreen_modes = set(["576i", "576p", "720p", "1080i"])
  5031.  
  5032.         # take over old AVSwitch component :)
  5033.         from Components.AVSwitch import AVSwitch
  5034. @@ -125,6 +107,16 @@
  5035.         config.av.wss.notifiers = [ ]
  5036.         AVSwitch.getOutputAspect = self.getOutputAspect
  5037.  
  5038. +#+++>
  5039. +       config.av.colorformat_hdmi = ConfigSelection(choices = {"hdmi_rgb": _("RGB"), "hdmi_yuv": _("YUV"), "hdmi_422": _("422")}, default="hdmi_rgb")
  5040. +       config.av.colorformat_yuv = ConfigSelection(choices = {"yuv": _("YUV")}, default="yuv")
  5041. +       config.av.hdmi_audio_source = ConfigSelection(choices = {"pcm": _("PCM"), "spdif": _("SPDIF")}, default="pcm")
  5042. +       config.av.threedmode = ConfigSelection(choices = {"off": _("Off"), "sbs": _("Side by Side"),"tab": _("Top and Bottom")}, default="off")
  5043. +       config.av.threedmode.addNotifier(self.set3DMode)
  5044. +       config.av.colorformat_hdmi.addNotifier(self.setHDMIColor)
  5045. +       config.av.colorformat_yuv.addNotifier(self.setYUVColor)
  5046. +       config.av.hdmi_audio_source.addNotifier(self.setHDMIAudioSource)
  5047. +#+++<
  5048.         config.av.aspect.addNotifier(self.updateAspect)
  5049.         config.av.wss.addNotifier(self.updateAspect)
  5050.         config.av.policy_169.addNotifier(self.updateAspect)
  5051. @@ -156,6 +148,8 @@
  5052.     def isModeAvailable(self, port, mode, rate):
  5053.         rate = self.rates[mode][rate]
  5054.         for mode in rate.values():
  5055. +           if port == "HDMI-PC":
  5056. +               return True
  5057.             if mode not in self.modes_available:
  5058.                 return False
  5059.         return True
  5060. @@ -192,7 +186,12 @@
  5061.         except IOError:
  5062.             print "writing initial videomode to /etc/videomode failed."
  5063.  
  5064. +       #call setResolution() with -1,-1 to read the new scrren dimesions without changing the framebuffer resolution
  5065. +       from enigma import gMainDC
  5066. +       gMainDC.getInstance().setResolution(-1, -1)
  5067. +
  5068.         self.updateAspect(None)
  5069. +       self.updateColor(port)
  5070.  
  5071.     def saveMode(self, port, mode, rate):
  5072.         print "saveMode", port, mode, rate
  5073. @@ -210,7 +209,8 @@
  5074.         return True
  5075.  
  5076.     def isPortUsed(self, port):
  5077. -       if port == "DVI":
  5078. +#      if port == "DVI":
  5079. +       if port == "HDMI":
  5080.             self.readPreferredModes()
  5081.             return len(self.modes_preferred) != 0
  5082.         else:
  5083. @@ -336,6 +336,33 @@
  5084.         except IOError:
  5085.             pass
  5086.  
  5087. +#+++>
  5088. +   def set3DMode(self, configElement):
  5089. +       open("/proc/stb/video/3d_mode", "w").write(configElement.value)
  5090. +
  5091. +   def setHDMIColor(self, configElement):
  5092. +       map = {"hdmi_rgb": 0, "hdmi_yuv": 1, "hdmi_422": 2}
  5093. +       open("/proc/stb/avs/0/colorformat", "w").write(configElement.value)
  5094. +
  5095. +   def setYUVColor(self, configElement):
  5096. +       map = {"yuv": 0}
  5097. +       open("/proc/stb/avs/0/colorformat", "w").write(configElement.value)
  5098. +
  5099. +   def setHDMIAudioSource(self, configElement):
  5100. +       open("/proc/stb/hdmi/audio_source", "w").write(configElement.value)
  5101. +
  5102. +   def updateColor(self, port):
  5103. +       print "updateColor: ", port
  5104. +       if port == "HDMI":
  5105. +           self.setHDMIColor(config.av.colorformat_hdmi)
  5106. +       elif port == "Component":
  5107. +           self.setYUVColor(config.av.colorformat_yuv)
  5108. +       elif port == "Scart":
  5109. +           map = {"cvbs": 0, "rgb": 1, "svideo": 2, "yuv": 3}
  5110. +           from enigma import eAVSwitch
  5111. +           eAVSwitch.getInstance().setColorFormat(map[config.av.colorformat.value])
  5112. +#+++<
  5113. +
  5114. config.av.edid_override = ConfigYesNo(default = False)
  5115. video_hw = VideoHardware()
  5116. video_hw.setConfiguredMode()
  5117. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Screens/ChannelSelection.py enigma2-nightly.patched/lib/python/Screens/ChannelSelection.py
  5118. --- enigma2-nightly.org/lib/python/Screens/ChannelSelection.py  2013-10-26 03:02:19.749604954 +0200
  5119. +++ enigma2-nightly.patched/lib/python/Screens/ChannelSelection.py  2013-10-26 03:04:42.193601733 +0200
  5120. @@ -5,6 +5,11 @@
  5121. import Components.ParentalControl
  5122. from Components.Button import Button
  5123. from Components.ServiceList import ServiceList, refreshServiceList
  5124. +#+++>
  5125. +from Components.Sources.StaticText import StaticText
  5126. +from Components.Label import Label
  5127. +from os import path as os_path, system, unlink
  5128. +#+++<
  5129. from Components.ActionMap import NumberActionMap, ActionMap, HelpableActionMap
  5130. from Components.MenuList import MenuList
  5131. from Components.ServiceEventTracker import ServiceEventTracker, InfoBarBase
  5132. @@ -480,7 +485,9 @@
  5133.         self.saved_title = None
  5134.         self.saved_root = None
  5135.         self.current_ref = None
  5136. -
  5137. +#+++>
  5138. +       self["title"] = StaticText()
  5139. +#+++<
  5140.         class ChannelSelectionEditActionMap(ActionMap):
  5141.             def __init__(self, csel, contexts = [ ], actions = { }, prio=0):
  5142.                 ActionMap.__init__(self, contexts, actions, prio)
  5143. @@ -716,6 +723,9 @@
  5144.             else:
  5145.                 new_title += ' ' + _("[favourite edit]")
  5146.         self.setTitle(new_title)
  5147. +#+++>
  5148. +       self["title"].setText(new_title)
  5149. +#+++<
  5150.         self.__marked = self.servicelist.getRootServices()
  5151.         for x in self.__marked:
  5152.             self.servicelist.addMarked(eServiceReference(x))
  5153. @@ -741,6 +751,9 @@
  5154.         self.bouquet_mark_edit = OFF
  5155.         self.mutableList = None
  5156.         self.setTitle(self.saved_title)
  5157. +#+++>
  5158. +       self["title"].setText(self.saved_title)
  5159. +#+++<
  5160.         self.saved_title = None
  5161.         # self.servicePath is just a reference to servicePathTv or Radio...
  5162.         # so we never ever do use the asignment operator in self.servicePath
  5163. @@ -797,6 +810,9 @@
  5164.             self.mutableList.flushChanges() # FIXME add check if changes was made
  5165.             self.mutableList = None
  5166.             self.setTitle(self.saved_title)
  5167. +#+++>
  5168. +           self["title"].setText(self.saved_title)
  5169. +#+++<
  5170.             self.saved_title = None
  5171.             self.servicelist.resetRoot()
  5172.         else:
  5173. @@ -808,6 +824,9 @@
  5174.             self.saved_title = self.getTitle()
  5175.             pos = self.saved_title.find(')')
  5176.             self.setTitle(self.saved_title[:pos+1] + ' ' + _("[move mode]") + self.saved_title[pos+1:]);
  5177. +#+++>
  5178. +           self["title"].setText(self.saved_title[:pos+1] + ' ' + _("[move mode]") + self.saved_title[pos+1:])
  5179. +#+++<
  5180.         self["Service"].editmode = True
  5181.  
  5182.     def handleEditCancel(self):
  5183. @@ -859,6 +878,11 @@
  5184.         self["list"] = ServiceList()
  5185.         self.servicelist = self["list"]
  5186.  
  5187. +#+++>
  5188. +       self["boquet"] = Label(_("Channel Selection"))
  5189. +       self["title"] = StaticText()
  5190. +#+++<
  5191. +
  5192.         self.numericalTextInput = NumericalTextInput()
  5193.         self.numericalTextInput.setUseableChars(u'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ')
  5194.  
  5195. @@ -943,6 +967,9 @@
  5196.             title = title[:pos]
  5197.         title += _(" (TV)")
  5198.         self.setTitle(title)
  5199. +#+++>
  5200. +       self["title"].setText(title)
  5201. +#+++<
  5202.  
  5203.     def setRadioMode(self):
  5204.         self.mode = MODE_RADIO
  5205. @@ -954,6 +981,9 @@
  5206.             title = title[:pos]
  5207.         title += _(" (Radio)")
  5208.         self.setTitle(title)
  5209. +#+++>
  5210. +       self["title"].setText(title)
  5211. +#+++<
  5212.  
  5213.     def setRoot(self, root, justSet=False):
  5214.         if self.startRoot is None:
  5215. @@ -1009,6 +1039,9 @@
  5216.                     end_ref = None
  5217.                 nameStr = self.getServiceName(base_ref)
  5218.                 titleStr += ' - ' + nameStr
  5219. +#+++>
  5220. +               self["boquet"].setText("Channel Selection")
  5221. +#+++<
  5222.                 if end_ref is not None:
  5223.                     if Len > 2:
  5224.                         titleStr += '/../'
  5225. @@ -1016,7 +1049,13 @@
  5226.                         titleStr += '/'
  5227.                     nameStr = self.getServiceName(end_ref)
  5228.                     titleStr += nameStr
  5229. +#+++>
  5230. +                   self["boquet"].setText(nameStr)
  5231. +#+++<
  5232.                 self.setTitle(titleStr)
  5233. +#+++>
  5234. +               self["title"].setText(titleStr)
  5235. +#+++<
  5236.  
  5237.     def moveUp(self):
  5238.         self.servicelist.moveUp()
  5239. @@ -1915,6 +1954,9 @@
  5240.  
  5241.     def layoutFinished(self):
  5242.         self.setModeTv()
  5243. +#+++>
  5244. +       self["title"].setText(self.title)
  5245. +#+++<
  5246.  
  5247.     def channelSelected(self): # just return selected service
  5248.         ref = self.getCurrentSelection()
  5249. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Screens/InfoBarGenerics.py enigma2-nightly.patched/lib/python/Screens/InfoBarGenerics.py
  5250. --- enigma2-nightly.org/lib/python/Screens/InfoBarGenerics.py   2013-10-25 18:26:55.178304232 +0200
  5251. +++ enigma2-nightly.patched/lib/python/Screens/InfoBarGenerics.py   2013-10-26 03:02:27.257604783 +0200
  5252. @@ -9,7 +9,7 @@
  5253. from Components.PluginComponent import plugins
  5254. from Components.ServiceEventTracker import ServiceEventTracker
  5255. from Components.Sources.Boolean import Boolean
  5256. -from Components.config import config, ConfigBoolean, ConfigClock
  5257. +from Components.config import config, ConfigBoolean, ConfigClock, ConfigSubsection, ConfigYesNo, ConfigText
  5258. from Components.SystemInfo import SystemInfo
  5259. from Components.UsageConfig import preferredInstantRecordPath, defaultMoviePath, ConfigSelection
  5260. from EpgSelection import EPGSelection
  5261. @@ -35,6 +35,7 @@
  5262.  
  5263. from Tools import Notifications, ASCIItranslit
  5264. from Tools.Directories import fileExists, getRecordingFilename, moveFiles
  5265. +from Tools.Command import command
  5266.  
  5267. from enigma import eTimer, eServiceCenter, eDVBServicePMTHandler, iServiceInformation, \
  5268.     iPlayableService, eServiceReference, eEPGCache, eActionMap
  5269. @@ -105,7 +106,7 @@
  5270.     global resumePointCache, resumePointCacheLast
  5271.     import cPickle
  5272.     try:
  5273. -       f = open('/home/root/resumepoints.pkl', 'wb')
  5274. +       f = open('/etc/enigma2/resumepoints.pkl', 'wb')
  5275.         cPickle.dump(resumePointCache, f, cPickle.HIGHEST_PROTOCOL)
  5276.     except Exception, ex:
  5277.         print "[InfoBar] Failed to write resumepoints:", ex
  5278. @@ -114,7 +115,7 @@
  5279. def loadResumePoints():
  5280.     import cPickle
  5281.     try:
  5282. -       return cPickle.load(open('/home/root/resumepoints.pkl', 'rb'))
  5283. +       return cPickle.load(open('/etc/enigma2/resumepoints.pkl', 'rb'))
  5284.     except Exception, ex:
  5285.         print "[InfoBar] Failed to load resumepoints:", ex
  5286.         return {}
  5287. @@ -222,6 +223,7 @@
  5288.     STATE_HIDING = 1
  5289.     STATE_SHOWING = 2
  5290.     STATE_SHOWN = 3
  5291. +   STATE_EPG = 4
  5292.  
  5293.     def __init__(self):
  5294.         self["ShowHideActions"] = ActionMap( ["InfobarShowHideActions"] ,
  5295. @@ -317,6 +319,12 @@
  5296.         if self.__state == self.STATE_SHOWN:
  5297.             self.hide()
  5298.  
  5299. +   def epg(self):
  5300. +       self.__state = self.STATE_EPG
  5301. +       self.hide()
  5302. +       self.hideTimer.stop()
  5303. +       self.openEventView()
  5304. +
  5305.     def toggleShow(self):
  5306.         if self.__state == self.STATE_HIDDEN:
  5307.             self.show()
  5308. @@ -327,7 +335,9 @@
  5309.         elif self.secondInfoBarScreen and config.usage.show_second_infobar.value and not self.secondInfoBarScreen.shown:
  5310.             self.secondInfoBarScreen.show()
  5311.             self.startHideTimer()
  5312. -       else:
  5313. +       elif self.__state == self.STATE_SHOWN:
  5314. +           self.epg()
  5315. +       elif self.__state == self.STATE_EPG:
  5316.             self.hide()
  5317.             self.hideTimer.stop()
  5318.  
  5319. @@ -1764,7 +1774,7 @@
  5320.  
  5321.     def updateExtensions(self):
  5322.         self.extensionsList = []
  5323. -       self.availableKeys = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "red", "green", "yellow", "blue" ]
  5324. +       self.availableKeys = [ "red", "green", "yellow", "blue", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" ]
  5325.         self.extensionKeys = {}
  5326.         for x in self.list:
  5327.             if x[0] == self.EXTENSION_SINGLE:
  5328. @@ -2268,16 +2278,16 @@
  5329.                 idx += 1
  5330.  
  5331.             if self.bouquets and len(self.bouquets):
  5332. -               keys = ["red", "blue", "",  "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n
  5333. +               keys = ["red", "blue", "yellow", "",  "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n
  5334.                 if config.usage.multibouquet.value:
  5335. -                   tlist = [(_("Quick zap"), "quickzap", service.subServices()), (_("Add to bouquet"), "CALLFUNC", self.addSubserviceToBouquetCallback), ("--", "")] + tlist
  5336. +                   tlist = [(_("Quick zap"), "quickzap", service.subServices()), (_("Add to bouquet"), "CALLFUNC", self.addSubserviceToBouquetCallback), ("Exit", "exit"), ("--", "")] + tlist
  5337.                 else:
  5338. -                   tlist = [(_("Quick zap"), "quickzap", service.subServices()), (_("Add to favourites"), "CALLFUNC", self.addSubserviceToBouquetCallback), ("--", "")] + tlist
  5339. -               selection += 3
  5340. +                   tlist = [(_("Quick zap"), "quickzap", service.subServices()), (_("Add to favourites"), "CALLFUNC", self.addSubserviceToBouquetCallback), ("Exit", "exit"), ("--", "")] + tlist
  5341. +               selection += 4
  5342.             else:
  5343. -               tlist = [(_("Quick zap"), "quickzap", service.subServices()), ("--", "")] + tlist
  5344. -               keys = ["red", "",  "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n
  5345. -               selection += 2
  5346. +               tlist = [(_("Quick zap"), "quickzap", service.subServices()), ("Exit", "exit"), ("--", "")] + tlist
  5347. +               keys = ["red", "yellow", "",  "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ] + [""] * n
  5348. +               selection += 3
  5349.  
  5350.             self.session.openWithCallback(self.subserviceSelected, ChoiceBox, title=_("Please select a sub service..."), list = tlist, selection = selection, keys = keys, skin_name = "SubserviceSelection")
  5351.  
  5352. @@ -2965,3 +2975,140 @@
  5353.         elif not Screens.Standby.inStandby:
  5354.             print "[InfoBarPowersaver] goto standby"
  5355.             self.session.open(Screens.Standby.Standby)
  5356. +
  5357. +class InfoBarAspectSelection:
  5358. +   def __init__(self):
  5359. +       self["AspectSelectionAction"] = HelpableActionMap(self, "InfobarAspectSelectionActions",
  5360. +           {
  5361. +               "aspectSelection": (self.ExGreen_toggleGreen, _("Aspect list...")),
  5362. +           })
  5363. +
  5364. +       self["key_green"] = Boolean(True)
  5365. +       self["key_yellow"] = Boolean(True)
  5366. +       self["key_blue"] = Boolean(True)
  5367. +
  5368. +   def ExGreen_doResolution(self):
  5369. +       self.resolutionSelection()
  5370. +
  5371. +   def ExGreen_toggleGreen(self, arg=""):
  5372. +       self.aspectSelection()
  5373. +
  5374. +   def aspectSelection(self):
  5375. +       selection = 0
  5376. +       tlist = []
  5377. +       tlist.append((_("Subservice list..."), "subservice"))
  5378. +       tlist.append((_("Resolution"), "resolution"))
  5379. +       tlist.append((_("3D Modus"), "tdmodus"))
  5380. +       tlist.append(("--", ""))
  5381. +       tlist.append(("Letterbox", "letterbox"))
  5382. +       tlist.append(("PanScan", "panscan"))
  5383. +       tlist.append(("Non Linear", "non"))
  5384. +       tlist.append(("Bestfit", "bestfit"))
  5385. +
  5386. +       mode = open("/proc/stb/video/policy").read()[:-1]
  5387. +       print mode
  5388. +       for x in range(len(tlist)):
  5389. +           if tlist[x][1] == mode:
  5390. +               selection = x
  5391. +
  5392. +       keys = ["green", "yellow", "blue", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ]
  5393. +       self.session.openWithCallback(self.aspectSelected, ChoiceBox, title=_("Please select an aspect ratio..."), list = tlist, selection = selection, keys = keys)
  5394. +
  5395. +   def aspectSelected(self, aspect):
  5396. +       if not aspect is None:
  5397. +           if isinstance(aspect[1], str):
  5398. +               if aspect[1] == "resolution":
  5399. +                   self.ExGreen_doResolution()
  5400. +               elif aspect[1] == "tdmodus":
  5401. +                   self.tdmodus()
  5402. +               elif aspect[1] == "subservice":
  5403. +                   self.subserviceSelection()
  5404. +               else:
  5405. +                   open("/proc/stb/video/policy", "w").write(aspect[1])
  5406. +       return
  5407. +
  5408. +   def tdmodus(self):
  5409. +       selection = 0
  5410. +       tlist = []
  5411. +       tlist.append((_("off"), "off"))
  5412. +       tlist.append((_("Side-by-Side"), "sbs"))
  5413. +       tlist.append((_("Top and Bottom"), "tab"))
  5414. +       keys = ["green", "yellow", "blue"]
  5415. +       self.session.openWithCallback(self.tdSelected, ChoiceBox, title=_("Please select an 3D modus..."), list = tlist, selection = selection, keys = keys)
  5416. +
  5417. +   def tdSelected(self, tdmod):
  5418. +       if not tdmod is None:
  5419. +           if isinstance(tdmod[1], str):
  5420. +               if tdmod[1] == "off":
  5421. +                   config.av.threedmode.value = "off"
  5422. +                   config.av.threedmode.save()
  5423. +                   command('killall 3d-mode')
  5424. +               elif tdmod[1] == "sbs":
  5425. +                   config.av.threedmode.value = "sbs"
  5426. +                   config.av.threedmode.save()
  5427. +                   command('3d-mode 40 &')
  5428. +               elif tdmod[1] == "tab":
  5429. +                   config.av.threedmode.value = "tab"
  5430. +                   config.av.threedmode.save()
  5431. +       return
  5432. +
  5433. +   def resolutionSelection(self):
  5434. +       xresString = open("/proc/stb/vmpeg/0/xres", "r").read()
  5435. +       yresString = open("/proc/stb/vmpeg/0/yres", "r").read()
  5436. +       fpsString = open("/proc/stb/vmpeg/0/framerate", "r").read()
  5437. +       xres = int(xresString, 16)
  5438. +       yres = int(yresString, 16)
  5439. +       fps = int(fpsString, 16)
  5440. +       fpsFloat = float(fps)
  5441. +       fpsFloat = fpsFloat/1000
  5442. +
  5443. +       selection = 0
  5444. +       tlist = []
  5445. +       tlist.append((_("Exit"), "exit"))
  5446. +       tlist.append((_("Auto(not available)"), "auto"))
  5447. +       tlist.append(("Video: " + str(xres) + "x" + str(yres) + "@" + str(fpsFloat) + "hz", ""))
  5448. +       tlist.append(("--", ""))
  5449. +       tlist.append(("576i", "576i50"))
  5450. +       tlist.append(("576p", "576p50"))
  5451. +       tlist.append(("720p@50hz", "720p50"))
  5452. +       tlist.append(("720p@60hz", "720p60"))
  5453. +       tlist.append(("1080i@50hz", "1080i50"))
  5454. +       tlist.append(("1080i@60hz", "1080i60"))
  5455. +       tlist.append(("1080p@23.976hz", "1080p23"))
  5456. +       tlist.append(("1080p@24hz", "1080p24"))
  5457. +       tlist.append(("1080p@25hz", "1080p25"))
  5458. +       tlist.append(("1080p@29hz", "1080p29"))
  5459. +       tlist.append(("1080p@30hz", "1080p30"))
  5460. +       tlist.append(("1080p@50hz", "1080p50"))
  5461. +       tlist.append(("1080p@59hz", "1080p59"))
  5462. +       tlist.append(("1080p@60hz", "1080p60"))
  5463. +
  5464. +       keys = ["green", "yellow", "blue", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ]
  5465. +
  5466. +       mode = open("/proc/stb/video/videomode").read()[:-1]
  5467. +       print mode
  5468. +       for x in range(len(tlist)):
  5469. +           if tlist[x][1] == mode:
  5470. +               selection = x
  5471. +
  5472. +       self.session.openWithCallback(self.ResolutionSelected, ChoiceBox, title=_("Please select a resolution..."), list = tlist, selection = selection, keys = keys)
  5473. +
  5474. +   def ResolutionSelected(self, Resolution):
  5475. +       if not Resolution is None:
  5476. +           if isinstance(Resolution[1], str):
  5477. +               if Resolution[1] != "auto":
  5478. +                   open("/proc/stb/video/videomode", "w").write(Resolution[1])
  5479. +                   from enigma import gMainDC
  5480. +                   gMainDC.getInstance().setResolution(-1, -1)
  5481. +       return
  5482. +
  5483. +class InfoBarSleepTimer:
  5484. +   def __init__(self):
  5485. +       self.addExtension((self.getSleepTimerName, self.showSleepTimerSetup, lambda: True), "blue")
  5486. +
  5487. +   def getSleepTimerName(self):
  5488. +       return _("Sleep Timer")
  5489. +
  5490. +   def showSleepTimerSetup(self):
  5491. +       from Screens.SleepTimerEdit import SleepTimerEdit
  5492. +       self.session.open(SleepTimerEdit)
  5493. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Screens/InfoBar.py enigma2-nightly.patched/lib/python/Screens/InfoBar.py
  5494. --- enigma2-nightly.org/lib/python/Screens/InfoBar.py   2013-08-11 08:11:19.318306128 +0200
  5495. +++ enigma2-nightly.patched/lib/python/Screens/InfoBar.py   2013-10-26 03:02:27.257604783 +0200
  5496. @@ -9,6 +9,9 @@
  5497.  
  5498. profile("LOAD:enigma")
  5499. import enigma
  5500. +#+++>
  5501. +from enigma import iServiceInformation, iPlayableService
  5502. +#+++<
  5503.  
  5504. profile("LOAD:InfoBarGenerics")
  5505. from Screens.InfoBarGenerics import InfoBarShowHide, \
  5506. @@ -19,7 +22,7 @@
  5507.     InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \
  5508.     InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \
  5509.     InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarServiceErrorPopupSupport, InfoBarJobman, InfoBarPowersaver, \
  5510. -   setResumePoint, delResumePoint
  5511. +   InfoBarAspectSelection, InfoBarSleepTimer, setResumePoint, delResumePoint
  5512.  
  5513. profile("LOAD:InitBar_Components")
  5514. from Components.ActionMap import HelpableActionMap
  5515. @@ -36,7 +39,7 @@
  5516.     InfoBarSubserviceSelection, InfoBarTimeshift, InfoBarSeek, InfoBarCueSheetSupport,
  5517.     InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions,
  5518.     InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarServiceErrorPopupSupport, InfoBarJobman, InfoBarPowersaver,
  5519. -   Screen):
  5520. +   InfoBarAspectSelection, InfoBarSleepTimer, Screen):
  5521.    
  5522.     ALLOW_SUSPEND = True
  5523.     instance = None
  5524. @@ -48,6 +51,11 @@
  5525.                 "showMovies": (self.showMovies, _("Play recorded movies...")),
  5526.                 "showRadio": (self.showRadio, _("Show the radio player...")),
  5527.                 "showTv": (self.showTv, _("Show the tv player...")),
  5528. +               "toogleTvRadio": (self.toogleTvRadio, _("toggels betwenn tv and radio...")),
  5529. +               "volumeUp": (self._volUp, _("...")),
  5530. +               "volumeDown": (self._volDown, _("...")),
  5531. +               "resolution": (self.resolution, _("...")),
  5532. +               "aspect": (self.aspect, _("...")),
  5533.             }, prio=2)
  5534.        
  5535.         self.allowPiP = True
  5536. @@ -59,7 +67,7 @@
  5537.                 InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \
  5538.                 InfoBarTimeshift, InfoBarSeek, InfoBarCueSheetSupport, InfoBarSummarySupport, InfoBarTimeshiftState, \
  5539.                 InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, InfoBarPowersaver, \
  5540. -               InfoBarPlugins, InfoBarServiceErrorPopupSupport:
  5541. +               InfoBarAspectSelection, InfoBarSleepTimer, InfoBarPlugins, InfoBarServiceErrorPopupSupport:
  5542.             x.__init__(self)
  5543.  
  5544.         self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("Watch recordings..."))]))
  5545. @@ -74,6 +82,88 @@
  5546.         assert InfoBar.instance is None, "class InfoBar is a singleton class and just one instance of this class is allowed!"
  5547.         InfoBar.instance = self
  5548.  
  5549. +   def aspect(self):
  5550. +       selection = 0
  5551. +       tlist = []
  5552. +       try:
  5553. +           policy = open("/proc/stb/video/policy_choices").read()[:-1]
  5554. +       except IOError:
  5555. +           print "couldn't read available policymodes."
  5556. +           policy_available = [ ]
  5557. +           return
  5558. +       policy_available = policy.split(' ')
  5559. +       for x in policy_available:
  5560. +           tlist.append((x[0].upper() + x[1:], _(x)))
  5561. +
  5562. +       mode = open("/proc/stb/video/policy").read()[:-1]
  5563. +       for x in range(len(tlist)):
  5564. +           if tlist[x][1] == mode:
  5565. +               selection = x
  5566. +
  5567. +       keys = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ]
  5568. +       from Screens.ChoiceBox import ChoiceBox
  5569. +       self.session.openWithCallback(self.aspectSelect, ChoiceBox, title=_("Please select an aspect ratio..."), list = tlist, selection = selection, keys = keys)
  5570. +
  5571. +   def aspectSelect(self, aspect):
  5572. +       if not aspect is None:
  5573. +           if isinstance(aspect[1], str):
  5574. +               open("/proc/stb/video/policy", "w").write(aspect[1])
  5575. +       return
  5576. +
  5577. +   def resolution(self):
  5578. +       xresString = open("/proc/stb/vmpeg/0/xres", "r").read()
  5579. +       yresString = open("/proc/stb/vmpeg/0/yres", "r").read()
  5580. +       fpsString = open("/proc/stb/vmpeg/0/framerate", "r").read()
  5581. +       xres = int(xresString, 16)
  5582. +       yres = int(yresString, 16)
  5583. +       fps = int(fpsString, 16)
  5584. +       fpsFloat = float(fps)
  5585. +       fpsFloat = fpsFloat/1000
  5586. +
  5587. +       selection = 0
  5588. +       tlist = []
  5589. +       tlist.append(("Video: " + str(xres) + "x" + str(yres) + "@" + str(fpsFloat) + "hz", ""))
  5590. +       tlist.append(("--", ""))
  5591. +       tlist.append(("576i", "576i50"))
  5592. +       tlist.append(("576p", "576p50"))
  5593. +       tlist.append(("720p@50hz", "720p50"))
  5594. +       tlist.append(("720p@60hz", "720p60"))
  5595. +       tlist.append(("1080i@50hz", "1080i50"))
  5596. +       tlist.append(("1080i@60hz", "1080i60"))
  5597. +       tlist.append(("[email protected]", "1080p23"))
  5598. +       tlist.append(("1080p@24hz", "1080p24"))
  5599. +       tlist.append(("1080p@25hz", "1080p25"))
  5600. +       tlist.append(("1080p@30hz", "1080p30"))
  5601. +       tlist.append(("1080p@50hz", "1080p50"))
  5602. +       tlist.append(("1080p@59hz", "1080p59"))
  5603. +       tlist.append(("1080p@60hz", "1080p60"))
  5604. +       keys = ["green", "", "yellow", "blue", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ]
  5605. +
  5606. +       mode = open("/proc/stb/video/videomode").read()[:-1]
  5607. +       for x in range(len(tlist)):
  5608. +           if tlist[x][1] == mode:
  5609. +               selection = x
  5610. +       from Screens.ChoiceBox import ChoiceBox
  5611. +       self.session.openWithCallback(self.ResolutionSelect, ChoiceBox, title=_("Please select a resolution..."), list = tlist, selection = selection, keys = keys)
  5612. +
  5613. +   def ResolutionSelect(self, Resolution):
  5614. +       if not Resolution is None:
  5615. +           if isinstance(Resolution[1], str):
  5616. +               open("/proc/stb/video/videomode", "w").write(Resolution[1])
  5617. +               from enigma import gMainDC
  5618. +               gMainDC.getInstance().setResolution(-1, -1)
  5619. +       return
  5620. +
  5621. +   def _volUp(self):
  5622. +       print "_volUp"
  5623. +       from Components.VolumeControl import VolumeControl
  5624. +       VolumeControl.instance.volUp()
  5625. +
  5626. +   def _volDown(self):
  5627. +       print "_volDown"
  5628. +       from Components.VolumeControl import VolumeControl
  5629. +       VolumeControl.instance.volDown()
  5630. +
  5631.     def __onClose(self):
  5632.         InfoBar.instance = None
  5633.  
  5634. @@ -92,6 +182,22 @@
  5635.         self.__serviceStarted(True)
  5636.         self.onExecBegin.remove(self.__checkServiceStarted)
  5637.  
  5638. +   def toogleTvRadio(self):
  5639. +       service = self.session.nav.getCurrentService()
  5640. +       info = service.info()
  5641. +       AudioPID = info.getInfo(iServiceInformation.sAudioPID)
  5642. +       VideoPID = info.getInfo(iServiceInformation.sVideoPID)
  5643. +
  5644. +       print "sAudioPID", AudioPID
  5645. +       print "sVideoPID", VideoPID
  5646. +
  5647. +       if VideoPID == -1:
  5648. +           print "radio->tv"
  5649. +           self.showTv2()
  5650. +       else:
  5651. +           print "tv->radio"
  5652. +           self.showRadio2()
  5653. +
  5654.     def serviceStarted(self):  #override from InfoBarShowHide
  5655.         new = self.servicelist.newServicePlayed()
  5656.         if self.execing:
  5657. @@ -115,6 +221,19 @@
  5658.             from Screens.ChannelSelection import ChannelSelectionRadio
  5659.             self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
  5660.  
  5661. +   def showTv2(self):
  5662. +       self.showTvChannelList(False)
  5663. +       self.openServiceList()
  5664. +
  5665. +   def showRadio2(self):
  5666. +       if config.usage.e1like_radio_mode.value:
  5667. +           self.showRadioChannelList(False)
  5668. +           self.openServiceList()
  5669. +       else:
  5670. +           self.rds_display.hide() # in InfoBarRdsDecoder
  5671. +           from Screens.ChannelSelection import ChannelSelectionRadio
  5672. +           self.session.openWithCallback(self.ChannelSelectionRadioClosed, ChannelSelectionRadio, self)
  5673. +
  5674.     def ChannelSelectionRadioClosed(self, *arg):
  5675.         self.rds_display.show()  # in InfoBarRdsDecoder
  5676.  
  5677. @@ -136,6 +255,7 @@
  5678.         InfoBarSeek, InfoBarShowMovies, InfoBarInstantRecord, InfoBarAudioSelection, HelpableScreen, InfoBarNotifications,
  5679.         InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView,
  5680.         InfoBarMoviePlayerSummarySupport, InfoBarSubtitleSupport, Screen, InfoBarTeletextPlugin,
  5681. +       InfoBarAspectSelection, InfoBarSubserviceSelection,
  5682.         InfoBarServiceErrorPopupSupport, InfoBarExtensions, InfoBarPlugins, InfoBarPiP):
  5683.  
  5684.     ENABLE_RESUME_SUPPORT = True
  5685. @@ -144,6 +264,8 @@
  5686.     def __init__(self, session, service, slist = None, lastservice = None):
  5687.         Screen.__init__(self, session)
  5688.        
  5689. +       InfoBarAspectSelection.__init__(self)
  5690. +
  5691.         self["actions"] = HelpableActionMap(self, "MoviePlayerActions",
  5692.             {
  5693.                 "leavePlayer": (self.leavePlayer, _("leave movie player...")),
  5694. @@ -264,11 +386,21 @@
  5695.                     return
  5696.  
  5697.         if answer in ("quit", "quitanddeleteconfirmed"):
  5698. +#+++>
  5699. +           # make sure that playback is unpaused otherwise the
  5700. +           # player driver might stop working
  5701. +           self.setSeekState(self.SEEK_STATE_PLAY)
  5702. +#+++<
  5703.             self.close()
  5704.         elif answer == "movielist":
  5705.             ref = self.session.nav.getCurrentlyPlayingServiceOrGroup()
  5706.             self.returning = True
  5707.             self.session.openWithCallback(self.movieSelected, Screens.MovieSelection.MovieSelection, ref)
  5708. +#+++>
  5709. +           # make sure that playback is unpaused otherwise the
  5710. +           # player driver might stop working
  5711. +           self.setSeekState(self.SEEK_STATE_PLAY)
  5712. +#+++<
  5713.             self.session.nav.stopService()
  5714.         elif answer == "restart":
  5715.             self.doSeek(0)
  5716. @@ -422,3 +554,7 @@
  5717.  
  5718.     def ref2HumanName(self, ref):
  5719.         return enigma.eServiceCenter.getInstance().info(ref).getName(ref)
  5720. +
  5721. +   def sleepTimer(self):
  5722. +       from Screens.SleepTimerEdit import SleepTimerEdit
  5723. +       self.session.open(SleepTimerEdit)
  5724. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Screens/Standby.py enigma2-nightly.patched/lib/python/Screens/Standby.py
  5725. --- enigma2-nightly.org/lib/python/Screens/Standby.py   2013-08-11 08:11:19.326306128 +0200
  5726. +++ enigma2-nightly.patched/lib/python/Screens/Standby.py   2013-10-26 03:02:27.257604783 +0200
  5727. @@ -13,6 +13,9 @@
  5728. class Standby(Screen):
  5729.     def Power(self):
  5730.         print "leave standby"
  5731. +#+++>
  5732. +       open("/proc/stb/hdmi/output", "w").write("on")
  5733. +#+++<
  5734.         #set input to encoder
  5735.         self.avswitch.setInput("ENCODER")
  5736.         #restart last played service
  5737. @@ -69,6 +72,9 @@
  5738.             self.avswitch.setInput("SCART")
  5739.         else:
  5740.             self.avswitch.setInput("AUX")
  5741. +#+++>
  5742. +       open("/proc/stb/hdmi/output", "w").write("off")
  5743. +#+++<
  5744.  
  5745.         gotoShutdownTime = int(config.usage.standby_to_shutdown_timer.value)
  5746.         if gotoShutdownTime:
  5747. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Screens/Wizard.py enigma2-nightly.patched/lib/python/Screens/Wizard.py
  5748. --- enigma2-nightly.org/lib/python/Screens/Wizard.py    2013-08-11 08:11:19.330306128 +0200
  5749. +++ enigma2-nightly.patched/lib/python/Screens/Wizard.py    2013-10-26 03:02:27.257604783 +0200
  5750. @@ -14,6 +14,9 @@
  5751.  
  5752. from xml.sax import make_parser
  5753. from xml.sax.handler import ContentHandler
  5754. +#+++>
  5755. +from enigma import evfd
  5756. +#+++<
  5757.  
  5758. class WizardSummary(Screen):
  5759.     def __init__(self, session, parent):
  5760. @@ -351,6 +354,9 @@
  5761.                 if self.updateValues in self.onShown:
  5762.                     self.onShown.remove(self.updateValues)
  5763.  
  5764. +#+++>
  5765. +       open("/proc/progress", "w").write("100")
  5766. +#+++<
  5767.         if print_now:
  5768.             print "Now: " + str(self.currStep)
  5769.  
  5770. @@ -443,6 +449,9 @@
  5771.             if self.wizard[self.currStep].has_key("onselect"):
  5772.                 self.selection = self["list"].current[-1]
  5773.                 print "self.selection:", self.selection
  5774. +#+++>
  5775. +               evfd.getInstance().vfd_write_string("-> " + self.selection)
  5776. +#+++<
  5777.                 exec("self." + self.wizard[self.currStep]["onselect"] + "()")
  5778.        
  5779.     def resetCounter(self):
  5780. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Tools/Command.py enigma2-nightly.patched/lib/python/Tools/Command.py
  5781. --- enigma2-nightly.org/lib/python/Tools/Command.py 1970-01-01 01:00:00.000000000 +0100
  5782. +++ enigma2-nightly.patched/lib/python/Tools/Command.py 2013-10-26 03:02:27.261604783 +0200
  5783. @@ -0,0 +1,22 @@
  5784. +from os import stat as os_stat, path as os_path, system
  5785. +import os
  5786. +
  5787. +def command(comandline, strip=1):
  5788. +   comandline = comandline + " >/tmp/command.txt"
  5789. +   os.system(comandline)
  5790. +   text = ""
  5791. +   if os.path.exists("/tmp/command.txt") is True:
  5792. +       file = open("/tmp/command.txt", "r")
  5793. +       if strip == 1:
  5794. +           for line in file:
  5795. +               text = text + line.strip() + '\n'
  5796. +       else:
  5797. +           for line in file:
  5798. +               text = text + line
  5799. +               if text[-1:] != '\n': text = text + "\n"
  5800. +       file.close
  5801. +   if text[-1:] == '\n': text = text[:-1]
  5802. +   comandline = text
  5803. +   os.system("rm /tmp/command.txt")
  5804. +   return comandline
  5805. +
  5806. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Tools/KeyBindings.py enigma2-nightly.patched/lib/python/Tools/KeyBindings.py
  5807. --- enigma2-nightly.org/lib/python/Tools/KeyBindings.py 2013-08-11 08:11:19.334306128 +0200
  5808. +++ enigma2-nightly.patched/lib/python/Tools/KeyBindings.py 2013-10-26 03:02:27.261604783 +0200
  5809. @@ -45,7 +45,10 @@
  5810.         KEYIDS["KEY_9"]: ("9",),
  5811.         KEYIDS["KEY_EXIT"]: ("EXIT",),
  5812.         KEYIDS["KEY_STOP"]: ("STOP",),
  5813. -       KEYIDS["KEY_RECORD"]: ("RECORD",)
  5814. +       KEYIDS["KEY_RECORD"]: ("RECORD",),
  5815. +       KEYIDS["KEY_EPG"]: ("EPG",),
  5816. +       KEYIDS["KEY_REWIND"]: ("REWIND",),
  5817. +       KEYIDS["KEY_FASTFORWARD"]: ("FASTFORWARD",)
  5818.     },
  5819.     {
  5820.         KEYIDS["BTN_0"]: ("UP", "fp"),
  5821. @@ -87,7 +90,10 @@
  5822.         KEYIDS["KEY_9"]: ("9",),
  5823.         KEYIDS["KEY_EXIT"]: ("EXIT",),
  5824.         KEYIDS["KEY_STOP"]: ("TV", "SHIFT"),
  5825. -       KEYIDS["KEY_RECORD"]: ("RADIO", "SHIFT")
  5826. +       KEYIDS["KEY_RECORD"]: ("RADIO", "SHIFT"),
  5827. +       KEYIDS["KEY_EPG"]: ("EPG",),
  5828. +       KEYIDS["KEY_REWIND"]: ("REWIND",),
  5829. +       KEYIDS["KEY_FASTFORWARD"]: ("FASTFORWARD",)
  5830.     },
  5831.     {
  5832.         KEYIDS["BTN_0"]: ("UP", "fp"),
  5833. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/python/Tools/Makefile.am enigma2-nightly.patched/lib/python/Tools/Makefile.am
  5834. --- enigma2-nightly.org/lib/python/Tools/Makefile.am    2013-08-11 08:11:19.334306128 +0200
  5835. +++ enigma2-nightly.patched/lib/python/Tools/Makefile.am    2013-10-26 03:02:27.261604783 +0200
  5836. @@ -5,4 +5,4 @@
  5837.     KeyBindings.py BoundFunction.py ISO639.py Notifications.py __init__.py \
  5838.     RedirectOutput.py StbHardware.py Import.py Event.py CList.py \
  5839.     LoadPixmap.py Profile.py HardwareInfo.py Transponder.py ASCIItranslit.py \
  5840. -   Downloader.py Trashcan.py GetEcmInfo.py Alternatives.py
  5841. +   Downloader.py Trashcan.py GetEcmInfo.py Alternatives.py Command.py
  5842. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/service/Makefile.inc enigma2-nightly.patched/lib/service/Makefile.inc
  5843. --- enigma2-nightly.org/lib/service/Makefile.inc    2013-08-11 08:11:19.338306128 +0200
  5844. +++ enigma2-nightly.patched/lib/service/Makefile.inc    2013-10-26 03:02:27.261604783 +0200
  5845. @@ -14,6 +14,13 @@
  5846.     service/servicem2ts.cpp \
  5847.     service/servicedvbstream.cpp
  5848.  
  5849. +if ENABLE_LIBEPLAYER3
  5850. +if ENABLE_MEDIAFWGSTREAMER
  5851. +service_libenigma_service_a_SOURCES += \
  5852. +   service/serviceeplayer3.cpp
  5853. +endif
  5854. +endif
  5855. +
  5856. serviceincludedir = $(pkgincludedir)/lib/service
  5857. serviceinclude_HEADERS = \
  5858.     service/event.h \
  5859. @@ -27,6 +34,13 @@
  5860.     service/servicem2ts.h \
  5861.     service/servicedvbstream.h
  5862.  
  5863. +if ENABLE_LIBEPLAYER3
  5864. +if ENABLE_MEDIAFWGSTREAMER
  5865. +serviceinclude_HEADERS += \
  5866. +   service/serviceeplayer3.h
  5867. +endif
  5868. +endif
  5869. +
  5870. if HAVE_LIBXINE
  5871. service_libenigma_service_a_SOURCES += \
  5872.     service/servicexine.cpp
  5873. @@ -39,4 +53,4 @@
  5874.     service/servicedvd.cpp
  5875. serviceinclude_HEADERS += \
  5876.     service/servicedvd.h
  5877. -endif
  5878. \ Kein Zeilenumbruch am Dateiende.
  5879. +endif
  5880. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/service/servicedvb.cpp enigma2-nightly.patched/lib/service/servicedvb.cpp
  5881. --- enigma2-nightly.org/lib/service/servicedvb.cpp  2013-08-11 08:11:19.338306128 +0200
  5882. +++ enigma2-nightly.patched/lib/service/servicedvb.cpp  2013-10-26 03:02:27.261604783 +0200
  5883. @@ -625,6 +625,9 @@
  5884.     if (sc)
  5885.     {
  5886.         std::list<std::string> extensions;
  5887. +#if defined(__sh__) //Topfield original recording extension
  5888. +       extensions.push_back("rec");
  5889. +#endif
  5890.         extensions.push_back("ts");
  5891.         extensions.push_back("trp");
  5892.         sc->addServiceFactory(eServiceFactoryDVB::id, this, extensions);
  5893. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/service/servicedvbrecord.cpp enigma2-nightly.patched/lib/service/servicedvbrecord.cpp
  5894. --- enigma2-nightly.org/lib/service/servicedvbrecord.cpp    2013-08-11 08:11:19.342306128 +0200
  5895. +++ enigma2-nightly.patched/lib/service/servicedvbrecord.cpp    2013-10-26 03:02:27.261604783 +0200
  5896. @@ -10,6 +10,10 @@
  5897. #include <netinet/in.h>
  5898.  
  5899.  
  5900. +#if defined(__sh__)
  5901. +#include <sys/vfs.h>
  5902. +#include <linux/magic.h>
  5903. +#endif
  5904. DEFINE_REF(eDVBServiceRecord);
  5905.  
  5906. eDVBServiceRecord::eDVBServiceRecord(const eServiceReferenceDVB &ref, bool isstreamclient): m_ref(ref)
  5907. @@ -299,9 +303,43 @@
  5908.    
  5909.     if (!m_record && m_tuned && !m_streaming && !m_simulate)
  5910.     {
  5911. +#if defined(__sh__)
  5912. +       int flags = O_WRONLY|O_CREAT|O_LARGEFILE;
  5913. +       struct statfs sbuf;
  5914. +#endif
  5915.         eDebug("Recording to %s...", m_filename.c_str());
  5916.         ::remove(m_filename.c_str());
  5917. +#if defined(__sh__)
  5918. +       //we must creat a file for statfs
  5919.         int fd = ::open(m_filename.c_str(), O_WRONLY|O_CREAT|O_LARGEFILE, 0666);
  5920. +       ::close(fd);
  5921. +       if (statfs(m_filename.c_str(), &sbuf) < 0)
  5922. +       {
  5923. +           eDebug("eDVBServiceRecord - can't get fs type assuming none NFS!");
  5924. +       } else
  5925. +       {
  5926. +           if (sbuf.f_type == EXT3_SUPER_MAGIC)
  5927. +               eDebug("eDVBServiceRecord - Ext2/3/4 Filesystem\n");
  5928. +           else
  5929. +           if (sbuf.f_type == NFS_SUPER_MAGIC)
  5930. +           {
  5931. +               eDebug("eDVBServiceRecord - NFS Filesystem; add O_DIRECT to flags\n");
  5932. +               flags |= O_DIRECT;
  5933. +           }
  5934. +           else
  5935. +           if (sbuf.f_type == USBDEVICE_SUPER_MAGIC)
  5936. +               eDebug("eDVBServiceRecord - USB Device\n");
  5937. +           else
  5938. +           if (sbuf.f_type == SMB_SUPER_MAGIC)
  5939. +               eDebug("eDVBServiceRecord - SMBs Device\n");
  5940. +           else
  5941. +           if (sbuf.f_type == MSDOS_SUPER_MAGIC)
  5942. +               eDebug("eDVBServiceRecord - MSDOS Device\n");
  5943. +       }
  5944. +       fd = ::open(m_filename.c_str(), flags, 0644);
  5945. +#else
  5946. +       int fd = ::open(m_filename.c_str(), O_WRONLY|O_CREAT|O_LARGEFILE, 0644);
  5947. +#endif
  5948.         if (fd == -1)
  5949.         {
  5950.             eDebug("eDVBServiceRecord - can't open recording file!");
  5951. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/service/serviceeplayer3.cpp enigma2-nightly.patched/lib/service/serviceeplayer3.cpp
  5952. --- enigma2-nightly.org/lib/service/serviceeplayer3.cpp 1970-01-01 01:00:00.000000000 +0100
  5953. +++ enigma2-nightly.patched/lib/service/serviceeplayer3.cpp 2013-10-26 03:02:27.265604783 +0200
  5954. @@ -0,0 +1,1157 @@
  5955. +   /* note: this requires gstreamer 0.10.x and a big list of plugins. */
  5956. +   /* it's currently hardcoded to use a big-endian alsasink as sink. */
  5957. +#include <lib/base/ebase.h>
  5958. +#include <lib/base/eerror.h>
  5959. +#include <lib/base/init_num.h>
  5960. +#include <lib/base/init.h>
  5961. +#include <lib/base/nconfig.h>
  5962. +#include <lib/base/object.h>
  5963. +#include <lib/dvb/decoder.h>
  5964. +#include <lib/components/file_eraser.h>
  5965. +#include <lib/gui/esubtitle.h>
  5966. +#include <lib/service/serviceeplayer3.h>
  5967. +#include <lib/service/service.h>
  5968. +#include <lib/gdi/gpixmap.h>
  5969. +
  5970. +#include <string>
  5971. +#include <sys/stat.h>
  5972. +
  5973. +#define HTTP_TIMEOUT 60
  5974. +
  5975. +typedef enum
  5976. +{
  5977. +   GST_PLAY_FLAG_VIDEO         = 0x00000001,
  5978. +   GST_PLAY_FLAG_AUDIO         = 0x00000002,
  5979. +   GST_PLAY_FLAG_TEXT          = 0x00000004,
  5980. +   GST_PLAY_FLAG_VIS           = 0x00000008,
  5981. +   GST_PLAY_FLAG_SOFT_VOLUME   = 0x00000010,
  5982. +   GST_PLAY_FLAG_NATIVE_AUDIO  = 0x00000020,
  5983. +   GST_PLAY_FLAG_NATIVE_VIDEO  = 0x00000040,
  5984. +   GST_PLAY_FLAG_DOWNLOAD      = 0x00000080,
  5985. +   GST_PLAY_FLAG_BUFFERING     = 0x00000100
  5986. +} GstPlayFlags;
  5987. +
  5988. +// eServiceFactoryEPlayer3
  5989. +
  5990. +/*
  5991. + * gstreamer suffers from a bug causing sparse streams to loose sync, after pause/resume / skip
  5992. + * see: https://bugzilla.gnome.org/show_bug.cgi?id=619434
  5993. + * As a workaround, we run the subsink in sync=false mode
  5994. + */
  5995. +#define GSTREAMER_SUBTITLE_SYNC_MODE_BUG
  5996. +/**/
  5997. +
  5998. +void ep3Blit(){
  5999. +   fbClass *fb = fbClass::getInstance();
  6000. +   fb->blit();
  6001. +}
  6002. +
  6003. +
  6004. +eServiceFactoryEPlayer3::eServiceFactoryEPlayer3()
  6005. +{
  6006. +   ePtr<eServiceCenter> sc;
  6007. +
  6008. +   eServiceCenter::getPrivInstance(sc);
  6009. +   if (sc)
  6010. +   {
  6011. +       std::list<std::string> extensions;
  6012. +       //extensions.push_back("dts");
  6013. +       //extensions.push_back("mp2");
  6014. +       //extensions.push_back("mp3");
  6015. +       //extensions.push_back("ogg");
  6016. +       //extensions.push_back("ogm");
  6017. +       //extensions.push_back("ogv");
  6018. +       extensions.push_back("mpg");
  6019. +       extensions.push_back("vob");
  6020. +       //extensions.push_back("wav");
  6021. +       //extensions.push_back("wave");
  6022. +       extensions.push_back("m4v");
  6023. +       extensions.push_back("mkv");
  6024. +       extensions.push_back("avi");
  6025. +       extensions.push_back("divx");
  6026. +       extensions.push_back("dat");
  6027. +       //extensions.push_back("flac");
  6028. +       //extensions.push_back("flv");
  6029. +       extensions.push_back("mp4");
  6030. +       extensions.push_back("mov");
  6031. +       //extensions.push_back("m4a");
  6032. +       //extensions.push_back("3gp");
  6033. +       //extensions.push_back("3g2");
  6034. +       //extensions.push_back("asf");
  6035. +#if defined(__sh__)
  6036. +       extensions.push_back("mpeg");
  6037. +       extensions.push_back("m2ts");
  6038. +       extensions.push_back("trp");
  6039. +       extensions.push_back("vdr");
  6040. +       extensions.push_back("mts");
  6041. +       extensions.push_back("rar");
  6042. +       extensions.push_back("img");
  6043. +       extensions.push_back("iso");
  6044. +       extensions.push_back("ifo");
  6045. +       extensions.push_back("wmv");
  6046. +#endif
  6047. +       //extensions.push_back("wma");
  6048. +       sc->addServiceFactory(eServiceFactoryEPlayer3::id, this, extensions);
  6049. +   }
  6050. +
  6051. +   m_service_info = new eStaticServiceEPlayer3Info();
  6052. +}
  6053. +
  6054. +eServiceFactoryEPlayer3::~eServiceFactoryEPlayer3()
  6055. +{
  6056. +   ePtr<eServiceCenter> sc;
  6057. +
  6058. +   eServiceCenter::getPrivInstance(sc);
  6059. +   if (sc)
  6060. +       sc->removeServiceFactory(eServiceFactoryEPlayer3::id);
  6061. +}
  6062. +
  6063. +DEFINE_REF(eServiceFactoryEPlayer3)
  6064. +
  6065. +   // iServiceHandler
  6066. +RESULT eServiceFactoryEPlayer3::play(const eServiceReference &ref, ePtr<iPlayableService> &ptr)
  6067. +{
  6068. +       // check resources...
  6069. +   ptr = new eServiceEPlayer3(ref);
  6070. +   return 0;
  6071. +}
  6072. +
  6073. +RESULT eServiceFactoryEPlayer3::record(const eServiceReference &ref, ePtr<iRecordableService> &ptr)
  6074. +{
  6075. +   ptr=0;
  6076. +   return -1;
  6077. +}
  6078. +
  6079. +RESULT eServiceFactoryEPlayer3::list(const eServiceReference &, ePtr<iListableService> &ptr)
  6080. +{
  6081. +   ptr=0;
  6082. +   return -1;
  6083. +}
  6084. +
  6085. +RESULT eServiceFactoryEPlayer3::info(const eServiceReference &ref, ePtr<iStaticServiceInformation> &ptr)
  6086. +{
  6087. +   ptr = m_service_info;
  6088. +   return 0;
  6089. +}
  6090. +
  6091. +class eEPlayer3ServiceOfflineOperations: public iServiceOfflineOperations
  6092. +{
  6093. +   DECLARE_REF(eEPlayer3ServiceOfflineOperations);
  6094. +   eServiceReference m_ref;
  6095. +public:
  6096. +   eEPlayer3ServiceOfflineOperations(const eServiceReference &ref);
  6097. +
  6098. +   RESULT deleteFromDisk(int simulate);
  6099. +   RESULT getListOfFilenames(std::list<std::string> &);
  6100. +   RESULT reindex();
  6101. +};
  6102. +
  6103. +DEFINE_REF(eEPlayer3ServiceOfflineOperations);
  6104. +
  6105. +eEPlayer3ServiceOfflineOperations::eEPlayer3ServiceOfflineOperations(const eServiceReference &ref): m_ref((const eServiceReference&)ref)
  6106. +{
  6107. +}
  6108. +
  6109. +RESULT eEPlayer3ServiceOfflineOperations::deleteFromDisk(int simulate)
  6110. +{
  6111. +   if (!simulate)
  6112. +   {
  6113. +       std::list<std::string> res;
  6114. +       if (getListOfFilenames(res))
  6115. +           return -1;
  6116. +
  6117. +       eBackgroundFileEraser *eraser = eBackgroundFileEraser::getInstance();
  6118. +       if (!eraser)
  6119. +           eDebug("FATAL !! can't get background file eraser");
  6120. +
  6121. +       for (std::list<std::string>::iterator i(res.begin()); i != res.end(); ++i)
  6122. +       {
  6123. +           eDebug("Removing %s...", i->c_str());
  6124. +           if (eraser)
  6125. +               eraser->erase(i->c_str());
  6126. +           else
  6127. +               ::unlink(i->c_str());
  6128. +       }
  6129. +   }
  6130. +   return 0;
  6131. +}
  6132. +
  6133. +RESULT eEPlayer3ServiceOfflineOperations::getListOfFilenames(std::list<std::string> &res)
  6134. +{
  6135. +   res.clear();
  6136. +   res.push_back(m_ref.path);
  6137. +   return 0;
  6138. +}
  6139. +
  6140. +RESULT eEPlayer3ServiceOfflineOperations::reindex()
  6141. +{
  6142. +   return -1;
  6143. +}
  6144. +
  6145. +
  6146. +RESULT eServiceFactoryEPlayer3::offlineOperations(const eServiceReference &ref, ePtr<iServiceOfflineOperations> &ptr)
  6147. +{
  6148. +   ptr = new eEPlayer3ServiceOfflineOperations(ref);
  6149. +   return 0;
  6150. +}
  6151. +
  6152. +// eStaticServiceEPlayer3Info
  6153. +
  6154. +
  6155. +// eStaticServiceEPlayer3Info is seperated from eServiceEPlayer3 to give information
  6156. +// about unopened files.
  6157. +
  6158. +// probably eServiceEPlayer3 should use this class as well, and eStaticServiceEPlayer3Info
  6159. +// should have a database backend where ID3-files etc. are cached.
  6160. +// this would allow listing the mp3 database based on certain filters.
  6161. +
  6162. +DEFINE_REF(eStaticServiceEPlayer3Info)
  6163. +
  6164. +eStaticServiceEPlayer3Info::eStaticServiceEPlayer3Info()
  6165. +{
  6166. +}
  6167. +
  6168. +RESULT eStaticServiceEPlayer3Info::getName(const eServiceReference &ref, std::string &name)
  6169. +{
  6170. +   if ( ref.name.length() )
  6171. +       name = ref.name;
  6172. +   else
  6173. +   {
  6174. +       size_t last = ref.path.rfind('/');
  6175. +       if (last != std::string::npos)
  6176. +           name = ref.path.substr(last+1);
  6177. +       else
  6178. +           name = ref.path;
  6179. +   }
  6180. +   return 0;
  6181. +}
  6182. +
  6183. +int eStaticServiceEPlayer3Info::getLength(const eServiceReference &ref)
  6184. +{
  6185. +   return -1;
  6186. +}
  6187. +
  6188. +int eStaticServiceEPlayer3Info::getInfo(const eServiceReference &ref, int w)
  6189. +{
  6190. +   switch (w)
  6191. +   {
  6192. +   case iServiceInformation::sTimeCreate:
  6193. +       {
  6194. +           struct stat s;
  6195. +           if (stat(ref.path.c_str(), &s) == 0)
  6196. +           {
  6197. +               return s.st_mtime;
  6198. +           }
  6199. +       }
  6200. +       break;
  6201. +   case iServiceInformation::sFileSize:
  6202. +       {
  6203. +           struct stat s;
  6204. +           if (stat(ref.path.c_str(), &s) == 0)
  6205. +           {
  6206. +               return s.st_size;
  6207. +           }
  6208. +       }
  6209. +       break;
  6210. +   }
  6211. +   return iServiceInformation::resNA;
  6212. +}
  6213. +
  6214. +long long eStaticServiceEPlayer3Info::getFileSize(const eServiceReference &ref)
  6215. +{
  6216. +   struct stat s;
  6217. +   if (stat(ref.path.c_str(), &s) == 0)
  6218. +   {
  6219. +       return s.st_size;
  6220. +   }
  6221. +   return 0;
  6222. +}
  6223. +
  6224. +DEFINE_REF(eStreamBufferEPlayer3Info)
  6225. +
  6226. +eStreamBufferEPlayer3Info::eStreamBufferEPlayer3Info(int percentage, int inputrate, int outputrate, int space, int size)
  6227. +: bufferPercentage(percentage),
  6228. +   inputRate(inputrate),
  6229. +   outputRate(outputrate),
  6230. +   bufferSpace(space),
  6231. +   bufferSize(size)
  6232. +{
  6233. +}
  6234. +
  6235. +int eStreamBufferEPlayer3Info::getBufferPercentage() const
  6236. +{
  6237. +   return bufferPercentage;
  6238. +}
  6239. +
  6240. +int eStreamBufferEPlayer3Info::getAverageInputRate() const
  6241. +{
  6242. +   return inputRate;
  6243. +}
  6244. +
  6245. +int eStreamBufferEPlayer3Info::getAverageOutputRate() const
  6246. +{
  6247. +   return outputRate;
  6248. +}
  6249. +
  6250. +int eStreamBufferEPlayer3Info::getBufferSpace() const
  6251. +{
  6252. +   return bufferSpace;
  6253. +}
  6254. +
  6255. +int eStreamBufferEPlayer3Info::getBufferSize() const
  6256. +{
  6257. +   return bufferSize;
  6258. +}
  6259. +
  6260. +// eServiceEPlayer3
  6261. +int eServiceEPlayer3::ac3_delay = 0,
  6262. +    eServiceEPlayer3::pcm_delay = 0;
  6263. +
  6264. +eServiceEPlayer3::eServiceEPlayer3(eServiceReference ref)
  6265. +   :m_ref(ref), m_pump(eApp, 1)
  6266. +{
  6267. +   m_subtitle_sync_timer = eTimer::create(eApp);
  6268. +   m_streamingsrc_timeout = 0;
  6269. +
  6270. +   m_currentAudioStream = -1;
  6271. +   m_currentSubtitleStream = -1;
  6272. +   m_cachedSubtitleStream = 0; /* report the first subtitle stream to be 'cached'. TODO: use an actual cache. */
  6273. +   m_subtitle_widget = 0;
  6274. +   m_currentTrickRatio = 1.0;
  6275. +   m_buffer_size = 8 * 1024 * 1024;
  6276. +
  6277. +   m_prev_decoder_time = -1;
  6278. +   m_decoder_time_valid_state = 0;
  6279. +   m_errorInfo.missing_codec = "";
  6280. +
  6281. +
  6282. +   CONNECT(m_subtitle_sync_timer->timeout, eServiceEPlayer3::pushSubtitles);
  6283. +
  6284. +   m_aspect = m_width = m_height = m_framerate = m_progressive = -1;
  6285. +
  6286. +   m_state = stIdle;
  6287. +   eDebug("eServiceEPlayer3::construct!");
  6288. +
  6289. +   const char *filename = m_ref.path.c_str();
  6290. +   const char *ext = strrchr(filename, '.');
  6291. +   if (!ext)
  6292. +       ext = filename + strlen(filename);
  6293. +
  6294. +   player = (Context_t*) malloc(sizeof(Context_t));
  6295. +
  6296. +   if (player)
  6297. +   {
  6298. +       player->playback  = &PlaybackHandler;
  6299. +       player->output    = &OutputHandler;
  6300. +       player->container = &ContainerHandler;
  6301. +       player->manager   = &ManagerHandler;
  6302. +       printf("%s\n", player->output->Name);
  6303. +   }
  6304. +
  6305. +   //Registration of output devices
  6306. +   if (player && player->output)
  6307. +   {
  6308. +       player->output->Command(player,OUTPUT_ADD, (void*)"audio");
  6309. +       player->output->Command(player,OUTPUT_ADD, (void*)"video");
  6310. +       player->output->Command(player,OUTPUT_ADD, (void*)"subtitle");
  6311. +   }
  6312. +
  6313. +   if (player && player->output && player->output->subtitle)
  6314. +   {
  6315. +       fbClass *fb = fbClass::getInstance();
  6316. +       SubtitleOutputDef_t out;
  6317. +       out.screen_width = fb->getScreenResX();
  6318. +       out.screen_height = fb->getScreenResY();
  6319. +       out.shareFramebuffer = 1;
  6320. +       out.framebufferFD = fb->getFD();
  6321. +       out.destination = fb->getLFB_Direct();
  6322. +       out.destStride = fb->Stride();
  6323. +       out.framebufferBlit = ep3Blit;
  6324. +       player->output->subtitle->Command(player, (OutputCmd_t)OUTPUT_SET_SUBTITLE_OUTPUT, (void*) &out);
  6325. +   }
  6326. +
  6327. +   //create playback path
  6328. +   char file[800] = {""};
  6329. +
  6330. +   if (!strncmp("http://", m_ref.path.c_str(), 7))
  6331. +       ;
  6332. +   else if (!strncmp("rtsp://", m_ref.path.c_str(), 7))
  6333. +       ;
  6334. +   else if (!strncmp("rtmp://", m_ref.path.c_str(), 7))
  6335. +       ;
  6336. +   else if (!strncmp("rtmpe://", m_ref.path.c_str(), 8))
  6337. +       ;
  6338. +   else if (!strncmp("rtmpt://", m_ref.path.c_str(), 8))
  6339. +       ;
  6340. +   else if (!strncmp("rtmps://", m_ref.path.c_str(), 8))
  6341. +       ;
  6342. +   else if (!strncmp("rtmpte://", m_ref.path.c_str(), 9))
  6343. +       ;
  6344. +   else if (!strncmp("rtp://", m_ref.path.c_str(), 6))
  6345. +       ;
  6346. +   else if (!strncmp("upnp://", m_ref.path.c_str(), 7))
  6347. +       ;
  6348. +   else if (!strncmp("mms://", m_ref.path.c_str(), 6))
  6349. +       ;
  6350. +   else if (!strncmp("file://", m_ref.path.c_str(), 7))
  6351. +       ;
  6352. +   else
  6353. +       strcat(file, "file://");
  6354. +   strcat(file, m_ref.path.c_str());
  6355. +
  6356. +   //try to open file
  6357. +   if (player && player->playback && player->playback->Command(player, PLAYBACK_OPEN, file) >= 0)
  6358. +   {
  6359. +       //VIDEO
  6360. +       //We dont have to register video tracks, or do we ?
  6361. +       //AUDIO
  6362. +       if (player && player->manager && player->manager->audio)
  6363. +       {
  6364. +           char ** TrackList = NULL;
  6365. +           player->manager->audio->Command(player, MANAGER_LIST, &TrackList);
  6366. +           if (TrackList != NULL)
  6367. +           {
  6368. +               printf("AudioTrack List\n");
  6369. +               int i = 0;
  6370. +               for (i = 0; TrackList[i] != NULL; i+=2)
  6371. +               {
  6372. +                   printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
  6373. +                   audioStream audio;
  6374. +                   audio.language_code = TrackList[i];
  6375. +
  6376. +                   // atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC
  6377. +                   if (    !strncmp("A_MPEG/L3",   TrackList[i+1], 9))
  6378. +                       audio.type = atMP3;
  6379. +                   else if (!strncmp("A_MP3",      TrackList[i+1], 5))
  6380. +                       audio.type = atMP3;
  6381. +                   else if (!strncmp("A_AC3",      TrackList[i+1], 5))
  6382. +                       audio.type = atAC3;
  6383. +                   else if (!strncmp("A_DTS",      TrackList[i+1], 5))
  6384. +                       audio.type = atDTS;
  6385. +                   else if (!strncmp("A_AAC",      TrackList[i+1], 5))
  6386. +                       audio.type = atAAC;
  6387. +                   else if (!strncmp("A_PCM",      TrackList[i+1], 5))
  6388. +                       audio.type = atPCM;
  6389. +                   else if (!strncmp("A_VORBIS",   TrackList[i+1], 8))
  6390. +                       audio.type = atOGG;
  6391. +                   else if (!strncmp("A_FLAC",     TrackList[i+1], 6))
  6392. +                       audio.type = atFLAC;
  6393. +                   else
  6394. +                       audio.type = atUnknown;
  6395. +
  6396. +                   m_audioStreams.push_back(audio);
  6397. +                   free(TrackList[i]);
  6398. +                   free(TrackList[i+1]);
  6399. +               }
  6400. +               free(TrackList);
  6401. +           }
  6402. +       }
  6403. +       //SUB
  6404. +       if (player && player->manager && player->manager->subtitle)
  6405. +       {
  6406. +           char ** TrackList = NULL;
  6407. +           player->manager->subtitle->Command(player, MANAGER_LIST, &TrackList);
  6408. +           if (TrackList != NULL)
  6409. +           {
  6410. +               printf("SubtitleTrack List\n");
  6411. +               int i = 0;
  6412. +               for (i = 0; TrackList[i] != NULL; i+=2)
  6413. +               {
  6414. +                   printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
  6415. +                   subtitleStream sub;
  6416. +                   sub.language_code = TrackList[i];
  6417. +                   //  stPlainText, stSSA, stSRT
  6418. +                   if (    !strncmp("S_TEXT/SSA",   TrackList[i+1], 10) ||
  6419. +                           !strncmp("S_SSA", TrackList[i+1], 5))
  6420. +                       sub.type = stSSA;
  6421. +                   else if (!strncmp("S_TEXT/ASS",   TrackList[i+1], 10) ||
  6422. +                           !strncmp("S_AAS", TrackList[i+1], 5))
  6423. +                       sub.type = stSSA;
  6424. +                   else if (!strncmp("S_TEXT/SRT",   TrackList[i+1], 10) ||
  6425. +                           !strncmp("S_SRT", TrackList[i+1], 5))
  6426. +                       sub.type = stSRT;
  6427. +                   else
  6428. +                       sub.type = stPlainText;
  6429. +
  6430. +                   m_subtitleStreams.push_back(sub);
  6431. +                   free(TrackList[i]);
  6432. +                   free(TrackList[i+1]);
  6433. +               }
  6434. +               free(TrackList);
  6435. +           }
  6436. +       }
  6437. +       m_event(this, evStart);
  6438. +   }
  6439. +   else
  6440. +   {
  6441. +       //Creation failed, no playback support for insert file, so delete playback context
  6442. +       //FIXME: How to tell e2 that we failed?
  6443. +       if (player && player->output)
  6444. +       {
  6445. +           player->output->Command(player,OUTPUT_DEL, (void*)"audio");
  6446. +           player->output->Command(player,OUTPUT_DEL, (void*)"video");
  6447. +           player->output->Command(player,OUTPUT_DEL, (void*)"subtitle");
  6448. +       }
  6449. +
  6450. +       if (player && player->playback)
  6451. +           player->playback->Command(player,PLAYBACK_CLOSE, NULL);
  6452. +
  6453. +       if (player)
  6454. +           free(player);
  6455. +       player = NULL;
  6456. +   }
  6457. +   //m_state = stRunning;
  6458. +   eDebug("eServiceEPlayer3-<\n");
  6459. +}
  6460. +
  6461. +eServiceEPlayer3::~eServiceEPlayer3()
  6462. +{
  6463. +   if (m_subtitle_widget) m_subtitle_widget->destroy();
  6464. +   m_subtitle_widget = 0;
  6465. +
  6466. +   if (m_state == stRunning)
  6467. +       stop();
  6468. +}
  6469. +
  6470. +DEFINE_REF(eServiceEPlayer3);
  6471. +
  6472. +RESULT eServiceEPlayer3::connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection)
  6473. +{
  6474. +   connection = new eConnection((iPlayableService*)this, m_event.connect(event));
  6475. +   m_event(this, evSeekableStatusChanged);
  6476. +   return 0;
  6477. +}
  6478. +
  6479. +RESULT eServiceEPlayer3::start()
  6480. +{
  6481. +   if (m_state != stIdle)
  6482. +   {
  6483. +       eDebug("eServiceEPlayer3::%s < m_state != stIdle", __func__);
  6484. +       return -1;
  6485. +   }
  6486. +
  6487. +   m_state = stRunning;
  6488. +
  6489. +   if (player && player->output && player->playback)
  6490. +   {
  6491. +       player->output->Command(player, OUTPUT_OPEN, NULL);
  6492. +       player->playback->Command(player, PLAYBACK_PLAY, NULL);
  6493. +   }
  6494. +
  6495. +   m_event(this, evStart);
  6496. +
  6497. +   return 0;
  6498. +}
  6499. +
  6500. +void eServiceEPlayer3::sourceTimeout()
  6501. +{
  6502. +   eDebug("eServiceEPlayer3::http source timeout! issuing eof...");
  6503. +   m_event((iPlayableService*)this, evEOF);
  6504. +}
  6505. +
  6506. +RESULT eServiceEPlayer3::stop()
  6507. +{
  6508. +   if (m_state == stIdle)
  6509. +   {
  6510. +       eDebug("eServiceEPlayer3::%s < m_state == stIdle", __func__);
  6511. +       return -1;
  6512. +   }
  6513. +
  6514. +   if (m_state == stStopped)
  6515. +       return -1;
  6516. +
  6517. +   eDebug("eServiceEPlayer3::stop %s", m_ref.path.c_str());
  6518. +
  6519. +   if (player && player->playback && player->output)
  6520. +   {
  6521. +       player->playback->Command(player, PLAYBACK_STOP, NULL);
  6522. +       player->output->Command(player, OUTPUT_CLOSE, NULL);
  6523. +   }
  6524. +
  6525. +   if (player && player->output)
  6526. +   {
  6527. +       player->output->Command(player,OUTPUT_DEL, (void*)"audio");
  6528. +       player->output->Command(player,OUTPUT_DEL, (void*)"video");
  6529. +       player->output->Command(player,OUTPUT_DEL, (void*)"subtitle");
  6530. +   }
  6531. +
  6532. +   if (player && player->playback)
  6533. +       player->playback->Command(player,PLAYBACK_CLOSE, NULL);
  6534. +
  6535. +   if (player)
  6536. +       free(player);
  6537. +
  6538. +   if (player != NULL)
  6539. +       player = NULL;
  6540. +
  6541. +   m_state = stStopped;
  6542. +
  6543. +   return 0;
  6544. +}
  6545. +
  6546. +RESULT eServiceEPlayer3::setTarget(int target)
  6547. +{
  6548. +   return -1;
  6549. +}
  6550. +
  6551. +RESULT eServiceEPlayer3::pause(ePtr<iPauseableService> &ptr)
  6552. +{
  6553. +   ptr=this;
  6554. +   return 0;
  6555. +}
  6556. +
  6557. +int speed_mapping[] =
  6558. +{
  6559. + /* e2_ratio   speed */
  6560. +   2,         1,
  6561. +   4,         3,
  6562. +   8,         7,
  6563. +   16,        15,
  6564. +   32,        31,
  6565. +   64,        63,
  6566. +   128,      127,
  6567. +   -2,       -5,
  6568. +   -4,      -10,
  6569. +   -8,      -20,
  6570. +   -16,      -40,
  6571. +   -32,      -80,
  6572. +   -64,     -160,
  6573. +   -128,     -320,
  6574. +   -1,       -1
  6575. +};
  6576. +
  6577. +int getSpeed(int ratio)
  6578. +{
  6579. +   int i = 0;
  6580. +   while (speed_mapping[i] != -1)
  6581. +   {
  6582. +       if (speed_mapping[i] == ratio)
  6583. +           return speed_mapping[i+1];
  6584. +       i += 2;
  6585. +   }
  6586. +   return -1;
  6587. +}
  6588. +
  6589. +RESULT eServiceEPlayer3::setSlowMotion(int ratio)
  6590. +{
  6591. +// konfetti: in libeplayer3 we changed this because I dont like application specific stuff in a library
  6592. +   int speed = getSpeed(ratio);
  6593. +   if (player && player->playback && (speed != -1))
  6594. +   {
  6595. +       int result = 0;
  6596. +       if (ratio > 1)
  6597. +           result = player->playback->Command(player, PLAYBACK_SLOWMOTION, (void*)&speed);
  6598. +
  6599. +       if (result != 0)
  6600. +           return -1;
  6601. +   }
  6602. +   return 0;
  6603. +}
  6604. +
  6605. +RESULT eServiceEPlayer3::setFastForward(int ratio)
  6606. +{
  6607. +// konfetti: in libeplayer3 we changed this because I dont like application specific stuff in a library
  6608. +   int speed = getSpeed(ratio);
  6609. +   if (player && player->playback && (speed != -1))
  6610. +   {
  6611. +       int result = 0;
  6612. +       if (ratio > 1)
  6613. +           result = player->playback->Command(player, PLAYBACK_FASTFORWARD, (void*)&speed);
  6614. +       else if (ratio < -1)
  6615. +       {
  6616. +           //speed = speed * -1;
  6617. +           result = player->playback->Command(player, PLAYBACK_FASTBACKWARD, (void*)&speed);
  6618. +       }
  6619. +       else
  6620. +           result = player->playback->Command(player, PLAYBACK_CONTINUE, NULL);
  6621. +
  6622. +       if (result != 0)
  6623. +           return -1;
  6624. +   }
  6625. +   return 0;
  6626. +}
  6627. +
  6628. +       // iPausableService
  6629. +RESULT eServiceEPlayer3::pause()
  6630. +{
  6631. +   if (player && player->playback)
  6632. +       player->playback->Command(player, PLAYBACK_PAUSE, NULL);
  6633. +
  6634. +   return 0;
  6635. +}
  6636. +
  6637. +RESULT eServiceEPlayer3::unpause()
  6638. +{
  6639. +   if (player && player->playback)
  6640. +       player->playback->Command(player, PLAYBACK_CONTINUE, NULL);
  6641. +
  6642. +   return 0;
  6643. +}
  6644. +
  6645. +   /* iSeekableService */
  6646. +RESULT eServiceEPlayer3::seek(ePtr<iSeekableService> &ptr)
  6647. +{
  6648. +   ptr = this;
  6649. +   return 0;
  6650. +}
  6651. +
  6652. +RESULT eServiceEPlayer3::getLength(pts_t &pts)
  6653. +{
  6654. +   double length = 0;
  6655. +
  6656. +   if (player && player->playback)
  6657. +       player->playback->Command(player, PLAYBACK_LENGTH, &length);
  6658. +
  6659. +   if (length <= 0)
  6660. +       return -1;
  6661. +
  6662. +   pts = length * 90000;
  6663. +   return 0;
  6664. +}
  6665. +
  6666. +RESULT eServiceEPlayer3::seekToImpl(pts_t to)
  6667. +{
  6668. +   return 0;
  6669. +}
  6670. +
  6671. +RESULT eServiceEPlayer3::seekTo(pts_t to)
  6672. +{
  6673. +   RESULT ret = -1;
  6674. +
  6675. +   float pos = (to/90000.0)-10;
  6676. +   if (player && player->playback)
  6677. +       player->playback->Command(player, PLAYBACK_SEEK, (void*)&pos);
  6678. +
  6679. +   ret =0;
  6680. +   return ret;
  6681. +}
  6682. +
  6683. +RESULT eServiceEPlayer3::seekRelative(int direction, pts_t to)
  6684. +{
  6685. +   pts_t ppos;
  6686. +   if (getPlayPosition(ppos) < 0) return -1;
  6687. +   ppos += to * direction;
  6688. +   if (ppos < 0)
  6689. +       ppos = 0;
  6690. +
  6691. +   float pos = direction*(to/90000.0);
  6692. +   if (player && player->playback)
  6693. +       player->playback->Command(player, PLAYBACK_SEEK, (void*)&pos);
  6694. +
  6695. +   return 0;
  6696. +}
  6697. +
  6698. +RESULT eServiceEPlayer3::getPlayPosition(pts_t &pts)
  6699. +{
  6700. +   if (player && player->playback && !player->playback->isPlaying)
  6701. +   {
  6702. +       eDebug("eServiceEPlayer3::%s !!!!EOF!!!! < -1", __func__);
  6703. +       if(m_state == stRunning)
  6704. +           m_event((iPlayableService*)this, evEOF);
  6705. +       pts = 0;
  6706. +       return -1;
  6707. +   }
  6708. +
  6709. +   unsigned long long int vpts = 0;
  6710. +   if (player && player->playback)
  6711. +       player->playback->Command(player, PLAYBACK_PTS, &vpts);
  6712. +
  6713. +   if (vpts<=0)
  6714. +       return -1;
  6715. +
  6716. +   /* len is in nanoseconds. we have 90 000 pts per second. */
  6717. +   pts = vpts>0?vpts:pts;;
  6718. +
  6719. +   return 0;
  6720. +}
  6721. +
  6722. +RESULT eServiceEPlayer3::setTrickmode(int trick)
  6723. +{
  6724. +       /* trickmode is not yet supported by our dvbmediasinks. */
  6725. +   return -1;
  6726. +}
  6727. +
  6728. +RESULT eServiceEPlayer3::isCurrentlySeekable()
  6729. +{
  6730. +   return 3;
  6731. +}
  6732. +
  6733. +RESULT eServiceEPlayer3::info(ePtr<iServiceInformation>&i)
  6734. +{
  6735. +   i = this;
  6736. +   return 0;
  6737. +}
  6738. +
  6739. +RESULT eServiceEPlayer3::getName(std::string &name)
  6740. +{
  6741. +   std::string title = m_ref.getName();
  6742. +   if (title.empty())
  6743. +   {
  6744. +       name = m_ref.path;
  6745. +       size_t n = name.rfind('/');
  6746. +       if (n != std::string::npos)
  6747. +           name = name.substr(n + 1);
  6748. +   }
  6749. +   else
  6750. +       name = title;
  6751. +   return 0;
  6752. +}
  6753. +
  6754. +int eServiceEPlayer3::getInfo(int w)
  6755. +{
  6756. +   switch (w)
  6757. +   {
  6758. +   case sServiceref: return m_ref;
  6759. +   case sVideoHeight: return m_height;
  6760. +   case sVideoWidth: return m_width;
  6761. +   case sFrameRate: return m_framerate;
  6762. +   case sProgressive: return m_progressive;
  6763. +   case sAspect: return m_aspect;
  6764. +   case sTagTitle:
  6765. +   case sTagArtist:
  6766. +   case sTagAlbum:
  6767. +   case sTagTitleSortname:
  6768. +   case sTagArtistSortname:
  6769. +   case sTagAlbumSortname:
  6770. +   case sTagDate:
  6771. +   case sTagComposer:
  6772. +   case sTagGenre:
  6773. +   case sTagComment:
  6774. +   case sTagExtendedComment:
  6775. +   case sTagLocation:
  6776. +   case sTagHomepage:
  6777. +   case sTagDescription:
  6778. +   case sTagVersion:
  6779. +   case sTagISRC:
  6780. +   case sTagOrganization:
  6781. +   case sTagCopyright:
  6782. +   case sTagCopyrightURI:
  6783. +   case sTagContact:
  6784. +   case sTagLicense:
  6785. +   case sTagLicenseURI:
  6786. +   case sTagCodec:
  6787. +   case sTagAudioCodec:
  6788. +   case sTagVideoCodec:
  6789. +   case sTagEncoder:
  6790. +   case sTagLanguageCode:
  6791. +   case sTagKeywords:
  6792. +   case sTagChannelMode:
  6793. +   case sUser+12:
  6794. +#if not defined(__sh__)
  6795. +       return resIsString;
  6796. +#endif
  6797. +   case sTagTrackGain:
  6798. +   case sTagTrackPeak:
  6799. +   case sTagAlbumGain:
  6800. +   case sTagAlbumPeak:
  6801. +   case sTagReferenceLevel:
  6802. +   case sTagBeatsPerMinute:
  6803. +   case sTagImage:
  6804. +   case sTagPreviewImage:
  6805. +   case sTagAttachment:
  6806. +       return resIsPyObject;
  6807. +   default:
  6808. +       return resNA;
  6809. +   }
  6810. +
  6811. +   return 0;
  6812. +}
  6813. +
  6814. +std::string eServiceEPlayer3::getInfoString(int w)
  6815. +{
  6816. +   char * tag = NULL;
  6817. +   char * res_str = NULL;
  6818. +   switch (w)
  6819. +   {
  6820. +   case sTagTitle:
  6821. +       tag = strdup("Title");
  6822. +       break;
  6823. +   case sTagArtist:
  6824. +       tag = strdup("Artist");
  6825. +       break;
  6826. +   case sTagAlbum:
  6827. +       tag = strdup("Album");
  6828. +       break;
  6829. +   case sTagComment:
  6830. +       tag = strdup("Comment");
  6831. +       break;
  6832. +   case sTagTrackNumber:
  6833. +       tag = strdup("Track");
  6834. +       break;
  6835. +   case sTagGenre:
  6836. +       tag = strdup("Genre");
  6837. +       break;
  6838. +   case sTagDate:
  6839. +       tag = strdup("Year");
  6840. +       break;
  6841. +   case sTagVideoCodec:
  6842. +       tag = strdup("VideoType");
  6843. +       break;
  6844. +   case sTagAudioCodec:
  6845. +       tag = strdup("AudioType");
  6846. +       break;
  6847. +   default:
  6848. +       return "";
  6849. +   }
  6850. +
  6851. +   if (player && player->playback)
  6852. +   {
  6853. +       /*Hellmaster1024: we need to save the adress of tag to free the strduped mem
  6854. +         the command will retun a new adress for a new strduped string.
  6855. +         Both Strings need to be freed! */
  6856. +       res_str = tag;
  6857. +       player->playback->Command(player, PLAYBACK_INFO, &res_str);
  6858. +       /* Hellmaster1024: in case something went wrong maybe no new adress is returned */
  6859. +       if (tag != res_str)
  6860. +       {
  6861. +           std::string res = res_str;
  6862. +           free(tag);
  6863. +           free(res_str);
  6864. +           return res;
  6865. +       }
  6866. +       else
  6867. +       {
  6868. +           free(tag);
  6869. +           return "";
  6870. +       }
  6871. +   }
  6872. +   free(tag);
  6873. +
  6874. +   return "";
  6875. +}
  6876. +
  6877. +RESULT eServiceEPlayer3::audioChannel(ePtr<iAudioChannelSelection> &ptr)
  6878. +{
  6879. +   ptr = this;
  6880. +   return 0;
  6881. +}
  6882. +
  6883. +RESULT eServiceEPlayer3::audioTracks(ePtr<iAudioTrackSelection> &ptr)
  6884. +{
  6885. +   ptr = this;
  6886. +   return 0;
  6887. +}
  6888. +
  6889. +RESULT eServiceEPlayer3::subtitle(ePtr<iSubtitleOutput> &ptr)
  6890. +{
  6891. +   ptr = this;
  6892. +   return 0;
  6893. +}
  6894. +
  6895. +RESULT eServiceEPlayer3::audioDelay(ePtr<iAudioDelay> &ptr)
  6896. +{
  6897. +   ptr = this;
  6898. +   return 0;
  6899. +}
  6900. +
  6901. +int eServiceEPlayer3::getNumberOfTracks()
  6902. +{
  6903. +   return m_audioStreams.size();
  6904. +}
  6905. +
  6906. +int eServiceEPlayer3::getCurrentTrack()
  6907. +{
  6908. +   return m_currentAudioStream;
  6909. +}
  6910. +
  6911. +RESULT eServiceEPlayer3::selectTrack(unsigned int i)
  6912. +{
  6913. +   int ret = selectAudioStream(i);
  6914. +
  6915. +   return ret;
  6916. +}
  6917. +
  6918. +int eServiceEPlayer3::selectAudioStream(int i)
  6919. +{
  6920. +   if (i != m_currentAudioStream)
  6921. +   {
  6922. +       if (player && player->playback)
  6923. +           player->playback->Command(player, PLAYBACK_SWITCH_AUDIO, (void*)&i);
  6924. +       m_currentAudioStream = i;
  6925. +       return 0;
  6926. +   }
  6927. +   return -1;
  6928. +}
  6929. +
  6930. +int eServiceEPlayer3::getCurrentChannel()
  6931. +{
  6932. +   return STEREO;
  6933. +}
  6934. +
  6935. +RESULT eServiceEPlayer3::selectChannel(int i)
  6936. +{
  6937. +   eDebug("eServiceEPlayer3::selectChannel(%i)",i);
  6938. +   return 0;
  6939. +}
  6940. +
  6941. +RESULT eServiceEPlayer3::getTrackInfo(struct iAudioTrackInfo &info, unsigned int i)
  6942. +{
  6943. +   if (i >= m_audioStreams.size())
  6944. +       return -2;
  6945. +
  6946. +   if (m_audioStreams[i].type == atMPEG)
  6947. +       info.m_description = "MPEG";
  6948. +   else if (m_audioStreams[i].type == atMP3)
  6949. +       info.m_description = "MP3";
  6950. +   else if (m_audioStreams[i].type == atAC3)
  6951. +       info.m_description = "AC3";
  6952. +   else if (m_audioStreams[i].type == atAAC)
  6953. +       info.m_description = "AAC";
  6954. +   else if (m_audioStreams[i].type == atDTS)
  6955. +       info.m_description = "DTS";
  6956. +   else if (m_audioStreams[i].type == atPCM)
  6957. +       info.m_description = "PCM";
  6958. +   else if (m_audioStreams[i].type == atOGG)
  6959. +       info.m_description = "OGG";
  6960. +
  6961. +   if (info.m_language.empty())
  6962. +       info.m_language = m_audioStreams[i].language_code;
  6963. +   return 0;
  6964. +}
  6965. +
  6966. +eAutoInitPtr<eServiceFactoryEPlayer3> init_eServiceFactoryEPlayer3(eAutoInitNumbers::service+1, "eServiceFactoryEPlayer3");
  6967. +
  6968. +void eServiceEPlayer3::eplayerCBsubtitleAvail(long int duration_ms, size_t len, char * buffer, void* user_data)
  6969. +{
  6970. +   eDebug("eServiceEPlayer3::%s >", __func__);
  6971. +   unsigned char tmp[len+1];
  6972. +   memcpy(tmp, buffer, len);
  6973. +   tmp[len] = 0;
  6974. +   eDebug("gstCBsubtitleAvail: %s", tmp);
  6975. +   eServiceEPlayer3 *_this = (eServiceEPlayer3*)user_data;
  6976. +   if ( _this->m_subtitle_widget )
  6977. +   {
  6978. +       ePangoSubtitlePage page;
  6979. +       gRGB rgbcol(0xD0,0xD0,0xD0);
  6980. +       page.m_elements.push_back(ePangoSubtitlePageElement(rgbcol, (const char*)tmp));
  6981. +       page.m_timeout = duration_ms;
  6982. +       (_this->m_subtitle_widget)->setPage(page);
  6983. +   }
  6984. +   eDebug("eServiceEPlayer3::%s <", __func__);
  6985. +}
  6986. +
  6987. +void eServiceEPlayer3::pushSubtitles()
  6988. +{
  6989. +}
  6990. +
  6991. +RESULT eServiceEPlayer3::enableSubtitles(iSubtitleUser *user, struct SubtitleTrack &track)
  6992. +{
  6993. +   if (m_currentSubtitleStream != track.pid)
  6994. +   {
  6995. +       m_subtitle_sync_timer->stop();
  6996. +       m_subtitle_pages.clear();
  6997. +       m_prev_decoder_time = -1;
  6998. +       m_decoder_time_valid_state = 0;
  6999. +
  7000. +       m_subtitle_widget = user;
  7001. +
  7002. +   }
  7003. +
  7004. +   if (player && player->playback)
  7005. +       player->playback->Command(player, PLAYBACK_SWITCH_SUBTITLE, (void*)&track.pid);
  7006. +
  7007. +   return 0;
  7008. +}
  7009. +
  7010. +RESULT eServiceEPlayer3::disableSubtitles()
  7011. +{
  7012. +   eDebug("eServiceEPlayer3::disableSubtitles");
  7013. +
  7014. +   m_subtitle_sync_timer->stop();
  7015. +   m_subtitle_pages.clear();
  7016. +   m_prev_decoder_time = -1;
  7017. +   m_decoder_time_valid_state = 0;
  7018. +   if (m_subtitle_widget) m_subtitle_widget->destroy();
  7019. +   m_subtitle_widget = 0;
  7020. +
  7021. +   int pid = -1;
  7022. +   if (player && player->playback)
  7023. +       player->playback->Command(player, PLAYBACK_SWITCH_SUBTITLE, (void*)&pid);
  7024. +
  7025. +   return 0;
  7026. +}
  7027. +
  7028. +RESULT eServiceEPlayer3::getCachedSubtitle(struct SubtitleTrack &track)
  7029. +{
  7030. +
  7031. +   bool autoturnon = eConfigManager::getConfigBoolValue("config.subtitles.pango_autoturnon", true);
  7032. +   if (!autoturnon)
  7033. +       return -1;
  7034. +
  7035. +   if (m_cachedSubtitleStream >= 0 && m_cachedSubtitleStream < (int)m_subtitleStreams.size())
  7036. +   {
  7037. +       track.type = 2;
  7038. +       track.pid = m_cachedSubtitleStream;
  7039. +       track.page_number = int(m_subtitleStreams[m_cachedSubtitleStream].type);
  7040. +       track.magazine_number = 0;
  7041. +       return 0;
  7042. +   }
  7043. +   return -1;
  7044. +}
  7045. +
  7046. +RESULT eServiceEPlayer3::getSubtitleList(std::vector<struct SubtitleTrack> &subtitlelist)
  7047. +{
  7048. +//     eDebug("eServiceEPlayer3::getSubtitleList");
  7049. +   int stream_idx = 0;
  7050. +
  7051. +   for (std::vector<subtitleStream>::iterator IterSubtitleStream(m_subtitleStreams.begin()); IterSubtitleStream != m_subtitleStreams.end(); ++IterSubtitleStream)
  7052. +   {
  7053. +       subtype_t type = IterSubtitleStream->type;
  7054. +       switch(type)
  7055. +       {
  7056. +       case stUnknown:
  7057. +       case stVOB:
  7058. +       case stPGS:
  7059. +           break;
  7060. +       default:
  7061. +       {
  7062. +           struct SubtitleTrack track;
  7063. +           track.type = 2;
  7064. +           track.pid = stream_idx;
  7065. +           track.page_number = int(type);
  7066. +           track.magazine_number = 0;
  7067. +           track.language_code = IterSubtitleStream->language_code;
  7068. +           subtitlelist.push_back(track);
  7069. +       }
  7070. +       }
  7071. +       stream_idx++;
  7072. +   }
  7073. +   eDebug("eServiceEPlayer3::getSubtitleList finished");
  7074. +   return 0;
  7075. +}
  7076. +
  7077. +RESULT eServiceEPlayer3::streamed(ePtr<iStreamedService> &ptr)
  7078. +{
  7079. +   ptr = this;
  7080. +   return 0;
  7081. +}
  7082. +
  7083. +ePtr<iStreamBufferInfo> eServiceEPlayer3::getBufferCharge()
  7084. +{
  7085. +   return new eStreamBufferEPlayer3Info(m_bufferInfo.bufferPercent, m_bufferInfo.avgInRate, m_bufferInfo.avgOutRate, m_bufferInfo.bufferingLeft, m_buffer_size);
  7086. +}
  7087. +
  7088. +int eServiceEPlayer3::setBufferSize(int size)
  7089. +{
  7090. +   m_buffer_size = size;
  7091. +   return 0;
  7092. +}
  7093. +
  7094. +int eServiceEPlayer3::getAC3Delay()
  7095. +{
  7096. +   return ac3_delay;
  7097. +}
  7098. +
  7099. +int eServiceEPlayer3::getPCMDelay()
  7100. +{
  7101. +   return pcm_delay;
  7102. +}
  7103. +
  7104. +void eServiceEPlayer3::setAC3Delay(int delay)
  7105. +{
  7106. +
  7107. +}
  7108. +
  7109. +void eServiceEPlayer3::setPCMDelay(int delay)
  7110. +{
  7111. +}
  7112. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/service/serviceeplayer3.h enigma2-nightly.patched/lib/service/serviceeplayer3.h
  7113. --- enigma2-nightly.org/lib/service/serviceeplayer3.h   1970-01-01 01:00:00.000000000 +0100
  7114. +++ enigma2-nightly.patched/lib/service/serviceeplayer3.h   2013-10-26 03:02:27.269604783 +0200
  7115. @@ -0,0 +1,301 @@
  7116. +#ifndef __serviceeplayer3_h
  7117. +#define __serviceeplayer3_h
  7118. +
  7119. +#include <lib/base/message.h>
  7120. +#include <lib/service/iservice.h>
  7121. +#include <lib/dvb/pmt.h>
  7122. +#include <lib/dvb/subtitle.h>
  7123. +#include <lib/dvb/teletext.h>
  7124. +
  7125. +#include <libeplayer3/include/common.h>
  7126. +#include <libeplayer3/include/subtitle.h>
  7127. +#define gint int
  7128. +#define gint64 int64_t
  7129. +extern OutputHandler_t     OutputHandler;
  7130. +extern PlaybackHandler_t   PlaybackHandler;
  7131. +extern ContainerHandler_t  ContainerHandler;
  7132. +extern ManagerHandler_t    ManagerHandler;
  7133. +
  7134. +/* for subtitles */
  7135. +#include <lib/gui/esubtitle.h>
  7136. +
  7137. +class eStaticServiceEPlayer3Info;
  7138. +
  7139. +class eServiceFactoryEPlayer3: public iServiceHandler
  7140. +{
  7141. +   DECLARE_REF(eServiceFactoryEPlayer3);
  7142. +public:
  7143. +   eServiceFactoryEPlayer3();
  7144. +   virtual ~eServiceFactoryEPlayer3();
  7145. +   enum { id = 0x1003 };
  7146. +
  7147. +       // iServiceHandler
  7148. +   RESULT play(const eServiceReference &, ePtr<iPlayableService> &ptr);
  7149. +   RESULT record(const eServiceReference &, ePtr<iRecordableService> &ptr);
  7150. +   RESULT list(const eServiceReference &, ePtr<iListableService> &ptr);
  7151. +   RESULT info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr);
  7152. +   RESULT offlineOperations(const eServiceReference &, ePtr<iServiceOfflineOperations> &ptr);
  7153. +private:
  7154. +   ePtr<eStaticServiceEPlayer3Info> m_service_info;
  7155. +};
  7156. +
  7157. +class eStaticServiceEPlayer3Info: public iStaticServiceInformation
  7158. +{
  7159. +   DECLARE_REF(eStaticServiceEPlayer3Info);
  7160. +   friend class eServiceFactoryEPlayer3;
  7161. +   eStaticServiceEPlayer3Info();
  7162. +public:
  7163. +   RESULT getName(const eServiceReference &ref, std::string &name);
  7164. +   int getLength(const eServiceReference &ref);
  7165. +   int getInfo(const eServiceReference &ref, int w);
  7166. +   int isPlayable(const eServiceReference &ref, const eServiceReference &ignore, bool simulate) { return 1; }
  7167. +   long long getFileSize(const eServiceReference &ref);
  7168. +};
  7169. +
  7170. +class eStreamBufferEPlayer3Info: public iStreamBufferInfo
  7171. +{
  7172. +   DECLARE_REF(eStreamBufferEPlayer3Info);
  7173. +   int bufferPercentage;
  7174. +   int inputRate;
  7175. +   int outputRate;
  7176. +   int bufferSpace;
  7177. +   int bufferSize;
  7178. +
  7179. +public:
  7180. +   eStreamBufferEPlayer3Info(int percentage, int inputrate, int outputrate, int space, int size);
  7181. +
  7182. +   int getBufferPercentage() const;
  7183. +   int getAverageInputRate() const;
  7184. +   int getAverageOutputRate() const;
  7185. +   int getBufferSpace() const;
  7186. +   int getBufferSize() const;
  7187. +};
  7188. +
  7189. +class eServiceEPlayer3InfoContainer: public iServiceInfoContainer
  7190. +{
  7191. +   DECLARE_REF(eServiceEPlayer3InfoContainer);
  7192. +
  7193. +   double doubleValue;
  7194. +
  7195. +
  7196. +   unsigned char *bufferData;
  7197. +   unsigned int bufferSize;
  7198. +
  7199. +public:
  7200. +   eServiceEPlayer3InfoContainer();
  7201. +   ~eServiceEPlayer3InfoContainer();
  7202. +
  7203. +   double getDouble(unsigned int index) const;
  7204. +   unsigned char *getBuffer(unsigned int &size) const;
  7205. +
  7206. +   void setDouble(double value);
  7207. +};
  7208. +
  7209. +typedef enum { atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC, atWMA } audiotype_t;
  7210. +typedef enum { stUnknown, stPlainText, stSSA, stASS, stSRT, stVOB, stPGS } subtype_t;
  7211. +typedef enum { ctNone, ctMPEGTS, ctMPEGPS, ctMKV, ctAVI, ctMP4, ctVCD, ctCDA, ctASF, ctOGG } containertype_t;
  7212. +
  7213. +class eServiceEPlayer3: public iPlayableService, public iPauseableService,
  7214. +   public iServiceInformation, public iSeekableService, public iAudioTrackSelection, public iAudioChannelSelection,
  7215. +   public iSubtitleOutput, public iStreamedService, public iAudioDelay, public Object
  7216. +{
  7217. +   DECLARE_REF(eServiceEPlayer3);
  7218. +public:
  7219. +   virtual ~eServiceEPlayer3();
  7220. +
  7221. +       // iPlayableService
  7222. +   RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection);
  7223. +   RESULT start();
  7224. +   RESULT stop();
  7225. +   RESULT setTarget(int target);
  7226. +  
  7227. +   RESULT pause(ePtr<iPauseableService> &ptr);
  7228. +   RESULT setSlowMotion(int ratio);
  7229. +   RESULT setFastForward(int ratio);
  7230. +
  7231. +   RESULT seek(ePtr<iSeekableService> &ptr);
  7232. +   RESULT audioTracks(ePtr<iAudioTrackSelection> &ptr);
  7233. +   RESULT audioChannel(ePtr<iAudioChannelSelection> &ptr);
  7234. +   RESULT subtitle(ePtr<iSubtitleOutput> &ptr);
  7235. +   RESULT audioDelay(ePtr<iAudioDelay> &ptr);
  7236. +
  7237. +       // not implemented (yet)
  7238. +   RESULT frontendInfo(ePtr<iFrontendInformation> &ptr) { ptr = 0; return -1; }
  7239. +   RESULT subServices(ePtr<iSubserviceList> &ptr) { ptr = 0; return -1; }
  7240. +   RESULT timeshift(ePtr<iTimeshiftService> &ptr) { ptr = 0; return -1; }
  7241. +   RESULT cueSheet(ePtr<iCueSheet> &ptr) { ptr = 0; return -1; }
  7242. +
  7243. +   RESULT rdsDecoder(ePtr<iRdsDecoder> &ptr) { ptr = 0; return -1; }
  7244. +   RESULT keys(ePtr<iServiceKeys> &ptr) { ptr = 0; return -1; }
  7245. +   RESULT stream(ePtr<iStreamableService> &ptr) { ptr = 0; return -1; }
  7246. +
  7247. +       // iPausableService
  7248. +   RESULT pause();
  7249. +   RESULT unpause();
  7250. +  
  7251. +   RESULT info(ePtr<iServiceInformation>&);
  7252. +  
  7253. +       // iSeekableService
  7254. +   RESULT getLength(pts_t &SWIG_OUTPUT);
  7255. +   RESULT seekTo(pts_t to);
  7256. +   RESULT seekRelative(int direction, pts_t to);
  7257. +   RESULT getPlayPosition(pts_t &SWIG_OUTPUT);
  7258. +   RESULT setTrickmode(int trick);
  7259. +   RESULT isCurrentlySeekable();
  7260. +
  7261. +       // iServiceInformation
  7262. +   RESULT getName(std::string &name);
  7263. +   int getInfo(int w);
  7264. +   std::string getInfoString(int w);
  7265. +
  7266. +       // iAudioTrackSelection
  7267. +   int getNumberOfTracks();
  7268. +   RESULT selectTrack(unsigned int i);
  7269. +   RESULT getTrackInfo(struct iAudioTrackInfo &, unsigned int n);
  7270. +   int getCurrentTrack();
  7271. +
  7272. +       // iAudioChannelSelection  
  7273. +   int getCurrentChannel();
  7274. +   RESULT selectChannel(int i);
  7275. +
  7276. +       // iSubtitleOutput
  7277. +   RESULT enableSubtitles(iSubtitleUser *user, SubtitleTrack &track);
  7278. +   RESULT disableSubtitles();
  7279. +   RESULT getSubtitleList(std::vector<SubtitleTrack> &sublist);
  7280. +   RESULT getCachedSubtitle(SubtitleTrack &track);
  7281. +
  7282. +       // iStreamedService
  7283. +   RESULT streamed(ePtr<iStreamedService> &ptr);
  7284. +   ePtr<iStreamBufferInfo> getBufferCharge();
  7285. +   int setBufferSize(int size);
  7286. +
  7287. +       // iAudioDelay
  7288. +   int getAC3Delay();
  7289. +   int getPCMDelay();
  7290. +   void setAC3Delay(int);
  7291. +   void setPCMDelay(int);
  7292. +
  7293. +   struct audioStream
  7294. +   {
  7295. +       audiotype_t type;
  7296. +       std::string language_code; /* iso-639, if available. */
  7297. +       std::string codec; /* clear text codec description */
  7298. +       audioStream()
  7299. +           :type(atUnknown)
  7300. +       {
  7301. +       }
  7302. +   };
  7303. +   struct subtitleStream
  7304. +   {
  7305. +       subtype_t type;
  7306. +       std::string language_code; /* iso-639, if available. */
  7307. +       int id;
  7308. +       subtitleStream()
  7309. +       {
  7310. +       }
  7311. +   };
  7312. +   struct sourceStream
  7313. +   {
  7314. +       audiotype_t audiotype;
  7315. +       containertype_t containertype;
  7316. +       bool is_video;
  7317. +       bool is_streaming;
  7318. +       sourceStream()
  7319. +           :audiotype(atUnknown), containertype(ctNone), is_video(false), is_streaming(false)
  7320. +       {
  7321. +       }
  7322. +   };
  7323. +
  7324. +   struct bufferInfo
  7325. +   {
  7326. +       gint bufferPercent;
  7327. +       gint avgInRate;
  7328. +       gint avgOutRate;
  7329. +       gint64 bufferingLeft;
  7330. +       bufferInfo()
  7331. +           :bufferPercent(0), avgInRate(0), avgOutRate(0), bufferingLeft(-1)
  7332. +       {
  7333. +       }
  7334. +   };
  7335. +   struct errorInfo
  7336. +   {
  7337. +       std::string error_message;
  7338. +       std::string missing_codec;
  7339. +   };
  7340. +
  7341. +private:
  7342. +   static int pcm_delay;
  7343. +   static int ac3_delay;
  7344. +   int m_currentAudioStream;
  7345. +   int m_currentSubtitleStream;
  7346. +   int m_cachedSubtitleStream;
  7347. +   int selectAudioStream(int i);
  7348. +   std::vector<audioStream> m_audioStreams;
  7349. +   std::vector<subtitleStream> m_subtitleStreams;
  7350. +   iSubtitleUser *m_subtitle_widget;
  7351. +
  7352. +   int m_currentTrickRatio;
  7353. +
  7354. +   friend class eServiceFactoryEPlayer3;
  7355. +   eServiceReference m_ref;
  7356. +   int m_buffer_size;
  7357. +
  7358. +   bufferInfo m_bufferInfo;
  7359. +   errorInfo m_errorInfo;
  7360. +   std::string m_download_buffer_path;
  7361. +   eServiceEPlayer3(eServiceReference ref);
  7362. +   Signal2<void,iPlayableService*,int> m_event;
  7363. +   enum
  7364. +   {
  7365. +       stIdle, stRunning, stStopped,
  7366. +   };
  7367. +   int m_state;
  7368. +
  7369. +   Context_t * player;
  7370. +
  7371. +   struct Message
  7372. +   {
  7373. +       Message()
  7374. +           :type(-1)
  7375. +       {}
  7376. +       Message(int type)
  7377. +           :type(type)
  7378. +       {}
  7379. +       int type;
  7380. +   };
  7381. +   eFixedMessagePump<Message> m_pump;
  7382. +   static void eplayerCBsubtitleAvail(long int duration_ns, size_t len, char * buffer, void* user_data);
  7383. +
  7384. +   struct subtitle_page_t
  7385. +   {
  7386. +       uint32_t start_ms;
  7387. +       uint32_t end_ms;
  7388. +       std::string text;
  7389. +
  7390. +       subtitle_page_t(uint32_t start_ms_in, uint32_t end_ms_in, std::string text_in)
  7391. +           : start_ms(start_ms_in), end_ms(end_ms_in), text(text_in)
  7392. +       {
  7393. +       }
  7394. +   };
  7395. +
  7396. +   typedef std::map<uint32_t, subtitle_page_t> subtitle_pages_map_t;
  7397. +   typedef std::pair<uint32_t, subtitle_page_t> subtitle_pages_map_pair_t;
  7398. +   subtitle_pages_map_t m_subtitle_pages;
  7399. +   ePtr<eTimer> m_subtitle_sync_timer;
  7400. +  
  7401. +   ePtr<eTimer> m_streamingsrc_timeout;
  7402. +   pts_t m_prev_decoder_time;
  7403. +   int m_decoder_time_valid_state;
  7404. +
  7405. +   void pushSubtitles();
  7406. +
  7407. +   void sourceTimeout();
  7408. +   sourceStream m_sourceinfo;
  7409. +
  7410. +   RESULT seekToImpl(pts_t to);
  7411. +
  7412. +   gint m_aspect, m_width, m_height, m_framerate, m_progressive;
  7413. +   std::string m_useragent;
  7414. +};
  7415. +
  7416. +#endif
  7417. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/service/servicemp3.cpp enigma2-nightly.patched/lib/service/servicemp3.cpp
  7418. --- enigma2-nightly.org/lib/service/servicemp3.cpp  2013-08-11 08:11:19.342306128 +0200
  7419. +++ enigma2-nightly.patched/lib/service/servicemp3.cpp  2013-10-26 03:02:27.269604783 +0200
  7420. @@ -16,8 +16,10 @@
  7421.  
  7422.  #include <string>
  7423.  
  7424. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7425.  #include <gst/gst.h>
  7426.  #include <gst/pbutils/missing-plugins.h>
  7427. +#endif
  7428.  #include <sys/stat.h>
  7429.  
  7430.  #define HTTP_TIMEOUT 30
  7431. @@ -61,6 +63,11 @@
  7432.  #define GSTREAMER_SUBTITLE_SYNC_MODE_BUG
  7433.  /**/
  7434.  
  7435. +void mp3Blit(){
  7436. +   fbClass *fb = fbClass::getInstance();
  7437. +   fb->blit();
  7438. +}
  7439. +
  7440.  eServiceFactoryMP3::eServiceFactoryMP3()
  7441.  {
  7442.     ePtr<eServiceCenter> sc;
  7443. @@ -75,24 +82,49 @@
  7444.         extensions.push_back("ogg");
  7445.         extensions.push_back("ogm");
  7446.         extensions.push_back("ogv");
  7447. -       extensions.push_back("mpg");
  7448. -       extensions.push_back("vob");
  7449.         extensions.push_back("wav");
  7450.         extensions.push_back("wave");
  7451. +       extensions.push_back("flac");
  7452. +       extensions.push_back("flv");
  7453. +       extensions.push_back("m4a");
  7454. +       extensions.push_back("3gp");
  7455. +       extensions.push_back("3g2");
  7456. +       extensions.push_back("asf");
  7457. +#if defined(__sh__)
  7458. +#if !defined(ENABLE_MEDIAFWGSTREAMER) || !defined(ENABLE_LIBEPLAYER3)
  7459. +/* Hellmaster1024: if both gst and eplayer3 are enabled, this is the GST service!
  7460. + * We only select the audio extensions (above), and leave the Video extensions for
  7461. + * the ePlayer3 service located in serviceeplayer3
  7462. + * If only one of GST and ePlayer3 this service handles all extensions and switches between
  7463. + * GST and ePlayer3
  7464. +*/
  7465.         extensions.push_back("m4v");
  7466.         extensions.push_back("mkv");
  7467.         extensions.push_back("avi");
  7468.         extensions.push_back("divx");
  7469.         extensions.push_back("dat");
  7470. -       extensions.push_back("flac");
  7471. -       extensions.push_back("flv");
  7472. +       extensions.push_back("mpg");
  7473. +       extensions.push_back("vob");
  7474.         extensions.push_back("mp4");
  7475.         extensions.push_back("mov");
  7476. -       extensions.push_back("m4a");
  7477. -       extensions.push_back("3gp");
  7478. -       extensions.push_back("3g2");
  7479. -       extensions.push_back("asf");
  7480. -       extensions.push_back("wmv");
  7481. +       extensions.push_back("mpeg");
  7482. +       extensions.push_back("m2ts");
  7483. +       extensions.push_back("trp");
  7484. +       extensions.push_back("vdr");
  7485. +       extensions.push_back("mts");
  7486. +       extensions.push_back("rar");
  7487. +       extensions.push_back("img");
  7488. +       extensions.push_back("iso");
  7489. +       extensions.push_back("ifo");
  7490. +       int fd = open("/proc/stb/info/model", O_RDONLY);
  7491. +       char tmp[255];
  7492. +       int rd = fd >= 0 ? read(fd, tmp, 255) : 0;
  7493. +       if (fd >= 0)
  7494. +           close(fd);
  7495. +       if (!strncmp(tmp, "ufs912\n", rd) || !strncmp(tmp, "ufs913\n", rd) || !strncmp(tmp, "atevio7500\n", rd) || !strncmp(tmp, "hs7110\n", rd) || !strncmp(tmp, "hs7810a\n", rd) || !strncmp(tmp, "spark7162\n", rd) || !strncmp(tmp, "whitebox\n", rd))
  7496. +           extensions.push_back("wmv");
  7497. +#endif
  7498. +#endif
  7499.         extensions.push_back("wma");
  7500.         sc->addServiceFactory(eServiceFactoryMP3::id, this, extensions);
  7501.     }
  7502. @@ -319,6 +351,7 @@
  7503.     return bufferSize;
  7504.  }
  7505.  
  7506. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7507.  DEFINE_REF(eServiceMP3InfoContainer);
  7508.  
  7509.  eServiceMP3InfoContainer::eServiceMP3InfoContainer()
  7510. @@ -369,6 +402,7 @@
  7511.     bufferSize = map.size;
  7512.  #endif
  7513.  }
  7514. +#endif
  7515.  
  7516.  // eServiceMP3
  7517.  int eServiceMP3::ac3_delay = 0,
  7518. @@ -381,25 +415,33 @@
  7519.  {
  7520.     m_subtitle_sync_timer = eTimer::create(eApp);
  7521.     m_streamingsrc_timeout = 0;
  7522. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7523.     m_stream_tags = 0;
  7524. +#endif
  7525.     m_currentAudioStream = -1;
  7526.     m_currentSubtitleStream = -1;
  7527.     m_cachedSubtitleStream = 0; /* report the first subtitle stream to be 'cached'. TODO: use an actual cache. */
  7528.     m_subtitle_widget = 0;
  7529.     m_currentTrickRatio = 1.0;
  7530.     m_buffer_size = 5 * 1024 * 1024;
  7531. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7532.     m_ignore_buffering_messages = 0;
  7533.     m_is_live = false;
  7534.     m_use_prefillbuffer = false;
  7535.     m_extra_headers = "";
  7536.     m_download_buffer_path = "";
  7537. +#endif
  7538.     m_prev_decoder_time = -1;
  7539.     m_decoder_time_valid_state = 0;
  7540.     m_errorInfo.missing_codec = "";
  7541. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7542.     audioSink = videoSink = NULL;
  7543. +#endif
  7544.  
  7545.     CONNECT(m_subtitle_sync_timer->timeout, eServiceMP3::pushSubtitles);
  7546. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7547.     CONNECT(m_pump.recv_msg, eServiceMP3::gstPoll);
  7548. +#endif
  7549.     CONNECT(m_nownext_timer->timeout, eServiceMP3::updateEpgCacheNowNext);
  7550.     m_aspect = m_width = m_height = m_framerate = m_progressive = -1;
  7551.  
  7552. @@ -411,6 +453,7 @@
  7553.     if (!ext)
  7554.         ext = filename + strlen(filename);
  7555.  
  7556. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7557.     m_sourceinfo.is_video = FALSE;
  7558.     m_sourceinfo.audiotype = atUnknown;
  7559.     if ( (strcasecmp(ext, ".mpeg") && strcasecmp(ext, ".mpg") && strcasecmp(ext, ".vob") && strcasecmp(ext, ".bin") && strcasecmp(ext, ".dat") ) == 0 )
  7560. @@ -592,10 +635,178 @@
  7561.         eDebug("eServiceMP3::sorry, can't play: %s",m_errorInfo.error_message.c_str());
  7562.     }
  7563.     g_free(uri);
  7564. +#else
  7565. +   player = (Context_t*) malloc(sizeof(Context_t));
  7566. +
  7567. +   if (player)
  7568. +   {
  7569. +       player->playback  = &PlaybackHandler;
  7570. +       player->output    = &OutputHandler;
  7571. +       player->container = &ContainerHandler;
  7572. +       player->manager   = &ManagerHandler;
  7573. +       printf("%s\n", player->output->Name);
  7574. +   }
  7575. +
  7576. +   //Registration of output devices
  7577. +   if (player && player->output)
  7578. +   {
  7579. +       player->output->Command(player,OUTPUT_ADD, (void*)"audio");
  7580. +       player->output->Command(player,OUTPUT_ADD, (void*)"video");
  7581. +       player->output->Command(player,OUTPUT_ADD, (void*)"subtitle");
  7582. +   }
  7583. +
  7584. +   if (player && player->output && player->output->subtitle)
  7585. +   {
  7586. +       fbClass *fb = fbClass::getInstance();
  7587. +       SubtitleOutputDef_t out;
  7588. +       out.screen_width = fb->getScreenResX();
  7589. +       out.screen_height = fb->getScreenResY();
  7590. +       out.shareFramebuffer = 1;
  7591. +       out.framebufferFD = fb->getFD();
  7592. +       out.destination = fb->getLFB_Direct();
  7593. +       out.destStride = fb->Stride();
  7594. +       out.framebufferBlit = mp3Blit;
  7595. +       player->output->subtitle->Command(player, (OutputCmd_t)OUTPUT_SET_SUBTITLE_OUTPUT, (void*) &out);
  7596. +   }
  7597. +
  7598. +   //create playback path
  7599. +   char file[800] = {""};
  7600. +
  7601. +   if (!strncmp("http://", m_ref.path.c_str(), 7))
  7602. +       ;
  7603. +   else if (!strncmp("rtsp://", m_ref.path.c_str(), 7))
  7604. +       ;
  7605. +   else if (!strncmp("rtmp://", m_ref.path.c_str(), 7))
  7606. +       ;
  7607. +   else if (!strncmp("rtmpe://", m_ref.path.c_str(), 8))
  7608. +       ;
  7609. +   else if (!strncmp("rtmpt://", m_ref.path.c_str(), 8))
  7610. +       ;
  7611. +   else if (!strncmp("rtmps://", m_ref.path.c_str(), 8))
  7612. +       ;
  7613. +   else if (!strncmp("rtmpte://", m_ref.path.c_str(), 9))
  7614. +       ;
  7615. +   else if (!strncmp("rtp://", m_ref.path.c_str(), 6))
  7616. +       ;
  7617. +   else if (!strncmp("upnp://", m_ref.path.c_str(), 7))
  7618. +       ;
  7619. +   else if (!strncmp("mms://", m_ref.path.c_str(), 6))
  7620. +       ;
  7621. +   else if (!strncmp("file://", m_ref.path.c_str(), 7))
  7622. +       ;
  7623. +   else
  7624. +       strcat(file, "file://");
  7625. +   strcat(file, m_ref.path.c_str());
  7626. +
  7627. +   //try to open file
  7628. +   if (player && player->playback && player->playback->Command(player, PLAYBACK_OPEN, file) >= 0)
  7629. +   {
  7630. +       //VIDEO
  7631. +       //We dont have to register video tracks, or do we ?
  7632. +       //AUDIO
  7633. +       if (player && player->manager && player->manager->audio)
  7634. +       {
  7635. +           char ** TrackList = NULL;
  7636. +           player->manager->audio->Command(player, MANAGER_LIST, &TrackList);
  7637. +           if (TrackList != NULL)
  7638. +           {
  7639. +               printf("AudioTrack List\n");
  7640. +               int i = 0;
  7641. +               for (i = 0; TrackList[i] != NULL; i+=2)
  7642. +               {
  7643. +                   printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
  7644. +                   audioStream audio;
  7645. +                   audio.language_code = TrackList[i];
  7646. +
  7647. +                   // atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC
  7648. +                   if (    !strncmp("A_MPEG/L3",   TrackList[i+1], 9))
  7649. +                       audio.type = atMP3;
  7650. +                   else if (!strncmp("A_MP3",      TrackList[i+1], 5))
  7651. +                       audio.type = atMP3;
  7652. +                   else if (!strncmp("A_AC3",      TrackList[i+1], 5))
  7653. +                       audio.type = atAC3;
  7654. +                   else if (!strncmp("A_DTS",      TrackList[i+1], 5))
  7655. +                       audio.type = atDTS;
  7656. +                   else if (!strncmp("A_AAC",      TrackList[i+1], 5))
  7657. +                       audio.type = atAAC;
  7658. +                   else if (!strncmp("A_PCM",      TrackList[i+1], 5))
  7659. +                       audio.type = atPCM;
  7660. +                   else if (!strncmp("A_VORBIS",   TrackList[i+1], 8))
  7661. +                       audio.type = atOGG;
  7662. +                   else if (!strncmp("A_FLAC",     TrackList[i+1], 6))
  7663. +                       audio.type = atFLAC;
  7664. +                   else
  7665. +                       audio.type = atUnknown;
  7666. +
  7667. +                   m_audioStreams.push_back(audio);
  7668. +                   free(TrackList[i]);
  7669. +                   free(TrackList[i+1]);
  7670. +               }
  7671. +               free(TrackList);
  7672. +           }
  7673. +       }
  7674. +       //SUB
  7675. +       if (player && player->manager && player->manager->subtitle)
  7676. +       {
  7677. +           char ** TrackList = NULL;
  7678. +           player->manager->subtitle->Command(player, MANAGER_LIST, &TrackList);
  7679. +           if (TrackList != NULL)
  7680. +           {
  7681. +               printf("SubtitleTrack List\n");
  7682. +               int i = 0;
  7683. +               for (i = 0; TrackList[i] != NULL; i+=2)
  7684. +               {
  7685. +                   printf("\t%s - %s\n", TrackList[i], TrackList[i+1]);
  7686. +                   subtitleStream sub;
  7687. +                   sub.language_code = TrackList[i];
  7688. +                   //  stPlainText, stSSA, stSRT
  7689. +                   if (    !strncmp("S_TEXT/SSA",   TrackList[i+1], 10) ||
  7690. +                           !strncmp("S_SSA", TrackList[i+1], 5))
  7691. +                       sub.type = stSSA;
  7692. +                   else if (!strncmp("S_TEXT/ASS",   TrackList[i+1], 10) ||
  7693. +                           !strncmp("S_AAS", TrackList[i+1], 5))
  7694. +                       sub.type = stSSA;
  7695. +                   else if (!strncmp("S_TEXT/SRT",   TrackList[i+1], 10) ||
  7696. +                           !strncmp("S_SRT", TrackList[i+1], 5))
  7697. +                       sub.type = stSRT;
  7698. +                   else
  7699. +                       sub.type = stPlainText;
  7700. +
  7701. +                   m_subtitleStreams.push_back(sub);
  7702. +                   free(TrackList[i]);
  7703. +                   free(TrackList[i+1]);
  7704. +               }
  7705. +               free(TrackList);
  7706. +           }
  7707. +       }
  7708. +       m_event(this, evStart);
  7709. +   }
  7710. +   else
  7711. +   {
  7712. +       //Creation failed, no playback support for insert file, so delete playback context
  7713. +       //FIXME: How to tell e2 that we failed?
  7714. +       if (player && player->output)
  7715. +       {
  7716. +           player->output->Command(player,OUTPUT_DEL, (void*)"audio");
  7717. +           player->output->Command(player,OUTPUT_DEL, (void*)"video");
  7718. +           player->output->Command(player,OUTPUT_DEL, (void*)"subtitle");
  7719. +       }
  7720. +
  7721. +       if (player && player->playback)
  7722. +           player->playback->Command(player,PLAYBACK_CLOSE, NULL);
  7723. +
  7724. +       if (player)
  7725. +           free(player);
  7726. +       player = NULL;
  7727. +   }
  7728. +   //m_state = stRunning;
  7729. +   eDebug("eServiceMP3-<\n");
  7730. +#endif
  7731.  }
  7732.  
  7733.  eServiceMP3::~eServiceMP3()
  7734.  {
  7735. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7736.     // disconnect subtitle callback
  7737.     GstElement *subsink = gst_bin_get_by_name(GST_BIN(m_gst_playbin), "subtitle_sink");
  7738.  
  7739. @@ -604,10 +815,12 @@
  7740.         g_signal_handler_disconnect (subsink, m_subs_to_pull_handler_id);
  7741.         gst_object_unref(subsink);
  7742.     }
  7743. +#endif
  7744.  
  7745.     if (m_subtitle_widget) m_subtitle_widget->destroy();
  7746.     m_subtitle_widget = 0;
  7747.  
  7748. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7749.     if (m_gst_playbin)
  7750.     {
  7751.         // disconnect sync handler callback
  7752. @@ -619,10 +832,12 @@
  7753.  #endif
  7754.         gst_object_unref(bus);
  7755.     }
  7756. +#endif
  7757.  
  7758.     if (m_state == stRunning)
  7759.         stop();
  7760.  
  7761. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7762.     if (m_stream_tags)
  7763.         gst_tag_list_free(m_stream_tags);
  7764.  
  7765. @@ -641,6 +856,7 @@
  7766.         gst_object_unref (GST_OBJECT (m_gst_playbin));
  7767.         eDebug("eServiceMP3::destruct!");
  7768.     }
  7769. +#endif
  7770.  }
  7771.  
  7772.  void eServiceMP3::updateEpgCacheNowNext()
  7773. @@ -690,7 +906,9 @@
  7774.  
  7775.  DEFINE_REF(eServiceMP3);
  7776.  
  7777. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7778.  DEFINE_REF(eServiceMP3::GstMessageContainer);
  7779. +#endif
  7780.  
  7781.  RESULT eServiceMP3::connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection)
  7782.  {
  7783. @@ -700,15 +918,31 @@
  7784.  
  7785.  RESULT eServiceMP3::start()
  7786.  {
  7787. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7788.     ASSERT(m_state == stIdle);
  7789. +#else
  7790. +   if (m_state != stIdle)
  7791. +   {
  7792. +       eDebug("eServiceMP3::%s < m_state != stIdle", __func__);
  7793. +       return -1;
  7794. +   }
  7795. +#endif
  7796.  
  7797.     m_state = stRunning;
  7798. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7799.     if (m_gst_playbin)
  7800.     {
  7801.         eDebug("eServiceMP3::starting pipeline");
  7802.         gst_element_set_state (m_gst_playbin, GST_STATE_PLAYING);
  7803.         updateEpgCacheNowNext();
  7804.     }
  7805. +#else
  7806. +   if (player && player->output && player->playback)
  7807. +   {
  7808. +       player->output->Command(player, OUTPUT_OPEN, NULL);
  7809. +       player->playback->Command(player, PLAYBACK_PLAY, NULL);
  7810. +   }
  7811. +#endif
  7812.  
  7813.     m_event(this, evStart);
  7814.  
  7815. @@ -723,13 +957,45 @@
  7816.  
  7817.  RESULT eServiceMP3::stop()
  7818.  {
  7819. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7820.     ASSERT(m_state != stIdle);
  7821. +#else
  7822. +   if (m_state == stIdle)
  7823. +   {
  7824. +       eDebug("eServiceMP3::%s < m_state == stIdle", __func__);
  7825. +       return -1;
  7826. +   }
  7827. +#endif
  7828.  
  7829.     if (m_state == stStopped)
  7830.         return -1;
  7831.  
  7832.     eDebug("eServiceMP3::stop %s", m_ref.path.c_str());
  7833. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7834.     gst_element_set_state(m_gst_playbin, GST_STATE_NULL);
  7835. +#else
  7836. +   if (player && player->playback && player->output)
  7837. +   {
  7838. +       player->playback->Command(player, PLAYBACK_STOP, NULL);
  7839. +       player->output->Command(player, OUTPUT_CLOSE, NULL);
  7840. +   }
  7841. +
  7842. +   if (player && player->output)
  7843. +   {
  7844. +       player->output->Command(player,OUTPUT_DEL, (void*)"audio");
  7845. +       player->output->Command(player,OUTPUT_DEL, (void*)"video");
  7846. +       player->output->Command(player,OUTPUT_DEL, (void*)"subtitle");
  7847. +   }
  7848. +
  7849. +   if (player && player->playback)
  7850. +       player->playback->Command(player,PLAYBACK_CLOSE, NULL);
  7851. +
  7852. +   if (player)
  7853. +       free(player);
  7854. +
  7855. +   if (player != NULL)
  7856. +       player = NULL;
  7857. +#endif
  7858.     m_state = stStopped;
  7859.     m_nownext_timer->stop();
  7860.  
  7861. @@ -747,37 +1013,119 @@
  7862.     return 0;
  7863.  }
  7864.  
  7865. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7866. +#else
  7867. +int speed_mapping[] =
  7868. +{
  7869. + /* e2_ratio   speed */
  7870. +   2,         1,
  7871. +   4,         3,
  7872. +   8,         7,
  7873. +   16,        15,
  7874. +   32,        31,
  7875. +   64,        63,
  7876. +   128,      127,
  7877. +   -2,       -5,
  7878. +   -4,      -10,
  7879. +   -8,      -20,
  7880. +   -16,      -40,
  7881. +   -32,      -80,
  7882. +   -64,     -160,
  7883. +   -128,     -320,
  7884. +   -1,       -1
  7885. +};
  7886. +
  7887. +int getSpeed(int ratio)
  7888. +{
  7889. +   int i = 0;
  7890. +   while (speed_mapping[i] != -1)
  7891. +   {
  7892. +       if (speed_mapping[i] == ratio)
  7893. +           return speed_mapping[i+1];
  7894. +       i += 2;
  7895. +   }
  7896. +   return -1;
  7897. +}
  7898. +#endif
  7899. +
  7900.  RESULT eServiceMP3::setSlowMotion(int ratio)
  7901.  {
  7902. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7903.     if (!ratio)
  7904.         return 0;
  7905.     eDebug("eServiceMP3::setSlowMotion ratio=%f",1.0/(gdouble)ratio);
  7906.     return trickSeek(1.0/(gdouble)ratio);
  7907. +#else
  7908. +// konfetti: in libeplayer3 we changed this because I dont like application specific stuff in a library
  7909. +   int speed = getSpeed(ratio);
  7910. +   if (player && player->playback && (speed != -1))
  7911. +   {
  7912. +       int result = 0;
  7913. +       if (ratio > 1)
  7914. +           result = player->playback->Command(player, PLAYBACK_SLOWMOTION, (void*)&speed);
  7915. +
  7916. +       if (result != 0)
  7917. +           return -1;
  7918. +   }
  7919. +   return 0;
  7920. +#endif
  7921.  }
  7922.  
  7923.  RESULT eServiceMP3::setFastForward(int ratio)
  7924.  {
  7925. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7926.     eDebug("eServiceMP3::setFastForward ratio=%i",ratio);
  7927.     return trickSeek(ratio);
  7928. +#else
  7929. +// konfetti: in libeplayer3 we changed this because I dont like application specific stuff in a library
  7930. +   int speed = getSpeed(ratio);
  7931. +   if (player && player->playback && (speed != -1))
  7932. +   {
  7933. +       int result = 0;
  7934. +       if (ratio > 1)
  7935. +           result = player->playback->Command(player, PLAYBACK_FASTFORWARD, (void*)&speed);
  7936. +       else if (ratio < -1)
  7937. +       {
  7938. +           //speed = speed * -1;
  7939. +           result = player->playback->Command(player, PLAYBACK_FASTBACKWARD, (void*)&speed);
  7940. +       }
  7941. +       else
  7942. +           result = player->playback->Command(player, PLAYBACK_CONTINUE, NULL);
  7943. +
  7944. +       if (result != 0)
  7945. +           return -1;
  7946. +   }
  7947. +   return 0;
  7948. +#endif
  7949.  }
  7950.  
  7951.         // iPausableService
  7952.  RESULT eServiceMP3::pause()
  7953.  {
  7954. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7955.     if (!m_gst_playbin || m_state != stRunning)
  7956.         return -1;
  7957.  
  7958.     trickSeek(0.0);
  7959. +#else
  7960. +   if (player && player->playback)
  7961. +       player->playback->Command(player, PLAYBACK_PAUSE, NULL);
  7962. +#endif
  7963.  
  7964.     return 0;
  7965.  }
  7966.  
  7967.  RESULT eServiceMP3::unpause()
  7968.  {
  7969. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7970.     if (!m_gst_playbin || m_state != stRunning)
  7971.         return -1;
  7972.  
  7973.     trickSeek(1.0);
  7974. +#else
  7975. +   if (player && player->playback)
  7976. +       player->playback->Command(player, PLAYBACK_CONTINUE, NULL);
  7977. +#endif
  7978.  
  7979.     return 0;
  7980.  }
  7981. @@ -791,6 +1139,7 @@
  7982.  
  7983.  RESULT eServiceMP3::getLength(pts_t &pts)
  7984.  {
  7985. +#ifdef ENABLE_MEDIAFWGSTREAMER
  7986.     if (!m_gst_playbin)
  7987.         return -1;
  7988.  
  7989. @@ -808,11 +1157,23 @@
  7990.         /* len is in nanoseconds. we have 90 000 pts per second. */
  7991.  
  7992.     pts = len / 11111LL;
  7993. +#else
  7994. +   double length = 0;
  7995. +
  7996. +   if (player && player->playback)
  7997. +       player->playback->Command(player, PLAYBACK_LENGTH, &length);
  7998. +
  7999. +   if (length <= 0)
  8000. +       return -1;
  8001. +
  8002. +   pts = length * 90000;
  8003. +#endif
  8004.     return 0;
  8005.  }
  8006.  
  8007.  RESULT eServiceMP3::seekToImpl(pts_t to)
  8008.  {
  8009. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8010.         /* convert pts to nanoseconds */
  8011.     gint64 time_nanoseconds = to * 11111LL;
  8012.     if (!gst_element_seek (m_gst_playbin, m_currentTrickRatio, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
  8013. @@ -822,6 +1183,7 @@
  8014.         eDebug("eServiceMP3::seekTo failed");
  8015.         return -1;
  8016.     }
  8017. +#endif
  8018.  
  8019.     return 0;
  8020.  }
  8021. @@ -830,17 +1192,25 @@
  8022.  {
  8023.     RESULT ret = -1;
  8024.  
  8025. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8026.     if (m_gst_playbin)
  8027.     {
  8028.         m_prev_decoder_time = -1;
  8029.         m_decoder_time_valid_state = 0;
  8030.         ret = seekToImpl(to);
  8031.     }
  8032. +#else
  8033. +   float pos = (to/90000.0)-10;
  8034. +   if (player && player->playback)
  8035. +       player->playback->Command(player, PLAYBACK_SEEK, (void*)&pos);
  8036.  
  8037. +   ret =0;
  8038. +#endif
  8039.     return ret;
  8040.  }
  8041.  
  8042.  
  8043. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8044.  RESULT eServiceMP3::trickSeek(gdouble ratio)
  8045.  {
  8046.     if (!m_gst_playbin)
  8047. @@ -881,28 +1251,41 @@
  8048.     m_decoder_time_valid_state = 0;
  8049.     return 0;
  8050.  }
  8051. +#endif
  8052.  
  8053.  
  8054.  RESULT eServiceMP3::seekRelative(int direction, pts_t to)
  8055.  {
  8056. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8057.     if (!m_gst_playbin)
  8058.         return -1;
  8059. -
  8060. +#endif
  8061.     pts_t ppos;
  8062.     if (getPlayPosition(ppos) < 0) return -1;
  8063.     ppos += to * direction;
  8064.     if (ppos < 0)
  8065.         ppos = 0;
  8066. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8067.     return seekTo(ppos);
  8068. +#else
  8069. +   float pos = direction*(to/90000.0);
  8070. +   if (player && player->playback)
  8071. +       player->playback->Command(player, PLAYBACK_SEEK, (void*)&pos);
  8072. +
  8073. +   return 0;
  8074. +#endif
  8075.  }
  8076.  
  8077. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8078.  gint eServiceMP3::match_sinktype(GstElement *element, gpointer type)
  8079.  {
  8080.     return strcmp(g_type_name(G_OBJECT_TYPE(element)), (const char*)type);
  8081.  }
  8082. +#endif
  8083.  
  8084.  RESULT eServiceMP3::getPlayPosition(pts_t &pts)
  8085.  {
  8086. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8087.     gint64 pos;
  8088.     pts = 0;
  8089.  
  8090. @@ -932,6 +1315,27 @@
  8091.  
  8092.     /* pos is in nanoseconds. we have 90 000 pts per second. */
  8093.     pts = pos / 11111LL;
  8094. +#else
  8095. +   if (player && player->playback && !player->playback->isPlaying)
  8096. +   {
  8097. +       eDebug("eServiceMP3::%s !!!!EOF!!!! < -1", __func__);
  8098. +       if(m_state == stRunning)
  8099. +           m_event((iPlayableService*)this, evEOF);
  8100. +       pts = 0;
  8101. +       return -1;
  8102. +   }
  8103. +
  8104. +   unsigned long long int vpts = 0;
  8105. +   if (player && player->playback)
  8106. +       player->playback->Command(player, PLAYBACK_PTS, &vpts);
  8107. +
  8108. +   if (vpts<=0)
  8109. +       return -1;
  8110. +
  8111. +   /* len is in nanoseconds. we have 90 000 pts per second. */
  8112. +   pts = vpts>0?vpts:pts;;
  8113. +
  8114. +#endif
  8115.     return 0;
  8116.  }
  8117.  
  8118. @@ -943,6 +1347,7 @@
  8119.  
  8120.  RESULT eServiceMP3::isCurrentlySeekable()
  8121.  {
  8122. +#ifdef ENABLE_MEDIAFWGSTREAMER // Hellmaster1024: 1 for skipping 3 for skipping anf fast forward
  8123.     int ret = 3; /* just assume that seeking and fast/slow winding are possible */
  8124.  
  8125.     if (!m_gst_playbin)
  8126. @@ -951,6 +1356,9 @@
  8127.         return 0;
  8128.  
  8129.     return ret;
  8130. +#else
  8131. +   return 3;
  8132. +#endif
  8133.  }
  8134.  
  8135.  RESULT eServiceMP3::info(ePtr<iServiceInformation>&i)
  8136. @@ -984,7 +1392,9 @@
  8137.  
  8138.  int eServiceMP3::getInfo(int w)
  8139.  {
  8140. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8141.     const gchar *tag = 0;
  8142. +#endif
  8143.  
  8144.     switch (w)
  8145.     {
  8146. @@ -1024,7 +1434,9 @@
  8147.     case sTagKeywords:
  8148.     case sTagChannelMode:
  8149.     case sUser+12:
  8150. +#if not defined(__sh__)
  8151.         return resIsString;
  8152. +#endif
  8153.     case sTagTrackGain:
  8154.     case sTagTrackPeak:
  8155.     case sTagAlbumGain:
  8156. @@ -1035,6 +1447,7 @@
  8157.     case sTagPreviewImage:
  8158.     case sTagAttachment:
  8159.         return resIsPyObject;
  8160. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8161.     case sTagTrackNumber:
  8162.         tag = GST_TAG_TRACK_NUMBER;
  8163.         break;
  8164. @@ -1068,16 +1481,19 @@
  8165.     case sTagCRC:
  8166.         tag = "has-crc";
  8167.         break;
  8168. +#endif
  8169.     default:
  8170.         return resNA;
  8171.     }
  8172.  
  8173. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8174.     if (!m_stream_tags || !tag)
  8175.         return 0;
  8176.  
  8177.     guint value;
  8178.     if (gst_tag_list_get_uint(m_stream_tags, tag, &value))
  8179.         return (int) value;
  8180. +#endif
  8181.  
  8182.     return 0;
  8183.  }
  8184. @@ -1103,6 +1519,7 @@
  8185.         return iServiceInformation::getInfoString(w);
  8186.     }
  8187.  
  8188. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8189.     if ( !m_stream_tags && w < sUser && w > 26 )
  8190.         return "";
  8191.     const gchar *tag = 0;
  8192. @@ -1215,9 +1632,69 @@
  8193.         g_free(value);
  8194.         return res;
  8195.     }
  8196. +#else
  8197. +   char * tag = NULL;
  8198. +   char * res_str = NULL;
  8199. +   switch (w)
  8200. +   {
  8201. +   case sTagTitle:
  8202. +       tag = strdup("Title");
  8203. +       break;
  8204. +   case sTagArtist:
  8205. +       tag = strdup("Artist");
  8206. +       break;
  8207. +   case sTagAlbum:
  8208. +       tag = strdup("Album");
  8209. +       break;
  8210. +   case sTagComment:
  8211. +       tag = strdup("Comment");
  8212. +       break;
  8213. +   case sTagTrackNumber:
  8214. +       tag = strdup("Track");
  8215. +       break;
  8216. +   case sTagGenre:
  8217. +       tag = strdup("Genre");
  8218. +       break;
  8219. +   case sTagDate:
  8220. +       tag = strdup("Year");
  8221. +       break;
  8222. +   case sTagVideoCodec:
  8223. +       tag = strdup("VideoType");
  8224. +       break;
  8225. +   case sTagAudioCodec:
  8226. +       tag = strdup("AudioType");
  8227. +       break;
  8228. +   default:
  8229. +       return "";
  8230. +   }
  8231. +
  8232. +   if (player && player->playback)
  8233. +   {
  8234. +       /*Hellmaster1024: we need to save the adress of tag to free the strduped mem
  8235. +         the command will retun a new adress for a new strduped string.
  8236. +         Both Strings need to be freed! */
  8237. +       res_str = tag;
  8238. +       player->playback->Command(player, PLAYBACK_INFO, &res_str);
  8239. +       /* Hellmaster1024: in case something went wrong maybe no new adress is returned */
  8240. +       if (tag != res_str)
  8241. +       {
  8242. +           std::string res = res_str;
  8243. +           free(tag);
  8244. +           free(res_str);
  8245. +           return res;
  8246. +       }
  8247. +       else
  8248. +       {
  8249. +           free(tag);
  8250. +           return "";
  8251. +       }
  8252. +   }
  8253. +   free(tag);
  8254. +#endif
  8255.     return "";
  8256.  }
  8257.  
  8258. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8259.  ePtr<iServiceInfoContainer> eServiceMP3::getInfoObject(int w)
  8260.  {
  8261.     eServiceMP3InfoContainer *container = new eServiceMP3InfoContainer;
  8262. @@ -1281,6 +1758,7 @@
  8263.     }
  8264.     return retval;
  8265.  }
  8266. +#endif
  8267.  
  8268.  RESULT eServiceMP3::audioChannel(ePtr<iAudioChannelSelection> &ptr)
  8269.  {
  8270. @@ -1313,13 +1791,16 @@
  8271.  
  8272.  int eServiceMP3::getCurrentTrack()
  8273.  {
  8274. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8275.     if (m_currentAudioStream == -1)
  8276.         g_object_get (G_OBJECT (m_gst_playbin), "current-audio", &m_currentAudioStream, NULL);
  8277. +#endif
  8278.     return m_currentAudioStream;
  8279.  }
  8280.  
  8281.  RESULT eServiceMP3::selectTrack(unsigned int i)
  8282.  {
  8283. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8284.     bool validposition = false;
  8285.     pts_t ppos = 0;
  8286.     if (getPlayPosition(ppos) >= 0)
  8287. @@ -1329,8 +1810,10 @@
  8288.         if (ppos < 0)
  8289.             ppos = 0;
  8290.     }
  8291. +#endif
  8292.  
  8293.     int ret = selectAudioStream(i);
  8294. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8295.     if (!ret)
  8296.     {
  8297.         if (validposition)
  8298. @@ -1339,12 +1822,14 @@
  8299.             seekTo(ppos);
  8300.         }
  8301.     }
  8302. +#endif
  8303.  
  8304.     return ret;
  8305.  }
  8306.  
  8307.  int eServiceMP3::selectAudioStream(int i)
  8308.  {
  8309. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8310.     int current_audio;
  8311.     g_object_set (G_OBJECT (m_gst_playbin), "current-audio", i, NULL);
  8312.     g_object_get (G_OBJECT (m_gst_playbin), "current-audio", &current_audio, NULL);
  8313. @@ -1355,6 +1840,16 @@
  8314.         return 0;
  8315.     }
  8316.     return -1;
  8317. +#else
  8318. +   if (i != m_currentAudioStream)
  8319. +   {
  8320. +       if (player && player->playback)
  8321. +           player->playback->Command(player, PLAYBACK_SWITCH_AUDIO, (void*)&i);
  8322. +       m_currentAudioStream = i;
  8323. +       return 0;
  8324. +   }
  8325. +   return -1;
  8326. +#endif
  8327.  }
  8328.  
  8329.  int eServiceMP3::getCurrentChannel()
  8330. @@ -1372,6 +1867,7 @@
  8331.  {
  8332.     if (i >= m_audioStreams.size())
  8333.         return -2;
  8334. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8335.         info.m_description = m_audioStreams[i].codec;
  8336.  /* if (m_audioStreams[i].type == atMPEG)
  8337.         info.m_description = "MPEG";
  8338. @@ -1391,11 +1887,28 @@
  8339.         info.m_description = "FLAC";
  8340.     else
  8341.         info.m_description = "???";*/
  8342. +#else
  8343. +   if (m_audioStreams[i].type == atMPEG)
  8344. +       info.m_description = "MPEG";
  8345. +   else if (m_audioStreams[i].type == atMP3)
  8346. +       info.m_description = "MP3";
  8347. +   else if (m_audioStreams[i].type == atAC3)
  8348. +       info.m_description = "AC3";
  8349. +   else if (m_audioStreams[i].type == atAAC)
  8350. +       info.m_description = "AAC";
  8351. +   else if (m_audioStreams[i].type == atDTS)
  8352. +       info.m_description = "DTS";
  8353. +   else if (m_audioStreams[i].type == atPCM)
  8354. +       info.m_description = "PCM";
  8355. +   else if (m_audioStreams[i].type == atOGG)
  8356. +       info.m_description = "OGG";
  8357. +#endif
  8358.     if (info.m_language.empty())
  8359.         info.m_language = m_audioStreams[i].language_code;
  8360.     return 0;
  8361.  }
  8362.  
  8363. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8364.  subtype_t getSubtitleType(GstPad* pad, gchar *g_codec=NULL)
  8365.  {
  8366.     subtype_t type = stUnknown;
  8367. @@ -2115,9 +2628,11 @@
  8368.         }
  8369.     }
  8370.  }
  8371. +#endif
  8372.  
  8373.  eAutoInitPtr<eServiceFactoryMP3> init_eServiceFactoryMP3(eAutoInitNumbers::service+1, "eServiceFactoryMP3");
  8374.  
  8375. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8376.  void eServiceMP3::gstCBsubtitleAvail(GstElement *subsink, GstBuffer *buffer, gpointer user_data)
  8377.  {
  8378.     eServiceMP3 *_this = (eServiceMP3*)user_data;
  8379. @@ -2235,9 +2750,30 @@
  8380.         }
  8381.     }
  8382.  }
  8383. +#else
  8384. +void eServiceMP3::eplayerCBsubtitleAvail(long int duration_ms, size_t len, char * buffer, void* user_data)
  8385. +{
  8386. +   eDebug("eServiceMP3::%s >", __func__);
  8387. +   unsigned char tmp[len+1];
  8388. +   memcpy(tmp, buffer, len);
  8389. +   tmp[len] = 0;
  8390. +   eDebug("gstCBsubtitleAvail: %s", tmp);
  8391. +   eServiceMP3 *_this = (eServiceMP3*)user_data;
  8392. +   if ( _this->m_subtitle_widget )
  8393. +   {
  8394. +       ePangoSubtitlePage page;
  8395. +       gRGB rgbcol(0xD0,0xD0,0xD0);
  8396. +       page.m_elements.push_back(ePangoSubtitlePageElement(rgbcol, (const char*)tmp));
  8397. +       page.m_timeout = duration_ms;
  8398. +       (_this->m_subtitle_widget)->setPage(page);
  8399. +   }
  8400. +   eDebug("eServiceMP3::%s <", __func__);
  8401. +}
  8402. +#endif
  8403.  
  8404.  void eServiceMP3::pushSubtitles()
  8405.  {
  8406. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8407.     pts_t running_pts = 0;
  8408.     int32_t next_timer = 0, decoder_ms, start_ms, end_ms, diff_start_ms, diff_end_ms;
  8409.     subtitle_pages_map_t::iterator current;
  8410. @@ -2340,23 +2876,30 @@
  8411.     m_subtitle_sync_timer->start(next_timer, true);
  8412.  
  8413.     eDebug("\n\n");
  8414. +
  8415. +#endif
  8416.  }
  8417.  
  8418.  RESULT eServiceMP3::enableSubtitles(iSubtitleUser *user, struct SubtitleTrack &track)
  8419.  {
  8420.     if (m_currentSubtitleStream != track.pid)
  8421. -   {
  8422. +   {  
  8423. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8424.         g_object_set (G_OBJECT (m_gst_playbin), "current-text", -1, NULL);
  8425. +#endif
  8426.         m_subtitle_sync_timer->stop();
  8427.         m_subtitle_pages.clear();
  8428.         m_prev_decoder_time = -1;
  8429.         m_decoder_time_valid_state = 0;
  8430. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8431.         m_currentSubtitleStream = track.pid;
  8432.         m_cachedSubtitleStream = m_currentSubtitleStream;
  8433.         g_object_set (G_OBJECT (m_gst_playbin), "current-text", m_currentSubtitleStream, NULL);
  8434. +#endif
  8435.  
  8436.         m_subtitle_widget = user;
  8437.  
  8438. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8439.         eDebug ("eServiceMP3::switched to subtitle stream %i", m_currentSubtitleStream);
  8440.  
  8441.  #ifdef GSTREAMER_SUBTITLE_SYNC_MODE_BUG
  8442. @@ -2366,7 +2909,13 @@
  8443.          */
  8444.         seekRelative(-1, 90000);
  8445.  #endif
  8446. +#endif
  8447.     }
  8448. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8449. +#else
  8450. +   if (player && player->playback)
  8451. +       player->playback->Command(player, PLAYBACK_SWITCH_SUBTITLE, (void*)&track.pid);
  8452. +#endif
  8453.  
  8454.     return 0;
  8455.  }
  8456. @@ -2374,15 +2923,23 @@
  8457.  RESULT eServiceMP3::disableSubtitles()
  8458.  {
  8459.     eDebug("eServiceMP3::disableSubtitles");
  8460. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8461.     m_currentSubtitleStream = -1;
  8462.     m_cachedSubtitleStream = m_currentSubtitleStream;
  8463.     g_object_set (G_OBJECT (m_gst_playbin), "current-text", m_currentSubtitleStream, NULL);
  8464. +#endif
  8465.     m_subtitle_sync_timer->stop();
  8466.     m_subtitle_pages.clear();
  8467.     m_prev_decoder_time = -1;
  8468.     m_decoder_time_valid_state = 0;
  8469.     if (m_subtitle_widget) m_subtitle_widget->destroy();
  8470.     m_subtitle_widget = 0;
  8471. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8472. +#else
  8473. +   int pid = -1;
  8474. +   if (player && player->playback)
  8475. +       player->playback->Command(player, PLAYBACK_SWITCH_SUBTITLE, (void*)&pid);
  8476. +#endif
  8477.     return 0;
  8478.  }
  8479.  
  8480. @@ -2449,7 +3006,9 @@
  8481.  int eServiceMP3::setBufferSize(int size)
  8482.  {
  8483.     m_buffer_size = size;
  8484. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8485.     g_object_set (G_OBJECT (m_gst_playbin), "buffer-size", m_buffer_size, NULL);
  8486. +#endif
  8487.     return 0;
  8488.  }
  8489.  
  8490. @@ -2465,6 +3024,7 @@
  8491.  
  8492.  void eServiceMP3::setAC3Delay(int delay)
  8493.  {
  8494. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8495.     ac3_delay = delay;
  8496.     if (!m_gst_playbin || m_state != stRunning)
  8497.         return;
  8498. @@ -2492,10 +3052,12 @@
  8499.             eTSMPEGDecoder::setHwAC3Delay(config_delay_int);
  8500.         }
  8501.     }
  8502. +#endif
  8503.  }
  8504.  
  8505.  void eServiceMP3::setPCMDelay(int delay)
  8506.  {
  8507. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8508.     pcm_delay = delay;
  8509.     if (!m_gst_playbin || m_state != stRunning)
  8510.         return;
  8511. @@ -2523,4 +3085,5 @@
  8512.             eTSMPEGDecoder::setHwPCMDelay(config_delay_int);
  8513.         }
  8514.     }
  8515. +#endif
  8516.  }
  8517. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/lib/service/servicemp3.h enigma2-nightly.patched/lib/service/servicemp3.h
  8518. --- enigma2-nightly.org/lib/service/servicemp3.h    2013-08-11 08:11:19.342306128 +0200
  8519. +++ enigma2-nightly.patched/lib/service/servicemp3.h    2013-10-26 03:02:27.273604784 +0200
  8520. @@ -6,7 +6,18 @@
  8521.  #include <lib/dvb/pmt.h>
  8522.  #include <lib/dvb/subtitle.h>
  8523.  #include <lib/dvb/teletext.h>
  8524. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8525.  #include <gst/gst.h>
  8526. +#else
  8527. +#include <libeplayer3/include/common.h>
  8528. +#include <libeplayer3/include/subtitle.h>
  8529. +#define gint int
  8530. +#define gint64 int64_t
  8531. +extern OutputHandler_t     OutputHandler;
  8532. +extern PlaybackHandler_t   PlaybackHandler;
  8533. +extern ContainerHandler_t  ContainerHandler;
  8534. +extern ManagerHandler_t    ManagerHandler;
  8535. +#endif
  8536.  /* for subtitles */
  8537.  #include <lib/gui/esubtitle.h>
  8538.  
  8539. @@ -67,7 +78,9 @@
  8540.     DECLARE_REF(eServiceMP3InfoContainer);
  8541.  
  8542.     double doubleValue;
  8543. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8544.     GstBuffer *bufferValue;
  8545. +#endif
  8546.  
  8547.     unsigned char *bufferData;
  8548.     unsigned int bufferSize;
  8549. @@ -83,10 +96,14 @@
  8550.     unsigned char *getBuffer(unsigned int &size) const;
  8551.  
  8552.     void setDouble(double value);
  8553. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8554.     void setBuffer(GstBuffer *buffer);
  8555. +#endif
  8556.  };
  8557.  
  8558. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8559.  typedef struct _GstElement GstElement;
  8560. +#endif
  8561.  
  8562.  typedef enum { atUnknown, atMPEG, atMP3, atAC3, atDTS, atAAC, atPCM, atOGG, atFLAC, atWMA } audiotype_t;
  8563.  typedef enum { stUnknown, stPlainText, stSSA, stASS, stSRT, stVOB, stPGS } subtype_t;
  8564. @@ -144,7 +161,9 @@
  8565.     RESULT getName(std::string &name);
  8566.     int getInfo(int w);
  8567.     std::string getInfoString(int w);
  8568. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8569.     ePtr<iServiceInfoContainer> getInfoObject(int w);
  8570. +#endif
  8571.  
  8572.         // iAudioTrackSelection
  8573.     int getNumberOfTracks();
  8574. @@ -173,6 +192,7 @@
  8575.     void setAC3Delay(int);
  8576.     void setPCMDelay(int);
  8577.  
  8578. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8579.     struct audioStream
  8580.     {
  8581.         GstPad* pad;
  8582. @@ -205,6 +225,38 @@
  8583.         {
  8584.         }
  8585.     };
  8586. +#else
  8587. +   struct audioStream
  8588. +   {
  8589. +       audiotype_t type;
  8590. +       std::string language_code; /* iso-639, if available. */
  8591. +       std::string codec; /* clear text codec description */
  8592. +       audioStream()
  8593. +           :type(atUnknown)
  8594. +       {
  8595. +       }
  8596. +   };
  8597. +   struct subtitleStream
  8598. +   {
  8599. +       subtype_t type;
  8600. +       std::string language_code; /* iso-639, if available. */
  8601. +       int id;
  8602. +       subtitleStream()
  8603. +       {
  8604. +       }
  8605. +   };
  8606. +   struct sourceStream
  8607. +   {
  8608. +       audiotype_t audiotype;
  8609. +       containertype_t containertype;
  8610. +       bool is_video;
  8611. +       bool is_streaming;
  8612. +       sourceStream()
  8613. +           :audiotype(atUnknown), containertype(ctNone), is_video(false), is_streaming(false)
  8614. +       {
  8615. +       }
  8616. +   };
  8617. +#endif
  8618.     struct bufferInfo
  8619.     {
  8620.         gint bufferPercent;
  8621. @@ -232,13 +284,19 @@
  8622.     std::vector<audioStream> m_audioStreams;
  8623.     std::vector<subtitleStream> m_subtitleStreams;
  8624.     iSubtitleUser *m_subtitle_widget;
  8625. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8626.     gdouble m_currentTrickRatio;
  8627. +#else
  8628. +   int m_currentTrickRatio;
  8629. +#endif
  8630.     friend class eServiceFactoryMP3;
  8631.     eServiceReference m_ref;
  8632.     int m_buffer_size;
  8633. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8634.     int m_ignore_buffering_messages;
  8635.     bool m_is_live;
  8636.     bool m_use_prefillbuffer;
  8637. +#endif
  8638.     bufferInfo m_bufferInfo;
  8639.     errorInfo m_errorInfo;
  8640.     std::string m_download_buffer_path;
  8641. @@ -249,6 +307,7 @@
  8642.         stIdle, stRunning, stStopped,
  8643.     };
  8644.     int m_state;
  8645. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8646.     GstElement *m_gst_playbin, *audioSink, *videoSink;
  8647.     GstTagList *m_stream_tags;
  8648.  
  8649. @@ -293,6 +352,22 @@
  8650.     static void playbinNotifySource(GObject *object, GParamSpec *unused, gpointer user_data);
  8651.     static gint match_sinktype(GstElement *element, gpointer type);
  8652.     static void handleElementAdded(GstBin *bin, GstElement *element, gpointer user_data);
  8653. +#else
  8654. +   Context_t * player;
  8655. +
  8656. +   struct Message
  8657. +   {
  8658. +       Message()
  8659. +           :type(-1)
  8660. +       {}
  8661. +       Message(int type)
  8662. +           :type(type)
  8663. +       {}
  8664. +       int type;
  8665. +   };
  8666. +   eFixedMessagePump<Message> m_pump;
  8667. +   static void eplayerCBsubtitleAvail(long int duration_ns, size_t len, char * buffer, void* user_data);
  8668. +#endif
  8669.  
  8670.     struct subtitle_page_t
  8671.     {
  8672. @@ -316,17 +391,23 @@
  8673.     int m_decoder_time_valid_state;
  8674.  
  8675.     void pushSubtitles();
  8676. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8677.     void pullSubtitle(GstBuffer *buffer);
  8678. +#endif
  8679.     void sourceTimeout();
  8680.     sourceStream m_sourceinfo;
  8681. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8682.     gulong m_subs_to_pull_handler_id;
  8683. +#endif
  8684.  
  8685.     RESULT seekToImpl(pts_t to);
  8686.  
  8687.     gint m_aspect, m_width, m_height, m_framerate, m_progressive;
  8688.     std::string m_useragent;
  8689. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8690.     std::string m_extra_headers;
  8691.     RESULT trickSeek(gdouble ratio);
  8692. +#endif
  8693.  };
  8694.  
  8695.  #endif
  8696. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/m4/ax_python_devel.m4 enigma2-nightly.patched/m4/ax_python_devel.m4
  8697. --- enigma2-nightly.org/m4/ax_python_devel.m4   2013-08-11 08:11:19.346306128 +0200
  8698. +++ enigma2-nightly.patched/m4/ax_python_devel.m4   2013-10-26 03:02:27.273604784 +0200
  8699. @@ -154,7 +154,7 @@
  8700.         python_path=`$PYTHON -c "import distutils.sysconfig; \
  8701.             print (distutils.sysconfig.get_python_inc ());"`
  8702.         if test -n "${python_path}"; then
  8703. -           python_path="-I$python_path"
  8704. +           python_path="-I$PY_PATH/include/python$PYTHON_VERSION"
  8705.         fi
  8706.         PYTHON_CPPFLAGS=$python_path
  8707.     fi
  8708. @@ -235,7 +235,8 @@
  8709.               "from distutils.sysconfig import get_python_lib as f; \
  8710.               import os; \
  8711.               print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
  8712. -           PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
  8713. +           PYTHON_LDFLAGS="-L$PY_PATH/include/python$PYTHON_VERSION -lpython$ac_python_version"
  8714. +#          PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
  8715.         fi
  8716.  
  8717.         if test -z "PYTHON_LDFLAGS"; then
  8718. @@ -253,8 +254,9 @@
  8719.     #
  8720.     AC_MSG_CHECKING([for Python site-packages path])
  8721.     if test -z "$PYTHON_SITE_PKG"; then
  8722. -       PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
  8723. -           print (distutils.sysconfig.get_python_lib(0,0));"`
  8724. +       PYTHON_SITE_PKG="$PY_PATH/lib/python$PYTHON_VERSION/site-packages"
  8725. +#      PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
  8726. +#          print (distutils.sysconfig.get_python_lib(0,0));"`
  8727.     fi
  8728.     AC_MSG_RESULT([$PYTHON_SITE_PKG])
  8729.     AC_SUBST([PYTHON_SITE_PKG])
  8730. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/main/bsod.cpp enigma2-nightly.patched/main/bsod.cpp
  8731. --- enigma2-nightly.org/main/bsod.cpp   2013-08-11 08:11:19.346306128 +0200
  8732. +++ enigma2-nightly.patched/main/bsod.cpp   2013-10-26 03:02:27.273604784 +0200
  8733. @@ -17,8 +17,11 @@
  8734.  #include "version_info.h"
  8735.  
  8736.  /************************************************/
  8737. -
  8738. +#if defined(__sh__) // dont send mails to dm
  8739. +#define CRASH_EMAILADDR "somebody who cares"
  8740. +#else
  8741.  #define CRASH_EMAILADDR "forum at www.openpli.org"
  8742. +#endif
  8743.  #define INFOFILE "/maintainer.info"
  8744.  
  8745.  #define RINGBUFFER_SIZE 16384
  8746. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/main/enigma.cpp enigma2-nightly.patched/main/enigma.cpp
  8747. --- enigma2-nightly.org/main/enigma.cpp 2013-08-11 08:11:19.346306128 +0200
  8748. +++ enigma2-nightly.patched/main/enigma.cpp 2013-10-26 03:02:27.273604784 +0200
  8749. @@ -29,10 +29,15 @@
  8750.  #include <lib/python/python.h>
  8751.  #include <lib/python/pythonconfig.h>
  8752.  
  8753. +#if defined(__sh__) // vfd class
  8754. +#include <lib/driver/vfd.h>
  8755. +#endif
  8756.  #include "bsod.h"
  8757.  #include "version_info.h"
  8758.  
  8759. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8760.  #include <gst/gst.h>
  8761. +#endif
  8762.  
  8763.  #ifdef OBJECT_DEBUG
  8764.  int object_total_remaining;
  8765. @@ -135,7 +140,9 @@
  8766.     atexit(object_dump);
  8767.  #endif
  8768.  
  8769. +#ifdef ENABLE_MEDIAFWGSTREAMER
  8770.     gst_init(&argc, &argv);
  8771. +#endif
  8772.  
  8773.     // set pythonpath if unset
  8774.     setenv("PYTHONPATH", eEnv::resolve("${libdir}/enigma2/python").c_str(), 0);
  8775. @@ -168,7 +175,11 @@
  8776.     eWidgetDesktop dsk_lcd(my_lcd_dc->size());
  8777.  
  8778.     dsk.setStyleID(0);
  8779. +#ifdef HAVE_GRAPHLCD
  8780. +   dsk_lcd.setStyleID(my_lcd_dc->size().width() == 320 ? 1 : 2);
  8781. +#else
  8782.     dsk_lcd.setStyleID(my_lcd_dc->size().width() == 96 ? 2 : 1);
  8783. +#endif
  8784.  
  8785.  /* if (double_buffer)
  8786.     {
  8787. @@ -222,6 +233,12 @@
  8788.     gRC::getInstance()->setSpinnerDC(my_dc);
  8789.  
  8790.     eRCInput::getInstance()->keyEvent.connect(slot(keyEvent));
  8791. +
  8792. +#if defined(__sh__) // initialise the vfd class
  8793. +   evfd * vfd = new evfd;
  8794. +   vfd->init();
  8795. +   delete vfd;
  8796. +#endif
  8797.    
  8798.     printf("executing main\n");
  8799.    
  8800. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/main/Makefile.am enigma2-nightly.patched/main/Makefile.am
  8801. --- enigma2-nightly.org/main/Makefile.am    2013-08-11 08:11:19.346306128 +0200
  8802. +++ enigma2-nightly.patched/main/Makefile.am    2013-10-26 03:02:27.273604784 +0200
  8803. @@ -9,6 +9,8 @@
  8804.  
  8805.  bin_PROGRAMS = enigma2
  8806.  
  8807. +installdir = $(targetprefix)/usr/local/bin
  8808. +
  8809.  enigma2_SOURCES = \
  8810.     bsod.cpp \
  8811.     bsod.h \
  8812. @@ -51,7 +53,17 @@
  8813.     @PTHREAD_LIBS@ \
  8814.     @PYTHON_LDFLAGS@ \
  8815.     @LIBDDVD_LIBS@ \
  8816. -   -ltuxtxt -ltuxtxt32bpp -lcrypt -lrt
  8817. +   -ltuxtxt -ltuxtxt32bpp -lcrypt -lrt \
  8818. +   -ldl -lpthread -lcrypt -lresolv -lmmeimage
  8819. +
  8820. +if ENABLE_LIBEPLAYER3
  8821. +enigma2_LDADD += \
  8822. +   -leplayer3
  8823. +endif
  8824. +
  8825. +if HAVE_GRAPHLCD
  8826. +enigma2_LDADD += -lglcddrivers -lglcdgraphics -lglcdskin
  8827. +endif
  8828.  
  8829.  enigma2_LDFLAGS = -Wl,--export-dynamic
  8830.  
  8831. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/mytest.py enigma2-nightly.patched/mytest.py
  8832. --- enigma2-nightly.org/mytest.py   2013-08-11 08:11:19.346306128 +0200
  8833. +++ enigma2-nightly.patched/mytest.py   2013-10-26 03:02:27.277604784 +0200
  8834. @@ -301,6 +301,10 @@
  8835.  
  8836.         self.pushCurrent()
  8837.         dlg = self.current_dialog = self.instantiateDialog(screen, *arguments, **kwargs)
  8838. +
  8839. +       if dlg is None:
  8840. +           return
  8841. +
  8842.         dlg.isTmp = True
  8843.         dlg.callback = None
  8844.         self.execBegin()
  8845. @@ -509,10 +513,10 @@
  8846.     if wakeupList:
  8847.         from time import strftime
  8848.         startTime = wakeupList[0]
  8849. -       if (startTime[0] - nowTime) < 270: # no time to switch box back on
  8850. +       if (startTime[0] - nowTime) < 330: # no time to switch box back on
  8851.             wptime = nowTime + 30  # so switch back on in 30 seconds
  8852.         else:
  8853. -           wptime = startTime[0] - 240
  8854. +           wptime = startTime[0] - 300
  8855.         if not config.misc.useTransponderTime.value:
  8856.             print "dvb time sync disabled... so set RTC now to current linux time!", strftime("%Y/%m/%d %H:%M", localtime(nowTime))
  8857.             setRTCtime(nowTime)
  8858. diff -Nur '--exclude=.git' '--exclude=tuxtxt' enigma2-nightly.org/skin.py enigma2-nightly.patched/skin.py
  8859. --- enigma2-nightly.org/skin.py 2013-08-11 08:11:19.626306121 +0200
  8860. +++ enigma2-nightly.patched/skin.py 2013-10-26 03:02:27.277604784 +0200
  8861. @@ -68,7 +68,7 @@
  8862.  
  8863.  # example: loadSkin("nemesis_greenline/skin.xml")
  8864.  config.skin = ConfigSubsection()
  8865. -DEFAULT_SKIN = "PLi-HD/skin.xml"
  8866. +DEFAULT_SKIN = "Nobile/skin.xml"
  8867.  # on SD hardware, PLi-HD will not be available
  8868.  if not fileExists(resolveFilename(SCOPE_SKIN, DEFAULT_SKIN)):
  8869.     # in that case, fallback to Magic (which is an SD skin)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement