[vdr] femon cleanup/SVDRP enhancement

Herbert Poetzl herbert at 13thfloor.at
Sun Jun 18 01:01:36 CEST 2006


Hi Rolf! Folks!

the first patch moves most of the value-to-string
conversions from femonosd.c to femontools.c and 
declares them properly in the femontools.h file.
the osd part is updated to utilize them.

the second patch extends the SVDRP interface of
femon by a basic INFO command (which can easily 
be extended in the future), giving output like
this:

PLUG femon INFO
900- Frequency:   11158 Mhz    Source:       S13.0E
900- Srate:       27500        Polarization: V
900- Inversion:   Auto         Coderate: Auto, Auto
900- Vpid:   369  Ppid:   369  Tpid:     0
900- Sid:  13108  Nid:      0  Tid:      0  Rid:     0
900- Apid:   370
900- Dpid:     0
900  CA:    1801

would be nice to get some feedback

TIA,
Herbert


diff -u femon-1.0.1.2/femontools.c femon-1.0.1.2/femontools.c
--- femon-1.0.1.2/femontools.c	2006-06-18 00:29:21.000000000 +0200
+++ femon-1.0.1.2/femontools.c	2006-06-18 00:29:21.000000000 +0200
@@ -154,0 +155,212 @@
+
+cString convCA(int value)
+{
+  cString str;
+
+  /* http://www.dvb.org/index.php?id=174 */
+  switch (value) {
+    case 0x0000:
+  	 /* Reserved */
+  	 str = cString(tr("Free to Air"));
+  	 break;
+    case 0x0001 ... 0x00FF:
+  	 /* Standardized systems */
+  	 if ((value == 0x00A0) || (value == 0x00A1))
+  	    str = cString(tr("Analog"));
+  	 else
+  	    str = cString(tr("Fixed"));
+  	 break;
+    case 0x0100 ... 0x01FF:
+  	 /* Canal Plus */
+  	 str = cString(tr("SECA/Mediaguard"));
+  	 break;
+    case 0x0500 ... 0x05FF:
+  	 /* France Telecom */
+  	 str = cString(tr("Viaccess"));
+  	 break;
+    case 0x0600 ... 0x06FF:
+  	 /* Irdeto */
+  	 str = cString(tr("Irdeto"));
+  	 break;
+    case 0x0900 ... 0x09FF:
+  	 /* News Datacom */
+  	 str = cString(tr("NDS/Videoguard"));
+  	 break;
+    case 0x0B00 ... 0x0BFF:
+  	 /* Norwegian Telekom */
+  	 str = cString(tr("Conax"));
+  	 break;
+    case 0x0D00 ... 0x0DFF:
+  	 /* Philips */
+  	 str = cString(tr("CryptoWorks"));
+  	 break;
+    case 0x0E00 ... 0x0EFF:
+  	 /* Scientific Atlanta */
+  	 str = cString(tr("PowerVu"));
+  	 break;
+    case 0x1200 ... 0x12FF:
+  	 /* BellVu Express */
+  	 str = cString(tr("NagraVision"));
+  	 break;
+    case 0x1700 ... 0x17FF:
+  	 /* BetaTechnik */
+  	 str = cString(tr("BetaCrypt"));
+  	 break;
+    case 0x1800 ... 0x18FF:
+  	 /* Kudelski SA */
+  	 str = cString(tr("NagraVision"));
+  	 break;
+    case 0x4A60 ... 0x4A6F:
+  	 /* @Sky */
+  	 str = cString(tr("SkyCrypt"));
+  	 break;
+    default:
+  	 str = cString::sprintf("%X", value);
+  	 break;
+    }
+  return str;
+}
+
+cString convCoderate(int value)
+{
+  cString str;
+
+  if	  (value == FEC_NONE)  str = cString(tr("None"));
+  else if (value == FEC_1_2)   str = cString("1/2");
+  else if (value == FEC_2_3)   str = cString("2/3");
+  else if (value == FEC_3_4)   str = cString("3/4");
+  else if (value == FEC_4_5)   str = cString("4/5");
+  else if (value == FEC_5_6)   str = cString("5/6");
+  else if (value == FEC_6_7)   str = cString("6/7");
+  else if (value == FEC_7_8)   str = cString("7/8");
+  else if (value == FEC_8_9)   str = cString("8/9");
+  else  	  /*FEC_AUTO*/ str = cString(tr("Auto"));
+  return str;
+}
+
+cString convInversion(int value)
+{
+  cString str;
+
+  if	  (value == INVERSION_OFF)   str = cString(tr("Off"));
+  else if (value == INVERSION_ON)    str = cString(tr("On"));
+  else  	  /*INVERSION_AUTO*/ str = cString(tr("Auto"));
+  return str;
+}
+
+cString convModulation(int value)
+{
+  cString str;
+ 
+  if	  (value == QPSK)      str = cString("QPSK");
+  else if (value == QAM_16)    str = cString("QAM 16");
+  else if (value == QAM_32)    str = cString("QAM 32");
+  else if (value == QAM_64)    str = cString("QAM 64");
+  else if (value == QAM_128)   str = cString("QAM 128");
+  else if (value == QAM_256)   str = cString("QAM 256");
+  else  	  /*QAM_AUTO*/ str = cString::sprintf("QAM %s", tr("Auto"));
+  return str;
+}
+
+cString convAspectRatio(int value)
+{
+  cString str;
+  
+  if	  (value == AR_1_1)    str = cString("1:1");
+  else if (value == AR_4_3)    str = cString("4:3");
+  else if (value == AR_16_9)   str = cString("16:9");
+  else if (value == AR_2_21_1) str = cString("2.21:1");
+  else  		       str = cString(tr("reserved"));
+  return str;
+}
+
+cString convVideoFormat(int value)
+{
+  cString str;
+  
+  if	  (value == VF_PAL)    str = cString(tr("PAL"));
+  else if (value == VF_NTSC)   str = cString(tr("NTSC"));
+  else  		       str = cString(tr("unknown"));
+  return str;
+}
+
+
+cString convAC3BitStreamMode(int value, int mode)
+{
+  cString str;
+
+  switch (value) {
+    case 0: str = cString(tr("Complete Main (CM)"));	 break;
+    case 1: str = cString(tr("Music and Effects (ME)")); break;
+    case 2: str = cString(tr("Visually Impaired (VI)")); break;
+    case 3: str = cString(tr("Hearing Impaired (HI)"));  break;
+    case 4: str = cString(tr("Dialogue (D)"));  	 break;
+    case 5: str = cString(tr("Commentary (C)"));	 break;
+    case 6: str = cString(tr("Emergency (E)")); 	 break;
+    case 7: str = (mode == 1) ? cString(tr("Voice Over (VO)")) : cString(tr("Karaoke")); break;
+    default: str = cString("---");
+    }
+  return str;
+}
+
+cString convAC3AudioCodingMode(int value)
+{
+  cString str;
+
+  switch (value) {
+    case 0:  str = cString::sprintf("1+1 - %s, %s",	       tr("Ch1"), tr("Ch2"));			         break;
+    case 1:  str = cString::sprintf("1/0 - %s",  	       tr("C"));					 break;
+    case 2:  str = cString::sprintf("2/0 - %s, %s",	       tr("L"), tr("R"));				 break;
+    case 3:  str = cString::sprintf("3/0 - %s, %s, %s",         tr("L"), tr("C"), tr("R"));			 break;
+    case 4:  str = cString::sprintf("2/1 - %s, %s, %s",         tr("L"), tr("R"), tr("S"));			 break;
+    case 5:  str = cString::sprintf("3/1 - %s, %s, %s, %s",     tr("L"), tr("C"), tr("R"),  tr("S"));	         break;
+    case 6:  str = cString::sprintf("2/2 - %s, %s, %s, %s",     tr("L"), tr("R"), tr("SL"), tr("SR"));		 break;
+    case 7:  str = cString::sprintf("3/2 - %s, %s, %s, %s, %s", tr("L"), tr("C"), tr("R"),  tr("SL"), tr("SR")); break;
+    default: str = cString("---");
+    }
+  return str;
+}
+
+cString convAC3CenterMixLevel(int value)
+{
+  cString str;
+
+  switch (value) {
+    case CML_MINUS_3dB:   str = cString::sprintf("-3.0 %s", tr("dB")); break;
+    case CML_MINUS_4_5dB: str = cString::sprintf("-4.5 %s", tr("dB")); break;
+    case CML_MINUS_6dB:   str = cString::sprintf("-6.0 %s", tr("dB")); break;
+    case CML_RESERVED:    str = cString(tr("reserved")); break;
+    default:		  str = cString("---");
+    }
+  return str;
+}
+
+cString convAC3SurroundMixLevel(int value)
+{
+  cString str;
+
+  switch (value) {
+    case SML_MINUS_3dB:   str = cString::sprintf("-3 %s", tr("dB"));   break;
+    case SML_MINUS_6dB:   str = cString::sprintf("-6 %s", tr("dB"));   break;
+    case SML_0_dB:	  str = cString::sprintf("0 %s", tr("dB"));    break;
+    case SML_RESERVED:	  str = cString(tr("reserved")); break;
+    default:		  str = cString("---");
+    }
+  return str;
+}
+
+cString convAC3DolbySurroundMode(int value)
+{
+  cString str;
+
+  switch (value) {
+    case DSM_NOT_INDICATED:	str = cString(tr("not indicated"));    break;
+    case DSM_NOT_DOLBYSURROUND: str = cString(tr("no"));	       break;
+    case DSM_DOLBYSURROUND:	str = cString(tr("yes"));	       break;
+    case DSM_RESERVED:  	str = cString(tr("reserved"));	       break;
+    default:			str = cString("---");
+    }
+  return str;
+}
+
+
diff -u femon-1.0.1.2/femontools.h femon-1.0.1.2/femontools.h
--- femon-1.0.1.2/femontools.h	2006-06-18 00:09:50.000000000 +0200
+++ femon-1.0.1.2/femontools.h	2006-06-18 00:09:50.000000000 +0200
@@ -30,2 +30,15 @@
 
