summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--radio.c32
-rw-r--r--radioaudio.c45
-rw-r--r--radiotools.c26
-rw-r--r--radiotools.h10
-rw-r--r--service.h32
5 files changed, 67 insertions, 78 deletions
diff --git a/radio.c b/radio.c
index 139ccd7..1a9ccd7 100644
--- a/radio.c
+++ b/radio.c
@@ -16,6 +16,7 @@
#include "radiotools.h"
#include "radioepg.h"
#include "inforx.h"
+#include "service.h"
#if VDRVERSNUM < 10737
#error This version of radio-plugin requires vdr >= 1.7.37
@@ -72,25 +73,6 @@ int IsRadioOrReplay;
bool DoInfoReq = false, InfoRequest = false;
int InfoTimeout = 3;
-struct RadioTextService_v1_0 {
- int rds_info; // 0= no / 1= Text / 2= Text + RTplus-Tags (Item,Artist)
- int rds_pty; // 0-31
- char *rds_text;
- char *rds_title;
- char *rds_artist;
- struct tm *title_start;
-};
-
-struct RadioTextService_v1_1 {
- int rds_info; // 0= no / 1= Text / 2= Text + RTplus-Tags (Item,Artist)
- int rds_pty; // 0-31
- std::string rds_text;
- std::string rds_title;
- std::string rds_artist;
- time_t title_start;
-};
-
-
// --- cRadioCheck -------------------------------------------------------
class cRadioCheck: public cThread {
@@ -622,13 +604,15 @@ bool cPluginRadio::Service(const char *Id, void *Data)
}
else if ((strcmp(Id,"RadioTextService-v1.1") == 0) && (S_Activate > 0) && (S_RtFunc >= 1)) {
if (Data) {
+ cCharSetConv conf(RT_Charset == 0 ? "ISO-8859-1" : 0);
RadioTextService_v1_1 *data = (RadioTextService_v1_1*)Data;
- data->rds_pty = RT_PTY;
- data->rds_info = (RT_Info < 0) ? 0 : RT_Info;
int ind = (RT_Index == 0) ? S_RtOsdRows - 1 : RT_Index - 1;
- data->rds_text = RT_Text[ind];
- data->rds_title = RTP_Title;
- data->rds_artist = RTP_Artist;
+ data->rds_pty = RT_PTY;
+ data->rds_info = RT_Info < 0 ? 0 : RT_Info;
+ data->rds_pty_info = RT_PTY > 0 ? ptynr2string(RT_PTY) : "";
+ data->rds_text = conf.Convert(RT_Text[ind]);
+ data->rds_title = conf.Convert(RTP_Title);
+ data->rds_artist = conf.Convert(RTP_Artist);
data->title_start = RTP_Starttime;
}
return true;
diff --git a/radioaudio.c b/radioaudio.c
index 2c374b7..2c9b395 100644
--- a/radioaudio.c
+++ b/radioaudio.c
@@ -79,49 +79,6 @@ unsigned char rds_addchar[128] = { 0xe1, 0xe0, 0xe9, 0xe8, 0xed, 0xec, 0xf3,
0xf3, 0xf4, 0xfd, 0xf5, 0xf8, 0xfe, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe,
0xff };
-const char* ptynr2string(int nr) {
- switch (nr) {
- // Source: http://www.ebu.ch/trev_255-beale.pdf
- case 0:
- return tr("unknown program type");
- case 1:
- return tr("News");
- case 2:
- return tr("Current affairs");
- case 3:
- return tr("Information");
- case 4:
- return tr("Sport");
- case 5:
- return tr("Education");
- case 6:
- return tr("Drama");
- case 7:
- return tr("Culture");
- case 8:
- return tr("Science");
- case 9:
- return tr("Varied");
- case 10:
- return tr("Pop music");
- case 11:
- return tr("Rock music");
- case 12:
- return tr("M.O.R. music");
- case 13:
- return tr("Light classical");
- case 14:
- return tr("Serious classical");
- case 15:
- return tr("Other music");
- // 16-30 "Spares"
- case 31:
- return tr("Alarm");
- default:
- return "?";
- }
-}
-
// announce text/items for lcdproc & other
void radioStatusMsg(void) {
if (!RT_MsgShow || S_RtMsgItems <= 0)
@@ -429,8 +386,8 @@ void cRDSReceiver::Receive(const uchar *Data, int Length)
int i;
for (i = 9; i <= (index - 3); i++) {
tmc[i - 9] = mtext[i];
- tmc_parser(tmc, i - 8);
}
+ tmc_parser(tmc, i - 8);
}
break;
default:
diff --git a/radiotools.c b/radiotools.c
index c30239d..d180575 100644
--- a/radiotools.c
+++ b/radiotools.c
@@ -1875,8 +1875,32 @@ void tmc_parser(unsigned char *data, int len)
default: printf(" todo, exit.\n");
}
}
-
}
+const char* ptynr2string(int nr)
+{
+ switch (nr) {
+ // Source: http://www.ebu.ch/trev_255-beale.pdf
+ case 0: return tr("unknown program type");
+ case 1: return tr("News");
+ case 2: return tr("Current affairs");
+ case 3: return tr("Information");
+ case 4: return tr("Sport");
+ case 5: return tr("Education");
+ case 6: return tr("Drama");
+ case 7: return tr("Culture");
+ case 8: return tr("Science");
+ case 9: return tr("Varied");
+ case 10: return tr("Pop music");
+ case 11: return tr("Rock music");
+ case 12: return tr("M.O.R. music");
+ case 13: return tr("Light classical");
+ case 14: return tr("Serious classical");
+ case 15: return tr("Other music");
+ // 16-30 "Spares"
+ case 31: return tr("Alarm");
+ default: return "?";
+ }
+}
//--------------- End -----------------------------------------------------------------
diff --git a/radiotools.h b/radiotools.h
index b948202..1bf042e 100644
--- a/radiotools.h
+++ b/radiotools.h
@@ -8,22 +8,14 @@
#ifndef __RADIO_TOOLS_H
#define __RADIO_TOOLS_H
-
bool file_exists(const char *filename);
-
bool enforce_directory(const char *path);
-
unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst);
-
char *rds_entitychar(char *text);
-
char *xhtml2text(char *text);
-
char *rtrim(char *text);
-
char *audiobitrate(const unsigned char *data);
-
void tmc_parser(unsigned char *data, int len); // Alert-c
-
+const char* ptynr2string(int nr);
#endif //__RADIO_TOOLS_H
diff --git a/service.h b/service.h
new file mode 100644
index 0000000..1665cbc
--- /dev/null
+++ b/service.h
@@ -0,0 +1,32 @@
+/*
+ * service.h: A plugin for the Video Disk Recorder
+ *
+ * See the README file for copyright information and how to reach the author.
+ *
+ */
+
+#ifndef __RADIO_SERVICE_H
+#define __RADIO_SERVICE_H
+
+// --- Service Interface -------------------------------------------------------
+
+struct RadioTextService_v1_0 {
+ int rds_info; // 0= no / 1= Text / 2= Text + RTplus-Tags (Item,Artist)
+ int rds_pty; // 0-31
+ char *rds_text;
+ char *rds_title;
+ char *rds_artist;
+ struct tm *title_start;
+};
+
+struct RadioTextService_v1_1 {
+ int rds_info; // 0= no / 1= Text / 2= Text + RTplus-Tags (Item,Artist)
+ int rds_pty; // 0-31
+ std::string rds_pty_info;
+ std::string rds_text;
+ std::string rds_title;
+ std::string rds_artist;
+ time_t title_start;
+};
+
+#endif // __RADIO_SERVICE_H