streaminfo update for webinterface

Alles rund um das grafische Benutzerinterface Enigma
mirakels
Neugieriger
Neugieriger
Beiträge: 17
Registriert: Montag 8. November 2004, 23:48

streaminfo update for webinterface

Beitrag von mirakels »

Hello,

as afollowup on the patch in december last year to make the streaminfo on the webpage alike the streaminfo on screen, below follows a patch to complete this work.
To do this I needed to move a structure from streaminfo.cpp to streaminfo.h so this info can be accessed in enigma_dyn.cpp by also including streaminfo.h.
Also I changed the clearCA function into a macro and introduced a variable that holds the number of entries in the caids table.

Finally to view all the streaminfo on the webpage I had to enlarge the window defined for it in index.js

Please consider it for inclusing the CVS.
The patch is against cvs of june 16th
Thanks

PS: the below inclusing might have converted tabs into spaces. If you want to have the code emailed or ftp-ed soemwhere please let me know...

-Marcel

Code: Alles auswählen

--- apps/tuxbox/enigma/data/htdocs/index.js.org 2005-06-17 14:36:40.000000000 +0200
+++ apps/tuxbox/enigma/data/htdocs/index.js     2005-06-17 14:38:31.000000000 +0200
@@ -159,7 +159,7 @@

 function openSI()
 {
-       NewWindow("cgi-bin/streaminfo", "si", "320", "300", "no");
+       NewWindow("cgi-bin/streaminfo", "si", "450", "560", "no");
 }

 function openChannelInfo()
--- apps/tuxbox/enigma/src/streaminfo.h.org     2005-06-17 14:37:10.000000000 +0200
+++ apps/tuxbox/enigma/src/streaminfo.h 2005-06-17 14:38:31.000000000 +0200
@@ -27,4 +27,13 @@
        eString getCAName(int casysid, int always);
 };

+struct caids_t
+{
+       int value, mask;
+       const char *description;
+       int flag;
+} ;
+
+#define clearCA() for (unsigned int i=0; i < caids_cnt; ++i) caids[i].flag=0
+
 #endif
--- apps/tuxbox/enigma/src/streaminfo.cpp.org   2005-06-17 14:37:21.000000000 +0200
+++ apps/tuxbox/enigma/src/streaminfo.cpp       2005-06-17 14:38:31.000000000 +0200
@@ -61,12 +61,7 @@
 }

 /* http://www.dvb.org/index.php?id=16 */
-static struct
-{
-       int value, mask;
-       const char *description;
-       int flag;
-} caids[]=
+struct caids_t  caids[]=
        {{0x0100, 0xFF00, "Seca/Mediaguard (Canal Plus)", 0},
        {0x0200, 0xFF00, "CCETT", 0},
        {0x0300, 0xFF00, "MSG MediaServices GmbH", 0},
@@ -128,15 +123,11 @@
        {0x4AD2, 0xFFFE, "Beijing Digital Video Technology Co., Ltd.", 0},
        {0x0000, 0x0000, "other/unknown", 0}};