+cString convCA(int value);
+cString convCoderate(int value);
+cString convInversion(int value);
+cString convModulation(int value);
+cString convAspectRatio(int value);
+cString convVideoFormat(int value);
+
+cString convAC3BitStreamMode(int value, int mode);
+cString convAC3AudioCodingMode(int value);
+cString convAC3CenterMixLevel(int value);
+cString convAC3SurroundMixLevel(int value);
+cString convAC3DolbySurroundMode(int value);
+
 #endif // __FEMONTOOLS_H
only in patch2:
unchanged:
--- femon-1.0.1/femonosd.c	2006-06-06 03:20:00.000000000 +0200
+++ femon-1.0.1.2/femonosd.c	2006-06-17 22:17:37.000000000 +0200
@@ -412,69 +412,8 @@ void cFemonOsd::DrawInfoWindow(void)
         m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
         offset += OSDROWHEIGHT;
         m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("CA"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-        value = channel->Ca();
         if (femonConfig.showcasystem) {
-           /* http://www.dvb.org/index.php?id=174 */
-           switch (value) {
-             case 0x0000:
-                  /* Reserved */
-                  snprintf(buf, sizeof(buf), "%s", tr("Free to Air"));
-                  break;
-             case 0x0001 ... 0x00FF:
-                  /* Standardized systems */
-                  if ((value == 0x00A0) || (value == 0x00A1))
-                     snprintf(buf, sizeof(buf), "%s", tr("Analog"));
-                  else
-                     snprintf(buf, sizeof(buf), "%s", tr("Fixed"));
-                  break;
-             case 0x0100 ... 0x01FF:
-                  /* Canal Plus */
-                  snprintf(buf, sizeof(buf), "%s", tr("SECA/Mediaguard"));
-                  break;
-             case 0x0500 ... 0x05FF:
-                  /* France Telecom */
-                  snprintf(buf, sizeof(buf), "%s", tr("Viaccess"));
-                  break;
-             case 0x0600 ... 0x06FF:
-                  /* Irdeto */
-                  snprintf(buf, sizeof(buf), "%s", tr("Irdeto"));
-                  break;
-             case 0x0900 ... 0x09FF:
-                  /* News Datacom */
-                  snprintf(buf, sizeof(buf), "%s", tr("NDS/Videoguard"));
-                  break;
-             case 0x0B00 ... 0x0BFF:
-                  /* Norwegian Telekom */
-                  snprintf(buf, sizeof(buf), "%s", tr("Conax"));
-                  break;
-             case 0x0D00 ... 0x0DFF:
-                  /* Philips */
-                  snprintf(buf, sizeof(buf), "%s", tr("CryptoWorks"));
-                  break;
-             case 0x0E00 ... 0x0EFF:
-                  /* Scientific Atlanta */
-                  snprintf(buf, sizeof(buf), "%s", tr("PowerVu"));
-                  break;
-             case 0x1200 ... 0x12FF:
-                  /* BellVu Express */
-                  snprintf(buf, sizeof(buf), "%s", tr("NagraVision"));
-                  break;
-             case 0x1700 ... 0x17FF:
-                  /* BetaTechnik */
-                  snprintf(buf, sizeof(buf), "%s", tr("BetaCrypt"));
-                  break;
-             case 0x1800 ... 0x18FF:
-                  /* Kudelski SA */
-                  snprintf(buf, sizeof(buf), "%s", tr("NagraVision"));
-                  break;
-             case 0x4A60 ... 0x4A6F:
-                  /* @Sky */
-                  snprintf(buf, sizeof(buf), "%s", tr("SkyCrypt"));
-                  break;
-             default:
-                  snprintf(buf, sizeof(buf), "%X", value);
-                  break;
-             }
+           snprintf(buf, sizeof(buf), "%s", *convCA(channel->Ca()));
            }
         else {
            snprintf(buf, sizeof(buf), "%X", value);
@@ -531,17 +470,7 @@ void cFemonOsd::DrawInfoWindow(void)
                else            /*INVERSION_AUTO*/ snprintf(buf, sizeof(buf), tr("Auto"));
                m_Osd->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("CoderateH"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-               value = channel->CoderateH();
-               if      (value == FEC_NONE)  snprintf(buf, sizeof(buf), tr("None"));
-               else if (value == FEC_1_2)   snprintf(buf, sizeof(buf), "1/2");
-               else if (value == FEC_2_3)   snprintf(buf, sizeof(buf), "2/3");
-               else if (value == FEC_3_4)   snprintf(buf, sizeof(buf), "3/4");
-               else if (value == FEC_4_5)   snprintf(buf, sizeof(buf), "4/5");
-               else if (value == FEC_5_6)   snprintf(buf, sizeof(buf), "5/6");
-               else if (value == FEC_6_7)   snprintf(buf, sizeof(buf), "6/7");
-               else if (value == FEC_7_8)   snprintf(buf, sizeof(buf), "7/8");
-               else if (value == FEC_8_9)   snprintf(buf, sizeof(buf), "8/9");
-               else            /*FEC_AUTO*/ snprintf(buf, sizeof(buf), tr("Auto"));
+               snprintf(buf, sizeof(buf), "%s", *convCoderate(channel->CoderateH()));
                m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                break;
 
@@ -562,14 +491,7 @@ void cFemonOsd::DrawInfoWindow(void)
                snprintf(buf, sizeof(buf), "%d", channel->Srate());
                m_Osd->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("Modulation"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-               value = channel->Modulation();
-               if      (value == QPSK)      snprintf(buf, sizeof(buf), "QPSK");
-               else if (value == QAM_16)    snprintf(buf, sizeof(buf), "QAM 16");
-               else if (value == QAM_32)    snprintf(buf, sizeof(buf), "QAM 32");
-               else if (value == QAM_64)    snprintf(buf, sizeof(buf), "QAM 64");
-               else if (value == QAM_128)   snprintf(buf, sizeof(buf), "QAM 128");
-               else if (value == QAM_256)   snprintf(buf, sizeof(buf), "QAM 256");
-               else            /*QAM_AUTO*/ snprintf(buf, sizeof(buf), "QAM %s", tr("Auto"));
+               snprintf(buf, sizeof(buf), "%s", *convModulation(channel->Modulation()));
                m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                offset += OSDROWHEIGHT;
                m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Inversion"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
@@ -579,17 +501,7 @@ void cFemonOsd::DrawInfoWindow(void)
                else            /*INVERSION_AUTO*/ snprintf(buf, sizeof(buf), tr("Auto"));
                m_Osd->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("CoderateH"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-               value = channel->CoderateH();
-               if      (value == FEC_NONE)  snprintf(buf, sizeof(buf), tr("None"));
-               else if (value == FEC_1_2)   snprintf(buf, sizeof(buf), "1/2");
-               else if (value == FEC_2_3)   snprintf(buf, sizeof(buf), "2/3");
-               else if (value == FEC_3_4)   snprintf(buf, sizeof(buf), "3/4");
-               else if (value == FEC_4_5)   snprintf(buf, sizeof(buf), "4/5");
-               else if (value == FEC_5_6)   snprintf(buf, sizeof(buf), "5/6");
-               else if (value == FEC_6_7)   snprintf(buf, sizeof(buf), "6/7");
-               else if (value == FEC_7_8)   snprintf(buf, sizeof(buf), "7/8");
-               else if (value == FEC_8_9)   snprintf(buf, sizeof(buf), "8/9");
-               else            /*FEC_AUTO*/ snprintf(buf, sizeof(buf), tr("Auto"));
+               snprintf(buf, sizeof(buf), "%s", *convCoderate(channel->CoderateH()));
                m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                break;
 
@@ -617,14 +529,7 @@ void cFemonOsd::DrawInfoWindow(void)
                else            /*BANDWIDTH_AUTO*/ snprintf(buf, sizeof(buf), tr("Auto"));
                m_Osd->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("Modulation"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-               value = channel->Modulation();
-               if      (value == QPSK)      snprintf(buf, sizeof(buf), "QPSK");
-               else if (value == QAM_16)    snprintf(buf, sizeof(buf), "QAM 16");
-               else if (value == QAM_32)    snprintf(buf, sizeof(buf), "QAM 32");
-               else if (value == QAM_64)    snprintf(buf, sizeof(buf), "QAM 64");
-               else if (value == QAM_128)   snprintf(buf, sizeof(buf), "QAM 128");
-               else if (value == QAM_256)   snprintf(buf, sizeof(buf), "QAM 256");
-               else            /*QAM_AUTO*/ snprintf(buf, sizeof(buf), "QAM %s", tr("Auto"));
+               snprintf(buf, sizeof(buf), "%s", *convModulation(channel->Modulation()));
                m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                offset += OSDROWHEIGHT;
                m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Inversion"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
@@ -634,29 +539,7 @@ void cFemonOsd::DrawInfoWindow(void)
                else            /*INVERSION_AUTO*/ snprintf(buf, sizeof(buf), tr("Auto"));
                m_Osd->DrawText(OSDINFOWIN_X(2), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), tr("Coderate"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-               value = channel->CoderateH();
-               if      (value == FEC_NONE)  snprintf(buf, sizeof(buf), "%s (H)", tr("None"));
-               else if (value == FEC_1_2)   snprintf(buf, sizeof(buf), "1/2 (H)");
-               else if (value == FEC_2_3)   snprintf(buf, sizeof(buf), "2/3 (H)");
-               else if (value == FEC_3_4)   snprintf(buf, sizeof(buf), "3/4 (H)");
-               else if (value == FEC_4_5)   snprintf(buf, sizeof(buf), "4/5 (H)");
-               else if (value == FEC_5_6)   snprintf(buf, sizeof(buf), "5/6 (H)");
-               else if (value == FEC_6_7)   snprintf(buf, sizeof(buf), "6/7 (H)");
-               else if (value == FEC_7_8)   snprintf(buf, sizeof(buf), "7/8 (H)");
-               else if (value == FEC_8_9)   snprintf(buf, sizeof(buf), "8/9 (H)");
-               else            /*FEC_AUTO*/ snprintf(buf, sizeof(buf), "%s (H)", tr("Auto"));
-               value = channel->CoderateL();
-               if      (value == FEC_NONE)  snprintf(buf2, sizeof(buf2), " %s (L)", tr("None"));
-               else if (value == FEC_1_2)   snprintf(buf2, sizeof(buf2), " 1/2 (L)");
-               else if (value == FEC_2_3)   snprintf(buf2, sizeof(buf2), " 2/3 (L)");
-               else if (value == FEC_3_4)   snprintf(buf2, sizeof(buf2), " 3/4 (L)");
-               else if (value == FEC_4_5)   snprintf(buf2, sizeof(buf2), " 4/5 (L)");
-               else if (value == FEC_5_6)   snprintf(buf2, sizeof(buf2), " 5/6 (L)");
-               else if (value == FEC_6_7)   snprintf(buf2, sizeof(buf2), " 6/7 (L)");
-               else if (value == FEC_7_8)   snprintf(buf2, sizeof(buf2), " 7/8 (L)");
-               else if (value == FEC_8_9)   snprintf(buf2, sizeof(buf2), " 8/9 (L)");
-               else            /*FEC_AUTO*/ snprintf(buf2, sizeof(buf2), " %s (L)", tr("Auto"));
-               strncat(buf, buf2, sizeof(buf));
+               snprintf(buf, sizeof(buf), "%s (H) %s (L)", *convCoderate(channel->CoderateH()), *convCoderate(channel->CoderateL()));
                m_Osd->DrawText(OSDINFOWIN_X(4), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
                offset += OSDROWHEIGHT;
                m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Hierarchy"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
@@ -701,15 +584,10 @@ void cFemonOsd::DrawInfoWindow(void)
         m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
         offset += OSDROWHEIGHT;
         m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Aspect Ratio"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-        if (m_Receiver) {
-           value = m_Receiver->VideoAspectRatio();
-           if      (value == AR_1_1)    snprintf(buf, sizeof(buf), "1:1");
-           else if (value == AR_4_3)    snprintf(buf, sizeof(buf), "4:3");
-           else if (value == AR_16_9)   snprintf(buf, sizeof(buf), "16:9");
-           else if (value == AR_2_21_1) snprintf(buf, sizeof(buf), "2.21:1");
-           else                         snprintf(buf, sizeof(buf), "%s", tr("reserved"));
-           }
-        else                            snprintf(buf, sizeof(buf), "---");
+        if (m_Receiver)
+           snprintf(buf, sizeof(buf), "%s", *convAspectRatio(m_Receiver->VideoAspectRatio()));
+        else
+	   snprintf(buf, sizeof(buf), "---");
         m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
         offset += OSDROWHEIGHT;
         m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Frame Rate"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
@@ -718,13 +596,10 @@ void cFemonOsd::DrawInfoWindow(void)
         m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
         offset += OSDROWHEIGHT;
         m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Video Format"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-        if (m_Receiver) {
-           value = m_Receiver->VideoFormat();
-           if      (value == VF_PAL)  snprintf(buf, sizeof(buf), "%s", tr("PAL"));
-           else if (value == VF_NTSC) snprintf(buf, sizeof(buf), "%s", tr("NTSC"));
-           else                       snprintf(buf, sizeof(buf), "%s", tr("unknown"));
-           }
-        else                          snprintf(buf, sizeof(buf), "---");
+        if (m_Receiver)
+           snprintf(buf, sizeof(buf), "%s", *convVideoFormat(m_Receiver->VideoFormat()));
+        else
+	   snprintf(buf, sizeof(buf), "---");
         m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
         offset += OSDROWHEIGHT;
         m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Resolution"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
@@ -788,64 +663,25 @@ void cFemonOsd::DrawInfoWindow(void)
            m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
            offset += OSDROWHEIGHT;
            m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Bit Stream Mode"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-           switch (m_Receiver->AC3BitStreamMode()) {
-             case 0: snprintf(buf, sizeof(buf), tr("Complete Main (CM)"));     break;
-             case 1: snprintf(buf, sizeof(buf), tr("Music and Effects (ME)")); break;
-             case 2: snprintf(buf, sizeof(buf), tr("Visually Impaired (VI)")); break;
-             case 3: snprintf(buf, sizeof(buf), tr("Hearing Impaired (HI)"));  break;
-             case 4: snprintf(buf, sizeof(buf), tr("Dialogue (D)"));           break;
-             case 5: snprintf(buf, sizeof(buf), tr("Commentary (C)"));         break;
-             case 6: snprintf(buf, sizeof(buf), tr("Emergency (E)"));          break;
-             case 7: (m_Receiver->AC3AudioCodingMode() == 1) ? snprintf(buf, sizeof(buf), tr("Voice Over (VO)")) : snprintf(buf, sizeof(buf), tr("Karaoke")); break;
-             default: snprintf(buf, sizeof(buf), "---");
-             }
+	   snprintf(buf, sizeof(buf), "%s", *convAC3BitStreamMode(m_Receiver->AC3BitStreamMode(), m_Receiver->AC3AudioCodingMode()));
            m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
            offset += OSDROWHEIGHT;
            m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Audio Coding Mode"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-           if (m_Receiver->AC3BitStreamMode() != 7) {
-              switch (m_Receiver->AC3AudioCodingMode()) {
-                case 0:  snprintf(buf, sizeof(buf), "1+1 - %s, %s",             tr("Ch1"), tr("Ch2"));                           break;
-                case 1:  snprintf(buf, sizeof(buf), "1/0 - %s",                 tr("C"));                                        break;
-                case 2:  snprintf(buf, sizeof(buf), "2/0 - %s, %s",             tr("L"), tr("R"));                               break;
-                case 3:  snprintf(buf, sizeof(buf), "3/0 - %s, %s, %s",         tr("L"), tr("C"), tr("R"));                      break;
-                case 4:  snprintf(buf, sizeof(buf), "2/1 - %s, %s, %s",         tr("L"), tr("R"), tr("S"));                      break;
-                case 5:  snprintf(buf, sizeof(buf), "3/1 - %s, %s, %s, %s",     tr("L"), tr("C"), tr("R"),  tr("S"));            break;
-                case 6:  snprintf(buf, sizeof(buf), "2/2 - %s, %s, %s, %s",     tr("L"), tr("R"), tr("SL"), tr("SR"));           break;
-                case 7:  snprintf(buf, sizeof(buf), "3/2 - %s, %s, %s, %s, %s", tr("L"), tr("C"), tr("R"),  tr("SL"), tr("SR")); break;
-                default: snprintf(buf, sizeof(buf), "---");
-                }
-             }
+           if (m_Receiver->AC3BitStreamMode() != 7)
+	      snprintf(buf, sizeof(buf), "%s", *convAC3AudioCodingMode(m_Receiver->AC3AudioCodingMode()));
 	   else snprintf(buf, sizeof(buf), "---");
            m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
            offset += OSDROWHEIGHT;
            m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Center Mix Level"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-           switch (m_Receiver->AC3CenterMixLevel()) {
-             case CML_MINUS_3dB:   snprintf(buf, sizeof(buf), "-3.0 %s", tr("dB"));  break;
-             case CML_MINUS_4_5dB: snprintf(buf, sizeof(buf), "-4.5 %s", tr("dB"));  break;
-             case CML_MINUS_6dB:   snprintf(buf, sizeof(buf), "-6.0 %s", tr("dB"));  break;
-             case CML_RESERVED:    snprintf(buf, sizeof(buf), "%s", tr("reserved")); break;
-             default:              snprintf(buf, sizeof(buf), "---");
-             }
+           snprintf(buf, sizeof(buf), "%s", *convAC3CenterMixLevel(m_Receiver->AC3CenterMixLevel()));
            m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
            offset += OSDROWHEIGHT;
            m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Surround Mix Level"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-           switch (m_Receiver->AC3SurroundMixLevel()) {
-             case SML_MINUS_3dB: snprintf(buf, sizeof(buf), "-3 %s", tr("dB"));    break;
-             case SML_MINUS_6dB: snprintf(buf, sizeof(buf), "-6 %s", tr("dB"));    break;
-             case SML_0_dB:      snprintf(buf, sizeof(buf), "0 %s", tr("dB"));     break;
-             case SML_RESERVED:  snprintf(buf, sizeof(buf), "%s", tr("reserved")); break;
-             default:            snprintf(buf, sizeof(buf), "---");
-             }
+           snprintf(buf, sizeof(buf), "%s", *convAC3SurroundMixLevel(m_Receiver->AC3SurroundMixLevel()));
            m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
            offset += OSDROWHEIGHT;
            m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Dolby Surround Mode"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
-           switch (m_Receiver->AC3DolbySurroundMode()) {
-             case DSM_NOT_INDICATED:     snprintf(buf, sizeof(buf), "%s", tr("not indicated")); break;
-             case DSM_NOT_DOLBYSURROUND: snprintf(buf, sizeof(buf), "%s", tr("no"));            break;
-             case DSM_DOLBYSURROUND:     snprintf(buf, sizeof(buf), "%s", tr("yes"));           break;
-             case DSM_RESERVED:          snprintf(buf, sizeof(buf), "%s", tr("reserved"));      break;
-             default:                    snprintf(buf, sizeof(buf), "---");
-             }
+           snprintf(buf, sizeof(buf), "%s", *convAC3DolbySurroundMode(m_Receiver->AC3DolbySurroundMode()));
            m_Osd->DrawText(OSDINFOWIN_X(3), OSDINFOWIN_Y(offset), buf, femonTheme[femonConfig.theme].clrActiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);
            offset += OSDROWHEIGHT;
            m_Osd->DrawText(OSDINFOWIN_X(1), OSDINFOWIN_Y(offset), tr("Low Frequency Effects"), femonTheme[femonConfig.theme].clrInactiveText, femonTheme[femonConfig.theme].clrBackground, m_Font);




diff -NurpP femon-1.0.1/femon.c femon-1.0.1.2/femon.c
--- femon-1.0.1/femon.c	2006-06-06 03:20:00.000000000 +0200
+++ femon-1.0.1.2/femon.c	2006-06-18 00:15:36.000000000 +0200
@@ -132,6 +132,8 @@ const char **cPluginFemon::SVDRPHelpPage
     "    Switch to previous possible device.",
     "NAME\n"
     "    Print the current frontend name.",
+    "INFO\n"
+    "    Print the current transponder info.",
     "STAT\n"
     "    Print the current frontend status.",
     "SGNL\n"
@@ -180,6 +182,9 @@ cString cPluginFemon::SVDRPCommand(const
   else if (strcasecmp(Command, "NAME") == 0) {
      return getFrontendName(cDevice::ActualDevice()->CardIndex());
      }
+  else if (strcasecmp(Command, "INFO") == 0) {
+     return getFrontendInfo(cDevice::ActualDevice()->CardIndex());
+     }
   else if (strcasecmp(Command, "STAT") == 0) {
      return getFrontendStatus(cDevice::ActualDevice()->CardIndex());
      }
diff -NurpP femon-1.0.1/femontools.c femon-1.0.1.2/femontools.c
--- femon-1.0.1/femontools.c	2006-06-06 03:20:00.000000000 +0200
+++ femon-1.0.1.2/femontools.c	2006-06-18 00:29:21.000000000 +0200
@@ -6,11 +6,15 @@
  * $Id$
  */
 
+#include <ctype.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/ioctl.h>
 #include <linux/dvb/frontend.h>
 #include "femontools.h"
+#include "femoncfg.h"
+#include "femoni18n.h"
+#include "femonreceiver.h"
 
 cString getFrontendName(int cardIndex)
 {
@@ -28,6 +32,46 @@ cString getFrontendName(int cardIndex)
   return (cString::sprintf("%s on device #%d", value.name, cardIndex));
 }
 
+cString getFrontendInfo(int cardIndex)
+{
+  cChannel *channel = Channels.GetByNumber(cDevice::CurrentChannel());
+  // eTrackType track = cDevice::PrimaryDevice()->GetCurrentAudioTrack();
+  cString str;
+  int value;
+  int freq = channel->Frequency();
+  while (freq > 20000) freq /= 1000;
+
+  cString apid_str = cString::sprintf("%5d", channel->Apid(0));
+  value = 1;
+  while (channel->Apid(value) && (value < MAXAPIDS))
+    apid_str = cString::sprintf("%s, %d", *apid_str, channel->Apid(value));
+
+  cString dpid_str = cString::sprintf("%5d", channel->Dpid(0));
+  value = 1;
+  while (channel->Dpid(value) && (value < MAXDPIDS))
+    dpid_str = cString::sprintf("%s, %d", *dpid_str, channel->Dpid(value));
+
+  cString ca_str = cString::sprintf(" %04x", channel->Ca(0));
+  value = 1;
+  while (channel->Ca(value) && (value < MAXCAIDS))
+    ca_str = cString::sprintf("%s, %04x", *ca_str, channel->Ca(value));
+  
+  return cString::sprintf(
+     " Frequency:   %5d Mhz    Source:       %s\n" 
+     " Srate:       %5d        Polarization: %c\n" 
+     " Inversion:   %-9s    Coderate: %s, %s\n"
+     " Vpid: %5d  Ppid: %5d  Tpid: %5d\n"
+     " Sid:  %5d  Nid:  %5d  Tid:  %5d  Rid: %5d\n"
+     " Apid: %s\n Dpid: %s\n CA:   %s",
+     freq, *cSource::ToString(channel->Source()),
+     channel->Srate(), toupper(channel->Polarization()),
+     *(convInversion(channel->Inversion())), 
+     *convCoderate(channel->CoderateH()), *convCoderate(channel->CoderateL()),
+     channel->Vpid(), channel->Ppid(), channel->Tpid(),
+     channel->Sid(), channel->Nid(), channel->Tid(), channel->Rid(),
+     *apid_str, *dpid_str, *ca_str);
+}
+
 cString getFrontendStatus(int cardIndex)
 {
   fe_status_t value;
diff -NurpP femon-1.0.1/femontools.h femon-1.0.1.2/femontools.h
--- femon-1.0.1/femontools.h	2006-06-06 03:20:00.000000000 +0200
+++ femon-1.0.1.2/femontools.h	2006-06-18 00:09:50.000000000 +0200
@@ -21,6 +21,7 @@
 #define FRONTEND_DEVICE "/dev/dvb/adapter%d/frontend%d"
 
 cString getFrontendName(int cardIndex = 0);
+cString getFrontendInfo(int cardIndex = 0);
 cString getFrontendStatus(int cardIndex = 0);
 uint16_t getSNR(int cardIndex = 0);
 uint16_t getSignal(int cardIndex = 0);




More information about the vdr mailing list