Webinterface-Teletext auch für Neutrino

dbluelle
Contributor
Beiträge: 319
Registriert: Samstag 29. Mai 2004, 18:49

Webinterface-Teletext auch für Neutrino

Beitrag von dbluelle »

Hallo,

Ich habe angefangen, den WebIF-Teletext auch für Neutrino verfügbar zu machen.
Leider funktioniert das so noch nicht richtig, und da ich meine Ergebnisse nicht selber testen kann, liegt der SourceCode hier.
Ich würde mich freuen, wenn das mal jemand ausprobiert und mir etwas auf die Sprünge hilft :)

Das ganze soll in etwa so funktionieren:
Die Erstellung des HTML-Codes habe ich in die libtuxtxt verlagert.
Da die Behandlung des Tuxtxt-Caches im Neutrino-"Hauptprogramm" erfolgt, muß sich der nhttpd die Daten über die NeutrinoMessages holen.
Also habe ich neue Messages eingeführt, bei deren Aufruf Neutrino die entsprechenden Funktionen aus der libtuxtxt aufruft und das Ergebnis zurückliefert.

Der Aufruf im WebIF geht über /fb/teletext.dbox2

Bei meinem "Betatester" scheint Neutrino in eine Endlosschleife zu geraten, wofür ich aber keinen Grund finde :gruebel:
Es kann allerdings sein, daß das Messaging-System da etwas überfordert ist, weil für eine Seite (derzeit) ca. 2000 Messages abgearbeitet werden müssen.

Die Änderungen an enigma_dyn.cpp und libtuxtxt können aber auf jeden Fall schon ins CVS übernommen werden.

dbluelle
yjogol
Developer
Beiträge: 809
Registriert: Montag 4. Juli 2005, 18:45

Re: Webinterface-Teletext auch für Neutrino

Beitrag von yjogol »

dbluelle hat geschrieben:Hallo,

Ich habe angefangen, den WebIF-Teletext auch für Neutrino verfügbar zu machen.
Leider funktioniert das so noch nicht richtig, und da ich meine Ergebnisse nicht selber testen kann, liegt der SourceCode hier.
Ich würde mich freuen, wenn das mal jemand ausprobiert und mir etwas auf die Sprünge hilft :)

Das ganze soll in etwa so funktionieren:
Die Erstellung des HTML-Codes habe ich in die libtuxtxt verlagert.
Da die Behandlung des Tuxtxt-Caches im Neutrino-"Hauptprogramm" erfolgt, muß sich der nhttpd die Daten über die NeutrinoMessages holen.
Also habe ich neue Messages eingeführt, bei deren Aufruf Neutrino die entsprechenden Funktionen aus der libtuxtxt aufruft und das Ergebnis zurückliefert.

Der Aufruf im WebIF geht über /fb/teletext.dbox2

Bei meinem "Betatester" scheint Neutrino in eine Endlosschleife zu geraten, wofür ich aber keinen Grund finde :gruebel:
Es kann allerdings sein, daß das Messaging-System da etwas überfordert ist, weil für eine Seite (derzeit) ca. 2000 Messages abgearbeitet werden müssen.

Die Änderungen an enigma_dyn.cpp und libtuxtxt können aber auf jeden Fall schon ins CVS übernommen werden.

dbluelle
Na das werd ich mir anschauen.
Aber 2000 Messages ... ist viel.
Gruß
yjogol
dbluelle
Contributor
Beiträge: 319
Registriert: Samstag 29. Mai 2004, 18:49

Beitrag von dbluelle »

Das mit den 2000 Messages ist nur ein Provisorium
(Ich habe das 1:1 aus der entsprechenden Enigma-Funktion umgesetzt und erstmal nicht auf Performance geachtet... ) .

Am besten wäre es wohl, wenn nur eine Message vom nhttpd gesendet wird und dann die komplette Seite in Neutrino gebaut und im /tmp-Verzeichnis abgelegt wird.
Nach Abarbeiten der Message würde dann nhttpd nur diese Datei lesen und rausschicken.

Allerdings würde ich erstmal gerne wissen, ob's überhaupt funktioniert, bzw. wo es jetzt noch hakt...

dbluelle
yjogol
Developer
Beiträge: 809
Registriert: Montag 4. Juli 2005, 18:45

Beitrag von yjogol »

Also ich bin mal erst soweit gekommen.
Idee?

Code: Alles auswählen

