mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
lib/libtuxtxt: remove not required if's with HAVE_SPARK_HARDWARE
It seems this may have come from incomplete cherry-picks, also some codepage conflicts should be solved.
This commit is contained in:
@@ -1,16 +1,11 @@
|
||||
#ifndef __teletext_h__
|
||||
#define __teletext_h__
|
||||
#include <config.h>
|
||||
|
||||
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);
|
||||
|
@@ -1533,11 +1533,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)
|
||||
@@ -1595,21 +1591,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;
|
||||
@@ -1635,9 +1620,6 @@ int tuxtx_main(int pid, int page, int source)
|
||||
CFrameBuffer *fbp = CFrameBuffer::getInstance();
|
||||
lfb = fbp->getFrameBufferPointer();
|
||||
lbb = fbp->getBackBufferPointer();
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
fb_pixel_t old_border_color = fbp->getBorderColor();
|
||||
#endif
|
||||
|
||||
tuxtxt_cache.vtxtpid = pid;
|
||||
|
||||
@@ -1847,9 +1829,6 @@ int tuxtx_main(int pid, int page, int source)
|
||||
|
||||
/* update page or timestring and lcd */
|
||||
RenderPage();
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
fbp->blit();
|
||||
#endif
|
||||
} while ((RCCode != RC_HOME) && (RCCode != RC_STANDBY));
|
||||
/* if transparent mode was selected, remember the original mode */
|
||||
screenmode[boxed] = prevscreenmode[boxed];
|
||||
@@ -1861,9 +1840,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;
|
||||
@@ -2324,10 +2300,6 @@ void CleanUp()
|
||||
******************************************************************************/
|
||||
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];
|
||||
@@ -2483,17 +2455,17 @@ skip_pid:
|
||||
//FIXME ??
|
||||
for (byte = 0; byte < pid_table[pid_test].service_name_len; byte++)
|
||||
{
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'?')
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'<EFBFBD>')
|
||||
bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] = 0x5B;
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'<EFBFBD>')
|
||||
bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] = 0x7B;
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'?')
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'<EFBFBD>')
|
||||
bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] = 0x5C;
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'<EFBFBD>')
|
||||
bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] = 0x7C;
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'?')
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'<EFBFBD>')
|
||||
bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] = 0x5D;
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'?')
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'<EFBFBD>')
|
||||
bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] = 0x7D;
|
||||
if (bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] == (unsigned char)'<EFBFBD>')
|
||||
bufSDT[sdt_scan+10 + bufSDT[sdt_scan + 8] + byte] = 0x7E;
|
||||
@@ -2816,7 +2788,6 @@ void Menu_Init(char *menu, int current_pid, int menuitem, int hotindex)
|
||||
national_subset = national_subset_bak;
|
||||
Menu_HighlightLine(menu, MenuLine[menuitem], 1);
|
||||
Menu_UpdateHotlist(menu, hotindex, menuitem);
|
||||
CFrameBuffer::getInstance()->blit();
|
||||
}
|
||||
|
||||
void ConfigMenu(int Init)
|
||||
@@ -3707,9 +3678,6 @@ void PageCatching()
|
||||
RCCode = -1;
|
||||
return;
|
||||
}
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
CopyBB2FB();
|
||||
#endif
|
||||
UpdateLCD();
|
||||
} while (RCCode != RC_OK);
|
||||
|
||||
@@ -3867,16 +3835,12 @@ void RenderCatchedPage()
|
||||
if (zoommode[boxed] == 1 && catch_row > 11)
|
||||
{
|
||||
zoommode[boxed] = 2;
|
||||
#if !HAVE_SPARK_HARDWARE
|
||||
CopyBB2FB();
|
||||
#endif
|
||||
}
|
||||
else if (zoommode[boxed] == 2 && catch_row < 12)
|
||||
{
|
||||
zoommode[boxed] = 1;
|
||||
#if !HAVE_SPARK_HARDWARE
|
||||
CopyBB2FB();
|
||||
#endif
|
||||
}
|
||||
SetPosX(catch_col);
|
||||
|
||||
@@ -3898,9 +3862,6 @@ void RenderCatchedPage()
|
||||
RenderCharFB(page_char[catch_row*40 + catch_col ], &a0);
|
||||
RenderCharFB(page_char[catch_row*40 + catch_col + 1], &a1);
|
||||
RenderCharFB(page_char[catch_row*40 + catch_col + 2], &a2);
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
CopyBB2FB();
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -5073,9 +5034,6 @@ void RenderMessage(int Message)
|
||||
for (byte = 0; byte < 38; byte++)
|
||||
RenderCharFB(message_6[byte], &atrtable[imenuatr + 2]);
|
||||
national_subset = national_subset_back;
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
CFrameBuffer::getInstance()->blit();
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
@@ -5185,9 +5143,6 @@ void DoFlashing(int startrow)
|
||||
}
|
||||
PosY += fontheight*factor;
|
||||
}
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
CopyBB2FB();
|
||||
#endif
|
||||
}
|
||||
|
||||
void RenderPage()
|
||||
@@ -5387,9 +5342,6 @@ void RenderPage()
|
||||
RenderCharFB(ns[0],&atrtable[ATR_WB]);
|
||||
RenderCharFB(ns[1],&atrtable[ATR_WB]);
|
||||
RenderCharFB(ns[2],&atrtable[ATR_WB]);
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
CopyBB2FB();
|
||||
#endif
|
||||
|
||||
tuxtxt_cache.pageupdate=0;
|
||||
}
|
||||
@@ -5631,9 +5583,6 @@ void CopyBB2FB()
|
||||
FillBorder(*lbb, true);
|
||||
// ClearBB(*(lfb + var_screeninfo.xres * var_screeninfo.yoffset));
|
||||
}
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
f->blit();
|
||||
#endif
|
||||
|
||||
if (clearbbcolor >= 0)
|
||||
{
|
||||
@@ -5716,7 +5665,6 @@ void CopyBB2FB()
|
||||
}
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
f->mark(0, 0, var_screeninfo.xres, var_screeninfo.yres);
|
||||
f->blit();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -1,16 +1,12 @@
|
||||
/* tuxtxt_common.h
|
||||
* for license info see the other tuxtxt files
|
||||
*/
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
#include <semaphore.h>
|
||||
#include <time.h>
|
||||
#if TUXTXT_COMPRESS == 1
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
@@ -571,101 +567,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*/)
|
||||
{
|
||||
@@ -678,11 +582,7 @@ void *tuxtxt_CacheThread(void * /*arg*/)
|
||||
0x20,0xa0,0x60,0xe0,
|
||||
0x10,0x90,0x50,0xd0,
|
||||
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 pes_packet[184*20];
|
||||
unsigned char vtxt_row[42];
|
||||
int line, byte/*, bit*/;
|
||||
int b1, b2, b3, b4;
|
||||
@@ -692,9 +592,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,30 +607,15 @@ 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, sizeof (pes_packet), 1000);
|
||||
//if (readcnt != sizeof(pes_packet))
|
||||
if ((readcnt <= 0) || (readcnt % 184))
|
||||
{
|
||||
readcnt = dmx->Read(pes_packet_dmx, sizeof(pes_packet_dmx), 1000);
|
||||
pes_packet_ptr = pes_packet_dmx;
|
||||
if ((readcnt <= 0) || (readcnt % 184))
|
||||
{
|
||||
#if TUXTXT_DEBUG
|
||||
if(readcnt > 0)
|
||||
printf ("TuxTxt: readerror: %d\n", readcnt);
|
||||
if(readcnt > 0)
|
||||
printf ("TuxTxt: readerror: %d\n", readcnt);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/* this "big hammer lock" is a hack: it avoids a crash if
|
||||
@@ -746,8 +628,7 @@ void *tuxtxt_CacheThread(void * /*arg*/)
|
||||
/* analyze it */
|
||||
for (line = 0; line < readcnt/0x2e /*4*/; line++)
|
||||
{
|
||||
unsigned char *vtx_rowbyte = pes_packet_ptr;
|
||||
pes_packet_ptr += 0x2e;
|
||||
unsigned char *vtx_rowbyte = &pes_packet[line*0x2e];
|
||||
if ((vtx_rowbyte[1] == 0x2C) && (vtx_rowbyte[0] == 0x02 || vtx_rowbyte[0] == 0x03))
|
||||
{
|
||||
/* clear rowbuffer */
|
||||
@@ -1188,10 +1069,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 +1082,10 @@ int tuxtxt_start_thread(int source)
|
||||
return 0;
|
||||
|
||||
tuxtxt_cache.thread_starting = 1;
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
if (!isTtxEplayer) {
|
||||
#endif
|
||||
tuxtxt_init_demuxer(source);
|
||||
tuxtxt_init_demuxer(source);
|
||||
|
||||
dmx->pesFilter(tuxtxt_cache.vtxtpid);
|
||||
dmx->Start();
|
||||
#if HAVE_SPARK_HARDWARE
|
||||
}
|
||||
#endif
|
||||
dmx->pesFilter(tuxtxt_cache.vtxtpid);
|
||||
dmx->Start();
|
||||
stop_cache = 0;
|
||||
|
||||
/* create decode-thread */
|
||||
@@ -1260,9 +1131,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
|
||||
|
Reference in New Issue
Block a user