-static void clearCA()
-{
-       for (unsigned int i=0; i< sizeof(caids)/sizeof(*caids); ++i)
-               caids[i].flag=0;
-}
+unsigned int caids_cnt = sizeof(caids)/sizeof(struct caids_t);

 eString eStreaminfo::getCAName(int casysid, int always)
 {
-       for (unsigned int i=0; i< sizeof(caids)/sizeof(*caids); ++i)
+       for (unsigned int i=0; i< caids_cnt; ++i)
                if ((casysid & caids[i].mask) == caids[i].value)
                {
                        if ((caids[i].flag) && !always)
--- apps/tuxbox/enigma/src/enigma_dyn.cpp.org   2005-06-17 14:37:37.000000000 +0200
+++ apps/tuxbox/enigma/src/enigma_dyn.cpp       2005-06-17 14:40:44.000000000 +0200
@@ -58,6 +58,7 @@
 #include <enigma_streamer.h>
 #include <enigma_processutils.h>
 #include <epgwindow.h>
+#include <streaminfo.h>
 #include <enigma_mount.h>

 using namespace std;
@@ -95,6 +96,9 @@
 extern bool onSameTP(const eServiceReferenceDVB& ref1, const eServiceReferenceDVB &ref2); // implemented in timer.cpp
 extern bool canPlayService( const eServiceReference & ref ); // implemented in timer.cpp

+extern struct caids_t caids[];
+extern unsigned int caids_cnt;
+
 eString firmwareLevel(eString verid)
 {
        eString result = "unknown";
@@ -3131,9 +3135,9 @@
                "<table cellspacing=5 cellpadding=0 border=0>"
                "<tr><td>Name:</td><td>" << name << "</td></tr>"
                "<tr><td>Provider:</td><td>" << provider << "</td></tr>";
-               eString sRef;
-               if (eServiceInterface::getInstance()->service)
-                       sRef = eServiceInterface::getInstance()->service.toString();
+       eString sRef;
+       if (eServiceInterface::getInstance()->service)
+               sRef = eServiceInterface::getInstance()->service.toString();
        result << "<tr><td>Service reference:</td><td>" << sRef << "</td></tr>"
                "<tr><td>VPID:</td><td>" << vpid << "</td></tr>"
                "<tr><td>APID:</td><td>" << apid << "</td></tr>"
@@ -3145,6 +3149,193 @@
                "<tr><td>PMT:</td><td>" << pmt << "</td></tr>"
                "<tr><td>Video Format:<td>" << vidform << "</td></tr>"
                "<tr><td>Namespace:<td>" << namespc << "</td></tr>"
+                ;
+
+       result << "\n<tr><td valign=top>Supported coding systems:</td><td>";
+       clearCA();
+       // singleLock s(eDVBServiceController::availCALock);
+       std::set<int>& availCA = sapi->availableCASystems;
+       for (std::set<int>::iterator i(availCA.begin()); i != availCA.end(); ++i)
+       {
+               eString caname=eStreaminfo::getInstance()->getCAName(*i, 0);
+               if (caname)
+                       result << caname << "<br>";
+       }
+
+       result << "</td></tr>\n<tr><td valign=top>Systems used in service:</td><td>";
+       int foundone = 0;
+       std::set<int>& calist = sapi->usedCASystems;
+       for (std::set<int>::iterator i(calist.begin()); i != calist.end(); ++i)
+       {
+               eString caname=eStreaminfo::getInstance()->getCAName(*i, 1);
+               eString codesys = eString().sprintf("%04xh:  ", *i) + caname;
+               result << codesys << "<br>";
+               foundone++;
+       }
+       if (!foundone)
+               result << "None";
+       result << "</td></tr>\n";
+
+       eTransponder *tp = sapi->transponder;
+       if (tp)
+       {
+               int systype = eSystemInfo::getInstance()->getFEType();
+               if ( systype == eSystemInfo::feSatellite )
+               {
+                       result << "<tr><td>Satellite<td>";
+                       int found = 0;
+                       for ( std::list<eLNB>::iterator it( eTransponderList::getInstance()->getLNBs().begin() );
+                                       found == 0 && it != eTransponderList::getInstance()->getLNBs().end(); it++)
+                               for ( ePtrList<eSatellite>::iterator s ( it->getSatelliteList().begin() );
+                                       s != it->getSatelliteList().end(); s++)
+                                       if (s->getOrbitalPosition() == tp->satellite.orbital_position) {
+                                               result <<  s->getDescription().c_str();
+                                               found = 1;
+                                               break;
+                                       }
+                       result << "</td></tr>";
+                       result <<  eString().sprintf("<tr><td>Frequency<td>%d MHz</tr>"
+                                       "<tr><td>Symbol Rate<td>%d Ksymbols/s</tr>"
+                                       "<tr><td>Polarity<td>%s</tr>"
+                                       "<tr><td>Inversion<td>%s</tr>",
+                                       tp->satellite.frequency / 1000,
+                                       tp->satellite.symbol_rate / 1000,
+                                       tp->satellite.polarisation ? "Vertical" : "Horizontal",
+                                       tp->satellite.inversion ? "Yes" : "No");
+
+                       result << "<tr><td>FEC<td>";
+                       switch (tp->satellite.fec)
+                       {
+                               case 0: result << "Auto"; break;
+                               case 1: result << "1/2"; break;
+                               case 2: result << "2/3"; break;
+                               case 3: result << "3/4"; break;
+                               case 4: result << "5/6"; break;
+                               case 5: result << "7/8"; break;
+                               case 6: result << "8/9"; break;
+                       }
+                       result << "</tr>";
+
+                       // Does this work for cable and terrestrial too???
+                       eFrontend *fe = eFrontend::getInstance();
+                       int status = fe->Status();
+                       bool lock = status & FE_HAS_LOCK;
+                       bool sync = status & FE_HAS_SYNC;
+                       result <<  eString().sprintf("<tr><td>SNR<td>%d%%</tr>", fe->SNR() * 100/65535);
+                       result <<  eString().sprintf("<tr><td>AGC<td>%d%%</tr>", fe->SignalStrength() * 100/65535);
+                       result <<  eString().sprintf("<tr><td>BER<td>%u</tr>", fe->BER());
+                       result << "<tr><td>Lock<td>" << (lock ? "Yes" : "No");
+                       result << "<tr><td>Sync<td>" << (sync ? "Yes" : "No");
+               }
+               else if ( systype == eSystemInfo::feCable )
+               {
+                       result <<  eString().sprintf("<tr><td>Frequency<td>%d MHz</tr>"
+                                               "<tr><td>Symbol Rate<td>%d Ksymbols/s</tr>"
+                                               "<tr><td>Inversion<td>%s</tr>",
+                                               tp->cable.frequency / 1000,
+                                               tp->cable.symbol_rate / 1000,
+                                               tp->cable.inversion ? "Yes" : "No");
+
+                       result << "<tr><td>Modulation<td>";
+                       switch (tp->cable.modulation)
+                       {
+                               case 0: result << "Auto"; break;
+                               case 1: result << "16-QAM"; break;
+                               case 2: result << "32-QAM"; break;
+                               case 3: result << "64-QAM"; break;
+                               case 4: result << "128-QAM"; break;
+                               case 5: result << "256-QAM"; break;
+                       }
+                       result << "</tr>";
+
+                       result << "<tr><td>FEC inner<td>";
+                       switch (tp->cable.fec_inner)
+                       {
+                               case 0: result << "Auto"; break;
+                               case 1: result << "1/2"; break;
+                               case 2: result << "2/3"; break;
+                               case 3: result << "3/4"; break;
+                               case 4: result << "5/6"; break;
+                               case 5: result << "7/8"; break;
+                               case 6: result << "8/9"; break;
+                       }
+                       result << "</tr>";
+               }
+               else if ( systype == eSystemInfo::feTerrestrial)
+               {
+                       result <<  eString().sprintf("<tr><td>Centre Frequency<td>%d MHz</tr>"
+                                               "<tr><td>Inversion<td>%d</tr>"
+                                               "<tr><td>Hierarchy Information<td>%d</tr>",
+                                               tp->terrestrial.centre_frequency / 1000,
+                                               tp->terrestrial.inversion,
+                                               tp->terrestrial.hierarchy_information);
+
+                       result << "<tr><td>Bandwidth<td>";
+                       switch (tp->terrestrial.bandwidth)
+                       {
+                               case 0: result << "8"; break;
+                               case 1: result << "7"; break;
+                               case 2: result << "6"; break;
+                       }
+                       result << " MHz</tr>";
+
+                       result << "<tr><td>Constellation<td>";
+                       switch (tp->terrestrial.constellation)
+                       {
+                               case 0: result << "Auto"; break;
+                               case 1: result << "QPSK"; break;
+                               case 2: result << "16-QAM"; break;
+                               case 3: result << "64-QAM"; break;
+                       }
+                       result << "</tr>";
+
+                       result << "<tr><td>Guard Interval<td>";
+                       switch (tp->terrestrial.guard_interval)
+                       {
+                               case 0: result << "Auto"; break;
+                               case 1: result << "1/32"; break;
+                               case 2: result << "1/16"; break;
+                               case 3: result << "1/8"; break;
+                               case 4: result << "1/4"; break;
+                       }
+                       result << "</tr>";
+
+                       result << "<tr><td>Transmission Mode<td>";
+                       switch (tp->terrestrial.transmission_mode)
+                       {
+                               case 0: result << "Auto"; break;
+                               case 1: result << "2k"; break;
+                               case 2: result << "8k"; break;
+                       }
+                       result << "</tr>";
+
+                       result << "<tr><td>codeRateLP<td>";
+                       switch (tp->terrestrial.code_rate_lp)
+                       {
+                               case 0: result << "Auto"; break;
+                               case 1: result << "1/2"; break;
+                               case 2: result << "2/3"; break;
+                               case 3: result << "3/4"; break;
+                               case 4: result << "5/6"; break;
+                               case 5: result << "7/8"; break;
+                       }
+                       result << "</tr>";
+
+                       result << "<tr><td>codeRateHP<td>";
+                       switch (tp->terrestrial.code_rate_hp)
+                       {
+                               case 0: result << "Auto"; break;
+                               case 1: result << "1/2"; break;
+                               case 2: result << "2/3"; break;
+                               case 3: result << "3/4"; break;
+                               case 4: result << "5/6"; break;
+                               case 5: result << "7/8"; break;
+                       }
+                       result << "</tr>";
+               }
+       }
+
+       result <<
                "</table>"
                "</body>"
                "</html>";
[/code]
digi_casi

Beitrag von digi_casi »

put it into cvs... thanks.