make[5]: Entering directory `/home/y/tuxbox/tuxbox-cvs/apps/tuxbox/neutrino/src/gui'
if powerpc-tuxbox-linux-gnu-g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../daemons -I../../src -I/home/y/tuxbox/dbox2/cdkroot/include/tuxbox -I/home/y/tuxbox/dbox2/cdkroot/include/freetype2 -I/home/y/tuxbox/dbox2/cdkroot/include/tuxbox -I/home/y/tuxbox/dbox2/cdkroot/include/tuxbox -I/home/y/tuxbox/dbox2/cdkroot/include/tuxbox/mpegtools -I/home/y/tuxbox/dbox2/cdkroot/include -I/home/y/tuxbox/tuxbox-cvs/driver/include -I../../lib  -I/home/y/tuxbox/tuxbox-cvs/driver/dvb/include -I/home/y/tuxbox/tuxbox-cvs/driver/include  -Wall -mcpu=823 -mmultiple -mstring -meabi -pipe -Os -MT infoviewer.o -MD -MP -MF ".deps/infoviewer.Tpo" -c -o infoviewer.o infoviewer.cpp; \
then mv -f ".deps/infoviewer.Tpo" ".deps/infoviewer.Po"; else rm -f ".deps/infoviewer.Tpo"; exit 1; fi
infoviewer.cpp:77: error: `tuxtxt_cache_struct' does not name a type
infoviewer.cpp:78: error: expected constructor, destructor, or type conversion before '*' token
infoviewer.cpp:78: error: expected `,' or `;' before '*' token
infoviewer.cpp:79: error: variable or field `tuxtxt_RenderStylesHTML' declared void
infoviewer.cpp:79: error: `tstHTML' was not declared in this scope
infoviewer.cpp:79: error: `pHTML' was not declared in this scope
infoviewer.cpp:79: error: expected primary-expression before "char"
infoviewer.cpp:79: error: initializer expression list treated as compound expression
infoviewer.cpp:80: error: variable or field `tuxtxt_RenderHTML' declared void
infoviewer.cpp:80: error: `tstHTML' was not declared in this scope
infoviewer.cpp:80: error: `pHTML' was not declared in this scope
infoviewer.cpp:80: error: expected primary-expression before "char"
infoviewer.cpp:80: error: initializer expression list treated as compound expression
infoviewer.cpp:81: error: variable or field `tuxtxt_EndHTML' declared void
infoviewer.cpp:81: error: `tstHTML' was not declared in this scope
infoviewer.cpp:81: error: `pHTML' was not declared in this scope
infoviewer.cpp: In constructor `CInfoViewer::CInfoViewer()':
infoviewer.cpp:106: error: `pTuxtxtHTML' undeclared (first use this function)
infoviewer.cpp:106: error: (Each undeclared identifier is reported only once for each function it appears in.)
infoviewer.cpp: In member function `int CInfoViewer::handleMsg(neutrino_msg_t, neutrino_msg_data_t)':
infoviewer.cpp:762: error: `pTuxtxtHTML' undeclared (first use this function)
infoviewer.cpp:762: error: `tuxtxt_InitHTML' undeclared (first use this function)
infoviewer.cpp:767: error: `tuxtxt_EndHTML' cannot be used as a function
infoviewer.cpp:779: error: `tuxtxt_RenderStylesHTML' cannot be used as a function
infoviewer.cpp:791: error: `tuxtxt_RenderHTML' cannot be used as a function
infoviewer.cpp:796: error: `tuxtxt_cache' undeclared (first use this function)
make[5]: *** [infoviewer.o] Fehler 1
make[5]: Leaving directory `/home/y/tuxbox/tuxbox-cvs/apps/tuxbox/neutrino/src/gui'
make[4]: *** [all-recursive] Fehler 1
make[4]: Leaving directory `/home/y/tuxbox/tuxbox-cvs/apps/tuxbox/neutrino/src/gui'
make[3]: *** [all-recursive] Fehler 1
make[3]: Leaving directory `/home/y/tuxbox/tuxbox-cvs/apps/tuxbox/neutrino/src'
make[2]: *** [all-recursive] Fehler 1
make[2]: Leaving directory `/home/y/tuxbox/tuxbox-cvs/apps/tuxbox/neutrino'
make[1]: *** [all] Fehler 2
make[1]: Leaving directory `/home/y
edit: kann es sein, dass infoviewer.h fehlt.
Also #include <tuxtxt/tuxtxt_def.h> fehlt und die Definition von pTuxtxtHTML in

Code: Alles auswählen

CInfoViewer::CInfoViewer()
{
	frameBuffer      = CFrameBuffer::getInstance();

	BoxStartX        = BoxStartY = BoxEndX = BoxEndY = 0;
	recordModeActive = false;
	is_visible       = false;
	showButtonBar    = false;
	gotTime          = g_Sectionsd->getIsTimeSet();
#ifndef SKIP_CA_STATUS
	CA_Status        = false;
#endif
#ifndef TUXTXT_CFG_STANDALONE
	pTuxtxtHTML      = NULL;
#endif

}
Gruß
yjogol[/code]
dbluelle
Contributor
Beiträge: 319
Registriert: Samstag 29. Mai 2004, 18:49

Beitrag von dbluelle »

yjogol hat geschrieben: kann es sein, dass infoviewer.h fehlt.
Jo, das stimmt :oops: .
Ich habs mal noch mit reingepackt.

dbluelle
yjogol
Developer
Beiträge: 809
Registriert: Montag 4. Juli 2005, 18:45

Beitrag von yjogol »

Also hab das alles bisher nicht compiliert bekommen.

Wenn etwas mehr Zeit habe, werde ich es mir anschauen.
Gruß
yjogol
FAQ zu YWeb unter http://www.yjogol.de
dbluelle
Contributor
Beiträge: 319
Registriert: Samstag 29. Mai 2004, 18:49

Beitrag von dbluelle »

Mir ist da noch was eingefallen:

Das Event-Handling scheint wohl nicht auf die Abarbeitung der Events zu warten, oder? :gruebel:
Also, wenn ich ein SendEvent(..) von httpd aus schicke, wird nicht gewartet, bis die Antwort von Neutrino kommt.

Wenn dem so ist, kann das ganze so nicht funktionieren. Wahrscheinlich muss man dann Neutrino wiederum einen Event losschicken, der dann im nhttpd abgearbeitet wird, oder so.

Das muß ich mir aber erstmal noch genauer anschauen...

dbluelle

P.S.: welche Fehlermeldungen bekommst du denn beim Kompilieren ?
dbluelle
Contributor
Beiträge: 319
Registriert: Samstag 29. Mai 2004, 18:49

Beitrag von dbluelle »

So, nach längerer Zeit hab' ich mich nochmal etwas mit der Sache beschäftigt...

Es gibt m.E. 3 Möglichkeiten:

1) der nhttpd schickt eine Message mit der Socket-ID an Neutrino, und Neutrino generiert die Seite und schreibt sie über den Socket raus (wobei ich nicht weiß, ob das so einfach geht, daß zwei Prozesse auf den gleichen Socket zugreifen).
Ausserdem müsste der nhttpd dann irgendwie 'merken', daß Neutrino fertig ist, um seine Aufräumaktionen (schliessen des socket usw.)durchzuführen.
2) Falls das mit dem gleichzeitigen Zugriff auf den Socket nicht geht, müsste Neutrino die generierte Seite in eine Datei /tmp/teletext.html oder so schreiben, die dann der nhttpd liest und ausgibt.
Hier müsste der nhttpd benachrichtigt werden, wenn die Datei geschrieben ist.
3) Es werden mehrere Messages geschickt, die jeweils einen Teil der Seite anfordern (ähnlich dem jetzigen Stand)

Ich blicke bei dieser ganzen Event-Geschichte noch nicht so durch, aber
so, wie ich das sehe, gibt es (bisher) keine Möglichkeit, eine Message an Neutrino zu schicken, die dann auch eine Antwort zurückliefert, bzw. überhaupt von Neutrino aus eine Message an den nhttpd zu schicken :gruebel:
Für die anderen Dienste (zapit, sectionsd, controld...) gibt es ja jeweils Client-Klassen, die das ganze handhaben, aber für Neutrino selber geht das nur über diese CEventServer-Klasse, oder übersehe ich da was?

Ich denke, da sind nöch größere Änderungen in Neutrino nötig, die ich mir (ohne Möglichkeit zum Testen) nicht unbedingt aufhalsen möchte ...

Oder weiß von euch jemand 'ne einfachere Lösung ?
(yjogol, du hast ja in deinem yWeb2.0-Thread was davon geschrieben, daß das 'in Arbeit' sei :wink: )

dbluelle
dbluelle
Contributor
Beiträge: 319
Registriert: Samstag 29. Mai 2004, 18:49

Ein neuer Versuch...

Beitrag von dbluelle »

Hier nochmal ein neuer Versuch:
Ich mache jetzt die Kommunikation zwischen Neutrino und dem nhttpd per FIFO. Allerdings scheint das so noch nicht zu klappen.
Ich bräuchte also mal jemanden, der das mal ausprobiert und dann die Logausgaben hier rein schreibt.
Der diff (s.u.) ist gegen das aktuelle CVS erstellt.
Vielen Dank im voraus,

dbluelle

Code: Alles auswählen

Index: apps/tuxbox/libs/libtuxtxt/libtuxtxt.c
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/libs/libtuxtxt/libtuxtxt.c,v
retrieving revision 1.7
diff -b -U3 -r1.7 libtuxtxt.c
--- a/apps/tuxbox/libs/libtuxtxt/libtuxtxt.c	10 Jul 2006 18:45:41 -0000	1.7
+++ b/apps/tuxbox/libs/libtuxtxt/libtuxtxt.c	23 Sep 2006 14:12:48 -0000
@@ -102,6 +102,434 @@
 	pthread_mutex_unlock(&tuxtxt_control_lock);
 }
 
+/******************************************************************************
+ * Generating HTML-Code                                                       *
+ ******************************************************************************/
+void tuxtxt_EndHTML(tstHTML* pHTML)
+{
+	if (pHTML->page_char) free(pHTML->page_char);
+	if (pHTML->page_atrb) free(pHTML->page_atrb);
+	free (pHTML);
+	pHTML = NULL;
+}
+tstHTML* tuxtxt_InitHTML()
+{
+	tstHTML *pHTML = malloc(sizeof(tstHTML));
+	if (pHTML)
+	{
+		pHTML->page_char = malloc(25*40);
+		if (!pHTML->page_char)
+		{
+			tuxtxt_EndHTML(pHTML);
+			return NULL;
+		}
+		pHTML->page_atrb = malloc(25*40*sizeof(tstPageAttr));
+		if (!pHTML->page_atrb)
+		{
+			tuxtxt_EndHTML(pHTML);
+			return NULL;
+		}
+		pHTML->row = 0;
+		pHTML->col = 0;
+		pHTML->stylecount_n=0;
+		pHTML->stylecount_d=0;
+		pHTML->stylecount_g=0;
+		pHTML->stylecount_b=0;
+		pHTML->pageinfo = tuxtxt_DecodePage(1, pHTML->page_char, pHTML->page_atrb, 0, 0);
+		memset(pHTML->cstyles_n,0,1024*sizeof(unsigned short));
+		memset(pHTML->cstyles_d,0,1024*sizeof(unsigned short));
+		memset(pHTML->cstyles_g,0,32*sizeof(unsigned short));
+		memset(pHTML->cstyles_b,0,32*sizeof(unsigned short));
+		if (pHTML->pageinfo &&
+			tuxtxt_cache.national_subset <= NAT_MAX_FROM_HEADER && 
+			pHTML->pageinfo->nationalvalid) 
+			tuxtxt_cache.national_subset = countryconversiontable[pHTML->pageinfo->national];
+	}
+	return pHTML;
+
+}
+void tuxtxt_color2string(const unsigned short * pcolormap, int color, char* colstr)
+{
+	if (!pcolormap)
+		pcolormap = tuxtxt_defaultcolors;
+	else
+	{
+		if (color < 16)
+			pcolormap = tuxtxt_defaultcolors;
+		else
+			color %= 16;
+	}
+	int cval = (((int)(pcolormap[color]) & 0xf00))>> 4 | 
+		   (((int)(pcolormap[color]) & 0x0f0))<< 8 | 
+		   (((int)(pcolormap[color]) & 0x00f))<<20;
+	sprintf(colstr,"#%06X",cval);
+}
+
+void tuxtxt_RenderGraphicHTML(unsigned char* graphbuffer,// buffer containing the graphics data (size must be >=xres*10)
+			      int xres,// length of 1 line in graphbuffer (must be >= 12)
+			      const char* fgclass, // CSS-class for foreground color
+			      const char* bgclass, // CSS-class for background color
+			      tstPageAttr* pAttr, // Attributes of Graphic
+			      int col, // current column (0..39 )
+			      char* result ) 
+{
+
+	unsigned char *p,*p1;
+	int srow, scol;
+	char tmpbuf[300];
+	char classfg[20];
+	sprintf(tmpbuf,"<td %s%s><table class=%s cellspacing=0 cellpadding=0><colgroup><col width=1 span=12></colgroup>",(pAttr->doublew ? " COLSPAN=2" : ""),(pAttr->doubleh ? " ROWSPAN=2" : ""),bgclass);
+	strcat(result,tmpbuf);
+	sprintf(classfg," class=%s",fgclass);
+	for (srow = 0; srow < 10; srow++)
+	{
+		strcat(result,"<tr>");
+		p = NULL;
+		int pcount = 0;
+		for (scol = 0; scol < 12; scol++)
+		{
+			p1 = &graphbuffer[srow*xres+scol];
+			if (p)
+			{
+				if (*p1 == *p) 
+					pcount++;
+				else
+				{
+					strcat(result,"<td");
+					if (*p == pAttr->fg)
+						strcat(result,classfg);
+					
+					if (pcount>0) 
+					{
+						sprintf(tmpbuf," colspan=%d",pcount+1);
+						strcat(result,tmpbuf);
+					}
+					strcat(result,"></td>");
+					pcount = 0;
+					p = p1;
+				}
+			}
+			else 
+				p = p1;
+		}
+		strcat(result,"<td");
+		if (*p == pAttr->fg)
+			strcat(result,classfg);
+		if (pcount>0) 
+		{
+			sprintf(tmpbuf," colspan=%d",pcount+1);
+			strcat(result,tmpbuf);
+		}
+		strcat(result,"></td></tr>\n");
+	}
+	strcat(result,"</table></td>");
+}
+void tuxtxt_RenderTextHTML(int Char,// Character to render
+			   const char* class, // CSS-class 
+			   tstPageAttr* pAttr, // Attributes of Graphic
+			   int col, // current column (0..39 )
+			   char* result ) // resulting html-string, buffersize must be >= 300
+{
+	char tmp[300];
+	sprintf(tmp,"<td class=%s%s%s>%s%s",class,(pAttr->doublew ? " COLSPAN=2" : ""),(pAttr->doubleh ? " ROWSPAN=2" : ""),(pAttr->underline ? "<u>" : ""),(pAttr->flashing ? "<blink>":""));
+	strcat(result,tmp);
+	if (Char < 0)
+		strcat(result," ");
+	else
+	{
+		if (Char > 0x20 && Char <= 0x7f)
+			result[strlen(result)] = (char)Char;
+		else
+		{
+			sprintf(tmp,"&#%d;",Char);
+			strcat(result,tmp);
+		}
+		if (pAttr->diacrit && pAttr->diacrit <16)
+		{
+			int dia[] ={0x20,0x300,0x301,0x302,0x303,0x304,0x306,0x307,0x308,0x323,0x30a,0x317,0x331,0x30b,0x316,0x30c};
+			sprintf(tmp,"&#%d;",dia[pAttr->diacrit]);
+			strcat(result,tmp);
+		}
+	}
+	if (pAttr->underline) strcat(result,"</u>");
+	if (pAttr->flashing) strcat(result,"</blink>");
+	strcat(result,"</td>");
+}
+void tuxtxt_RenderLinkHTML(int number,// Pagenumber to render 
+			   const char* class, // CSS-class
+			   tstPageAttr* pAttr, // Attributes of Graphic
+			   int col, // current column (0..39 )
+			   char* result ) // resulting html-string, buffersize must be >= 300
+{
+	char tmpbuf[300];
+	sprintf(tmpbuf,"<td class=%s%s COLSPAN=%d%s>%s<a href=\"javascript:setpage(%d,-1)\" class=%s>%d</a>%s</td>",class,(pAttr->doublew && pAttr->doubleh ? "D":""),(pAttr->doublew ? 6 : 3),(pAttr->doubleh ? " ROWSPAN=2" : ""),(pAttr->underline ? "<u>" : ""),number,class,number,(pAttr->underline ? "</u>" : ""));
+	strcat(result,tmpbuf);
+}
+void tuxtxt_RenderStyleHTML(const char* colorstyle, // CSS-classname
+			   const char* fcolor, // foreground color
+			   const char* bcolor, // background color
+			   int typ, // 0 = normal, 1 = double size, 2 = graphic char foreground,  3 = graphic char background
+			   char* result ) // resulting html-string, buffersize must be >= 200
+{
+	switch(typ)
+	{
+		case 0:
+		case 1:
+			sprintf(result,".%s {font-family:Courier,monospace;font-weight:bold;font-size:%d;color:%s;background-color:%s;text-align:center;width:12;height:20}\n",colorstyle,1<<(4+typ),fcolor,bcolor);
+			break;
+		case 2:
+			sprintf(result,".%s {background-color:%s;width:1;height:2}\n",colorstyle,fcolor);
+			break;
+		case 3:
+			sprintf(result,".%s {background-color:%s;table-layout:fixed;width:12;height:20;border-style:none}\n",colorstyle,fcolor);
+			break;
+	}
+	
+}
+void tuxtxt_RenderStylesHTML(tstHTML* pHTML,
+		      char* style) // pointer to new generated css-style, must be >= 200
+{
+	if (!pHTML)
+	{
+		return;
+	}	
+
+	if (pHTML->row >23 || pHTML->col >= 40)
+	{
+		printf("tuxtxt_RenderStylesHTML:irregular row(%d) or column (%d)\n",pHTML->row,pHTML->col);
+		return;
+	}
+	if (!pHTML->pageinfo)
+	{
+		pHTML->row = 24;
+		pHTML->col = 0;
+		return;
+	}
+	int stylenr;
+	tstPageAttr* pAttr;
+	int PosX = 0;
+	char bcolor[10];
+	char fcolor[10];
+	char colorstyle[10];
+	memset(style,0,200);
+	unsigned char axdrcs[12+1+10+1] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
+	pAttr = &pHTML->page_atrb[pHTML->row*40+pHTML->col];
+	int Char = tuxtxt_RenderChar(NULL, 24, pHTML->page_char[pHTML->row*40+pHTML->col], &PosX, 0, pAttr, 0, 12, 12, 10, 0, axdrcs,2);
+	tuxtxt_color2string(tuxtxt_cache.colortable,pAttr->fg,fcolor);
+	tuxtxt_color2string(tuxtxt_cache.colortable,pAttr->bg,bcolor);
+	stylenr = ((pAttr->fg)<<5)|pAttr->bg;
+	if (pAttr->doublew && pAttr->doubleh)
+	{		
+		if (pHTML->cstyles_d[stylenr] == 0)
+		{
+			pHTML->stylecount_d++;
+			pHTML->cstyles_d[stylenr] = pHTML->stylecount_d;
+			sprintf(colorstyle,"d%x",pHTML->cstyles_d[stylenr]);
+			tuxtxt_RenderStyleHTML(colorstyle,fcolor,bcolor,1,style);
+		}
+	}
+	else
+	{
+		if (Char == 0 && (pAttr->fg == pAttr->bg))
+			Char = 0x20;
+		if (Char == 0) // graphic character
+		{
+			stylenr = pAttr->fg;
+			if (pHTML->cstyles_g[stylenr] == 0)
+			{
+				pHTML->stylecount_g++;
+				pHTML->cstyles_g[stylenr] = pHTML->stylecount_g;
+				sprintf(colorstyle,"g%x",pHTML->cstyles_g[stylenr]);
+				tuxtxt_RenderStyleHTML(colorstyle,fcolor,bcolor,2,style);
+			}
+			stylenr = pAttr->bg;
+			if (pHTML->cstyles_b[stylenr] == 0)
+			{
+				char tmpstyle[200];
+				pHTML->stylecount_b++;
+				pHTML->cstyles_b[stylenr] = pHTML->stylecount_b;
+				sprintf(colorstyle,"b%x",pHTML->cstyles_b[stylenr]);
+				tuxtxt_RenderStyleHTML(colorstyle,bcolor,fcolor,3,tmpstyle);
+				strcat(style,tmpstyle);
+			}
+		}
+		else
+		{
+			if (pHTML->cstyles_n[stylenr] == 0)
+			{
+				pHTML->stylecount_n++;
+				pHTML->cstyles_n[stylenr] = pHTML->stylecount_n;
+				sprintf(colorstyle,"n%x",pHTML->cstyles_n[stylenr]);
+				tuxtxt_RenderStyleHTML(colorstyle,fcolor,bcolor,0,style);
+			}
+		}
+	}
+	if (pHTML->col < 39 && pAttr->doublew)
+	{
+		pHTML->page_char[40*pHTML->row+pHTML->col+1] = 0xff;
+		pHTML->page_atrb[40*pHTML->row+pHTML->col+1].doubleh = 0;
+		pHTML->page_atrb[40*pHTML->row+pHTML->col+1].doublew = 0;
+	}
+
+	if (pHTML->row < 23 && pAttr->doubleh)
+	{
+		pHTML->page_char[40*(pHTML->row+1)+pHTML->col] = 0xff;
+		pHTML->page_atrb[40*(pHTML->row+1)+pHTML->col].doubleh = 0;
+		pHTML->page_atrb[40*(pHTML->row+1)+pHTML->col].doublew = 0;
+		if (pAttr->doublew && pHTML->col < 39)
+		{
+			pHTML->page_char[40*(pHTML->row+1)+pHTML->col+1] = 0xff;
+			pHTML->page_atrb[40*(pHTML->row+1)+pHTML->col+1].doubleh = 0;
+			pHTML->page_atrb[40*(pHTML->row+1)+pHTML->col+1].doublew = 0;
+		}
+	}
+	pHTML->col++;
+	if (pHTML->col == 40)
+	{
+		pHTML->row++;
+		pHTML->col = 0;
+	}
+}
+void tuxtxt_RenderHTML(tstHTML* pHTML,
+		      char* result ) // resulting html-string, buffersize must be >= 4000
+{
+	if (!pHTML)
+	{
+		strcpy(result,"Teletext not available");
+		return;
+	}	
+
+	if (pHTML->row >23 || pHTML->col >= 40)
+	{
+		printf("irregular row(%d) or column (%d)\n",pHTML->row,pHTML->col);
+		return;
+	}
+	if (!pHTML->pageinfo)
+	{
+		strcpy(result,"Page not available");
+		pHTML->row = 24;
+		return;
+	}
+	memset (result,0,4000);
+	if (pHTML->row == 0 && pHTML->col == 0)
+	{	
+		strcpy(result,"<table border=0 cellspacing=0 cellpadding=0 style=\"table-layout:fixed;height=450;width=480\" ><colgroup><col width=12 span=40 /></colgroup>");
+	}
+	if (pHTML->col == 0)
+		strcat(result,"<tr>");
+		
+	int stylenr;
+	int numberlink = 0;
+	int linkcount = 0;
+	tstPageAttr* pAttr;
+	int PosX = 0;
+	char colorstyle[10];
+	char graphfgstyle[10];
+	char graphbgstyle[10];
+	char linkcolorstyle[10];
+	char nonumberlink[300];
+	char bcolor[10];
+	char fcolor[10];
+	unsigned char  charbuffer[24*20]; 
+	unsigned char axdrcs[12+1+10+1] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23};
+	memset(nonumberlink,0,300);
+	while (1)
+	{
+		pAttr = &pHTML->page_atrb[pHTML->row*40+pHTML->col];
+		memset(charbuffer,pAttr->bg,24*20);
+		int Char = tuxtxt_RenderChar(charbuffer, 24, pHTML->page_char[pHTML->row*40+pHTML->col], &PosX, 0, pAttr, 0, 12, 12, 10, 0, axdrcs,2);
+		tuxtxt_color2string(tuxtxt_cache.colortable,pAttr->fg,fcolor);
+		tuxtxt_color2string(tuxtxt_cache.colortable,pAttr->bg,bcolor);
+		stylenr = ((pAttr->fg)<<5)|pAttr->bg;
+		if (pAttr->doublew && pAttr->doubleh)
+		{		
+			sprintf(colorstyle,"d%x",pHTML->cstyles_d[stylenr]);
+		}
+		else
+		{
+//			if (Char == 0 && (pAttr->fg == pAttr->bg || !memchr(charbuffer,pAttr->fg,24*20)))
+			if (Char == 0 && (pAttr->fg == pAttr->bg))
+				Char = 0x20;
+			if (Char == 0) // graphic character
+			{
+				stylenr = pAttr->fg;
+				sprintf(graphfgstyle,"g%x",pHTML->cstyles_g[stylenr]);
+				stylenr = pAttr->bg;
+				sprintf(graphbgstyle,"b%x",pHTML->cstyles_b[stylenr]);
+			}
+			else
+			{
+				sprintf(colorstyle,"n%x",pHTML->cstyles_n[stylenr]);
+			}
+		}
+		if (pHTML->col < 39 && pAttr->doublew)
+		{
+			pHTML->page_char[40*pHTML->row+pHTML->col+1] = 0xff;
+			pHTML->page_atrb[40*pHTML->row+pHTML->col+1].doubleh = 0;
+			pHTML->page_atrb[40*pHTML->row+pHTML->col+1].doublew = 0;
+		}
+
+		if (pHTML->row < 23 && pAttr->doubleh)
+		{
+			pHTML->page_char[40*(pHTML->row+1)+pHTML->col] = 0xff;
+			pHTML->page_atrb[40*(pHTML->row+1)+pHTML->col].doubleh = 0;
+			pHTML->page_atrb[40*(pHTML->row+1)+pHTML->col].doublew = 0;
+			if (pAttr->doublew && pHTML->col < 39)
+			{
+				pHTML->page_char[40*(pHTML->row+1)+pHTML->col+1] = 0xff;
+				pHTML->page_atrb[40*(pHTML->row+1)+pHTML->col+1].doubleh = 0;
+				pHTML->page_atrb[40*(pHTML->row+1)+pHTML->col+1].doublew = 0;
+			}
+		}
+		if (pHTML->row > 0 && Char>= 0x30 && Char <= 0x39) //Digits
+		{
+			if (linkcount == 0)
+			{
+				memset(nonumberlink,0,300);
+				strcpy(linkcolorstyle,colorstyle);
+			}
+			numberlink= numberlink*10 + (Char&0x0f);
+			tuxtxt_RenderTextHTML(Char,colorstyle, pAttr,pHTML->col,nonumberlink);
+			
+			linkcount++;
+			pHTML->col++;
+			if (pHTML->col == 40)
+			{
+				if (linkcount == 3 && numberlink >= 100 && numberlink < 900)
+					tuxtxt_RenderLinkHTML(numberlink,linkcolorstyle, pAttr,pHTML->col,result);
+				else
+					strcat(result,nonumberlink);
+				break;
+			}
+			
+		}
+		else
+		{
+			if (linkcount == 3 && numberlink >= 100 && numberlink < 900)
+				tuxtxt_RenderLinkHTML(numberlink,linkcolorstyle, pAttr,pHTML->col,result);
+			else
+				strcat(result,nonumberlink);
+			if (Char!=-1)
+			{
+				if (Char != 0)
+					tuxtxt_RenderTextHTML(Char,colorstyle, pAttr,pHTML->col,result);
+				else 				
+					tuxtxt_RenderGraphicHTML(charbuffer,24,graphfgstyle,graphbgstyle,pAttr,pHTML->col, result);
+			}
+			pHTML->col++;
+			break;
+		}
+	}
+	if (pHTML->col == 40)
+	{
+		strcat(result,"</tr>\n");
+		pHTML->col = 0;
+		pHTML->row++;
+		if (pHTML->row == 24)
+			strcat(result,"</table>\n");
+	}
+}
+
 /* Local Variables: */
 /* indent-tabs-mode:t */
 /* tab-width:3 */
Index: apps/tuxbox/libs/libtuxtxt/tuxtxt_common.h
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/libs/libtuxtxt/tuxtxt_common.h,v
retrieving revision 1.10
diff -b -U3 -r1.10 tuxtxt_common.h
--- a/apps/tuxbox/libs/libtuxtxt/tuxtxt_common.h	10 Jul 2006 18:45:41 -0000	1.10
+++ b/apps/tuxbox/libs/libtuxtxt/tuxtxt_common.h	23 Sep 2006 14:12:49 -0000
@@ -190,7 +190,9 @@
 	uLongf comprlen = 23*40;
 	if (compress2(pagecompressed,&comprlen,buffer,23*40,Z_BEST_SPEED) == Z_OK)
 	{
-		if (pg->pData) free(pg->pData);//realloc(pg->pData,j); realloc scheint nicht richtig zu funktionieren?
+		if (pg->pData)
+			pg->pData = realloc(pg->pData,comprlen); 
+		else
 		pg->pData = malloc(comprlen);
 		pg->ziplen = 0;
 		if (pg->pData)
@@ -210,7 +212,9 @@
 		pg->bitmask[i>>3] |= 0x80>>(i&0x07);
 		cbuf[j++]=buffer[i];
     }
-    if (pg->pData) free(pg->pData);//realloc(pg->pData,j); realloc scheint nicht richtig zu funktionieren?
+	if (pg->pData)
+		pg->pData = realloc(pg->pData,j); 
+	else
     pg->pData = malloc(j);
 	if (pg->pData)
 	{
@@ -2301,8 +2303,8 @@
  ******************************************************************************/
 
 tstPageinfo* tuxtxt_DecodePage(int showl25, // 1=decode Level2.5-graphics
-				 unsigned char* page_char, // page buffer, min. 24*40 
-				 tstPageAttr *page_atrb, // attribut buffer, min 24*40
+				 unsigned char* page_char, // page buffer, min. 25*40 
+				 tstPageAttr *page_atrb, // attribut buffer, min 25*40
 				 int hintmode,// 1=show hidden information
 				 int showflof // 1=decode FLOF-line
 				 )
@@ -2770,6 +2772,7 @@
 }
 void tuxtxt_FillRect(unsigned char *lfb, int xres, int x, int y, int w, int h, int color)
 {
+	if (!lfb) return;
 	unsigned char *p = lfb + x + y * xres;
 
 	if (w > 0)
@@ -2786,6 +2789,7 @@
 	unsigned char *ax, /* array[0..12] of x-offsets, array[0..10] of y-offsets for each pixel */
 	unsigned char fgcolor, unsigned char bgcolor)
 {
+	if (d == NULL) return;
 	int bit, x, y;
 	unsigned char *ay = ax + 13; /* array[0..10] of y-offsets for each pixel */
 
@@ -2824,6 +2828,7 @@
 
 void tuxtxt_DrawVLine(unsigned char *lfb, int xres, int x, int y, int l, int color)
 {
+	if (!lfb) return;
 	unsigned char *p = lfb + x + y * xres;
 
 	for ( ; l > 0 ; l--)
@@ -2835,12 +2840,14 @@
 
 void tuxtxt_DrawHLine(unsigned char* lfb,int xres,int x, int y, int l, int color)
 {
+	if (!lfb) return;
 	if (l > 0)
 		memset(lfb + x + y * xres, color, l);
 }
 
 void tuxtxt_FillRectMosaicSeparated(unsigned char *lfb, int xres,int x, int y, int w, int h, int fgcolor, int bgcolor, int set)
 {
+	if (!lfb) return;
 	tuxtxt_FillRect(lfb,xres,x, y, w, h, bgcolor);
 	if (set)
 	{
@@ -2924,7 +2931,7 @@
 
 void tuxtxt_DrawShape(unsigned char *lfb, int xres,int x, int y, int shapenumber, int curfontwidth, int fontheight, int curfontheight, int fgcolor, int bgcolor, int clear)
 {
-	if (shapenumber < 0x20 || shapenumber > 0x7e || (shapenumber == 0x7e && clear))
+	if (!lfb || shapenumber < 0x20 || shapenumber > 0x7e || (shapenumber == 0x7e && clear))
 		return;
 
 	unsigned char *p = aShapes[shapenumber - 0x20];
@@ -3144,6 +3151,8 @@
 			}
 			else if (*aShapes[Char - 0x20] == S_ADT)
 			{
+				if (lfb) 
+				{
 				int x,y,f,c;
 				unsigned char* p = lfb + *pPosX + PosY* xres;
 				for (y=0; y<fontheight;y++)
@@ -3158,6 +3167,7 @@
 						p += xres;
 					}
 				}
+				}
 				*pPosX += curfontwidth;
 				return 0;
 			}
Index: apps/tuxbox/libs/libtuxtxt/tuxtxt_def.h
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/libs/libtuxtxt/tuxtxt_def.h,v
retrieving revision 1.7
diff -b -U3 -r1.7 tuxtxt_def.h
--- a/apps/tuxbox/libs/libtuxtxt/tuxtxt_def.h	24 Feb 2006 19:44:41 -0000	1.7
+++ b/apps/tuxbox/libs/libtuxtxt/tuxtxt_def.h	23 Sep 2006 14:12:51 -0000
@@ -3,7 +3,7 @@
  ******************************************************************************/
 #ifndef TUXTXT_DEF_H
 
-#define TUXTXT_DEF_h
+#define TUXTXT_DEF_H
 #ifdef HAVE_DREAMBOX_HARDWARE
  #define TUXTXT_COMPRESS 1 // compress page data: 0 no compression, 1 with zlib, 2 with own algorithm
 #else
@@ -277,6 +277,23 @@
 	unsigned short *colortable;
 } tuxtxt_cache_struct;
 
+typedef struct
+{
+	unsigned char* page_char; // Character array (25*40) of decoded page
+	tstPageAttr* page_atrb;   // Attributes Array (25*40) of decoded page
+	int col;                  // current column (0..39 )
+	int row;                  // current row (0..23)
+	tstPageinfo* pageinfo;    // pageinfo of decoded page
+	unsigned short cstyles_n[1024];
+	unsigned short cstyles_d[1024];
+	unsigned short cstyles_g[32];
+	unsigned short cstyles_b[32];
+	unsigned short stylecount_n;
+	unsigned short stylecount_d;
+	unsigned short stylecount_g;
+	unsigned short stylecount_b;	
+} tstHTML;
+
 // G2 Charset (0 = Latin, 1 = Cyrillic, 2 = Greek)
 const unsigned short int G2table[3][6*16] =
 {
Index: apps/tuxbox/neutrino/daemons/nhttpd/request.h
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/nhttpd/Attic/request.h,v
retrieving revision 1.28
diff -b -U3 -r1.28 request.h
--- a/apps/tuxbox/neutrino/daemons/nhttpd/request.h	17 Jun 2006 17:24:10 -0000	1.28
+++ b/apps/tuxbox/neutrino/daemons/nhttpd/request.h	23 Sep 2006 14:12:51 -0000
@@ -68,7 +68,6 @@
 
 	bool CheckAuth(void);
 	std::string GetContentType(std::string ext);
-	std::string GetFileName(std::string path, std::string filename);
 	void SplitParameter(char *param_str);
 	void RewriteURL(void);
 	int OpenFile(std::string path, std::string filename);
@@ -107,6 +106,7 @@
 	CWebserverRequest(CWebserver *server);
 	~CWebserverRequest(void);
 	
+	std::string GetFileName(std::string path, std::string filename);
 	// output methods
 	void printf(const char *fmt, ...);
 	bool SocketWrite(char const *text);
Index: apps/tuxbox/neutrino/daemons/nhttpd/webapi.cpp
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/nhttpd/Attic/webapi.cpp,v
retrieving revision 1.73
diff -b -U3 -r1.73 webapi.cpp
--- a/apps/tuxbox/neutrino/daemons/nhttpd/webapi.cpp	17 Jun 2006 17:24:10 -0000	1.73
+++ b/apps/tuxbox/neutrino/daemons/nhttpd/webapi.cpp	23 Sep 2006 14:12:52 -0000
@@ -46,7 +46,7 @@
 	const char *operations[] = {
 		"test.dbox2", "timer.dbox2","info.dbox2","dbox.dbox2","bouquetlist.dbox2",
 		"channellist.dbox2","controlpanel.dbox2",
-		"actualepg.dbox2","epg.dbox2","switch.dbox2",NULL};
+		"actualepg.dbox2","epg.dbox2","switch.dbox2","teletext.dbox2",NULL};
 
 	dprintf("Executing %s\n",request->Filename.c_str());
 
@@ -88,6 +88,8 @@
 			break;
 		case 9:	return Switch(request);
 			break;
+		case 10:return Teletext(request);
+			break;
 		default:
 			request->Send404Error();
 			return false;
@@ -1680,3 +1682,147 @@
 	if (!strftime(string, 6, "%H:%M", tm))
 		sprintf(string, "??:??");
 }
+#define FIFO_TUXTXT "/tmp/tuxtxt_fifo"
+// sendet eine Message an Neutrino und schreibt die Antwort in pData
+void CWebAPI::SendFIFOMessage(int msg, void* pData, int datasize)
+{
+printf("nhttpd tuxtxt send FIFO Message\n");
+	Parent->EventServer->sendEvent(msg, CEventServer::INITID_HTTPD);
+        FILE* fp = fopen(FIFO_TUXTXT, "r");
+	if (fp != NULL)
+	{
+printf("nhttpd tuxtxt send FIFO Message opened\n");
+	        fread(pData, datasize,1, fp);
+        	fclose(fp);
+	}
+printf("nhttpd tuxtxt send FIFO Message done\n");
+}
+// sendet eine Message an Neutrino und schreibt die Antwort direkt in den Request
+void CWebAPI::SendFIFOMessage2(int msg, CWebserverRequest* request)
+{
+printf("nhttpd tuxtxt send FIFO Message2\n");
+	Parent->EventServer->sendEvent(msg, CEventServer::INITID_HTTPD);
+        FILE* fp = fopen(FIFO_TUXTXT, "r");
+	char tmp[400];
+	if (fp != NULL)
+	{
+printf("nhttpd tuxtxt send FIFO Message2 opened\n");
+		while (fread((void*)tmp, 400,1, fp))
+		{
+			request->SocketWrite(tmp);
+printf("nhttpd write HTML:%s\n",tmp);
+		}
+		fclose(fp);
+	}
+printf("nhttpd tuxtxt send FIFO Message2 done\n");
+}
+bool CWebAPI::Teletext(CWebserverRequest* request)
+{
+	CStringList params;
+
+
+	char pg[10];
+	char sp[200];
+	int tpage, tsubpage = -1;
+printf("nhttpd tuxtxt mknod\n");
+        umask(0);
+        mknod(FIFO_TUXTXT, S_IFIFO|0666, 0);
+printf("nhttpd tuxtxt init\n");
+	Parent->EventServer->sendEvent(NeutrinoMessages::EVT_TUXTXT_INIT_HTML, CEventServer::INITID_HTTPD);
+
+printf("nhttpd tuxtxt set page\n");
+	if (request->ParameterList.size() > 0)
+	{
+		std::string page =request->ParameterList["page"];
+
+		if (page != "")
+		{
+			sscanf(page.c_str(),"%x",&tpage);
+			Parent->EventServer->sendEvent(NeutrinoMessages::EVT_TUXTXT_SET_PAGE, CEventServer::INITID_HTTPD, (void *)&tpage,sizeof(int));
+		}
+		else 
+			SendFIFOMessage(NeutrinoMessages::EVT_TUXTXT_GET_PAGE, (void *)&tpage,sizeof(int));
+			
+
+		std::string subpage = request->ParameterList["subpage"];
+
+		if (subpage != "")
+			sscanf(subpage.c_str(),"%x",&tsubpage);
+	}
+	else 
+	{
+		SendFIFOMessage(NeutrinoMessages::EVT_TUXTXT_GET_PAGE, (void *)&tpage,sizeof(int));
+	}
+printf("nhttpd tuxtxt page set:%x\n",tpage);
+	Parent->EventServer->sendEvent(NeutrinoMessages::EVT_TUXTXT_SET_SUBPAGE, CEventServer::INITID_HTTPD, (void *)&tsubpage,sizeof(int));
+printf("nhttpd tuxtxt subpage set:%x\n",tsubpage);
+
+	sprintf(pg,"%x", tpage);
+
+	request->SendPlainHeader("text/html");
+	char tmpresult[400];
+	char *p;
+	FILE* fhtml = fopen(request->GetFileName("/","teletext.html").c_str(),"r");
+	if (fhtml == NULL)
+	{
+		request->Send404Error();
+		return false;
+	}
+printf("nhttpd tuxtxt open html page\n");
+	while (fgets(tmpresult,400,fhtml))
+	{
+		p = strstr(tmpresult,"%%");
+		
+		if (p)
+		{
+			*p= 0x00;
+			request->SocketWrite(tmpresult);
+			p++;
+			if (strncmp(p,"%COLORTABLE%%",13) == 0)
+			{
+printf("nhttpd tuxtxt reading styles\n");
+				SendFIFOMessage2(NeutrinoMessages::EVT_TUXTXT_STYLE_HTML,request);
+				p +=13;
+			}
+			else if (strncmp(p,"%TELETEXT%%",11) == 0)
+			{
+printf("nhttpd tuxtxt reading html\n");
+				SendFIFOMessage2(NeutrinoMessages::EVT_TUXTXT_RENDER_HTML,request);
+				p +=11;
+			}
+			else if (strncmp(p,"%SUBPAGES%%",11) == 0)
+			{
+printf("nhttpd tuxtxt reading subpages\n");
+				char subpg[0x80];
+				SendFIFOMessage(NeutrinoMessages::EVT_TUXTXT_GET_SUBPAGES, (void *)&subpg,0x80);
+				for (int loop = 0; loop < 0x80; loop++)
+				{
+					if (subpg[loop])
+					{
+						//TODO anpassen fr Neutrino pictures
+						sprintf(sp, "<input type=button value=\"%2x\" style=\"width:20px;height:22px; background-image:url(/%s.png);background-repeat:repeat-x\"  onclick=\"setpage(0,%2x)\">",loop,(loop == tsubpage ? "yellow":"green"),loop);
+						request->SocketWrite(sp);
+					}
+				}
+				p +=11;
+			}
+			else if (strncmp(p,"%CURPAGE%%",10) == 0)
+			{
+				request->SocketWrite(pg);
+				p +=10;
+			}
+			else 
+			{
+				request->SocketWrite("%");
+			}
+			request->SocketWrite(p);
+		}
+		else
+			request->SocketWrite(tmpresult);
+	}
+	fclose(fhtml);
+printf("nhttpd tuxtxt html written\n");
+	Parent->EventServer->sendEvent(NeutrinoMessages::EVT_TUXTXT_END_HTML, CEventServer::INITID_HTTPD);
+printf("nhttpd tuxtxt html closed\n");
+	return true;
+}
Index: apps/tuxbox/neutrino/daemons/nhttpd/webapi.h
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/nhttpd/Attic/webapi.h,v
retrieving revision 1.8
diff -b -U3 -r1.8 webapi.h
--- a/apps/tuxbox/neutrino/daemons/nhttpd/webapi.h	28 Mar 2005 14:12:33 -0000	1.8
+++ b/apps/tuxbox/neutrino/daemons/nhttpd/webapi.h	23 Sep 2006 14:12:52 -0000
@@ -60,6 +60,7 @@
 		bool ActualEPG(CWebserverRequest *request);
 		bool EPG(CWebserverRequest *request);
 		bool Switch(CWebserverRequest *request);
+		bool Teletext(CWebserverRequest* request);
 
 		void loadTimerMain(CWebserverRequest *request);
 		void correctTime(struct tm *zt);
@@ -69,7 +70,8 @@
 		void newTimerForm(CWebserverRequest *request);
 		void doNewTimer(CWebserverRequest *request);
 		void timeString(time_t time, char string[6]);
-
+		void SendFIFOMessage(int msg, void* pData, int datasize);
+		void SendFIFOMessage2(int msg, CWebserverRequest* request);
 	public:
 		CWebAPI(CWebDbox *parent) { Parent = parent; }
 		bool Execute(CWebserverRequest* request);
Index: apps/tuxbox/neutrino/daemons/nhttpd/webdbox.cpp
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/daemons/nhttpd/Attic/webdbox.cpp,v
retrieving revision 1.64
diff -b -U3 -r1.64 webdbox.cpp
--- a/apps/tuxbox/neutrino/daemons/nhttpd/webdbox.cpp	17 Jun 2006 17:24:10 -0000	1.64
+++ b/apps/tuxbox/neutrino/daemons/nhttpd/webdbox.cpp	23 Sep 2006 14:12:52 -0000
@@ -158,6 +158,15 @@
 	EventServer->registerEvent2( NeutrinoMessages::EVT_START_PLUGIN, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
 	EventServer->registerEvent2( NeutrinoMessages::LOCK_RC, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
 	EventServer->registerEvent2( NeutrinoMessages::UNLOCK_RC, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
+	EventServer->registerEvent2( NeutrinoMessages::EVT_TUXTXT_INIT_HTML, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
+	EventServer->registerEvent2( NeutrinoMessages::EVT_TUXTXT_END_HTML, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
+	EventServer->registerEvent2( NeutrinoMessages::EVT_TUXTXT_STYLE_HTML, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
+	EventServer->registerEvent2( NeutrinoMessages::EVT_TUXTXT_RENDER_HTML, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
+	EventServer->registerEvent2( NeutrinoMessages::EVT_TUXTXT_SET_PAGE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
+	EventServer->registerEvent2( NeutrinoMessages::EVT_TUXTXT_GET_PAGE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
+	EventServer->registerEvent2( NeutrinoMessages::EVT_TUXTXT_SET_SUBPAGE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
+	EventServer->registerEvent2( NeutrinoMessages::EVT_TUXTXT_GET_SUBPAGE, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
+	EventServer->registerEvent2( NeutrinoMessages::EVT_TUXTXT_GET_SUBPAGES, CEventServer::INITID_HTTPD, "/tmp/neutrino.sock");
 }
 //-------------------------------------------------------------------------
 
Index: apps/tuxbox/neutrino/src/neutrinoMessages.h
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/src/neutrinoMessages.h,v
retrieving revision 1.30
diff -b -U3 -r1.30 neutrinoMessages.h
--- a/apps/tuxbox/neutrino/src/neutrinoMessages.h	19 May 2006 21:28:10 -0000	1.30
+++ b/apps/tuxbox/neutrino/src/neutrinoMessages.h	23 Sep 2006 14:12:52 -0000
@@ -101,6 +101,9 @@
 		/* sectionsd */
 		EVT_SERVICES_UPD                         = CRCInput::RC_Events + 38,
 		EVT_SI_FINISHED                          = CRCInput::RC_Events + 39,
+		/* neutrino tuxtxt-calls for webif*/
+		EVT_TUXTXT_INIT_HTML                     = CRCInput::RC_Events + 40,
+		EVT_TUXTXT_END_HTML                      = CRCInput::RC_Events + 41,
 
 
 		EVT_CURRENTEPG                           = CRCInput::RC_WithData +  1,
@@ -136,7 +139,15 @@
 		EVT_ZAP_GOTPIDS                          = CRCInput::RC_WithData + 21, /* data: (t_channel_id *) */
 
 		/* neutrino */
-		EVT_RECORDING_ENDED                      = CRCInput::RC_WithData + 22
+		EVT_RECORDING_ENDED                      = CRCInput::RC_WithData + 22,
+		/* neutrino tuxtxt-calls for webif*/
+		EVT_TUXTXT_STYLE_HTML                    = CRCInput::RC_WithData + 23, 
+		EVT_TUXTXT_RENDER_HTML                   = CRCInput::RC_WithData + 24, 
+		EVT_TUXTXT_SET_PAGE                      = CRCInput::RC_WithData + 25, /* data: int */
+		EVT_TUXTXT_GET_PAGE                      = CRCInput::RC_WithData + 26, 
+		EVT_TUXTXT_SET_SUBPAGE                   = CRCInput::RC_WithData + 27, /* data: int */
+		EVT_TUXTXT_GET_SUBPAGE                   = CRCInput::RC_WithData + 28, 
+		EVT_TUXTXT_GET_SUBPAGES                  = CRCInput::RC_WithData + 29 
 	};
 	enum
 	{
Index: apps/tuxbox/neutrino/src/gui/infoviewer.cpp
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/src/gui/infoviewer.cpp,v
retrieving revision 1.202
diff -b -U3 -r1.202 infoviewer.cpp
--- a/apps/tuxbox/neutrino/src/gui/infoviewer.cpp	22 Aug 2006 21:50:23 -0000	1.202
+++ b/apps/tuxbox/neutrino/src/gui/infoviewer.cpp	23 Sep 2006 14:12:53 -0000
@@ -71,8 +71,17 @@
 #define LCD_UPDATE_TIME_TV_MODE (60 * 1000 * 1000)
 
 #ifndef TUXTXT_CFG_STANDALONE
-extern "C" void tuxtxt_start(int tpid);
-extern "C" int  tuxtxt_stop();
+#include <tuxtxt/tuxtxt_def.h>
+extern "C"
+{
+	void tuxtxt_start(int tpid);
+	int  tuxtxt_stop();
+	tuxtxt_cache_struct tuxtxt_cache;
+	tstHTML* tuxtxt_InitHTML();
+	void tuxtxt_RenderStylesHTML(tstHTML* pHTML,char* styles);
+	void tuxtxt_RenderHTML(tstHTML* pHTML,char* result );
+	void tuxtxt_EndHTML(tstHTML* pHTML);
+}
 #endif
 
 int time_left_width;
@@ -829,10 +838,122 @@
 		return messages_return::handled;
 	}
 #endif
+#ifndef TUXTXT_CFG_STANDALONE
+#define FIFO_TUXTXT "/tmp/tuxtxt_fifo"
+	else if ( msg == NeutrinoMessages::EVT_TUXTXT_INIT_HTML )
+	{
+printf("Neutrino tuxtxt init\n");
+		pTuxtxtHTML = tuxtxt_InitHTML();
+printf("Neutrino tuxtxt init done\n");
+		return messages_return::handled;
+	}
+	else if ( msg == NeutrinoMessages::EVT_TUXTXT_END_HTML )
+	{
+printf("Neutrino tuxtxt end\n");
+		tuxtxt_EndHTML((tstHTML*)pTuxtxtHTML);
+printf("Neutrino tuxtxt end done\n");
+		return messages_return::handled;
+	}
+	else if (msg == NeutrinoMessages::EVT_TUXTXT_STYLE_HTML)
+	{
+printf("Neutrino tuxtxt styles\n");
+		char styles[200];
+		FILE *fp;
+        	if (fp = fopen(FIFO_TUXTXT, "w"))
+		{
+printf("Neutrino tuxtxt styles FIFO opened\n");
+			while (((tstHTML*)pTuxtxtHTML)->row <24)
+			{
+				tuxtxt_RenderStylesHTML(((tstHTML*)pTuxtxtHTML),styles);
+				fwrite(styles,strlen(styles),1,fp);
+			}
+			fclose(fp);
+printf("Neutrino tuxtxt styles FIFO closed\n");
+			((tstHTML*)pTuxtxtHTML)->row = 0;
+			((tstHTML*)pTuxtxtHTML)->col = 0;
+        	}
+printf("Neutrino tuxtxt styles done\n");
+		return messages_return::handled;
+	}
+	else if (msg == NeutrinoMessages::EVT_TUXTXT_RENDER_HTML)
+	{
+printf("Neutrino tuxtxt html\n");
+		char html[4000];
+		FILE *fp;
+        	if (fp = fopen(FIFO_TUXTXT, "w"))
+		{
+printf("Neutrino tuxtxt html FIFO opened\n");
+			while (((tstHTML*)pTuxtxtHTML)->row <24)
+			{
+				tuxtxt_RenderHTML(((tstHTML*)pTuxtxtHTML),html);
+				fwrite(html,strlen(html),1,fp);
+			}
+			fclose(fp);
+printf("Neutrino tuxtxt html FIFO closed\n");
+			((tstHTML*)pTuxtxtHTML)->row = 0;
+			((tstHTML*)pTuxtxtHTML)->col = 0;
+        	}
+printf("Neutrino tuxtxt html done\n");
+		return messages_return::handled;
+	}
+	else if (msg == NeutrinoMessages::EVT_TUXTXT_SET_PAGE)
+	{
+printf("Neutrino tuxtxt set page %x\n",*(int*)data);
+		tuxtxt_cache.page=*(int*)data;
+		return messages_return::handled;
+	}
+	else if (msg == NeutrinoMessages::EVT_TUXTXT_GET_PAGE)
+	{
+printf("Neutrino tuxtxt get page %x\n",tuxtxt_cache.page);
+		CreateFIFOAnswer(&tuxtxt_cache.page, sizeof(int));
+		return messages_return::handled;
+	}
+	else if (msg == NeutrinoMessages::EVT_TUXTXT_SET_SUBPAGE)
+	{
+		if (*(int*)data == -1) *(int*)data = tuxtxt_cache.subpagetable[tuxtxt_cache.page];
+printf("Neutrino tuxtxt set subpage %x\n",*(int*)data);
+		tuxtxt_cache.subpage=*(int*)data;
+		return messages_return::handled;
+	}
+	else if (msg == NeutrinoMessages::EVT_TUXTXT_GET_SUBPAGE)
+	{
+printf("Neutrino tuxtxt get subpage %x\n",tuxtxt_cache.subpagetable[tuxtxt_cache.page]);
+		CreateFIFOAnswer(&tuxtxt_cache.subpagetable[tuxtxt_cache.page], sizeof(int));
+		return messages_return::handled;
+	}
+	else if (msg == NeutrinoMessages::EVT_TUXTXT_GET_SUBPAGES)
+	{
+printf("Neutrino tuxtxt get subpages\n");
+		char subp[0x80];
+		memset(subp,0,0x80);
+		for (int loop = 0; loop < 0x80; loop++)
+		{
+			if (tuxtxt_cache.astCachetable[tuxtxt_cache.page][loop])
+			{
+				subp[loop]=0x01;
+			}
+		}
+		CreateFIFOAnswer(subp, 0x80);
+printf("Neutrino tuxtxt get subpages done\n");
+		return messages_return::handled;
+	}
+#endif
 	
    return messages_return::unhandled;
 }
-
+#ifndef TUXTXT_CFG_STANDALONE
+void CInfoViewer::CreateFIFOAnswer(void* pData, int datasize)
+{
+printf("Neutrino tuxtxt create FIFO Answer\n");
+        FILE *fp;
+        if((fp = fopen(FIFO_TUXTXT, "w"))) {
+printf("Neutrino tuxtxt create FIFO Answer opened\n");
+		fwrite(pData,datasize,1,fp);
+        }
+        fclose(fp);
+printf("Neutrino tuxtxt create FIFO Answer done\n");
+}
+#endif
 
 void CInfoViewer::showButton_SubServices()
 {
Index: apps/tuxbox/neutrino/src/gui/infoviewer.h
===================================================================
RCS file: /cvs/tuxbox/apps/tuxbox/neutrino/src/gui/infoviewer.h,v
retrieving revision 1.62
diff -b -U3 -r1.62 infoviewer.h
--- a/apps/tuxbox/neutrino/src/gui/infoviewer.h	21 Aug 2006 20:58:26 -0000	1.62
+++ b/apps/tuxbox/neutrino/src/gui/infoviewer.h	23 Sep 2006 14:12:56 -0000
@@ -99,6 +99,10 @@
 	void showFailure();
 	void showMotorMoving(int duration);
    	void showLcdPercentOver();
+#ifndef TUXTXT_CFG_STANDALONE
+	void*       pTuxtxtHTML;
+	void CreateFIFOAnswer(void* pData, int datasize);
+#endif
 
  public:
 	bool	is_visible;