Advertisement
svenhoefer

Untitled

Jan 24th, 2018
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 8.72 KB | None | 0 0
  1. diff --git a/lib/libtuxtxt/teletext.h b/lib/libtuxtxt/teletext.h
  2. index 871fde9..c1a45bf 100644
  3. --- a/lib/libtuxtxt/teletext.h
  4. +++ b/lib/libtuxtxt/teletext.h
  5. @@ -6,11 +6,7 @@ int tuxtxt_init();
  6.  void tuxtxt_close();
  7.  void tuxtxt_start(int tpid, int source = 0);  // Start caching
  8.  int  tuxtxt_stop(); // Stop caching
  9. -#if HAVE_SPARK_HARDWARE
  10. -int tuxtx_main(int pid, int page = 0, int source = 0, bool _isEplayer = false);
  11. -#else
  12.  int tuxtx_main(int pid, int page = 0, int source = 0);
  13. -#endif
  14.  void tuxtx_stop_subtitle();
  15.  int tuxtx_subtitle_running(int *pid, int *page, int *running);
  16.  void tuxtx_pause_subtitle(bool pause = 1);
  17. diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp
  18. index 839386d..11ef46e 100644
  19. --- a/lib/libtuxtxt/tuxtxt.cpp
  20. +++ b/lib/libtuxtxt/tuxtxt.cpp
  21. @@ -39,9 +39,6 @@ static int ttx_req_pause;
  22.  static int sub_pid, sub_page;
  23.  static bool use_gui;
  24.  static int cfg_national_subset;
  25. -#if HAVE_SPARK_HARDWARE
  26. -bool isTtxEplayer = false;
  27. -#endif
  28.  
  29.  static int screen_x, screen_y, screen_w, screen_h;
  30.  
  31. @@ -1537,11 +1534,7 @@ void tuxtx_pause_subtitle(bool pause)
  32.         //printf("TuxTxt subtitle unpause, running %d pid %d page %d\n", reader_running, sub_pid, sub_page);
  33.         ttx_paused = 0;
  34.         if(!reader_running && sub_pid && sub_page)
  35. -#if HAVE_SPARK_HARDWARE
  36. -           tuxtx_main(sub_pid, sub_page, 0, isTtxEplayer);
  37. -#else
  38.             tuxtx_main(sub_pid, sub_page);
  39. -#endif
  40.     }
  41.     else {
  42.         if(!reader_running)
  43. @@ -1599,21 +1592,10 @@ int tuxtx_subtitle_running(int *pid, int *page, int *running)
  44.     return ret;
  45.  }
  46.  
  47. -#if HAVE_SPARK_HARDWARE
  48. -int tuxtx_main(int pid, int page, int source, bool isEplayer)
  49. -#else
  50.  int tuxtx_main(int pid, int page, int source)
  51. -#endif
  52.  {
  53.     char cvs_revision[] = "$Revision: 1.95 $";
  54.  
  55. -#if HAVE_SPARK_HARDWARE
  56. -   if (isTtxEplayer != isEplayer) {
  57. -       tuxtxt_stop();
  58. -       tuxtxt_clear_cache();
  59. -       isTtxEplayer = isEplayer;
  60. -   }
  61. -#endif
  62.     use_gui = 1;
  63.     boxed = 0;
  64.     oldboxed = boxed;
  65. @@ -1862,9 +1844,6 @@ int tuxtx_main(int pid, int page, int source)
  66.     if ( initialized )
  67.         tuxtxt_close();
  68.  #endif
  69. -#if HAVE_SPARK_HARDWARE
  70. -   fbp->setBorderColor(old_border_color);
  71. -#endif
  72.  
  73.     printf("Tuxtxt: plugin ended\n");
  74.     return 1;
  75. @@ -2322,10 +2301,6 @@ static void CleanUp()
  76.   ******************************************************************************/
  77.  static int GetTeletextPIDs()
  78.  {
  79. -#if HAVE_SPARK_HARDWARE
  80. -   if (isTtxEplayer)
  81. -       return 0;
  82. -#endif
  83.     int pat_scan, pmt_scan, sdt_scan, desc_scan, pid_test, byte, diff, first_sdt_sec;
  84.  
  85.     unsigned char bufPAT[1024];
  86. @@ -5642,7 +5617,6 @@ static void CopyBB2FB()
  87.     if (!zoommode[boxed])
  88.     {
  89.  #if HAVE_SPARK_HARDWARE
  90. -       f->setBorderColor(argb[fillcolor]);
  91.         f->blitBPA2FB((unsigned char *)lbb, SURF_ARGB8888, var_screeninfo.xres, var_screeninfo.yres,
  92.             0, 0, -1, -1,
  93.             -1, -1, -1, -1, true);
  94. diff --git a/lib/libtuxtxt/tuxtxt_common.h b/lib/libtuxtxt/tuxtxt_common.h
  95. index 718da95..895b696 100644
  96. --- a/lib/libtuxtxt/tuxtxt_common.h
  97. +++ b/lib/libtuxtxt/tuxtxt_common.h
  98. @@ -9,7 +9,6 @@
  99.  #include <string.h>
  100.  #include <ctype.h>
  101.  #include <unistd.h>
  102. -#include <semaphore.h>
  103.  #include <time.h>
  104.  #if TUXTXT_COMPRESS == 1
  105.  #include <zlib.h>
  106. @@ -571,101 +570,9 @@ void tuxtxt_allocate_cache(int magazine)
  107.     pthread_mutex_unlock(&tuxtxt_cache_lock);
  108.  }
  109.  
  110. -#if HAVE_SPARK_HARDWARE
  111. -/******************************************************************************
  112. - * Handling of packets injected by libeplayer3                                *
  113. - ******************************************************************************/
  114. -
  115. -struct injected_page
  116. -{
  117. -   uint8_t *data;
  118. -   int size;
  119. -   injected_page() : data(NULL){};
  120. -};
  121. -
  122. -#define INJECT_QUEUE_LIMIT 64
  123. -static struct injected_page inject_queue[INJECT_QUEUE_LIMIT];
  124. -static int inject_queue_index_read = 0;
  125. -static int inject_queue_index_write = 0;
  126. -static pthread_mutex_t inject_mutex = PTHREAD_MUTEX_INITIALIZER;
  127. -static sem_t inject_sem;
  128. -static int last_injected_pid = -1;
  129. -
  130. -static void clear_inject_queue(void)
  131. -{
  132. -   pthread_mutex_lock(&inject_mutex);
  133. -   while (!sem_trywait(&inject_sem)) {
  134. -       if (inject_queue[inject_queue_index_read].data) {
  135. -           free(inject_queue[inject_queue_index_read].data);
  136. -           inject_queue[inject_queue_index_read].data = NULL;
  137. -       }
  138. -       inject_queue_index_read++;
  139. -       inject_queue_index_read %= INJECT_QUEUE_LIMIT;
  140. -   }
  141. -   pthread_mutex_unlock(&inject_mutex);
  142. -}
  143. -
  144. -void teletext_write(int pid, uint8_t *data, int size)
  145. -{
  146. -   if (last_injected_pid != pid) {
  147. -       clear_inject_queue();
  148. -       last_injected_pid = pid;
  149. -   }
  150. -   bool do_sem_post = true;
  151. -   pthread_mutex_lock(&inject_mutex);
  152. -   if (inject_queue[inject_queue_index_write].data && inject_queue[inject_queue_index_write].size != size) {
  153. -       free(inject_queue[inject_queue_index_write].data);
  154. -       do_sem_post = false;
  155. -   }
  156. -   if (!inject_queue[inject_queue_index_write].data) {
  157. -       inject_queue[inject_queue_index_write].data = (uint8_t *) malloc(size);
  158. -       inject_queue[inject_queue_index_write].size = size;
  159. -   }
  160. -   if (inject_queue[inject_queue_index_write].data) {
  161. -       memcpy(inject_queue[inject_queue_index_write].data, data, size);
  162. -       inject_queue_index_write++;
  163. -       inject_queue_index_write %= INJECT_QUEUE_LIMIT;
  164. -       if (do_sem_post)
  165. -           sem_post(&inject_sem);
  166. -   }
  167. -   pthread_mutex_unlock(&inject_mutex);
  168. -}
  169. -
  170. -static bool read_injected_packet(unsigned char * &packet, int &size, int timeout_in_ms)
  171. -{
  172. -   struct timespec ts;
  173. -   clock_gettime(CLOCK_REALTIME, &ts);
  174. -   ts.tv_nsec += timeout_in_ms * 1000000;
  175. -   if (ts.tv_nsec > 999999999) {
  176. -       ts.tv_sec++;
  177. -       ts.tv_nsec -= 1000000000;
  178. -   }
  179. -   bool res = !sem_timedwait(&inject_sem, &ts);
  180. -   if (res) {
  181. -       pthread_mutex_lock(&inject_mutex);
  182. -       packet = inject_queue[inject_queue_index_read].data;
  183. -       if (packet) {
  184. -           size = inject_queue[inject_queue_index_read].size;
  185. -           inject_queue[inject_queue_index_read].data = NULL;
  186. -           inject_queue_index_read++;
  187. -           inject_queue_index_read %= INJECT_QUEUE_LIMIT;
  188. -       }
  189. -       else
  190. -           res = false;
  191. -       pthread_mutex_unlock(&inject_mutex);
  192. -   } else
  193. -       packet = NULL;
  194. -
  195. -   return res;
  196. -}
  197. -#endif
  198. -
  199.  /******************************************************************************
  200.   * CacheThread                                                                *
  201.   ******************************************************************************/
  202. -#if HAVE_SPARK_HARDWARE
  203. -extern bool isTtxEplayer;
  204. -#endif
  205.  static int stop_cache = 0;
  206.  void *tuxtxt_CacheThread(void * /*arg*/)
  207.  {
  208. @@ -680,9 +587,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
  209.         0x30,0xb0,0x70,0xf0 };
  210.     unsigned char pes_packet_dmx[184*20];
  211.     unsigned char *pes_packet_ptr = NULL;
  212. -#if HAVE_SPARK_HARDWARE
  213. -   unsigned char *pes_packet_eplayer3 = NULL;
  214. -#endif
  215.     unsigned char vtxt_row[42];
  216.     int line, byte/*, bit*/;
  217.     int b1, b2, b3, b4;
  218. @@ -692,9 +596,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
  219.     unsigned char pagedata[9][23*40];
  220.     tstPageinfo *pageinfo_thread;
  221.  
  222. -#if HAVE_SPARK_HARDWARE
  223. -   sem_init(&inject_sem, 0, 0);
  224. -#endif
  225.     set_threadname("tuxtxt:cache");
  226.     printf("TuxTxt running thread...(%04x)\n",tuxtxt_cache.vtxtpid);
  227.     tuxtxt_cache.receiving = 1;
  228. @@ -710,20 +611,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
  229.         /* read packet */
  230.         ssize_t readcnt = 0;
  231.  
  232. -#if HAVE_SPARK_HARDWARE
  233. -       if (isTtxEplayer) {
  234. -           pes_packet_ptr = NULL;
  235. -           if (pes_packet_eplayer3) {
  236. -               free(pes_packet_eplayer3);
  237. -               pes_packet_eplayer3 = NULL;
  238. -           }
  239. -           if (!read_injected_packet(pes_packet_eplayer3, readcnt, 1000))
  240. -               continue;
  241. -           pes_packet_ptr = pes_packet_eplayer3;
  242. -       }
  243. -       else
  244. -#endif
  245. -       {
  246.             readcnt = dmx->Read(pes_packet_dmx, sizeof(pes_packet_dmx), 1000);
  247.             pes_packet_ptr = pes_packet_dmx;
  248.             if ((readcnt <= 0) || (readcnt % 184))
  249. @@ -734,7 +621,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
  250.  #endif
  251.                 continue;
  252.             }
  253. -       }
  254.  
  255.         /* this "big hammer lock" is a hack: it avoids a crash if
  256.          * tuxtxt_clear_cache() is called while the cache thread is in the
  257. @@ -1188,10 +1074,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
  258.         }
  259.         pthread_mutex_unlock(&tuxtxt_cache_biglock);
  260.     }
  261. -#if HAVE_SPARK_HARDWARE
  262. -   if (pes_packet_eplayer3)
  263. -       free(pes_packet_eplayer3);
  264. -#endif
  265.  
  266.     pthread_exit(NULL);
  267.  }
  268. @@ -1205,16 +1087,11 @@ int tuxtxt_start_thread(int source)
  269.         return 0;
  270.  
  271.     tuxtxt_cache.thread_starting = 1;
  272. -#if HAVE_SPARK_HARDWARE
  273. -   if (!isTtxEplayer) {
  274. -#endif
  275.         tuxtxt_init_demuxer(source);
  276.  
  277.         dmx->pesFilter(tuxtxt_cache.vtxtpid);
  278.         dmx->Start();
  279. -#if HAVE_SPARK_HARDWARE
  280. -   }
  281. -#endif
  282. +
  283.     stop_cache = 0;
  284.  
  285.     /* create decode-thread */
  286. @@ -1260,9 +1137,6 @@ int tuxtxt_stop_thread()
  287.         delete dmx;
  288.         dmx = NULL;
  289.     }
  290. -#if HAVE_SPARK_HARDWARE
  291. -   clear_inject_queue();
  292. -#endif
  293.  #if 1//TUXTXT_DEBUG
  294.     printf("TuxTxt stopped service %x\n", tuxtxt_cache.vtxtpid);
  295.  #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement