TTX subs menu, not ready yet, just backup of current code

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@184 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
focus
2010-01-19 11:22:08 +00:00
parent 8058f2be7e
commit b554e4ef4e
15 changed files with 150 additions and 56 deletions

View File

@@ -41,8 +41,8 @@ static int dvbsub_pid;
static int dvbsub_stopped;
cDvbSubtitleConverter *dvbSubtitleConverter;
void* reader_thread(void *arg);
void* dvbsub_thread(void* arg);
static void* reader_thread(void *arg);
static void* dvbsub_thread(void* arg);
int dvbsub_init() {
int trc;
@@ -184,7 +184,7 @@ static int64_t get_pts_stc_delta(int64_t pts)
return delta;
}
void* reader_thread(void * /*arg*/)
static void* reader_thread(void * /*arg*/)
{
uint8_t tmp[16]; /* actually 6 should be enough */
int count;
@@ -277,7 +277,7 @@ void* reader_thread(void * /*arg*/)
pthread_exit(NULL);
}
void* dvbsub_thread(void* /*arg*/)
static void* dvbsub_thread(void* /*arg*/)
{
struct timespec restartWait;
struct timeval now;

9
lib/libdvbsub/dvbsub.h Normal file
View File

@@ -0,0 +1,9 @@
#ifndef _DVB_SUB_H
#define _DVB_SUB_H
int dvbsub_init();
int dvbsub_stop();
int dvbsub_close();
int dvbsub_start(int pid);
int dvbsub_pause();
int dvbsub_getpid();
#endif

12
lib/libtuxtxt/teletext.h Normal file
View File

@@ -0,0 +1,12 @@
#ifndef __teletext_h__
#define __teletext_h__
extern int tuxtxt_init();
extern void tuxtxt_close();
extern void tuxtxt_start(int tpid); // Start caching
extern int tuxtxt_stop(); // Stop caching
extern int tuxtx_main(int _rc, void * _fb, int pid, int x, int y, int w, int h, int page = 0);
void tuxtx_stop_subtitle();
int tuxtx_subtitle_running(int pid, int page);
#endif

View File

@@ -1477,15 +1477,54 @@ void eval_l25()
* main loop *
******************************************************************************/
int tuxtx_main(int _rc, void * _fb, int pid, int x, int y, int w, int h)
static int subtitle_mode;
static pthread_t ttx_sub_thread;
static int reader_running;
static void* reader_thread(void * /*arg*/)
{
printf("TuxTxt subtitle thread started\n");
reader_running = 1;
while(reader_running) {
RenderPage();
}
CleanUp();
tuxtxt_close();
printf("TuxTxt subtitle thread stopped\n");
}
void tuxtx_stop_subtitle()
{
printf("TuxTxt stopping subtitle thread ...\n");
reader_running = 0;
if(ttx_sub_thread)
pthread_join(ttx_sub_thread, NULL);
ttx_sub_thread = NULL;
}
int tuxtx_subtitle_running(int pid, int page)
{
if(reader_running && (tuxtxt_cache.vtxtpid == pid) && (tuxtxt_cache.page == page))
{
return 1;
}
return 0;
}
int tuxtx_main(int _rc, void * _fb, int pid, int x, int y, int w, int h, int page)
{
char cvs_revision[] = "$Revision: 1.95 $";
subtitle_mode = 0;
//printf("to init tuxtxt\n");fflush(stdout);
#if !TUXTXT_CFG_STANDALONE
int initialized = tuxtxt_init();
if ( initialized )
if (initialized)
tuxtxt_cache.page = 0x100;
if(page) {
tuxtxt_cache.page = page;
subtitle_mode = 1;
}
#endif
/* show versioninfo */
@@ -1507,7 +1546,7 @@ int tuxtx_main(int _rc, void * _fb, int pid, int x, int y, int w, int h)
if(tuxtxt_cache.vtxtpid == 0)
printf("[tuxtxt] No PID given, so scanning for PIDs ...\n\n");
else
printf("[tuxtxt] using PID %x\n", tuxtxt_cache.vtxtpid);
printf("[tuxtxt] using PID %x page %d\n", tuxtxt_cache.vtxtpid, tuxtxt_cache.page);
fcntl(rc, F_SETFL, fcntl(rc, F_GETFL) | O_EXCL | O_NONBLOCK);
@@ -1543,6 +1582,10 @@ int tuxtx_main(int _rc, void * _fb, int pid, int x, int y, int w, int h)
if (Init() == 0)
return 0;
if(subtitle_mode) {
pthread_create(&ttx_sub_thread, 0, reader_thread, (void *) NULL);
return 1;
}
//transpmode = 1;
/* main loop */
do {
@@ -3326,7 +3369,7 @@ void PageInput(int Number)
{
tuxtxt_cache.subpage = subp;
tuxtxt_cache.pageupdate = 1;
#if TUXTXT_DEBUG
#if 1 //TUXTXT_DEBUG
printf("TuxTxt <DirectInput: %.3X-%.2X>\n", tuxtxt_cache.page, tuxtxt_cache.subpage);
#endif
}