summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--radio.c195
-rw-r--r--radioaudio.c144
-rw-r--r--radioepg.c351
-rw-r--r--radiotools.c324
4 files changed, 624 insertions, 390 deletions
diff --git a/radio.c b/radio.c
index 1a9ccd7..1a71d7d 100644
--- a/radio.c
+++ b/radio.c
@@ -23,7 +23,7 @@
#endif
#ifndef GIT_REV
-static const char *VERSION = "1.0.1";
+static const char *VERSION = "1.1.0";
#else
static const char *VERSION = GIT_REV;
#endif
@@ -97,22 +97,23 @@ cRadioCheck::cRadioCheck(void)
}
cRadioCheck::~cRadioCheck() {
- if (Running())
+ if (Running()) {
Stop();
+ }
}
void cRadioCheck::Init(void) {
if (RadioCheck == NULL) {
RadioCheck = new cRadioCheck;
RadioCheck->Start();
- }
+ }
}
void cRadioCheck::Exit(void) {
if (RadioCheck != NULL) {
RadioCheck->Stop();
DELETENULL(RadioCheck);
- }
+ }
}
void cRadioCheck::Stop(void) {
@@ -121,17 +122,18 @@ void cRadioCheck::Stop(void) {
void cRadioCheck::Action(void)
{
-
- if ((S_Verbose & 0x0f) >= 2)
+ if ((S_Verbose & 0x0f) >= 2) {
printf("vdr-radio: background-checking starts\n");
+ }
while (Running()) {
cCondWait::SleepMs(2000);
-
+
// check Live-Radio
- if (IsRadioOrReplay == 1 && chan != NULL) {
+ if ((IsRadioOrReplay == 1) && (chan != NULL)) {
if (chan->Vpid()) {
- isyslog("radio: channnel '%s' got Vpid= %d", chan->Name(), chan->Vpid());
+ isyslog("radio: channnel '%s' got Vpid= %d", chan->Name(),
+ chan->Vpid());
IsRadioOrReplay = 0;
#if VDRVERSNUM >= 20300
LOCK_CHANNELS_READ
@@ -140,61 +142,91 @@ void cRadioCheck::Action(void)
Channels.SwitchTo(cDevice::CurrentChannel());
#endif
//cDevice::PrimaryDevice()->SwitchChannel(chan, true);
- }
- else {
- if ((InfoTimeout-=2) <= 0) {
+ } else {
+ if ((InfoTimeout -= 2) <= 0) {
InfoTimeout = 20;
int chtid = chan->Tid();
// Kanal-EPG PresentEvent
- if (chan->Apid(0) > 0 && (chtid == PREMIERERADIO_TID || chtid == KDRADIO_TID
- || chtid == UMRADIO_TID1 || chtid == UMRADIO_TID2 || chtid == UMRADIO_TID3 || chtid == UMRADIO_TID4 || chtid == UMRADIO_TID5)) {
+ if (chan->Apid(0) > 0
+ && (chtid == PREMIERERADIO_TID
+ || chtid == KDRADIO_TID
+ || chtid == UMRADIO_TID1
+ || chtid == UMRADIO_TID2
+ || chtid == UMRADIO_TID3
+ || chtid == UMRADIO_TID4
+ || chtid == UMRADIO_TID5)) {
#if VDRVERSNUM >= 20300
LOCK_SCHEDULES_READ
static cStateKey SchedulesStateKey;
- const cSchedules *scheds = cSchedules::GetSchedulesRead(SchedulesStateKey);
+ const cSchedules *scheds = cSchedules::GetSchedulesRead(
+ SchedulesStateKey);
#else
cSchedulesLock schedLock;
const cSchedules *scheds = cSchedules::Schedules(schedLock);
#endif
if (scheds != NULL) {
- const cSchedule *sched = scheds->GetSchedule(chan->GetChannelID());
+ const cSchedule *sched = scheds->GetSchedule(
+ chan->GetChannelID());
if (sched != NULL) {
- const cEvent *present = sched->GetPresentEvent();
+ const cEvent *present =
+ sched->GetPresentEvent();
if (present != NULL) {
- if (chtid == PREMIERERADIO_TID) // Premiere
- InfoTimeout = epg_premiere(present->Title(), present->Description(), present->StartTime(), present->EndTime());
- else if (chtid == KDRADIO_TID) // Kabel Deutschland
- InfoTimeout = epg_kdg(present->Description(), present->StartTime(), present->EndTime());
- else // Unity Media Kabel
- InfoTimeout = epg_unitymedia(present->Description(), present->StartTime(), present->EndTime());
- InfoRequest = true;
+ if (chtid == PREMIERERADIO_TID) { // Premiere
+ InfoTimeout = epg_premiere(
+ present->Title(),
+ present->Description(),
+ present->StartTime(),
+ present->EndTime());
}
- else
- dsyslog("radio: no event.present (Tid= %d, Apid= %d)", chtid, chan->Apid(0));
+ else if (chtid == KDRADIO_TID) {// Kabel Deutschland
+ InfoTimeout = epg_kdg(
+ present->Description(),
+ present->StartTime(),
+ present->EndTime());
+ }
+ else {
+ // Unity Media Kabel
+ InfoTimeout = epg_unitymedia(
+ present->Description(),
+ present->StartTime(),
+ present->EndTime());
+ }
+ InfoRequest = true;
}
- else
- dsyslog("radio: no schedule (Tid= %d, Apid= %d)", chtid, chan->Apid(0));
+ else {
+ dsyslog("radio: no event.present (Tid= %d, Apid= %d)",
+ chtid, chan->Apid(0));
+ }
+ }
+ else {
+ dsyslog("radio: no schedule (Tid= %d, Apid= %d)",
+ chtid, chan->Apid(0));
}
}
+ }
// Artist/Title with external script?
- else if (chan->Apid(0) > 0 && DoInfoReq) {
+ else if (chan->Apid(0) > 0 && DoInfoReq) {
InfoTimeout = info_request(chtid, chan->Apid(0));
InfoRequest = (InfoTimeout > 0);
- }
}
}
}
+ }
// temp. OSD-CloseTimeout
- (RT_OsdTOTemp > 0) ? RT_OsdTOTemp -= 2 : RT_OsdTOTemp = 0; // in sec like this cycletime
+ (RT_OsdTOTemp > 0) ? RT_OsdTOTemp -= 2 : RT_OsdTOTemp = 0; // in sec like this cycletime
// Radiotext-Autodisplay
- if ((S_RtDispl == 2) && (RT_Info >= 0) && !RT_OsdTO && (RT_OsdTOTemp == 0) && RT_ReOpen && !Skins.IsOpen() && !cOsd::IsOpen())
+ if ((S_RtDispl == 2) && (RT_Info >= 0) && !RT_OsdTO
+ && (RT_OsdTOTemp == 0) && RT_ReOpen && !Skins.IsOpen()
+ && !cOsd::IsOpen()) {
cRemote::CallPlugin("radio");
}
+ }
- if ((S_Verbose & 0x0f) >= 2)
+ if ((S_Verbose & 0x0f) >= 2) {
printf("vdr-radio: background-checking ends\n");
+ }
}
@@ -501,10 +533,12 @@ bool cPluginRadio::Start(void)
DataDir = strdup("/tmp/vdr-radio.XXXXXX");
mkdtemp(DataDir);
}
- if (!LiveFileParam)
+ if (!LiveFileParam) {
asprintf(&LiveFile, "%s/radio.mpg", ConfigDir);
- if (!ReplayFileParam)
+ }
+ if (!ReplayFileParam) {
asprintf(&ReplayFile, "%s/replay.mpg", ConfigDir);
+ }
cRadioCheck::Init();
@@ -515,9 +549,9 @@ void cPluginRadio::Stop(void)
{
cRadioCheck::Exit();
- if (IsRadioOrReplay > 0)
+ if (IsRadioOrReplay > 0) {
radioAudio->DisableRadioTextProcessing();
-
+ }
radioImage->Exit();
}
@@ -532,16 +566,16 @@ cOsdObject *cPluginRadio::MainMenuAction(void)
/* if (!cDevice::PrimaryDevice()->Transferring() && !cDevice::PrimaryDevice()->Replaying()) {
//cRemote::CallPlugin("radio"); // try again later <-- disabled, looping if activate over menu @ tv in dvb-livemode
} */
- if (S_Activate > 0 && S_RtFunc > 0 && S_RtDispl > 0 && IsRadioOrReplay > 0) {
+ if (S_Activate > 0 && S_RtFunc > 0 && S_RtDispl > 0
+ && IsRadioOrReplay > 0) {
if (!RTplus_Osd) {
cRadioTextOsd *rtosd = new cRadioTextOsd();
return rtosd;
- }
- else {
+ } else {
cRTplusOsd *rtposd = new cRTplusOsd();
return rtposd;
- }
}
+ }
return NULL;
}
@@ -640,45 +674,47 @@ const char **cPluginRadio::SVDRPHelpPages(void)
cString cPluginRadio::SVDRPCommand(const char *Command, const char *Option, int &ReplyCode)
{
if (strcasecmp(Command, "RTINFO") == 0) {
- // we use the default reply code here
+ // we use the default reply code here
if (RT_Info == 2) {
int ind = (RT_Index == 0) ? S_RtOsdRows - 1 : RT_Index - 1;
- return cString::sprintf(" Radiotext: %s\n RT-Title : %s\n RT-Artist: %s\n", RT_Text[ind], RTP_Title, RTP_Artist);
- }
- else if (RT_Info == 1) {
+ return cString::sprintf(
+ " Radiotext: %s\n RT-Title : %s\n RT-Artist: %s\n",
+ RT_Text[ind], RTP_Title, RTP_Artist);
+ } else if (RT_Info == 1) {
int ind = (RT_Index == 0) ? S_RtOsdRows - 1 : RT_Index - 1;
- return cString::sprintf(" Radiotext: %s\n", RT_Text[ind]);
- }
- else
+ return cString::sprintf(" Radiotext: %s\n", RT_Text[ind]);
+ } else
return cString::sprintf(" Radiotext not available (yet)\n");
- }
- else if (strcasecmp(Command, "RTCLOSE") == 0) {
+ } else if (strcasecmp(Command, "RTCLOSE") == 0) {
// we use the default reply code here
if (RT_OsdTO)
return cString::sprintf("RT-OSD already closed");
else {
RT_OsdTO = true;
return cString::sprintf("RT-OSD will be closed now");
- }
}
- else if (strcasecmp(Command, "RTTCLOSE") == 0) {
+ } else if (strcasecmp(Command, "RTTCLOSE") == 0) {
// we use the default reply code here
RT_OsdTOTemp = 2 * Setup.OSDMessageTime;
return cString::sprintf("RT-OSD will be temporarily closed");
- }
+ }
return NULL;
}
-void cPluginRadio::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView)
-{
- if (Device != cDevice::PrimaryDevice()) return;
+void cPluginRadio::ChannelSwitch(const cDevice *Device, int ChannelNumber,
+ bool LiveView) {
+ if (Device != cDevice::PrimaryDevice()) {
+ return;
+ }
IsRadioOrReplay = Radio_CA = 0;
radioAudio->DisableRadioTextProcessing();
InfoTimeout = 3;
- if (S_Activate == false) return;
+ if (S_Activate == false) {
+ return;
+ }
char *image;
if (cDevice::CurrentChannel() == ChannelNumber) {
@@ -691,30 +727,37 @@ void cPluginRadio::ChannelSwitch(const cDevice *Device, int ChannelNumber, bool
if (chan != NULL && chan->Vpid() == 0 && chan->Apid(0) > 0) {
asprintf(&image, "%s/%s.mpg", ConfigDir, chan->Name());
if (!file_exists(image)) {
- dsyslog("radio: channel-image not found '%s' (Channelname= %s)", image, chan->Name());
+ dsyslog("radio: channel-image not found '%s' (Channelname= %s)",
+ image, chan->Name());
free(image);
asprintf(&image, "%s", LiveFile);
- if (!file_exists(image))
- dsyslog("radio: live-image not found '%s' (Channelname= %s)", image, chan->Name());
+ if (!file_exists(image)) {
+ dsyslog("radio: live-image not found '%s' (Channelname= %s)",
+ image, chan->Name());
}
- dsyslog("radio: [ChannelSwitch # Apid= %d, Ca= %d] channelname '%s', use image '%s'", chan->Apid(0), chan->Ca(0), chan->Name(), image);
- if ((Radio_CA = chan->Ca(0)) == 0 || S_Encrypted == 1)
+ }
+ dsyslog("radio: [ChannelSwitch # Apid= %d, Ca= %d] channelname '%s', use image '%s'",
+ chan->Apid(0), chan->Ca(0), chan->Name(), image);
+ if ((Radio_CA = chan->Ca(0)) == 0 || S_Encrypted == 1) {
cDevice::PrimaryDevice()->ForceTransferMode();
+ }
radioImage->SetBackgroundImage(image);
radioAudio->EnableRadioTextProcessing(chan->Name(), chan->Apid(0), false);
free(image);
IsRadioOrReplay = 1;
DoInfoReq = (S_ExtInfo > 0);
- }
}
+ }
}
-void cPluginRadio::Replaying(const cControl *Control, const char *Name, const char *FileName, bool On)
-{
+void cPluginRadio::Replaying(const cControl *Control, const char *Name,
+ const char *FileName, bool On) {
IsRadioOrReplay = 0;
radioAudio->DisableRadioTextProcessing();
- if (S_Activate == false) return;
+ if (S_Activate == false) {
+ return;
+ }
bool isRadio = false;
@@ -727,31 +770,35 @@ void cPluginRadio::Replaying(const cControl *Control, const char *Name, const ch
cUnbufferedFile *f = fn.Open();
if (f) {
uchar b[4] = { 0x00, 0x00, 0x00, 0x00 };
- ReadFrame(f, b, sizeof (b), sizeof (b));
+ ReadFrame(f, b, sizeof(b), sizeof(b));
fn.Close();
- isRadio = (b[0] == 0x00) && (b[1] == 0x00) && (b[2] == 0x01) && (0xc0 <= b[3] && b[3] <= 0xdf);
- }
+ isRadio = (b[0] == 0x00) && (b[1] == 0x00) && (b[2] == 0x01)
+ && (0xc0 <= b[3] && b[3] <= 0xdf);
}
+ }
// check VDR TS-Recordings
asprintf(&vdrfile, "%s/info", FileName);
if (file_exists(vdrfile)) {
cRecordingInfo rfi(FileName);
if (rfi.Read()) {
- if (rfi.FramesPerSecond() > 0 && rfi.FramesPerSecond() < 18) // max. seen 13.88 @ ARD-RadioTP 320k
+ if (rfi.FramesPerSecond() > 0 && rfi.FramesPerSecond() < 18) {// max. seen 13.88 @ ARD-RadioTP 320k
isRadio = true;
}
}
- free(vdrfile);
}
+ free(vdrfile);
+ }
if (isRadio) {
- if (!file_exists(ReplayFile))
+ if (!file_exists(ReplayFile)) {
dsyslog("radio: replay-image not found '%s'", ReplayFile);
- else
+ }
+ else {
radioImage->SetBackgroundImage(ReplayFile);
+ }
radioAudio->EnableRadioTextProcessing(Name, 0, true);
IsRadioOrReplay = 2;
- }
+ }
}
diff --git a/radioaudio.c b/radioaudio.c
index 2c9b395..c8922c9 100644
--- a/radioaudio.c
+++ b/radioaudio.c
@@ -939,8 +939,7 @@ void cRadioAudio::RadiotextDecode(unsigned char *mtext, int len) {
// byte 8 = MEL (MessageElementLength, max. 64+1 byte @ RT)
if (mtext[8] == 0 || mtext[8] > RT_MEL || mtext[8] > leninfo - 4) {
if ((S_Verbose & 0x0f) >= 1) {
- printf(
- "RT-Error: Length=0 or not correct (MFL= %d, MEL= %d)\n",
+ printf("RT-Error: Length=0 or not correct (MFL= %d, MEL= %d)\n",
mtext[4], mtext[8]);
}
return;
@@ -1031,7 +1030,8 @@ void cRadioAudio::RadiotextDecode(unsigned char *mtext, int len) {
"RTp-Error (tag#%d = Typ/Start/Len): %d/%d/%d (Start+Length > 'RT-MEL' !)\n",
i + 1, rtp_typ[i], rtp_start[i], rtp_len[i]);
}
- } else {
+ }
+ else {
char temptext[RT_MEL];
memset(temptext, 0x20, RT_MEL - 1);
memmove(temptext, plustext + rtp_start[i], rtp_len[i] + 1);
@@ -1048,15 +1048,17 @@ void cRadioAudio::RadiotextDecode(unsigned char *mtext, int len) {
if (memcmp(RTP_Title, temptext, RT_MEL - 1) != 0
|| (mtext[10] & 0x10) != RTP_ItemToggle) {
memcpy(RTP_Title, temptext, RT_MEL - 1);
- if (RT_PlusShow && rtp_itime.Elapsed() > 1000)
+ if (RT_PlusShow && rtp_itime.Elapsed() > 1000) {
rtp_idiffs = (int) rtp_itime.Elapsed()
/ 1000;
+ }
if (!rtp_content.item_New) {
RTP_Starttime = time(NULL);
rtp_itime.Set(0);
sprintf(RTP_Artist, "---");
- if (++rtp_content.item_Index >= MAX_RTPC)
+ if (++rtp_content.item_Index >= MAX_RTPC) {
rtp_content.item_Index = 0;
+ }
rtp_content.item_Start[rtp_content.item_Index] =
time(NULL); // todo: replay-mode
rtp_content.item_Artist[rtp_content.item_Index] =
@@ -1064,10 +1066,11 @@ void cRadioAudio::RadiotextDecode(unsigned char *mtext, int len) {
}
rtp_content.item_New =
(!rtp_content.item_New) ? true : false;
- if (rtp_content.item_Index >= 0)
+ if (rtp_content.item_Index >= 0) {
asprintf(
&rtp_content.item_Title[rtp_content.item_Index],
"%s", rtrim(rtp_content.temptext));
+ }
RT_PlusShow = RT_MsgShow = rtp_itoggle = true;
}
}
@@ -1080,15 +1083,17 @@ void cRadioAudio::RadiotextDecode(unsigned char *mtext, int len) {
if (memcmp(RTP_Artist, temptext, RT_MEL - 1) != 0
|| (mtext[10] & 0x10) != RTP_ItemToggle) {
memcpy(RTP_Artist, temptext, RT_MEL - 1);
- if (RT_PlusShow && rtp_itime.Elapsed() > 1000)
+ if (RT_PlusShow && rtp_itime.Elapsed() > 1000) {
rtp_idiffs = (int) rtp_itime.Elapsed()
/ 1000;
+ }
if (!rtp_content.item_New) {
RTP_Starttime = time(NULL);
rtp_itime.Set(0);
sprintf(RTP_Title, "---");
- if (++rtp_content.item_Index >= MAX_RTPC)
+ if (++rtp_content.item_Index >= MAX_RTPC) {
rtp_content.item_Index = 0;
+ }
rtp_content.item_Start[rtp_content.item_Index] =
time(NULL); // todo: replay-mode
rtp_content.item_Title[rtp_content.item_Index] =
@@ -1096,10 +1101,11 @@ void cRadioAudio::RadiotextDecode(unsigned char *mtext, int len) {
}
rtp_content.item_New =
(!rtp_content.item_New) ? true : false;
- if (rtp_content.item_Index >= 0)
+ if (rtp_content.item_Index >= 0) {
asprintf(
&rtp_content.item_Artist[rtp_content.item_Index],
"%s", rtrim(rtp_content.temptext));
+ }
RT_PlusShow = RT_MsgShow = rtp_itoggle = true;
}
}
@@ -1113,22 +1119,25 @@ void cRadioAudio::RadiotextDecode(unsigned char *mtext, int len) {
rtrim(rtp_content.temptext));
break;
case 14: // Info_Stockmarket
- if (++rtp_content.info_StockIndex >= MAX_RTPC)
+ if (++rtp_content.info_StockIndex >= MAX_RTPC) {
rtp_content.info_StockIndex = 0;
+ }
asprintf(
&rtp_content.info_Stock[rtp_content.info_StockIndex],
"%s", rtrim(rtp_content.temptext));
break;
case 15: // Info_Sport
- if (++rtp_content.info_SportIndex >= MAX_RTPC)
+ if (++rtp_content.info_SportIndex >= MAX_RTPC) {
rtp_content.info_SportIndex = 0;
+ }
asprintf(
&rtp_content.info_Sport[rtp_content.info_SportIndex],
"%s", rtrim(rtp_content.temptext));
break;
case 16: // Info_Lottery
- if (++rtp_content.info_LotteryIndex >= MAX_RTPC)
+ if (++rtp_content.info_LotteryIndex >= MAX_RTPC) {
rtp_content.info_LotteryIndex = 0;
+ }
asprintf(
&rtp_content.info_Lottery[rtp_content.info_LotteryIndex],
"%s", rtrim(rtp_content.temptext));
@@ -1138,8 +1147,9 @@ void cRadioAudio::RadiotextDecode(unsigned char *mtext, int len) {
rtrim(rtp_content.temptext));
break;
case 25: // Info_Weather
- if (++rtp_content.info_WeatherIndex >= MAX_RTPC)
+ if (++rtp_content.info_WeatherIndex >= MAX_RTPC) {
rtp_content.info_WeatherIndex = 0;
+ }
asprintf(
&rtp_content.info_Weather[rtp_content.info_WeatherIndex],
"%s", rtrim(rtp_content.temptext));
@@ -1161,8 +1171,9 @@ void cRadioAudio::RadiotextDecode(unsigned char *mtext, int len) {
rtrim(rtp_content.temptext));
break;
case 30: // Info_Other
- if (++rtp_content.info_OtherIndex >= MAX_RTPC)
+ if (++rtp_content.info_OtherIndex >= MAX_RTPC) {
rtp_content.info_OtherIndex = 0;
+ }
asprintf(
&rtp_content.info_Other[rtp_content.info_OtherIndex],
"%s", rtrim(rtp_content.temptext));
@@ -1511,7 +1522,8 @@ void cRadioAudio::RassDecode(unsigned char *mtext, int len) {
if (slidenumr == 0) {
Rass_Flags[0][0] = !slidedel;
(RT_Info > 0) ? : RT_Info = 0; // open RadioTextOsd for ArchivTip
- } else {
+ }
+ else {
int islide = (int) floor(slidenumr / 1000);
for (int i = 3; i >= 0; i--) {
if (fmod(slidenumr, pow(10, i)) == 0) {
@@ -1888,12 +1900,15 @@ void cRadioTextOsd::ShowText(void) {
fcolor, bcolor);
osd->DrawBitmap(Setup.OSDWidth - 48, inloff - 1, radio,
fcolor, bcolor);
- } else
+ }
+ else {
osd->DrawBitmap(Setup.OSDWidth - 84, inloff, rds, bcolor,
fcolor);
- if (ARec_Record)
+ }
+ if (ARec_Record) {
osd->DrawBitmap(Setup.OSDWidth - 140, inloff, arec, bcolor,
0xFFFC1414); // FG=Red
+ }
else {
inloff = (ftitel->Height() + 9 - ftext->Height()) / 2;
osd->DrawText(4, inloff, RadioAudio->bitrate, fcolor,
@@ -1901,9 +1916,10 @@ void cRadioTextOsd::ShowText(void) {
ftext->Height(), taRight);
}
}
- } else
+ } else {
osd->DrawRectangle(0, 0, Setup.OSDWidth - 1, ftitel->Height() + 9,
0x00000000);
+ }
// Body
bcolor =
(S_RtSkinColor > 0) ?
@@ -1917,30 +1933,36 @@ void cRadioTextOsd::ShowText(void) {
osd->DrawEllipse(0, bheight - 6, 5, bheight - 1, 0x00000000, -3);
osd->DrawEllipse(Setup.OSDWidth - 6, bheight - 6, Setup.OSDWidth - 1,
bheight - 1, 0x00000000, -4);
- if (S_RtOsdTitle == 1)
+ if (S_RtOsdTitle == 1) {
osd->DrawRectangle(5, ftitel->Height() + 9, Setup.OSDWidth - 6,
ftitel->Height() + 9, fcolor);
+ }
if (RT_MsgShow) {
// RT-Text roundloop
int ind = (RT_Index == 0) ? S_RtOsdRows - 1 : RT_Index - 1;
if (S_RtOsdLoop == 1) { // latest bottom
- for (int i = ind + 1; i < S_RtOsdRows; i++)
+ for (int i = ind + 1; i < S_RtOsdRows; i++) {
osd->DrawText(5, yoff + fheight * (ii++),
Convert(RT_Text[i]), fcolor, clrTransparent, ftext,
Setup.OSDWidth - 4, ftext->Height());
- for (int i = 0; i <= ind; i++)
+ }
+ for (int i = 0; i <= ind; i++) {
osd->DrawText(5, yoff + fheight * (ii++),
Convert(RT_Text[i]), fcolor, clrTransparent, ftext,
Setup.OSDWidth - 4, ftext->Height());
- } else { // latest top
- for (int i = ind; i >= 0; i--)
+ }
+ }
+ else { // latest top
+ for (int i = ind; i >= 0; i--) {
osd->DrawText(5, yoff + fheight * (ii++),
Convert(RT_Text[i]), fcolor, clrTransparent, ftext,
Setup.OSDWidth - 4, ftext->Height());
- for (int i = S_RtOsdRows - 1; i > ind; i--)
+ }
+ for (int i = S_RtOsdRows - 1; i > ind; i--) {
osd->DrawText(5, yoff + fheight * (ii++),
Convert(RT_Text[i]), fcolor, clrTransparent, ftext,
Setup.OSDWidth - 4, ftext->Height());
+ }
}
// + RT-Plus or PS-Text = 2 rows
if ((S_RtOsdTags == 1 && RT_PlusShow) || S_RtOsdTags >= 2) {
@@ -1962,14 +1984,17 @@ void cRadioTextOsd::ShowText(void) {
osd->DrawText(fwidth, 3 + yoff + fheight * (ii++),
Convert(RTP_Artist), fcolor, clrTransparent, ftext,
Setup.OSDWidth - 4, ftext->Height());
- } else {
+ }
+ else {
char *temp;
asprintf(&temp, "%s", "");
int ind = (RDS_PSIndex == 0) ? 11 : RDS_PSIndex - 1;
- for (int i = ind + 1; i < 12; i++)
+ for (int i = ind + 1; i < 12; i++) {
asprintf(&temp, "%s%s ", temp, RDS_PSText[i]);
- for (int i = 0; i <= ind; i++)
+ }
+ for (int i = 0; i <= ind; i++) {
asprintf(&temp, "%s%s ", temp, RDS_PSText[i]);
+ }
snprintf(stext[1], 6 * 9, "%s", temp);
snprintf(stext[2], 6 * 9, "%s", temp + (6 * 9));
free(temp);
@@ -2002,8 +2027,9 @@ int cRadioTextOsd::RassImage(int QArchiv, int QKey, bool DirUp) {
int i;
if (QKey >= 0 && QKey <= 9) {
- if (QArchiv == 0)
+ if (QArchiv == 0) {
(Rass_Flags[QKey][0]) ? QArchiv = QKey * 1000 : QArchiv = 0;
+ }
else if (QArchiv > 0) {
if (floor(QArchiv / 1000) == QKey) {
for (i = 3; i >= 0; i--) {
@@ -2014,21 +2040,25 @@ int cRadioTextOsd::RassImage(int QArchiv, int QKey, bool DirUp) {
QArchiv += QKey * (int) pow(10, --i) :
QArchiv = QKey * 1000;
(Rass_Flags[QKey][3 - i]) ? : QArchiv = QKey * 1000;
- } else
+ }
+ else {
(Rass_Flags[QKey][0]) ? QArchiv = QKey * 1000 : QArchiv = 0;
+ }
}
}
// Gallery
else if (QKey > 9 && Rass_GalCount >= 0) {
- if (QArchiv < Rass_GalStart || QArchiv > Rass_GalEnd)
+ if (QArchiv < Rass_GalStart || QArchiv > Rass_GalEnd) {
QArchiv = Rass_GalStart - 1;
+ }
if (DirUp) {
for (i = QArchiv + 1; i <= Rass_GalEnd; i++) {
if (Rass_Gallery[i])
break;
}
QArchiv = (i <= Rass_GalEnd) ? i : Rass_GalStart;
- } else {
+ }
+ else {
for (i = QArchiv - 1; i >= Rass_GalStart; i--) {
if (Rass_Gallery[i])
break;
@@ -2039,10 +2069,12 @@ int cRadioTextOsd::RassImage(int QArchiv, int QKey, bool DirUp) {
// show mpeg-still
char *image;
- if (QArchiv >= 0)
+ if (QArchiv >= 0) {
asprintf(&image, "%s/Rass_%d.mpg", DataDir, QArchiv);
- else
+ }
+ else {
asprintf(&image, "%s/Rass_show.mpg", DataDir);
+ }
RadioImage->SetBackgroundImage(image);
free(image);
@@ -2097,14 +2129,18 @@ void cRadioTextOsd::RassOsd(void) {
for (int i = 1; i <= 9; i++) {
// Pages
if (Rass_Flags[i][0] && Rass_Flags[i][1] && Rass_Flags[i][2]
- && Rass_Flags[i][3])
+ && Rass_Flags[i][3]) {
qosd->DrawBitmap(48, (i * 24) + offs, pages4, bcolor, fcolor);
- else if (Rass_Flags[i][0] && Rass_Flags[i][1] && Rass_Flags[i][2])
+ }
+ else if (Rass_Flags[i][0] && Rass_Flags[i][1] && Rass_Flags[i][2]) {
qosd->DrawBitmap(48, (i * 24) + offs, pages3, bcolor, fcolor);
- else if (Rass_Flags[i][0] && Rass_Flags[i][1])
+ }
+ else if (Rass_Flags[i][0] && Rass_Flags[i][1]) {
qosd->DrawBitmap(48, (i * 24) + offs, pages2, bcolor, fcolor);
- else if (Rass_Flags[i][0])
+ }
+ else if (Rass_Flags[i][0]) {
qosd->DrawBitmap(48, (i * 24) + offs, page1, bcolor, fcolor);
+ }
// Marker
if (floor(Rass_Archiv / 1000) == i) {
qosd->DrawBitmap(28, (i * 24) + offs, marker, bcolor, fcolor);
@@ -2213,8 +2249,9 @@ void cRadioTextOsd::RassImgSave(const char *size, int pos) {
DataDir, RT_Titel, i, ts->tm_mon + 1, ts->tm_mday);
asprintf(&cmd, "ffmpeg -i \"%s\" -s %s -f mjpeg -y \"%s\"",
infile, size, outfile);
- if ((error = system(cmd)))
+ if ((error = system(cmd))) {
i = Rass_GalEnd + 1;
+ }
}
}
asprintf(&cmd, "%s", tr("Rass-Image(s) saved from Gallery"));
@@ -2237,8 +2274,10 @@ void cRadioTextOsd::RassImgSave(const char *size, int pos) {
if (error) {
asprintf(&cmd, "%s: %s", tr("Rass-Image failed"), outfile);
Skins.Message(mtError, cmd, Setup.OSDMessageTime);
- } else
+ }
+ else {
Skins.Message(mtInfo, cmd, Setup.OSDMessageTime);
+ }
free(outfile);
free(cmd);
@@ -2369,7 +2408,7 @@ eOSState cRadioTextOsd::ProcessKey(eKeys Key) {
return state;
// Key pressed ...
- if (Key != kNone && Key < k_Release) {
+ if ((Key != kNone) && (Key < k_Release)) {
if (osd) { // Radiotext, -plus Osd
switch (Key) {
case kBack:
@@ -2387,7 +2426,8 @@ eOSState cRadioTextOsd::ProcessKey(eKeys Key) {
LastKey = (Key == kChanUp || Key == kChanDn) ? kNone : Key;
return osEnd;
}
- } else if (qosd && Rass_Archiv >= 0) { // Rass-Archiv Osd
+ }
+ else if (qosd && Rass_Archiv >= 0) { // Rass-Archiv Osd
int i, pos;
pos = (Rass_Archiv > 0 && Rass_Archiv <= RASS_GALMAX) ?
10 : (int) floor(Rass_Archiv / 1000);
@@ -2395,8 +2435,9 @@ eOSState cRadioTextOsd::ProcessKey(eKeys Key) {
// back to Slideshow
case kBlue:
case kBack:
- if (!RT_Replay)
+ if (!RT_Replay) {
Rass_Archiv = RassImage(-1, 0, false);
+ }
else {
Rass_Archiv = -1;
RadioImage->SetBackgroundImage(ReplayFile);
@@ -2429,8 +2470,9 @@ eOSState cRadioTextOsd::ProcessKey(eKeys Key) {
RassOsd();
return osContinue;
}
- if (++i > 10)
+ if (++i > 10) {
i = 0;
+ }
}
break;
case kUp:
@@ -2441,8 +2483,9 @@ eOSState cRadioTextOsd::ProcessKey(eKeys Key) {
RassOsd();
return osContinue;
}
- if (--i < 0)
+ if (--i < 0) {
i = 10;
+ }
}
break;
case kRed:
@@ -2458,7 +2501,8 @@ eOSState cRadioTextOsd::ProcessKey(eKeys Key) {
LastKey = (Key == kChanUp || Key == kChanDn) ? kNone : Key;
return osEnd;
}
- } else if (qosd && Rass_Archiv == -1) { // Rass-Slideshow Osd
+ }
+ else if (qosd && Rass_Archiv == -1) { // Rass-Slideshow Osd
switch (Key) {
// close
case kBack:
@@ -2479,7 +2523,8 @@ eOSState cRadioTextOsd::ProcessKey(eKeys Key) {
LastKey = (Key == kChanUp || Key == kChanDn) ? kNone : Key;
return osEnd;
}
- } else { // no RT && no Rass
+ }
+ else { // no RT && no Rass
Hide();
LastKey = (Key == kChanUp || Key == kChanDn) ? kNone : Key;
return osEnd;
@@ -2491,13 +2536,16 @@ eOSState cRadioTextOsd::ProcessKey(eKeys Key) {
RT_OsdTO = true;
Hide();
return osEnd;
- } else if (Rass_Archiv >= 0)
+ }
+ else if (Rass_Archiv >= 0) {
RassOsd();
+ }
else if (RT_MsgShow && !rtclosed
&& (!Rass_Flags[0][0] || S_RassText >= 2 || rassclosed)) { // Rass_Show == -1
RassOsdClose();
ShowText();
- } else if (Rass_Flags[0][0] && !rassclosed
+ }
+ else if (Rass_Flags[0][0] && !rassclosed
&& (S_RassText < 2 || rtclosed)) {
RTOsdClose();
RassOsdTip();
diff --git a/radioepg.c b/radioepg.c
index 69bfff0..cc9e325 100644
--- a/radioepg.c
+++ b/radioepg.c
@@ -7,10 +7,9 @@
#include "radioepg.h"
-
// Premiere-Radio
-int epg_premiere(const char *epgtitle, const char *epgdescr, time_t epgstart, time_t epgend)
-{
+int epg_premiere(const char *epgtitle, const char *epgdescr, time_t epgstart,
+ time_t epgend) {
int i;
const char *p;
char artist[RT_MEL], titel[RT_MEL], album[RT_MEL], jahr[RT_MEL];
@@ -18,9 +17,10 @@ int epg_premiere(const char *epgtitle, const char *epgdescr, time_t epgstart, ti
// EPG not actual
if (epgtitle == NULL || epgdescr == NULL) {
- dsyslog("radio: epg_premiere called, no title or description, nextCall in 5 s\n");
+ dsyslog(
+ "radio: epg_premiere called, no title or description, nextCall in 5 s\n");
return 5;
- }
+ }
// Interpret
p = strstr(epgtitle, PEPG_ARTIST);
@@ -32,24 +32,30 @@ int epg_premiere(const char *epgtitle, const char *epgdescr, time_t epgstart, ti
if (p != NULL) {
p += strlen(PEPG_TITEL);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(titel, p-i, i);
- titel[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(titel, p - i, i);
+ titel[i] = '\0';
+ }
+ else {
sprintf(titel, "---");
+ }
// Album
p = strstr(epgdescr, PEPG_ALBUM);
if (p != NULL) {
p += strlen(PEPG_ALBUM);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(album, p-i, i);
- album[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(album, p - i, i);
+ album[i] = '\0';
+ }
+ else {
sprintf(album, "---");
}
+ }
else { // P-Klassik ?
// Komponist
p = strstr(epgtitle, PEPG_KOMP);
@@ -62,86 +68,109 @@ int epg_premiere(const char *epgtitle, const char *epgdescr, time_t epgstart, ti
strcpy(album, artist); // Album = Komponist
p += strlen(PEPG_ARTIST);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(artist, p-i, i);
- artist[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(artist, p - i, i);
+ artist[i] = '\0';
+ }
+ else {
sprintf(album, "---");
+ }
// Werk
p = strstr(epgdescr, PEPG_WERK);
if (p != NULL) {
p += strlen(PEPG_WERK);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(titel, p-i, i);
- titel[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(titel, p - i, i);
+ titel[i] = '\0';
+ }
+ else {
sprintf(titel, "---");
}
+ }
else {
sprintf(artist, "---");
sprintf(titel, "---");
- }
}
-
+ }
+
// Jahr
p = strstr(epgdescr, PEPG_JAHR);
if (p != NULL) {
p += strlen(PEPG_JAHR);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(jahr, p-i, i);
- jahr[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(jahr, p - i, i);
+ jahr[i] = '\0';
+ }
+ else {
sprintf(jahr, "----");
+ }
// quick hack for epg-blabla
if (strlen(jahr) > 24)
sprintf(jahr, "----");
-
+
int nextevent = epgend - time(NULL);
- if (strcmp(RTP_Artist, artist)!=0 || strcmp(RTP_Title, titel)!=0) {
+ if (strcmp(RTP_Artist, artist) != 0 || strcmp(RTP_Title, titel) != 0) {
snprintf(RTP_Artist, RT_MEL, "%s", artist);
snprintf(RTP_Title, RT_MEL, "%s", titel);
RTP_Starttime = epgstart;
struct tm *ts = localtime_r(&RTP_Starttime, &tm_store);
- if (++rtp_content.rt_Index >= 2*MAX_RTPC)
+ if (++rtp_content.rt_Index >= 2 * MAX_RTPC) {
rtp_content.rt_Index = 0;
- asprintf(&rtp_content.radiotext[rtp_content.rt_Index], "%02d:%02d %s: %s", ts->tm_hour, ts->tm_min, RTP_Artist, RTP_Title);
- snprintf(RT_Text[RT_Index], RT_MEL, "%s", rtp_content.radiotext[rtp_content.rt_Index]);
- RT_Index +=1; if (RT_Index >= S_RtOsdRows) RT_Index = 0;
+ }
+ asprintf(&rtp_content.radiotext[rtp_content.rt_Index],
+ "%02d:%02d %s: %s", ts->tm_hour, ts->tm_min, RTP_Artist,
+ RTP_Title);
+ snprintf(RT_Text[RT_Index], RT_MEL, "%s",
+ rtp_content.radiotext[rtp_content.rt_Index]);
+ RT_Index += 1;
+ if (RT_Index >= S_RtOsdRows) {
+ RT_Index = 0;
+ }
if (strcmp(album, "---") != 0) {
- if (++rtp_content.rt_Index >= 2*MAX_RTPC)
+ if (++rtp_content.rt_Index >= 2 * MAX_RTPC) {
rtp_content.rt_Index = 0;
- asprintf(&rtp_content.radiotext[rtp_content.rt_Index], " ... %s (%s)", album, jahr);
- snprintf(RT_Text[RT_Index], RT_MEL, "%s", rtp_content.radiotext[rtp_content.rt_Index]);
- RT_Index +=1; if (RT_Index >= S_RtOsdRows) RT_Index = 0;
}
+ asprintf(&rtp_content.radiotext[rtp_content.rt_Index],
+ " ... %s (%s)", album, jahr);
+ snprintf(RT_Text[RT_Index], RT_MEL, "%s",
+ rtp_content.radiotext[rtp_content.rt_Index]);
+ RT_Index += 1;
+ if (RT_Index >= S_RtOsdRows) {
+ RT_Index = 0;
+ }
+ }
if (++rtp_content.item_Index >= MAX_RTPC)
rtp_content.item_Index = 0;
if (rtp_content.item_Index >= 0) {
rtp_content.item_Start[rtp_content.item_Index] = RTP_Starttime;
- asprintf(&rtp_content.item_Artist[rtp_content.item_Index], "%s", RTP_Artist);
- asprintf(&rtp_content.item_Title[rtp_content.item_Index], "%s", RTP_Title);
- }
+ asprintf(&rtp_content.item_Artist[rtp_content.item_Index], "%s",
+ RTP_Artist);
+ asprintf(&rtp_content.item_Title[rtp_content.item_Index], "%s",
+ RTP_Title);
+ }
RT_MsgShow = RT_PlusShow = true;
(RT_Info > 0) ? : RT_Info = 2;
radioStatusMsg();
- if ((S_Verbose & 0x0f) >= 1)
+ if ((S_Verbose & 0x0f) >= 1) {
printf("Premiereradio: %s / %s\n", RTP_Artist, RTP_Title);
}
-
- dsyslog("radio: epg_premiere called, nextEvent in %ds\n", nextevent);
- return (nextevent < 0) ? 10 : nextevent+2;
-}
+ }
+ dsyslog("radio: epg_premiere called, nextEvent in %ds\n", nextevent);
+ return (nextevent < 0) ? 10 : nextevent + 2;
+}
// Kabel Deutschland Radio
-int epg_kdg(const char *epgdescr, time_t epgstart, time_t epgend)
-{
+int epg_kdg(const char *epgdescr, time_t epgstart, time_t epgend) {
int i;
const char *p;
char artist[RT_MEL], titel[RT_MEL], album[RT_MEL], komp[RT_MEL];
@@ -149,222 +178,284 @@ int epg_kdg(const char *epgdescr, time_t epgstart, time_t epgend)
// EPG not actual
if (epgdescr == NULL) {
- dsyslog("radio: epg_kdg called, no description, nextCall in 5s\n");
+ dsyslog("radio: epg_kdg called, no description, nextCall in 5s\n");
return 5;
- }
+ }
// Titel
p = strstr(epgdescr, KDEPG_TITEL);
if (p != NULL) {
p += strlen(KDEPG_TITEL);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(titel, p-i, i);
- titel[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(titel, p - i, i);
+ titel[i] = '\0';
+ }
+ else {
sprintf(titel, "---");
+ }
// Interpret
p = strstr(epgdescr, KDEPG_ARTIST);
if (p != NULL) {
p += strlen(KDEPG_ARTIST);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(artist, p-i, i);
- artist[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(artist, p - i, i);
+ artist[i] = '\0';
+ }
+ else {
sprintf(artist, "---");
+ }
// Album
p = strstr(epgdescr, KDEPG_ALBUM);
if (p != NULL) {
p += strlen(KDEPG_ALBUM);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(album, p-i, i);
- album[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(album, p - i, i);
+ album[i] = '\0';
+ }
+ else {
sprintf(album, "---");
+ }
// Komponist
p = strstr(epgdescr, KDEPG_KOMP);
if (p != NULL) {
p += strlen(KDEPG_KOMP);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(komp, p-i, i);
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1))
+ ++i;
+ memcpy(komp, p - i, i);
komp[i] = '\0';
- }
- else
+ }
+ else {
sprintf(komp, "---");
+ }
int nextevent = epgend - time(NULL);
- if (strcmp(RTP_Artist, artist)!=0 || strcmp(RTP_Title, titel)!=0) {
+ if (strcmp(RTP_Artist, artist) != 0 || strcmp(RTP_Title, titel) != 0) {
snprintf(RTP_Artist, RT_MEL, "%s", artist);
snprintf(RTP_Title, RT_MEL, "%s", titel);
RTP_Starttime = epgstart;
struct tm *ts = localtime_r(&RTP_Starttime, &tm_store);
- if (++rtp_content.rt_Index >= 2*MAX_RTPC)
+ if (++rtp_content.rt_Index >= 2 * MAX_RTPC) {
rtp_content.rt_Index = 0;
- asprintf(&rtp_content.radiotext[rtp_content.rt_Index], "%02d:%02d %s: %s", ts->tm_hour, ts->tm_min, RTP_Artist, RTP_Title);
- snprintf(RT_Text[RT_Index], RT_MEL, "%s", rtp_content.radiotext[rtp_content.rt_Index]);
- RT_Index +=1; if (RT_Index >= S_RtOsdRows) RT_Index = 0;
+ }
+ asprintf(&rtp_content.radiotext[rtp_content.rt_Index],
+ "%02d:%02d %s: %s", ts->tm_hour, ts->tm_min, RTP_Artist,
+ RTP_Title);
+ snprintf(RT_Text[RT_Index], RT_MEL, "%s",
+ rtp_content.radiotext[rtp_content.rt_Index]);
+ RT_Index += 1;
+ if (RT_Index >= S_RtOsdRows) {
+ RT_Index = 0;
+ }
if (strcmp(album, "---") != 0) {
- if (++rtp_content.rt_Index >= 2*MAX_RTPC)
+ if (++rtp_content.rt_Index >= 2 * MAX_RTPC)
rtp_content.rt_Index = 0;
- asprintf(&rtp_content.radiotext[rtp_content.rt_Index], " ... %s (%s)", album, komp);
- snprintf(RT_Text[RT_Index], RT_MEL, "%s", rtp_content.radiotext[rtp_content.rt_Index]);
- RT_Index +=1; if (RT_Index >= S_RtOsdRows) RT_Index = 0;
+ asprintf(&rtp_content.radiotext[rtp_content.rt_Index],
+ " ... %s (%s)", album, komp);
+ snprintf(RT_Text[RT_Index], RT_MEL, "%s",
+ rtp_content.radiotext[rtp_content.rt_Index]);
+ RT_Index += 1;
+ if (RT_Index >= S_RtOsdRows) {
+ RT_Index = 0;
}
- if (++rtp_content.item_Index >= MAX_RTPC)
+ }
+ if (++rtp_content.item_Index >= MAX_RTPC) {
rtp_content.item_Index = 0;
+ }
if (rtp_content.item_Index >= 0) {
rtp_content.item_Start[rtp_content.item_Index] = RTP_Starttime;
- asprintf(&rtp_content.item_Artist[rtp_content.item_Index], "%s", RTP_Artist);
- asprintf(&rtp_content.item_Title[rtp_content.item_Index], "%s", RTP_Title);
- }
+ asprintf(&rtp_content.item_Artist[rtp_content.item_Index], "%s",
+ RTP_Artist);
+ asprintf(&rtp_content.item_Title[rtp_content.item_Index], "%s",
+ RTP_Title);
+ }
RT_MsgShow = RT_PlusShow = true;
(RT_Info > 0) ? : RT_Info = 2;
radioStatusMsg();
- if ((S_Verbose & 0x0f) >= 1)
+ if ((S_Verbose & 0x0f) >= 1) {
printf("KDG-Radio: %s / %s\n", RTP_Artist, RTP_Title);
}
-
- dsyslog("radio: epg_kdg called, nextEvent in %ds\n", nextevent);
- return (nextevent < 0) ? 10 : nextevent+2;
+ }
+
+ dsyslog("radio: epg_kdg called, nextEvent in %ds\n", nextevent);
+ return (nextevent < 0) ? 10 : nextevent + 2;
}
// Unity Media - Music Choice, Kabel
-int epg_unitymedia(const char *epgdescr, time_t epgstart, time_t epgend)
-{
+int epg_unitymedia(const char *epgdescr, time_t epgstart, time_t epgend) {
int i;
const char *p;
- char artist[RT_MEL], titel[RT_MEL], album[RT_MEL], jahr[RT_MEL], komp[RT_MEL];
+ char artist[RT_MEL], titel[RT_MEL], album[RT_MEL], jahr[RT_MEL],
+ komp[RT_MEL];
struct tm tm_store;
// EPG not actual
if (epgdescr == NULL) {
- dsyslog("radio: epg_unitymedia called, no title or description, nextCall in 5s\n");
+ dsyslog("radio: epg_unitymedia called, no title or description, nextCall in 5s\n");
return 5;
- }
+ }
// Titel
p = strstr(epgdescr, UMEPG_TITEL);
if (p != NULL) {
p += strlen(UMEPG_TITEL);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(titel, p-i, i);
- titel[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else {
+ memcpy(titel, p - i, i);
+ titel[i] = '\0';
+ }
+ else {
// Kein titel check for Werk
p = strstr(epgdescr, UMEPG_WERK);
if (p != NULL) {
p += strlen(UMEPG_WERK);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(titel, p-i, i);
- titel[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(titel, p - i, i);
+ titel[i] = '\0';
+ }
+ else {
sprintf(titel, "---");
}
+ }
// Interpret
p = strstr(epgdescr, UMEPG_ARTIST);
if (p != NULL) {
p += strlen(UMEPG_ARTIST);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(artist, p-i, i);
- artist[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
+ memcpy(artist, p - i, i);
+ artist[i] = '\0';
+ }
else {
p = strstr(epgdescr, UMEPG_KOMP);
if (p != NULL) {
p += strlen(UMEPG_KOMP);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(artist, p-i, i);
- artist[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(artist, p - i, i);
+ artist[i] = '\0';
+ }
+ else {
sprintf(artist, "---");
}
+ }
// Komponist
p = strstr(epgdescr, UMEPG_KOMP);
if (p != NULL) {
p += strlen(UMEPG_KOMP);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(komp, p-i, i);
- komp[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(komp, p - i, i);
+ komp[i] = '\0';
+ }
+ else {
sprintf(komp, "---");
+ }
// Album
p = strstr(epgdescr, UMEPG_ALBUM);
if (p != NULL) {
p += strlen(UMEPG_ALBUM);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(album, p-i, i);
- album[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(album, p - i, i);
+ album[i] = '\0';
+ }
+ else {
sprintf(album, "---");
+ }
// Jahr
p = strstr(epgdescr, UMEPG_JAHR);
if (p != NULL) {
p += strlen(UMEPG_JAHR);
i = 1;
- while (*++p!='\n' && *p!='\0' && i<(RT_MEL-1)) ++i;
- memcpy(jahr, p-i, i);
- jahr[i] = '\0';
+ while (*++p != '\n' && *p != '\0' && i < (RT_MEL - 1)) {
+ ++i;
}
- else
+ memcpy(jahr, p - i, i);
+ jahr[i] = '\0';
+ }
+ else {
sprintf(jahr, "---");
+ }
int nextevent = epgend - time(NULL);
- if (strcmp(RTP_Artist, artist)!=0 || strcmp(RTP_Title, titel)!=0) {
+ if (strcmp(RTP_Artist, artist) != 0 || strcmp(RTP_Title, titel) != 0) {
snprintf(RTP_Artist, RT_MEL, "%s", artist);
snprintf(RTP_Title, RT_MEL, "%s", titel);
RTP_Starttime = epgstart;
struct tm *ts = localtime_r(&RTP_Starttime, &tm_store);
- if (++rtp_content.rt_Index >= 2*MAX_RTPC)
+ if (++rtp_content.rt_Index >= 2 * MAX_RTPC) {
rtp_content.rt_Index = 0;
- asprintf(&rtp_content.radiotext[rtp_content.rt_Index], "%02d:%02d %s: %s", ts->tm_hour, ts->tm_min, RTP_Artist, RTP_Title);
- snprintf(RT_Text[RT_Index], RT_MEL, "%s", rtp_content.radiotext[rtp_content.rt_Index]);
- RT_Index +=1; if (RT_Index >= S_RtOsdRows) RT_Index = 0;
+ }
+ asprintf(&rtp_content.radiotext[rtp_content.rt_Index],
+ "%02d:%02d %s: %s", ts->tm_hour, ts->tm_min, RTP_Artist,
+ RTP_Title);
+ snprintf(RT_Text[RT_Index], RT_MEL, "%s",
+ rtp_content.radiotext[rtp_content.rt_Index]);
+ RT_Index += 1;
+ if (RT_Index >= S_RtOsdRows) {
+ RT_Index = 0;
+ }
if (strcmp(album, "---") != 0) {
- if (++rtp_content.rt_Index >= 2*MAX_RTPC)
+ if (++rtp_content.rt_Index >= 2 * MAX_RTPC)
rtp_content.rt_Index = 0;
- asprintf(&rtp_content.radiotext[rtp_content.rt_Index], " ... %s (%s)", album, jahr);
- snprintf(RT_Text[RT_Index], RT_MEL, "%s", rtp_content.radiotext[rtp_content.rt_Index]);
- RT_Index +=1; if (RT_Index >= S_RtOsdRows) RT_Index = 0;
+ asprintf(&rtp_content.radiotext[rtp_content.rt_Index],
+ " ... %s (%s)", album, jahr);
+ snprintf(RT_Text[RT_Index], RT_MEL, "%s",
+ rtp_content.radiotext[rtp_content.rt_Index]);
+ RT_Index += 1;
+ if (RT_Index >= S_RtOsdRows) {
+ RT_Index = 0;
}
- if (++rtp_content.item_Index >= MAX_RTPC)
+ }
+ if (++rtp_content.item_Index >= MAX_RTPC) {
rtp_content.item_Index = 0;
+ }
if (rtp_content.item_Index >= 0) {
rtp_content.item_Start[rtp_content.item_Index] = RTP_Starttime;
- asprintf(&rtp_content.item_Artist[rtp_content.item_Index], "%s", RTP_Artist);
- asprintf(&rtp_content.item_Title[rtp_content.item_Index], "%s", RTP_Title);
- }
+ asprintf(&rtp_content.item_Artist[rtp_content.item_Index], "%s",
+ RTP_Artist);
+ asprintf(&rtp_content.item_Title[rtp_content.item_Index], "%s",
+ RTP_Title);
+ }
RT_Charset = 1; // UTF8 ?!?
RT_MsgShow = RT_PlusShow = true;
(RT_Info > 0) ? : RT_Info = 2;
radioStatusMsg();
- if ((S_Verbose & 0x0f) >= 1)
+ if ((S_Verbose & 0x0f) >= 1) {
printf("UnityMedia-Radio: %s / %s\n", RTP_Artist, RTP_Title);
+ }
}
- dsyslog("radio: epg_um called, nextEvent in %ds\n", nextevent);
- return (nextevent < 0) ? 10 : nextevent+2;
+ dsyslog("radio: epg_um called, nextEvent in %ds\n", nextevent);
+ return (nextevent < 0) ? 10 : nextevent + 2;
}
// end
diff --git a/radiotools.c b/radiotools.c
index d180575..e67e985 100644
--- a/radiotools.c
+++ b/radiotools.c
@@ -32,14 +32,16 @@ bool enforce_directory(const char *path)
if (mkdir(path, ACCESSPERMS)) {
esyslog("radio: ERROR failed to create directory %s", path);
return false;
- }
}
+ }
else {
if (!S_ISDIR(sbuf.st_mode)) {
- esyslog("radio: ERROR failed to create directory %s: file exists but is not a directory", path);
+ esyslog(
+ "radio: ERROR failed to create directory %s: file exists but is not a directory",
+ path);
return false;
- }
}
+ }
return true;
}
@@ -65,13 +67,15 @@ unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst)
// with start 0xffff and result invers
register unsigned short crc = 0xffff;
- if (skipfirst) daten++;
+ if (skipfirst) {
+ daten++;
+ }
while (len--) {
- crc = (crc >> 8) | (crc << 8);
- crc ^= *daten++;
- crc ^= (crc & 0xff) >> 4;
- crc ^= (crc << 8) << 4;
- crc ^= ((crc & 0xff) << 4) << 1;
+ crc = (crc >> 8) | (crc << 8);
+ crc ^= *daten++;
+ crc ^= (crc & 0xff) >> 4;
+ crc ^= (crc << 8) << 4;
+ crc ^= ((crc & 0xff) << 4) << 1;
}
#if crc_timetest
@@ -93,12 +97,12 @@ const char *entitystr[EntityChars] = { "&apos;", "&amp;", "&quot;", "&gt"
"&Ograve;", "&Oacute;", "&Ocirc;", "&Otilde;", "&ograve;", "&oacute;", "&ocirc;", "&otilde;",
"&Ugrave;", "&Uacute;", "&Ucirc;", "&Ntilde;", "&ugrave;", "&uacute;", "&ucirc;", "&ntilde;" };
const char *entitychar[EntityChars] = { "'", "&", "\"", ">", "<", "c", "*", " ",
- "Ä", "ä", "Ö", "ö", "Ü", "ü", "ß", "°",
- "À", "Á", "Â", "Ã", "à", "á", "â", "ã",
- "È", "É", "Ê", "Ë", "è", "é", "ê", "ë",
- "Ì", "Í", "Î", "Ï", "ì", "í", "î", "ï",
- "Ò", "Ó", "Ô", "Õ", "ò", "ó", "ô", "õ",
- "Ù", "Ú", "Û", "Ñ", "ù", "ú", "û", "ñ" };
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�" };
char *rds_entitychar(char *text)
{
@@ -143,42 +147,46 @@ const char *xhtmlstr[XhtmlChars] = { "&#039;", "&#038;", "&#034;", "&#062;",
/* hex todo: "&#x27;", "&#x26;", */
/* see *entitychar[]
const char *xhtmlychar[EntityChars] = { "'", "&", "\"", ">", "<", "c", "*", " ",
- "Ä", "ä", "Ö", "ö", "Ü", "ü", "ß", "°",
- "À", "Á", "Â", "Ã", "à", "á", "â", "ã",
- "È", "É", "Ê", "Ë", "è", "é", "ê", "ë",
- "Ì", "Í", "Î", "Ï", "ì", "í", "î", "ï",
- "Ò", "Ó", "Ô", "Õ", "ò", "ó", "ô", "õ",
- "Ù", "Ú", "Û", "Ñ", "ù", "ú", "û", "ñ" };
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�",
+ "�", "�", "�", "�", "�", "�", "�", "�" };
*/
char *xhtml2text(char *text)
{
int i = 0, l, lof, lre, space;
char *temp;
-
+
while (i < XhtmlChars) {
if ((temp = strstr(text, xhtmlstr[i])) != NULL) {
- if ((S_Verbose & 0x0f) >= 2)
+ if ((S_Verbose & 0x0f) >= 2) {
printf("XHTML-Char: %s\n", text);
+ }
l = strlen(xhtmlstr[i]);
- lof = (temp-text);
+ lof = (temp - text);
if (strlen(text) < RT_MEL) {
lre = strlen(text) - lof - l;
space = 1;
- }
+ }
else {
- lre = RT_MEL - 1 - lof - l;
+ lre = RT_MEL - 1 - lof - l;
space = 0;
- }
- memmove(text+lof, entitychar[i], 1);
- memmove(text+lof+1, temp+l, lre);
- if (space != 0)
- memmove(text+lof+1+lre, " ", l-1);
}
- else i++;
+ memmove(text + lof, entitychar[i], 1);
+ memmove(text + lof + 1, temp + l, lre);
+ if (space != 0) {
+ memmove(text + lof + 1 + lre, " ", l - 1);
+ }
}
+ else {
+ i++;
+ }
+ }
- rds_entitychar(text);
+ rds_entitychar(text);
return text;
}
@@ -187,9 +195,9 @@ char *xhtml2text(char *text)
char *rtrim(char *text)
{
char *s = text + strlen(text) - 1;
- while (s >= text && (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r'))
+ while (s >= text && (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r')) {
*s-- = 0;
-
+ }
return text;
}
@@ -212,25 +220,31 @@ char *audiobitrate(const unsigned char *data)
//printf("vdr-radio: audioheader = <%02x %02x %02x %02x>\n", data[hl], data[hl+1], data[hl+2], data[hl+3]);
char *temp;
- if (data[hl] == 0xff && (data[hl+1] & 0xe0) == 0xe0) { // syncword o.k.
- int layer = (data[hl+1] & 0x06) >> 1; // Layer description
+ if (data[hl] == 0xff && (data[hl + 1] & 0xe0) == 0xe0) { // syncword o.k.
+ int layer = (data[hl + 1] & 0x06) >> 1; // Layer description
if (layer > 0) {
- switch ((data[hl+1] & 0x18) >> 3) { // Audio Version ID
- case 0x00: asprintf(&temp, "V2.5");
- break;
- case 0x01: asprintf(&temp, "Vres");
- break;
- case 0x02: asprintf(&temp, "V2");
- break;
- case 0x03: asprintf(&temp, "%s", bitrates[3-layer][data[hl+2] >> 4]);
- break;
- }
+ switch ((data[hl + 1] & 0x18) >> 3) { // Audio Version ID
+ case 0x00:
+ asprintf(&temp, "V2.5");
+ break;
+ case 0x01:
+ asprintf(&temp, "Vres");
+ break;
+ case 0x02:
+ asprintf(&temp, "V2");
+ break;
+ case 0x03:
+ asprintf(&temp, "%s", bitrates[3 - layer][data[hl + 2] >> 4]);
+ break;
}
- else
+ }
+ else {
asprintf(&temp, "Lres");
}
- else
+ }
+ else {
asprintf(&temp, "???");
+ }
return temp;
}
@@ -1770,137 +1784,171 @@ const char *tmc_mglabel[16] = {
int tmc_mgsize[16] = { 3, 3, 5, 5, 5, 8, 8, 8, 8, 11, 16, 16, 16, 16, 0, 0 };
// TMC, Alert-C Coding
-void tmc_parser(unsigned char *data, int len)
-{
+void tmc_parser(unsigned char *data, int len) {
static char lastdata[6];
-
+
if (len < 6) {
- printf("TMC Length only '%d' bytes (<6).\n", len);
- return;
- }
+ printf("TMC Length only '%d' bytes (<6).\n", len);
+ return;
+ }
if (memcmp(data, lastdata, 6) == 0) {
- printf("TMC Repeating.\n");
- return;
- }
+ printf("TMC Repeating.\n");
+ return;
+ }
memcpy(lastdata, data, 6);
-
+
// Buffer = data[0], todo or not :D
-
+
// check Encrypted-Service, TMC Pro ?
if ((data[1] & 0x1f) == 0x00) { // Type+DP = '00000'
- printf("TMC Encrypted Service detected, TMC-Pro?\n");
- return;
- }
+ printf("TMC Encrypted Service detected, TMC-Pro?\n");
+ return;
+ }
+
+ int type = (data[1] & 0x18) >> 3; // Type = User-,TuningInformation & Multi-,Singlegroup Message
+ int dp = data[1] & 0x07; // Duration+Persistance or Continuity Index
+ int da = (data[2] & 0x80) >> 7; // DiversionAdvice or GroupIndicator
+ int di = (data[2] & 0x40) >> 6; // Direction (-/+) or 2.GroupIndicator
+ int ex = (data[2] & 0x38) >> 3; // Extent
+ int ev = (data[2] & 0x07) << 8 | data[3]; // Event
+ int lo = data[4] << 8 | data[5]; // Location
- int type = (data[1] & 0x18)>>3; // Type = User-,TuningInformation & Multi-,Singlegroup Message
- int dp = data[1] & 0x07; // Duration+Persistance or Continuity Index
- int da = (data[2] & 0x80)>>7; // DiversionAdvice or GroupIndicator
- int di = (data[2] & 0x40)>>6; // Direction (-/+) or 2.GroupIndicator
- int ex = (data[2] & 0x38)>>3; // Extent
- int ev = (data[2] & 0x07)<<8 | data[3]; // Event
- int lo = data[4]<<8 | data[5]; // Location
-
switch (type) {
case 0: // Multigroup-Message
- printf("TMC Multi-Group Message, ");
- if (da == 1) {
+ printf("TMC Multi-Group Message, ");
+ if (da == 1) {
printf("First:\n");
- printf(" CI: '%d', Direction: %s, Extent: '%d'\n", dp, tmc_direction[di], ex);
+ printf(" CI: '%d', Direction: %s, Extent: '%d'\n", dp,
+ tmc_direction[di], ex);
printf(" Event: '%d' = %s\n", ev, tmc_event[ev]);
printf(" Location: '%d' > LT not available yet :-(\n", lo);
- }
- else {
- int gsi = (data[2] & 0x30)>>4; // GroupSequenceIdentifier
+ }
+ else {
+ int gsi = (data[2] & 0x30) >> 4; // GroupSequenceIdentifier
printf("Subsequent:\n");
- printf(" CI: '%d', 2.GI: '%d', GSI: '%d', Block_0x: '%02x%02x%02x%02x'\n", dp, di, gsi, data[2]&0xf, data[3], data[4], data[5]);
+ printf(
+ " CI: '%d', 2.GI: '%d', GSI: '%d', Block_0x: '%02x%02x%02x%02x'\n",
+ dp, di, gsi, data[2] & 0xf, data[3], data[4], data[5]);
if (di == 0) {
printf(" SecondGroupIndicator = 0 -> todo, exit here.\n\n");
return;
- }
- unsigned int block = (data[2]&0x0f)<<24 | data[3]<<16 | data[4]<<8 | data[5];
+ }
+ unsigned int block = (data[2] & 0x0f) << 24 | data[3] << 16
+ | data[4] << 8 | data[5];
int lc = 1;
int rbits = 28;
while (rbits > 0) {
- int lb = block>>(rbits-4);
- rbits -= 4;
- if (lb <= 0)
- return;
- block = block & ((unsigned long int)(pow(2,rbits)) - 1);
- rbits -= tmc_mgsize[lb];
- int val = block>>(rbits);
- printf(" #%d: Label '%02d' = %s", lc, lb, tmc_mglabel[lb]);
- if (val > 0) {
+ int lb = block >> (rbits - 4);
+ rbits -= 4;
+ if (lb <= 0)
+ return;
+ block = block & ((unsigned long int) (pow(2, rbits)) - 1);
+ rbits -= tmc_mgsize[lb];
+ int val = block >> (rbits);
+ printf(" #%d: Label '%02d' = %s", lc, lb, tmc_mglabel[lb]);
+ if (val > 0) {
switch (lb) {
- case 0: printf(", Value '%d' min.?\n", val);
- break;
- case 2: printf(", Value '%d' km?\n", val);
- break;
- case 3: printf(", Value '%d' km/h?\n", val);
- break;
- case 9: printf(", Value '%d' = %s\n", val, tmc_event[val]);
- break;
+ case 0:
+ printf(", Value '%d' min.?\n", val);
+ break;
+ case 2:
+ printf(", Value '%d' km?\n", val);
+ break;
+ case 3:
+ printf(", Value '%d' km/h?\n", val);
+ break;
+ case 9:
+ printf(", Value '%d' = %s\n", val, tmc_event[val]);
+ break;
case 11:
- case 13: printf(", Value '%d' > LT not available yet :-(\n", val);
- break;
- case 14:
- case 15: printf(" ---\n");
- break;
- default: printf(", Value '%d'\n", val);
- }
+ case 13:
+ printf(", Value '%d' > LT not available yet :-(\n",
+ val);
+ break;
+ case 14:
+ case 15:
+ printf(" ---\n");
+ break;
+ default:
+ printf(", Value '%d'\n", val);
}
+ }
else {
- if (block > 0)
- printf(", rest block_0x '%04x'\n", (int)block);
- else
- printf(", ...\n");
+ if (block > 0) {
+ printf(", rest block_0x '%04x'\n", (int) block);
+ }
+ else {
+ printf(", ...\n");
}
- block = block & ((unsigned int)(pow(2,rbits)) - 1);
- lc++;
}
+ block = block & ((unsigned int) (pow(2, rbits)) - 1);
+ lc++;
}
+ }
break;
case 1: // Singlegroup-Message
printf("TMC Single-Group Message:\n");
- printf(" Duration: %s, Diversion: '%d', Direction: %s, Extent: '%d'\n", tmc_duration[dp], da, tmc_direction[di], ex);
+ printf(" Duration: %s, Diversion: '%d', Direction: %s, Extent: '%d'\n",
+ tmc_duration[dp], da, tmc_direction[di], ex);
printf(" Event: '%d' = %s\n", ev, tmc_event[ev]);
printf(" Location: '%d' > LT not available yet :-(\n", lo);
- break;
+ break;
case 2:
case 3: // System,Tuning
printf("TMC Tuning/System Information:\n");
switch (data[1] & 0x0f) {
- case 9: printf(" LTN: '%d', MGS: '%d', SID: '%d' %04x.\n", data[2]>>2, (data[2] & 0x03)<<2 | data[3]>>6, data[3] & 0x3f, lo);
- break;
- default: printf(" todo, exit.\n");
- }
+ case 9:
+ printf(" LTN: '%d', MGS: '%d', SID: '%d' %04x.\n", data[2] >> 2,
+ (data[2] & 0x03) << 2 | data[3] >> 6, data[3] & 0x3f, lo);
+ break;
+ default:
+ printf(" todo, exit.\n");
}
+ }
}
-const char* ptynr2string(int nr)
-{
+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");
+ // 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 "?";
- }
+ case 31:
+ return tr("Alarm");
+ default:
+ return "?";
+ }
}
//--------------- End -----------------------------------------------------------------