Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/lib/libtuxtxt/teletext.h b/lib/libtuxtxt/teletext.h
- index 871fde9..c1a45bf 100644
- --- a/lib/libtuxtxt/teletext.h
- +++ b/lib/libtuxtxt/teletext.h
- @@ -6,11 +6,7 @@ int tuxtxt_init();
- void tuxtxt_close();
- void tuxtxt_start(int tpid, int source = 0); // Start caching
- int tuxtxt_stop(); // Stop caching
- -#if HAVE_SPARK_HARDWARE
- -int tuxtx_main(int pid, int page = 0, int source = 0, bool _isEplayer = false);
- -#else
- int tuxtx_main(int pid, int page = 0, int source = 0);
- -#endif
- void tuxtx_stop_subtitle();
- int tuxtx_subtitle_running(int *pid, int *page, int *running);
- void tuxtx_pause_subtitle(bool pause = 1);
- diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp
- index 839386d..11ef46e 100644
- --- a/lib/libtuxtxt/tuxtxt.cpp
- +++ b/lib/libtuxtxt/tuxtxt.cpp
- @@ -39,9 +39,6 @@ static int ttx_req_pause;
- static int sub_pid, sub_page;
- static bool use_gui;
- static int cfg_national_subset;
- -#if HAVE_SPARK_HARDWARE
- -bool isTtxEplayer = false;
- -#endif
- static int screen_x, screen_y, screen_w, screen_h;
- @@ -1537,11 +1534,7 @@ void tuxtx_pause_subtitle(bool pause)
- //printf("TuxTxt subtitle unpause, running %d pid %d page %d\n", reader_running, sub_pid, sub_page);
- ttx_paused = 0;
- if(!reader_running && sub_pid && sub_page)
- -#if HAVE_SPARK_HARDWARE
- - tuxtx_main(sub_pid, sub_page, 0, isTtxEplayer);
- -#else
- tuxtx_main(sub_pid, sub_page);
- -#endif
- }
- else {
- if(!reader_running)
- @@ -1599,21 +1592,10 @@ int tuxtx_subtitle_running(int *pid, int *page, int *running)
- return ret;
- }
- -#if HAVE_SPARK_HARDWARE
- -int tuxtx_main(int pid, int page, int source, bool isEplayer)
- -#else
- int tuxtx_main(int pid, int page, int source)
- -#endif
- {
- char cvs_revision[] = "$Revision: 1.95 $";
- -#if HAVE_SPARK_HARDWARE
- - if (isTtxEplayer != isEplayer) {
- - tuxtxt_stop();
- - tuxtxt_clear_cache();
- - isTtxEplayer = isEplayer;
- - }
- -#endif
- use_gui = 1;
- boxed = 0;
- oldboxed = boxed;
- @@ -1862,9 +1844,6 @@ int tuxtx_main(int pid, int page, int source)
- if ( initialized )
- tuxtxt_close();
- #endif
- -#if HAVE_SPARK_HARDWARE
- - fbp->setBorderColor(old_border_color);
- -#endif
- printf("Tuxtxt: plugin ended\n");
- return 1;
- @@ -2322,10 +2301,6 @@ static void CleanUp()
- ******************************************************************************/
- static int GetTeletextPIDs()
- {
- -#if HAVE_SPARK_HARDWARE
- - if (isTtxEplayer)
- - return 0;
- -#endif
- int pat_scan, pmt_scan, sdt_scan, desc_scan, pid_test, byte, diff, first_sdt_sec;
- unsigned char bufPAT[1024];
- @@ -5642,7 +5617,6 @@ static void CopyBB2FB()
- if (!zoommode[boxed])
- {
- #if HAVE_SPARK_HARDWARE
- - f->setBorderColor(argb[fillcolor]);
- f->blitBPA2FB((unsigned char *)lbb, SURF_ARGB8888, var_screeninfo.xres, var_screeninfo.yres,
- 0, 0, -1, -1,
- -1, -1, -1, -1, true);
- diff --git a/lib/libtuxtxt/tuxtxt_common.h b/lib/libtuxtxt/tuxtxt_common.h
- index 718da95..895b696 100644
- --- a/lib/libtuxtxt/tuxtxt_common.h
- +++ b/lib/libtuxtxt/tuxtxt_common.h
- @@ -9,7 +9,6 @@
- #include <string.h>
- #include <ctype.h>
- #include <unistd.h>
- -#include <semaphore.h>
- #include <time.h>
- #if TUXTXT_COMPRESS == 1
- #include <zlib.h>
- @@ -571,101 +570,9 @@ void tuxtxt_allocate_cache(int magazine)
- pthread_mutex_unlock(&tuxtxt_cache_lock);
- }
- -#if HAVE_SPARK_HARDWARE
- -/******************************************************************************
- - * Handling of packets injected by libeplayer3 *
- - ******************************************************************************/
- -
- -struct injected_page
- -{
- - uint8_t *data;
- - int size;
- - injected_page() : data(NULL){};
- -};
- -
- -#define INJECT_QUEUE_LIMIT 64
- -static struct injected_page inject_queue[INJECT_QUEUE_LIMIT];
- -static int inject_queue_index_read = 0;
- -static int inject_queue_index_write = 0;
- -static pthread_mutex_t inject_mutex = PTHREAD_MUTEX_INITIALIZER;
- -static sem_t inject_sem;
- -static int last_injected_pid = -1;
- -
- -static void clear_inject_queue(void)
- -{
- - pthread_mutex_lock(&inject_mutex);
- - while (!sem_trywait(&inject_sem)) {
- - if (inject_queue[inject_queue_index_read].data) {
- - free(inject_queue[inject_queue_index_read].data);
- - inject_queue[inject_queue_index_read].data = NULL;
- - }
- - inject_queue_index_read++;
- - inject_queue_index_read %= INJECT_QUEUE_LIMIT;
- - }
- - pthread_mutex_unlock(&inject_mutex);
- -}
- -
- -void teletext_write(int pid, uint8_t *data, int size)
- -{
- - if (last_injected_pid != pid) {
- - clear_inject_queue();
- - last_injected_pid = pid;
- - }
- - bool do_sem_post = true;
- - pthread_mutex_lock(&inject_mutex);
- - if (inject_queue[inject_queue_index_write].data && inject_queue[inject_queue_index_write].size != size) {
- - free(inject_queue[inject_queue_index_write].data);
- - do_sem_post = false;
- - }
- - if (!inject_queue[inject_queue_index_write].data) {
- - inject_queue[inject_queue_index_write].data = (uint8_t *) malloc(size);
- - inject_queue[inject_queue_index_write].size = size;
- - }
- - if (inject_queue[inject_queue_index_write].data) {
- - memcpy(inject_queue[inject_queue_index_write].data, data, size);
- - inject_queue_index_write++;
- - inject_queue_index_write %= INJECT_QUEUE_LIMIT;
- - if (do_sem_post)
- - sem_post(&inject_sem);
- - }
- - pthread_mutex_unlock(&inject_mutex);
- -}
- -
- -static bool read_injected_packet(unsigned char * &packet, int &size, int timeout_in_ms)
- -{
- - struct timespec ts;
- - clock_gettime(CLOCK_REALTIME, &ts);
- - ts.tv_nsec += timeout_in_ms * 1000000;
- - if (ts.tv_nsec > 999999999) {
- - ts.tv_sec++;
- - ts.tv_nsec -= 1000000000;
- - }
- - bool res = !sem_timedwait(&inject_sem, &ts);
- - if (res) {
- - pthread_mutex_lock(&inject_mutex);
- - packet = inject_queue[inject_queue_index_read].data;
- - if (packet) {
- - size = inject_queue[inject_queue_index_read].size;
- - inject_queue[inject_queue_index_read].data = NULL;
- - inject_queue_index_read++;
- - inject_queue_index_read %= INJECT_QUEUE_LIMIT;
- - }
- - else
- - res = false;
- - pthread_mutex_unlock(&inject_mutex);
- - } else
- - packet = NULL;
- -
- - return res;
- -}
- -#endif
- -
- /******************************************************************************
- * CacheThread *
- ******************************************************************************/
- -#if HAVE_SPARK_HARDWARE
- -extern bool isTtxEplayer;
- -#endif
- static int stop_cache = 0;
- void *tuxtxt_CacheThread(void * /*arg*/)
- {
- @@ -680,9 +587,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
- 0x30,0xb0,0x70,0xf0 };
- unsigned char pes_packet_dmx[184*20];
- unsigned char *pes_packet_ptr = NULL;
- -#if HAVE_SPARK_HARDWARE
- - unsigned char *pes_packet_eplayer3 = NULL;
- -#endif
- unsigned char vtxt_row[42];
- int line, byte/*, bit*/;
- int b1, b2, b3, b4;
- @@ -692,9 +596,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
- unsigned char pagedata[9][23*40];
- tstPageinfo *pageinfo_thread;
- -#if HAVE_SPARK_HARDWARE
- - sem_init(&inject_sem, 0, 0);
- -#endif
- set_threadname("tuxtxt:cache");
- printf("TuxTxt running thread...(%04x)\n",tuxtxt_cache.vtxtpid);
- tuxtxt_cache.receiving = 1;
- @@ -710,20 +611,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
- /* read packet */
- ssize_t readcnt = 0;
- -#if HAVE_SPARK_HARDWARE
- - if (isTtxEplayer) {
- - pes_packet_ptr = NULL;
- - if (pes_packet_eplayer3) {
- - free(pes_packet_eplayer3);
- - pes_packet_eplayer3 = NULL;
- - }
- - if (!read_injected_packet(pes_packet_eplayer3, readcnt, 1000))
- - continue;
- - pes_packet_ptr = pes_packet_eplayer3;
- - }
- - else
- -#endif
- - {
- readcnt = dmx->Read(pes_packet_dmx, sizeof(pes_packet_dmx), 1000);
- pes_packet_ptr = pes_packet_dmx;
- if ((readcnt <= 0) || (readcnt % 184))
- @@ -734,7 +621,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
- #endif
- continue;
- }
- - }
- /* this "big hammer lock" is a hack: it avoids a crash if
- * tuxtxt_clear_cache() is called while the cache thread is in the
- @@ -1188,10 +1074,6 @@ void *tuxtxt_CacheThread(void * /*arg*/)
- }
- pthread_mutex_unlock(&tuxtxt_cache_biglock);
- }
- -#if HAVE_SPARK_HARDWARE
- - if (pes_packet_eplayer3)
- - free(pes_packet_eplayer3);
- -#endif
- pthread_exit(NULL);
- }
- @@ -1205,16 +1087,11 @@ int tuxtxt_start_thread(int source)
- return 0;
- tuxtxt_cache.thread_starting = 1;
- -#if HAVE_SPARK_HARDWARE
- - if (!isTtxEplayer) {
- -#endif
- tuxtxt_init_demuxer(source);
- dmx->pesFilter(tuxtxt_cache.vtxtpid);
- dmx->Start();
- -#if HAVE_SPARK_HARDWARE
- - }
- -#endif
- +
- stop_cache = 0;
- /* create decode-thread */
- @@ -1260,9 +1137,6 @@ int tuxtxt_stop_thread()
- delete dmx;
- dmx = NULL;
- }
- -#if HAVE_SPARK_HARDWARE
- - clear_inject_queue();
- -#endif
- #if 1//TUXTXT_DEBUG
- printf("TuxTxt stopped service %x\n", tuxtxt_cache.vtxtpid);
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement