summaryrefslogtreecommitdiff
path: root/radioaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'radioaudio.c')
-rw-r--r--radioaudio.c1909
1 files changed, 1 insertions, 1908 deletions
diff --git a/radioaudio.c b/radioaudio.c
index 0092114..1823e26 100644
--- a/radioaudio.c
+++ b/radioaudio.c
@@ -14,30 +14,6 @@
#include "service.h"
#include <math.h>
-// OSD-Symbols
-#include "symbols/rds.xpm"
-#include "symbols/arec.xpm"
-#include "symbols/rass.xpm"
-#include "symbols/radio.xpm"
-#include "symbols/index.xpm"
-#include "symbols/marker.xpm"
-#include "symbols/page1.xpm"
-#include "symbols/pages2.xpm"
-#include "symbols/pages3.xpm"
-#include "symbols/pages4.xpm"
-#include "symbols/no0.xpm"
-#include "symbols/no1.xpm"
-#include "symbols/no2.xpm"
-#include "symbols/no3.xpm"
-#include "symbols/no4.xpm"
-#include "symbols/no5.xpm"
-#include "symbols/no6.xpm"
-#include "symbols/no7.xpm"
-#include "symbols/no8.xpm"
-#include "symbols/no9.xpm"
-#include "symbols/bok.xpm"
-#include "symbols/pageE.xpm"
-
// Radiotext
int RTP_ItemToggle = 1, RTP_TToggle = 0;
bool RT_MsgShow = false, RT_PlusShow = false;
@@ -56,10 +32,9 @@ bool ARec_Receive = false, ARec_Record = false;
int Rass_Show = -1; // -1=No, 0=Yes, 1=display
int Rass_Archiv = -1; // -1=Off, 0=Index, 1000-9990=Slidenr.
bool Rass_Flags[11][4]; // Slides+Gallery existent
-// ... Gallery (1..999)
-#define RASS_GALMAX 999
bool Rass_Gallery[RASS_GALMAX + 1];
int Rass_GalStart, Rass_GalEnd, Rass_GalCount, Rass_SlideFoto;
+// ... Gallery (1..999)
cRadioImage *RadioImage;
cRDSReceiver *RDSReceiver;
@@ -102,333 +77,6 @@ void radioStatusMsg(void) {
}
}
-// --- cRadioImage -------------------------------------------------------
-
-cRadioImage::cRadioImage(void) :
- cThread("radioimage") {
- imagepath = 0;
- imageShown = false;
- RadioImage = this;
-}
-
-cRadioImage::~cRadioImage() {
- if (Running())
- Stop();
- free(imagepath);
-}
-
-void cRadioImage::Init(void) {
- RadioImage->Start();
-}
-
-void cRadioImage::Exit(void) {
- if (RadioImage != NULL) {
- RadioImage->Stop();
- DELETENULL(RadioImage);
- }
-}
-
-void cRadioImage::Stop(void) {
- Cancel(2);
-}
-
-void cRadioImage::Action(void) {
- if ((S_Verbose & 0x0f) >= 2)
- printf("vdr-radio: image-showing starts\n");
-
- while (Running()) {
- cCondWait::SleepMs(333);
- if ((IsRadioOrReplay == 1) && imagepath && !imageShown) { // only live $20090905
- imageShown = true;
- Show(imagepath);
- }
- }
-
- if ((S_Verbose & 0x0f) >= 2) {
- printf("vdr-radio: image-showing ends\n");
- }
-}
-
-void cRadioImage::Show(const char *file) {
- uchar *buffer;
- int fd;
- struct stat st;
- struct video_still_picture sp;
- if ((fd = open(file, O_RDONLY)) >= 0) {
- fstat(fd, &st);
- sp.iFrame = (char *) malloc(st.st_size);
- if (sp.iFrame) {
- sp.size = st.st_size;
- if (read(fd, sp.iFrame, sp.size) > 0) {
- buffer = (uchar *) sp.iFrame;
- if (S_StillPic > 0)
- cDevice::PrimaryDevice()->StillPicture(buffer, sp.size);
- else {
- for (int i = 1; i <= 25; i++)
- send_pes_packet(buffer, sp.size, i);
- }
- }
- free(sp.iFrame);
- }
- close(fd);
- }
-}
-
-void cRadioImage::send_pes_packet(unsigned char *data, int len, int timestamp) {
-#define PES_MAX_SIZE 2048
- int ptslen = timestamp ? 5 : 1;
- static unsigned char pes_header[PES_MAX_SIZE];
- pes_header[0] = pes_header[1] = 0;
- pes_header[2] = 1;
- pes_header[3] = 0xe0;
-
- while (len > 0) {
- int payload_size = len;
- if (6 + ptslen + payload_size > PES_MAX_SIZE) {
- payload_size = PES_MAX_SIZE - (6 + ptslen);
- }
- pes_header[4] = (ptslen + payload_size) >> 8;
- pes_header[5] = (ptslen + payload_size) & 255;
- if (ptslen == 5) {
- int x;
- x = (0x02 << 4) | (((timestamp >> 30) & 0x07) << 1) | 1;
- pes_header[8] = x;
- x = ((((timestamp >> 15) & 0x7fff) << 1) | 1);
- pes_header[7] = x >> 8;
- pes_header[8] = x & 255;
- x = ((((timestamp) & 0x7fff) < 1) | 1);
- pes_header[9] = x >> 8;
- pes_header[10] = x & 255;
- } else {
- pes_header[6] = 0x0f;
- }
-
- memcpy(&pes_header[6 + ptslen], data, payload_size);
- cDevice::PrimaryDevice()->PlayPes(pes_header,
- 6 + ptslen + payload_size);
- len -= payload_size;
- data += payload_size;
- ptslen = 1;
- }
-}
-
-void cRadioImage::SetBackgroundImage(const char *Image) {
- free(imagepath);
- imagepath = 0;
-
- if (Image) {
- imageShown = false;
- asprintf(&imagepath, "%s", Image);
- }
-}
-
-// --- cRDSReceiver ------------------------------------------------------------
-
-cRDSReceiver::cRDSReceiver(int Pid) {
- dsyslog("radio: additional RDS-Receiver starts on Pid=%d", Pid);
-
- pid = Pid;
- rt_start = rt_bstuff = false;
-}
-
-cRDSReceiver::~cRDSReceiver() {
- dsyslog("radio: additional RDS-Receiver stopped");
-}
-
-#if VDRVERSNUM >= 20300
-void cRDSReceiver::Receive(const uchar *Data, int Length)
-#else
- void cRDSReceiver::Receive(uchar *Data, int Length)
-#endif
- {
- const int mframel = 263; // max. 255(MSG)+4(ADD/SQC/MFL)+2(CRC)+2(Start/Stop) of RDS-data
- static unsigned char mtext[mframel + 1];
- static int index;
- static int mec = 0;
-
- // check TS-Size, -Sync, PID, Payload
- if (Length != TS_SIZE || Data[0] != 0x47
- || pid != ((Data[1] & 0x1f) << 8) + Data[2] || !(Data[3] & 0x10)) {
- return;
- }
-
- int offset;
- if (Data[1] & 0x40) { // 1.TS-Frame, payload-unit-start
- offset = (Data[3] & 0x20) ? Data[4] + 11 : 10; // Header + ADFL + 6 byte: PES-Startcode, -StreamID, -PacketLength
- if (Data[offset - 3] == 0xbd) { // StreamID = Private stream 1 (for rds)
- offset += 3; // 3 byte: Extension + Headerlength
- offset += Data[offset - 1];
- } else {
- return;
- }
- } else {
- offset = (Data[3] & 0x20) ? Data[4] + 5 : 4; // Header + ADFL
- }
-
- if ((TS_SIZE - offset) <= 0) {
- return;
- }
- // print TS-RawData with RDS
- if ((S_Verbose & 0x02) == 0x02) {
- printf("\n\nTS-Data(%d):\n", Length);
- int cnt = 0;
- for (int a = 0; a < Length; a++) {
- printf("%02x ", Data[a]);
- cnt++;
- if (cnt > 15) {
- cnt = 0;
- printf("\n");
- }
- }
- printf("(End)\n");
- }
-
- for (int i = 0, val = 0; i < (TS_SIZE - offset); i++) {
- val = Data[offset + i];
-
- if (val == 0xfe) { // Start
- index = -1;
- rt_start = true;
- rt_bstuff = false;
- mec = 0;
- if ((S_Verbose & 0x0f) >= 2) {
- printf("\nRDS-Start: ");
- }
- }
-
- if (rt_start) {
- if ((S_Verbose & 0x0f) >= 2) {
- printf("%02x ", val);
- }
- // byte-stuffing reverse: 0xfd00->0xfd, 0xfd01->0xfe, 0xfd02->0xff
- if (rt_bstuff) {
- switch (val) {
- case 0x00:
- mtext[index] = 0xfd;
- break;
- case 0x01:
- mtext[index] = 0xfe;
- break;
- case 0x02:
- mtext[index] = 0xff;
- break;
- default:
- mtext[++index] = val; // should never be
- }
- rt_bstuff = false;
- if ((S_Verbose & 0x0f) >= 2) {
- printf("(Bytestuffing -> %02x) ", mtext[index]);
- }
- } else {
- mtext[++index] = val;
- }
- if (val == 0xfd && index > 0) { // stuffing found
- rt_bstuff = true;
- }
- // early check for used MEC
- if (index == 5) {
- //mec = val;
- switch (val) {
- case 0x0a: // RT
- case 0x46: // ODA-Data
- case 0x07: // PTY
- case 0x3e: // PTYN
- case 0x30: // TMC
- case 0x02:
- mec = val; // PS
- RdsLogo = true;
- break;
- default:
- rt_start = false;
- if ((S_Verbose & 0x0f) >= 2) {
- printf("[RDS-MEC '%02x' not used -> End]\n", val);
- }
- }
- }
- if (index >= mframel) { // max. rdslength, garbage ?
- rt_start = false;
- if ((S_Verbose & 0x0f) >= 2) {
- printf("(RDS-Error: too long, garbage ?)\n");
- }
- }
- }
-
- if (rt_start && val == 0xff) { // End
- rt_start = false;
- if ((S_Verbose & 0x0f) >= 2) {
- printf("(RDS-End)\n");
- }
- if (index < 9) { // min. rdslength, garbage ?
- if ((S_Verbose & 0x0f) >= 1) {
- printf("RDS-Error: too short -> garbage ?\n");
- }
- } else {
- // crc16-check
- unsigned short crc16 = crc16_ccitt(mtext, index - 3, true);
- if (crc16 != (mtext[index - 2] << 8) + mtext[index - 1]) {
- if ((S_Verbose & 0x0f) >= 1) {
- printf(
- "RDS-Error: wrong CRC # calc = %04x <> transmit = %02x%02x\n",
- crc16, mtext[index - 2], mtext[index - 1]);
- }
- } else {
- switch (mec) {
- case 0x0a:
- RadioAudio->RadiotextDecode(mtext, index); // Radiotext
- break;
- case 0x46:
- switch ((mtext[7] << 8) + mtext[8]) { // ODA-ID
- case 0x4bd7:
- RadioAudio->RadiotextDecode(mtext, index); // RT+
- break;
- case 0x0d45:
- case 0xcd46:
- if ((S_Verbose & 0x20) > 0) {
- unsigned char tmc[6]; // TMC Alert-C
- int i;
- for (i = 9; i <= (index - 3); i++) {
- tmc[i - 9] = mtext[i];
- }
- tmc_parser(tmc, i - 8);
- }
- break;
- default:
- if ((S_Verbose & 0x0f) >= 2) {
- printf(
- "[RDS-ODA AID '%02x%02x' not used -> End]\n",
- mtext[7], mtext[8]);
- }
- }
- break;
- case 0x07:
- RT_PTY = mtext[8]; // PTY
- if ((S_Verbose & 0x0f) >= 1) {
- printf("RDS-PTY set to '%s'\n",
- ptynr2string(RT_PTY));
- }
- break;
- case 0x3e:
- RadioAudio->RDS_PsPtynDecode(true, mtext, index); // PTYN
- break;
- case 0x02:
- RadioAudio->RDS_PsPtynDecode(false, mtext, index); // PS
- break;
- case 0x30:
- if ((S_Verbose & 0x20) > 0) { // TMC Alert-C
- unsigned char tmc[6];
- int i;
- for (i = 7; i <= (index - 3); i++) {
- tmc[i - 7] = mtext[i];
- }
- tmc_parser(tmc, i - 6);
- }
- break;
- }
- }
- }
- }
- }
-}
// --- cRadioAudio -------------------------------------------------------------
@@ -1739,1559 +1387,4 @@ void cRadioAudio::DisableRadioTextProcessing() {
}
}
-// --- cRadioTextOsd ------------------------------------------------------
-
-cBitmap cRadioTextOsd::rds(rds_xpm);
-cBitmap cRadioTextOsd::arec(arec_xpm);
-cBitmap cRadioTextOsd::rass(rass_xpm);
-cBitmap cRadioTextOsd::index(index_xpm);
-cBitmap cRadioTextOsd::radio(radio_xpm);
-cBitmap cRadioTextOsd::marker(marker_xpm);
-cBitmap cRadioTextOsd::page1(page1_xpm);
-cBitmap cRadioTextOsd::pages2(pages2_xpm);
-cBitmap cRadioTextOsd::pages3(pages3_xpm);
-cBitmap cRadioTextOsd::pages4(pages4_xpm);
-cBitmap cRadioTextOsd::no0(no0_xpm);
-cBitmap cRadioTextOsd::no1(no1_xpm);
-cBitmap cRadioTextOsd::no2(no2_xpm);
-cBitmap cRadioTextOsd::no3(no3_xpm);
-cBitmap cRadioTextOsd::no4(no4_xpm);
-cBitmap cRadioTextOsd::no5(no5_xpm);
-cBitmap cRadioTextOsd::no6(no6_xpm);
-cBitmap cRadioTextOsd::no7(no7_xpm);
-cBitmap cRadioTextOsd::no8(no8_xpm);
-cBitmap cRadioTextOsd::no9(no9_xpm);
-cBitmap cRadioTextOsd::bok(bok_xpm);
-cBitmap cRadioTextOsd::pageE(pageE_xpm);
-
-cRadioTextOsd::cRadioTextOsd() :
- cCharSetConv((RT_Charset == 0) ? "ISO-8859-1" : NULL) {
- RadioTextOsd = this;
- osd = NULL;
- qosd = NULL;
- qiosd = NULL;
- rtclosed = rassclosed = false;
- RT_ReOpen = false;
- ftext = NULL;
- ftitel = NULL;
- LastKey = kNone;
- fheight = 0;
- bheight = 0;
-}
-
-cRadioTextOsd::~cRadioTextOsd() {
- if (Rass_Archiv >= 0) {
- if (!RT_Replay) {
- Rass_Archiv = RassImage(-1, -1, false);
- }
- else {
- Rass_Archiv = -1;
- RadioImage->SetBackgroundImage(ReplayFile);
- }
- }
-
- if (osd != NULL) {
- delete osd;
- osd = NULL;
- }
- if (qosd != NULL) {
- delete qosd;
- qosd = NULL;
-
- }
- if (qiosd != NULL) {
- delete qiosd;
- qiosd = NULL;
- }
- RadioTextOsd = NULL;
- RT_ReOpen = !RT_OsdTO;
-
- cRemote::Put(LastKey);
-}
-
-void cRadioTextOsd::Show(void) {
- LastKey = kNone;
- RT_OsdTO = false;
- osdtimer.Set();
-
- ftext = cFont::GetFont(fontSml);
- fheight = ftext->Height() + 4;
- bheight =
- (S_RtOsdTags >= 1) ?
- fheight * (S_RtOsdRows + 3) : fheight * (S_RtOsdRows + 1);
- bheight += 20;
-
- asprintf(&RTp_Titel, "%s - %s",
- InfoRequest ? tr("ext. Info") : tr("RTplus"), RT_Titel);
-
- if (S_RtDispl >= 1 && (!Rass_Flags[0][0] || S_RassText >= 2)) { // Rass_Show == -1
- RT_MsgShow = (RT_Info >= 1);
- ShowText();
- }
-}
-
-void cRadioTextOsd::Hide(void) {
- RTOsdClose();
- RassOsdClose();
-}
-
-void cRadioTextOsd::RTOsdClose(void) {
- if (osd != NULL) {
- delete osd;
- osd = NULL;
- }
-}
-
-void cRadioTextOsd::ShowText(void) {
- char stext[3][100];
- int yoff = 17, ii = 1;
-
- if (!osd && !qosd && !Skins.IsOpen() && !cOsd::IsOpen()) {
- if (S_RtOsdPos == 1)
- osd = cOsdProvider::NewOsd(Setup.OSDLeft,
- Setup.OSDTop + Setup.OSDHeight - bheight);
- else
- osd = cOsdProvider::NewOsd(Setup.OSDLeft, Setup.OSDTop);
- tArea Area = { 0, 0, Setup.OSDWidth - 1, bheight - 1, 4 };
- osd->SetAreas(&Area, 1);
- }
-
- if (osd) {
- uint32_t bcolor, fcolor;
- int skin = theme_skin();
- ftitel = cFont::GetFont(fontOsd);
- ftext = cFont::GetFont(fontSml);
- if (S_RtOsdTitle == 1) {
- // Title
- bcolor =
- (S_RtSkinColor > 0) ?
- radioSkin[skin].clrTitleBack :
- (0x00FFFFFF | S_RtBgTra << 24)
- & rt_color[S_RtBgCol];
- fcolor =
- (S_RtSkinColor > 0) ?
- radioSkin[skin].clrTitleText : rt_color[S_RtFgCol];
- osd->DrawRectangle(0, 0, Setup.OSDWidth - 1, ftitel->Height() + 9,
- bcolor);
- osd->DrawEllipse(0, 0, 5, 5, 0x00000000, -2);
- osd->DrawEllipse(Setup.OSDWidth - 6, 0, Setup.OSDWidth - 1, 5,
- 0x00000000, -1);
- sprintf(stext[0], RT_PTY == 0 ? "%s - %s %s%s" : "%s - %s (%s)%s",
- RT_Titel, InfoRequest ? tr("ext. Info") : tr("Radiotext"),
- RT_PTY == 0 ? RDS_PTYN : ptynr2string(RT_PTY),
- RT_MsgShow ? ":" : tr(" [waiting ...]"));
- osd->DrawText(4, 5, stext[0], fcolor, clrTransparent, ftitel,
- Setup.OSDWidth - 4, ftitel->Height());
- // Radio, RDS- or Rass-Symbol, ARec-Symbol or Bitrate
- int inloff = (ftitel->Height() + 9 - 20) / 2;
- if (Rass_Flags[0][0]) {
- osd->DrawBitmap(Setup.OSDWidth - 51, inloff, rass, bcolor,
- fcolor);
- if (ARec_Record)
- osd->DrawBitmap(Setup.OSDWidth - 107, inloff, arec, bcolor,
- 0xFFFC1414); // FG=Red
- else {
- inloff = (ftitel->Height() + 9 - ftext->Height()) / 2;
- osd->DrawText(4, inloff, RadioAudio->bitrate, fcolor,
- clrTransparent, ftext, Setup.OSDWidth - 59,
- ftext->Height(), taRight);
- }
- } else {
- if (InfoRequest && !RdsLogo) {
- osd->DrawBitmap(Setup.OSDWidth - 72, inloff + 1, radio,
- fcolor, bcolor);
- osd->DrawBitmap(Setup.OSDWidth - 48, inloff - 1, radio,
- fcolor, bcolor);
- }
- else {
- osd->DrawBitmap(Setup.OSDWidth - 84, inloff, rds, bcolor,
- fcolor);
- }
- 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,
- clrTransparent, ftext, Setup.OSDWidth - 92,
- ftext->Height(), taRight);
- }
- }
- } else {
- osd->DrawRectangle(0, 0, Setup.OSDWidth - 1, ftitel->Height() + 9,
- 0x00000000);
- }
- // Body
- bcolor =
- (S_RtSkinColor > 0) ?
- radioSkin[skin].clrBack :
- (0x00FFFFFF | S_RtBgTra << 24) & rt_color[S_RtBgCol];
- fcolor =
- (S_RtSkinColor > 0) ?
- radioSkin[skin].clrText : rt_color[S_RtFgCol];
- osd->DrawRectangle(0, ftitel->Height() + 10, Setup.OSDWidth - 1,
- bheight - 1, bcolor);
- 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) {
- 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++) {
- 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++) {
- 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--) {
- 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--) {
- 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) {
- if (!RDS_PSShow || !strstr(RTP_Title, "---")
- || !strstr(RTP_Artist, "---")) {
- sprintf(stext[1], "> %s", tr("Title :"));
- sprintf(stext[2], "> %s", tr("Artist :"));
- int fwidth = ftext->Width(stext[1]);
- fwidth = max(fwidth, ftext->Width(stext[2])) + 15;
- osd->DrawText(4, 6 + yoff + fheight * (ii), stext[1],
- fcolor, clrTransparent, ftext, fwidth - 5,
- ftext->Height());
- osd->DrawText(fwidth, 6 + yoff + fheight * (ii++),
- Convert(RTP_Title), fcolor, clrTransparent, ftext,
- Setup.OSDWidth - 4, ftext->Height());
- osd->DrawText(4, 3 + yoff + fheight * (ii), stext[2],
- fcolor, clrTransparent, ftext, fwidth - 5,
- ftext->Height());
- osd->DrawText(fwidth, 3 + yoff + fheight * (ii++),
- Convert(RTP_Artist), fcolor, clrTransparent, ftext,
- Setup.OSDWidth - 4, ftext->Height());
- }
- else {
- char *temp;
- asprintf(&temp, "%s", "");
- int ind = (RDS_PSIndex == 0) ? 11 : RDS_PSIndex - 1;
- for (int i = ind + 1; i < 12; i++) {
- asprintf(&temp, "%s%s ", temp, RDS_PSText[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);
- osd->DrawText(6, 6 + yoff + fheight * ii, "[", fcolor,
- clrTransparent, ftext, 12, ftext->Height());
- osd->DrawText(Setup.OSDWidth - 12, 6 + yoff + fheight * ii,
- "]", fcolor, clrTransparent, ftext,
- Setup.OSDWidth - 6, ftext->Height());
- osd->DrawText(16, 6 + yoff + fheight * (ii++), stext[1],
- fcolor, clrTransparent, ftext, Setup.OSDWidth - 16,
- ftext->Height(), taCenter);
- osd->DrawText(6, 3 + yoff + fheight * ii, "[", fcolor,
- clrTransparent, ftext, 12, ftext->Height());
- osd->DrawText(Setup.OSDWidth - 12, 3 + yoff + fheight * ii,
- "]", fcolor, clrTransparent, ftext,
- Setup.OSDWidth - 6, ftext->Height());
- osd->DrawText(16, 3 + yoff + fheight * (ii++), stext[2],
- fcolor, clrTransparent, ftext, Setup.OSDWidth - 16,
- ftext->Height(), taCenter);
- }
- }
- }
- osd->Flush();
- }
-
- RT_MsgShow = false;
-}
-
-int cRadioTextOsd::RassImage(int QArchiv, int QKey, bool DirUp) {
- int i;
-
- if (QKey >= 0 && QKey <= 9) {
- 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--) {
- if (fmod(QArchiv, pow(10, i)) == 0)
- break;
- }
- (i > 0) ?
- QArchiv += QKey * (int) pow(10, --i) :
- QArchiv = QKey * 1000;
- (Rass_Flags[QKey][3 - i]) ? : QArchiv = QKey * 1000;
- }
- 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) {
- 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 {
- for (i = QArchiv - 1; i >= Rass_GalStart; i--) {
- if (Rass_Gallery[i])
- break;
- }
- QArchiv = (i >= Rass_GalStart) ? i : Rass_GalEnd;
- }
- }
-
- // show mpeg-still
- char *image;
- if (QArchiv >= 0) {
- asprintf(&image, "%s/Rass_%d.mpg", DataDir, QArchiv);
- }
- else {
- asprintf(&image, "%s/Rass_show.mpg", DataDir);
- }
- RadioImage->SetBackgroundImage(image);
- free(image);
-
- return QArchiv;
-}
-
-void cRadioTextOsd::RassOsd(void) {
- ftext = cFont::GetFont(fontSml);
- int fh = ftext->Height();
-
- if (!qosd && !osd && !Skins.IsOpen() && !cOsd::IsOpen()) {
- qosd = cOsdProvider::NewOsd(Setup.OSDLeft,
- Setup.OSDTop + Setup.OSDHeight - (29 + 264 - 6 + 36));
- tArea Area = { 0, 0, 97, 29 + 264 + 5, 4 };
- qosd->SetAreas(&Area, 1);
- }
-
- if (qosd) {
- uint32_t bcolor, fcolor;
- int skin = theme_skin();
- // Logo
- bcolor = radioSkin[skin].clrTitleBack;
- fcolor = radioSkin[skin].clrTitleText;
- qosd->DrawRectangle(0, 1, 97, 29, bcolor);
- qosd->DrawEllipse(0, 0, 5, 5, 0x00000000, -2);
- qosd->DrawEllipse(92, 0, 97, 5, 0x00000000, -1);
- qosd->DrawBitmap(25, 5, rass, bcolor, fcolor);
- // Body
- bcolor = radioSkin[skin].clrBack;
- fcolor = radioSkin[skin].clrText;
- int offs = 29 + 2;
- qosd->DrawRectangle(0, offs, 97, 29 + 264 + 5, bcolor);
- qosd->DrawEllipse(0, 29 + 264, 5, 29 + 264 + 5, 0x00000000, -3);
- qosd->DrawEllipse(92, 29 + 264, 97, 29 + 264 + 5, 0x00000000, -4);
- qosd->DrawRectangle(5, 29, 92, 29, fcolor);
- // Keys+Index
- offs += 4;
- qosd->DrawBitmap(4, offs, no0, bcolor, fcolor);
- qosd->DrawBitmap(44, offs, index, bcolor, fcolor);
- qosd->DrawBitmap(4, 24 + offs, no1, bcolor, fcolor);
- qosd->DrawBitmap(4, 48 + offs, no2, bcolor, fcolor);
- qosd->DrawBitmap(4, 72 + offs, no3, bcolor, fcolor);
- qosd->DrawBitmap(4, 96 + offs, no4, bcolor, fcolor);
- qosd->DrawBitmap(4, 120 + offs, no5, bcolor, fcolor);
- qosd->DrawBitmap(4, 144 + offs, no6, bcolor, fcolor);
- qosd->DrawBitmap(4, 168 + offs, no7, bcolor, fcolor);
- qosd->DrawBitmap(4, 192 + offs, no8, bcolor, fcolor);
- qosd->DrawBitmap(4, 216 + offs, no9, bcolor, fcolor);
- qosd->DrawBitmap(4, 240 + offs, bok, bcolor, fcolor);
- // Content
- bool mark = false;
- 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]) {
- qosd->DrawBitmap(48, (i * 24) + offs, pages4, bcolor, fcolor);
- }
- 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]) {
- qosd->DrawBitmap(48, (i * 24) + offs, pages2, bcolor, fcolor);
- }
- 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);
- mark = true;
- }
- }
- // Gallery
- if (Rass_GalCount > 0) {
- char *temp;
- qosd->DrawBitmap(48, 240 + offs, pageE, bcolor, fcolor);
- asprintf(&temp, "%d", Rass_GalCount);
- qosd->DrawText(67, 240 + offs + (20 - fh), temp, fcolor,
- clrTransparent, ftext, 97, fh);
- free(temp);
- }
- // Marker gallery/index
- if (!mark) {
- if (Rass_Archiv > 0 && Rass_Archiv <= RASS_GALMAX)
- qosd->DrawBitmap(30, 240 + offs, marker, bcolor, fcolor);
- else
- qosd->DrawBitmap(28, offs, marker, bcolor, fcolor);
- }
- qosd->Flush();
- }
-}
-
-void cRadioTextOsd::RassOsdTip(void) {
- ftext = cFont::GetFont(fontSml);
- int fh = ftext->Height();
-
- if (!qosd && !osd && !Skins.IsOpen() && !cOsd::IsOpen()) {
- qosd = cOsdProvider::NewOsd(Setup.OSDLeft,
- Setup.OSDTop + Setup.OSDHeight - (29 + (2 * fh) - 6 + 36));
- tArea Area = { 0, 0, 97, 29 + (2 * fh) + 5, 4 };
- qosd->SetAreas(&Area, 1);
- }
-
- if (qosd) {
- uint32_t bcolor, fcolor;
- int skin = theme_skin();
- // Title
- bcolor = radioSkin[skin].clrTitleBack;
- fcolor = radioSkin[skin].clrTitleText;
- qosd->DrawRectangle(0, 0, 97, 29, bcolor);
- qosd->DrawEllipse(0, 0, 5, 5, 0x00000000, -2);
- qosd->DrawEllipse(92, 0, 97, 5, 0x00000000, -1);
- qosd->DrawBitmap(25, 5, rass, bcolor, fcolor);
- // Body
- bcolor = radioSkin[skin].clrBack;
- fcolor = radioSkin[skin].clrText;
- qosd->DrawRectangle(0, 29 + 2, 97, 29 + (2 * fh) + 5, bcolor);
- qosd->DrawEllipse(0, 29 + (2 * fh), 5, 29 + (2 * fh) + 5, 0x00000000,
- -3);
- qosd->DrawEllipse(92, 29 + (2 * fh), 97, 29 + (2 * fh) + 5, 0x00000000,
- -4);
- qosd->DrawRectangle(5, 29, 92, 29, fcolor);
- qosd->DrawText(5, 29 + 4, tr("Records"), fcolor, clrTransparent, ftext,
- 97, fh);
- qosd->DrawText(5, 29 + fh + 4, ".. <0>", fcolor, clrTransparent, ftext,
- 97, fh);
- qosd->Flush();
- }
-}
-
-void cRadioTextOsd::RassOsdClose(void) {
- if (qosd != NULL) {
- delete qosd;
- qosd = NULL;
- }
-}
-
-void cRadioTextOsd::RassImgSave(const char *size, int pos) {
- char *infile, *outfile, *cmd;
- int filenr = 0, error = 0;
- struct tm *ts, tm_store;
-
- if (!enforce_directory(DataDir))
- return;
-
- time_t t = time(NULL);
- ts = localtime_r(&t, &tm_store);
- switch (pos) {
- // all from 1-9
- case 1 ... 9:
- for (int i = 3; i >= 0; i--) {
- filenr += (int) (pos * pow(10, i));
- if (Rass_Flags[pos][3 - i]) {
- asprintf(&infile, "%s/Rass_%d.mpg", DataDir, filenr);
- asprintf(&outfile, "%s/Rass_%s-%04d_%02d%02d%02d%02d.jpg",
- DataDir, RT_Titel, filenr, ts->tm_mon + 1, ts->tm_mday,
- ts->tm_hour, ts->tm_min);
- asprintf(&cmd, "ffmpeg -i \"%s\" -s %s -f mjpeg -y \"%s\"",
- infile, size, outfile);
- if ((error = system(cmd)))
- i = -1;
- }
- }
- asprintf(&cmd, "%s '%d'", tr("Rass-Image(s) saved from Archiv "), pos);
- break;
- // all from gallery
- case 10:
- for (int i = Rass_GalStart; i <= Rass_GalEnd; i++) {
- if (Rass_Gallery[i]) {
- asprintf(&infile, "%s/Rass_%d.mpg", DataDir, i);
- asprintf(&outfile, "%s/Rass_%s-Gallery%04d_%02d%02d.jpg",
- 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))) {
- i = Rass_GalEnd + 1;
- }
- }
- }
- asprintf(&cmd, "%s", tr("Rass-Image(s) saved from Gallery"));
- break;
- // single
- default:
- asprintf(&infile, "%s/Rass_%d.mpg", DataDir, Rass_Archiv);
- asprintf(&outfile, "%s/Rass_%s-%04d_%02d%02d%02d%02d.jpg", DataDir,
- RT_Titel, Rass_Archiv, ts->tm_mon + 1, ts->tm_mday, ts->tm_hour,
- ts->tm_min);
- asprintf(&cmd, "ffmpeg -i \"%s\" -s %s -f mjpeg -y \"%s\"", infile,
- size, outfile);
- error = system(cmd);
- asprintf(&cmd, "%s: %s", tr("Rass-Image saved"), outfile);
- }
- free(infile);
-
- // Info
- RassOsdClose();
- if (error) {
- asprintf(&cmd, "%s: %s", tr("Rass-Image failed"), outfile);
- Skins.Message(mtError, cmd, Setup.OSDMessageTime);
- }
- else {
- Skins.Message(mtInfo, cmd, Setup.OSDMessageTime);
- }
-
- free(outfile);
- free(cmd);
-}
-
-void cRadioTextOsd::rtp_print(void) {
- struct tm tm_store;
- time_t t = time(NULL);
- printf("\n>>> %s-Memoryclasses @ %s", InfoRequest ? "Info" : "RTplus",
- asctime(localtime_r(&t, &tm_store)));
- printf(" on '%s' since %s", RT_Titel,
- asctime(localtime_r(&rtp_content.start, &tm_store)));
-
- printf("--- Programme ---\n");
- if (rtp_content.prog_StatShort != NULL)
- printf("StationShort: %s\n", rtp_content.prog_StatShort);
- if (rtp_content.prog_Station != NULL)
- printf(" Station: %s\n", rtp_content.prog_Station);
- if (rtp_content.prog_Now != NULL)
- printf(" Now: %s\n", rtp_content.prog_Now);
- if (rtp_content.prog_Next != NULL)
- printf(" Next: %s\n", rtp_content.prog_Next);
- if (rtp_content.prog_Part != NULL)
- printf(" Part: %s\n", rtp_content.prog_Part);
- if (rtp_content.prog_Host != NULL)
- printf(" Host: %s\n", rtp_content.prog_Host);
- if (rtp_content.prog_EditStaff != NULL)
- printf(" Ed.Staff: %s\n", rtp_content.prog_EditStaff);
- if (rtp_content.prog_Homepage != NULL)
- printf(" Homepage: %s\n", rtp_content.prog_Homepage);
-
- printf("--- Interactivity ---\n");
- if (rtp_content.phone_Hotline != NULL)
- printf(" Phone-Hotline: %s\n", rtp_content.phone_Hotline);
- if (rtp_content.phone_Studio != NULL)
- printf(" Phone-Studio: %s\n", rtp_content.phone_Studio);
- if (rtp_content.sms_Studio != NULL)
- printf(" SMS-Studio: %s\n", rtp_content.sms_Studio);
- if (rtp_content.email_Hotline != NULL)
- printf(" Email-Hotline: %s\n", rtp_content.email_Hotline);
- if (rtp_content.email_Studio != NULL)
- printf(" Email-Studio: %s\n", rtp_content.email_Studio);
-
- printf("--- Info ---\n");
- if (rtp_content.info_News != NULL)
- printf(" News: %s\n", rtp_content.info_News);
- if (rtp_content.info_NewsLocal != NULL)
- printf(" NewsLocal: %s\n", rtp_content.info_NewsLocal);
- if (rtp_content.info_DateTime != NULL)
- printf(" DateTime: %s\n", rtp_content.info_DateTime);
- if (rtp_content.info_Traffic != NULL)
- printf(" Traffic: %s\n", rtp_content.info_Traffic);
- if (rtp_content.info_Alarm != NULL)
- printf(" Alarm: %s\n", rtp_content.info_Alarm);
- if (rtp_content.info_Advert != NULL)
- printf(" Advertisg: %s\n", rtp_content.info_Advert);
- if (rtp_content.info_Url != NULL)
- printf(" Url: %s\n", rtp_content.info_Url);
- // no sorting
- for (int i = 0; i < MAX_RTPC; i++)
- if (rtp_content.info_Stock[i] != NULL)
- printf(" Stock[%02d]: %s\n", i, rtp_content.info_Stock[i]);
- for (int i = 0; i < MAX_RTPC; i++)
- if (rtp_content.info_Sport[i] != NULL)
- printf(" Sport[%02d]: %s\n", i, rtp_content.info_Sport[i]);
- for (int i = 0; i < MAX_RTPC; i++)
- if (rtp_content.info_Lottery[i] != NULL)
- printf(" Lottery[%02d]: %s\n", i, rtp_content.info_Lottery[i]);
- for (int i = 0; i < MAX_RTPC; i++)
- if (rtp_content.info_Weather[i] != NULL)
- printf(" Weather[%02d]: %s\n", i, rtp_content.info_Weather[i]);
- for (int i = 0; i < MAX_RTPC; i++)
- if (rtp_content.info_Other[i] != NULL)
- printf(" Other[%02d]: %s\n", i, rtp_content.info_Other[i]);
- /*
- printf("--- Item-Playlist ---\n");
- // no sorting
- if (rtp_content.item_Index >= 0) {
- for (int i = 0; i < MAX_RTPC; i++) {
- if (rtp_content.item_Title[i] != NULL && rtp_content.item_Artist[i] != NULL) {
- struct tm tm_store;
- struct tm *ts = localtime_r(&rtp_content.item_Start[i], &tm_store);
- printf(" [%02d] %02d:%02d Title: %s | Artist: %s\n",
- i, ts->tm_hour, ts->tm_min, rtp_content.item_Title[i], rtp_content.item_Artist[i]);
- }
- }
- }
-
- printf("--- Last seen Radiotext ---\n");
- // no sorting
- if (rtp_content.rt_Index >= 0) {
- for (int i = 0; i < 2*MAX_RTPC; i++)
- if (rtp_content.radiotext[i] != NULL) printf(" [%03d] %s\n", i, rtp_content.radiotext[i]);
- }
- */
- printf("<<<\n");
-}
-
-#define rtplog 0
-eOSState cRadioTextOsd::ProcessKey(eKeys Key) {
- // RTplus Infolog
- if (rtplog == 1 && (S_Verbose & 0x0f) >= 1) {
- static int ct = 0;
- if (++ct >= 60) {
- ct = 0;
- rtp_print();
- }
- }
-
- // check end @ replay
- if (RT_Replay) {
- int rplayCur, rplayTot;
- cControl::Control()->GetIndex(rplayCur, rplayTot, false);
- if (rplayCur >= rplayTot - 1) {
- Hide();
- return osEnd;
- }
- }
-
- // Timeout or no Info/Rass
- if (RT_OsdTO || (RT_OsdTOTemp > 0) || (RT_Info < 0)) {
- Hide();
- return osEnd;
- }
-
- eOSState state = cOsdObject::ProcessKey(Key);
- if (state != osUnknown)
- return state;
-
- // Key pressed ...
- if ((Key != kNone) && (Key < k_Release)) {
- if (osd) { // Radiotext, -plus Osd
- switch (Key) {
- case kBack:
- RTOsdClose();
- rtclosed = true;
- //rassclosed = false;
- break;
- case k0:
- RTOsdClose();
- RTplus_Osd = true;
- cRemote::CallPlugin("radio");
- return osEnd;
- default:
- Hide();
- LastKey = (Key == kChanUp || Key == kChanDn) ? kNone : Key;
- return osEnd;
- }
- }
- 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);
- switch (Key) {
- // back to Slideshow
- case kBlue:
- case kBack:
- if (!RT_Replay) {
- Rass_Archiv = RassImage(-1, 0, false);
- }
- else {
- Rass_Archiv = -1;
- RadioImage->SetBackgroundImage(ReplayFile);
- }
- RassOsdClose();
- rassclosed = rtclosed = false;
- break;
- // Archiv-Sides
- case k0 ... k9:
- Rass_Archiv = RassImage(Rass_Archiv, Key - k0, false);
- RassOsd();
- break;
- case kOk:
- if (Rass_Flags[10][0]) {
- Rass_Archiv = RassImage(Rass_Archiv, 10, true);
- RassOsd();
- }
- break;
- case kLeft:
- case kRight:
- Rass_Archiv = RassImage(Rass_Archiv, pos,
- (Key == kRight) ? true : false);
- RassOsd();
- break;
- case kDown:
- (pos == 10) ? i = 0 : i = pos + 1;
- while (i != pos) {
- if (Rass_Flags[i][0]) {
- Rass_Archiv = RassImage(Rass_Archiv, i, true);
- RassOsd();
- return osContinue;
- }
- if (++i > 10) {
- i = 0;
- }
- }
- break;
- case kUp:
- (pos == 0) ? i = 10 : i = pos - 1;
- while (i != pos) {
- if (Rass_Flags[i][0]) {
- Rass_Archiv = RassImage(Rass_Archiv, i, true);
- RassOsd();
- return osContinue;
- }
- if (--i < 0) {
- i = 10;
- }
- }
- break;
- case kRed:
- RassImgSave("1024x576", 0);
- break;
- case kGreen:
- RassImgSave("1024x576", pos);
- break;
- case kYellow:
- break; // todo, what ?
- default:
- Hide();
- LastKey = (Key == kChanUp || Key == kChanDn) ? kNone : Key;
- return osEnd;
- }
- }
- else if (qosd && Rass_Archiv == -1) { // Rass-Slideshow Osd
- switch (Key) {
- // close
- case kBack:
- RassOsdClose();
- rassclosed = true;
- //rtclosed = false;
- break;
- // Archiv-Index
- case k0:
- if (Rass_Flags[0][0]) {
- RassOsdClose();
- Rass_Archiv = RassImage(0, 0, false);
- RassOsd();
- }
- break;
- default:
- Hide();
- LastKey = (Key == kChanUp || Key == kChanDn) ? kNone : Key;
- return osEnd;
- }
- }
- else { // no RT && no Rass
- Hide();
- LastKey = (Key == kChanUp || Key == kChanDn) ? kNone : Key;
- return osEnd;
- }
- }
- // no Key pressed ...
- else if (S_RtOsdTO > 0
- && osdtimer.Elapsed() / 1000 / 60 >= (uint) S_RtOsdTO) {
- RT_OsdTO = true;
- Hide();
- return osEnd;
- }
- 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
- && (S_RassText < 2 || rtclosed)) {
- RTOsdClose();
- RassOsdTip();
- }
-
- return osContinue;
-}
-
-// --- cRTplusOsd ------------------------------------------------------
-
-cRTplusOsd::cRTplusOsd(void) :
- cOsdMenu(RTp_Titel, 3, 12), cCharSetConv(
- (RT_Charset == 0) ? "ISO-8859-1" : NULL) {
- RTplus_Osd = false;
-
- bcount = helpmode = 0;
- listtyp[0] = tr("Radiotext");
- listtyp[1] = tr("Playlist");
- listtyp[2] = tr("Sports");
- listtyp[3] = tr("Lottery");
- listtyp[4] = tr("Weather");
- listtyp[5] = tr("Stockmarket");
- listtyp[6] = tr("Other");
-
- Load();
- Display();
-}
-
-cRTplusOsd::~cRTplusOsd() {
-}
-
-void cRTplusOsd::Load(void) {
- char text[80];
-
- struct tm tm_store;
- struct tm *ts = localtime_r(&rtp_content.start, &tm_store);
- snprintf(text, sizeof(text), "%s %02d:%02d",
- InfoRequest ? tr("extra Info since") : tr("RTplus Memory since"),
- ts->tm_hour, ts->tm_min);
- Add(new cOsdItem(hk(text)));
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
-
- snprintf(text, sizeof(text), "-- %s --", tr("Programme"));
- Add(new cOsdItem(hk(text)));
- if (rtp_content.prog_StatShort != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Stat.Short"),
- Convert(rtp_content.prog_StatShort));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.prog_Station != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Station"),
- Convert(rtp_content.prog_Station));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.prog_Now != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Now"),
- Convert(rtp_content.prog_Now));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.prog_Part != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("...Part"),
- Convert(rtp_content.prog_Part));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.prog_Next != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Next"),
- Convert(rtp_content.prog_Next));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.prog_Host != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Host"),
- Convert(rtp_content.prog_Host));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.prog_EditStaff != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Edit.Staff"),
- Convert(rtp_content.prog_EditStaff));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.prog_Homepage != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Homepage"),
- Convert(rtp_content.prog_Homepage));
- Add(new cOsdItem(hk(text)));
- }
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
-
- snprintf(text, sizeof(text), "-- %s --", tr("Interactivity"));
- Add(new cOsdItem(hk(text)));
- if (rtp_content.phone_Hotline != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Phone-Hotline"),
- Convert(rtp_content.phone_Hotline));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.phone_Studio != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Phone-Studio"),
- Convert(rtp_content.phone_Studio));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.sms_Studio != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("SMS-Studio"),
- Convert(rtp_content.sms_Studio));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.email_Hotline != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Email-Hotline"),
- Convert(rtp_content.email_Hotline));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.email_Studio != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Email-Studio"),
- Convert(rtp_content.email_Studio));
- Add(new cOsdItem(hk(text)));
- }
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
-
- snprintf(text, sizeof(text), "-- %s --", tr("Info"));
- Add(new cOsdItem(hk(text)));
- if (rtp_content.info_News != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("News"),
- Convert(rtp_content.info_News));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.info_NewsLocal != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("NewsLocal"),
- Convert(rtp_content.info_NewsLocal));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.info_DateTime != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("DateTime"),
- Convert(rtp_content.info_DateTime));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.info_Traffic != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Traffic"),
- Convert(rtp_content.info_Traffic));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.info_Alarm != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Alarm"),
- Convert(rtp_content.info_Alarm));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.info_Advert != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Advertising"),
- Convert(rtp_content.info_Advert));
- Add(new cOsdItem(hk(text)));
- }
- if (rtp_content.info_Url != NULL) {
- snprintf(text, sizeof(text), "\t%s:\t%s", tr("Url"),
- Convert(rtp_content.info_Url));
- Add(new cOsdItem(hk(text)));
- }
-
- for (int i = 0; i <= 6; i++)
- btext[i] = NULL;
- bcount = 0;
- asprintf(&btext[bcount++], "%s", listtyp[0]);
- if (rtp_content.item_Index >= 0)
- asprintf(&btext[bcount++], "%s", listtyp[1]);
- if (rtp_content.info_SportIndex >= 0)
- asprintf(&btext[bcount++], "%s", listtyp[2]);
- if (rtp_content.info_LotteryIndex >= 0)
- asprintf(&btext[bcount++], "%s", listtyp[3]);
- if (rtp_content.info_WeatherIndex >= 0)
- asprintf(&btext[bcount++], "%s", listtyp[4]);
- if (rtp_content.info_StockIndex >= 0)
- asprintf(&btext[bcount++], "%s", listtyp[5]);
- if (rtp_content.info_OtherIndex >= 0)
- asprintf(&btext[bcount++], "%s", listtyp[6]);
-
- switch (bcount) {
- case 4:
- if (helpmode == 0)
- SetHelp(btext[0], btext[1], btext[2], ">>");
- else if (helpmode == 1)
- SetHelp("<<", btext[3], NULL, tr("Exit"));
- break;
- case 5:
- if (helpmode == 0)
- SetHelp(btext[0], btext[1], btext[2], ">>");
- else if (helpmode == 1)
- SetHelp("<<", btext[3], btext[4], tr("Exit"));
- break;
- case 6:
- if (helpmode == 0)
- SetHelp(btext[0], btext[1], btext[2], ">>");
- else if (helpmode == 1)
- SetHelp("<<", btext[3], btext[4], ">>");
- else if (helpmode == 2)
- SetHelp("<<", btext[5], NULL, tr("Exit"));
- break;
- case 7:
- if (helpmode == 0)
- SetHelp(btext[0], btext[1], btext[2], ">>");
- else if (helpmode == 1)
- SetHelp("<<", btext[3], btext[4], ">>");
- else if (helpmode == 2)
- SetHelp("<<", btext[5], btext[6], tr("Exit"));
- break;
- default:
- helpmode = 0;
- SetHelp(btext[0], btext[1], btext[2], tr("Exit"));
- }
-}
-
-void cRTplusOsd::Update(void) {
- Clear();
- Load();
- Display();
-}
-
-int cRTplusOsd::rtptyp(char *btext) {
- for (int i = 0; i <= 6; i++) {
- if (strcmp(btext, listtyp[i]) == 0)
- return i;
- }
-
- return -1;
-}
-
-void cRTplusOsd::rtp_fileprint(void) {
- struct tm *ts, tm_store;
- char *fname, *fpath;
- FILE *fd;
- int ind, lfd = 0;
-
- if (!enforce_directory(DataDir))
- return;
-
- time_t t = time(NULL);
- ts = localtime_r(&t, &tm_store);
- asprintf(&fname, "%s_%s_%04d-%02d-%02d.%02d.%02d",
- InfoRequest ? "Info" : "RTplus", RT_Titel, ts->tm_year + 1900,
- ts->tm_mon + 1, ts->tm_mday, ts->tm_hour, ts->tm_min);
- asprintf(&fpath, "%s/%s", DataDir, fname);
- if ((fd = fopen(fpath, "w")) != NULL) {
-
- fprintf(fd, ">>> %s-Memoryclasses @ %s",
- InfoRequest ? "Info" : "RTplus",
- asctime(localtime_r(&t, &tm_store)));
- fprintf(fd, " on '%s' since %s", RT_Titel,
- asctime(localtime_r(&rtp_content.start, &tm_store)));
-
- fprintf(fd, "--- Programme ---\n");
- if (rtp_content.prog_StatShort != NULL)
- fprintf(fd, "StationShort: %s\n", rtp_content.prog_StatShort);
- if (rtp_content.prog_Station != NULL)
- fprintf(fd, " Station: %s\n", rtp_content.prog_Station);
- if (rtp_content.prog_Now != NULL)
- fprintf(fd, " Now: %s\n", rtp_content.prog_Now);
- if (rtp_content.prog_Part != NULL)
- fprintf(fd, " Part: %s\n", rtp_content.prog_Part);
- if (rtp_content.prog_Next != NULL)
- fprintf(fd, " Next: %s\n", rtp_content.prog_Next);
- if (rtp_content.prog_Host != NULL)
- fprintf(fd, " Host: %s\n", rtp_content.prog_Host);
- if (rtp_content.prog_EditStaff != NULL)
- fprintf(fd, " Ed.Staff: %s\n", rtp_content.prog_EditStaff);
- if (rtp_content.prog_Homepage != NULL)
- fprintf(fd, " Homepage: %s\n", rtp_content.prog_Homepage);
-
- fprintf(fd, "--- Interactivity ---\n");
- if (rtp_content.phone_Hotline != NULL)
- fprintf(fd, " Phone-Hotline: %s\n", rtp_content.phone_Hotline);
- if (rtp_content.phone_Studio != NULL)
- fprintf(fd, " Phone-Studio: %s\n", rtp_content.phone_Studio);
- if (rtp_content.sms_Studio != NULL)
- fprintf(fd, " SMS-Studio: %s\n", rtp_content.sms_Studio);
- if (rtp_content.email_Hotline != NULL)
- fprintf(fd, " Email-Hotline: %s\n", rtp_content.email_Hotline);
- if (rtp_content.email_Studio != NULL)
- fprintf(fd, " Email-Studio: %s\n", rtp_content.email_Studio);
-
- fprintf(fd, "--- Info ---\n");
- if (rtp_content.info_News != NULL)
- fprintf(fd, " News: %s\n", rtp_content.info_News);
- if (rtp_content.info_NewsLocal != NULL)
- fprintf(fd, " NewsLocal: %s\n", rtp_content.info_NewsLocal);
- if (rtp_content.info_DateTime != NULL)
- fprintf(fd, " DateTime: %s\n", rtp_content.info_DateTime);
- if (rtp_content.info_Traffic != NULL)
- fprintf(fd, " Traffic: %s\n", rtp_content.info_Traffic);
- if (rtp_content.info_Alarm != NULL)
- fprintf(fd, " Alarm: %s\n", rtp_content.info_Alarm);
- if (rtp_content.info_Advert != NULL)
- fprintf(fd, " Advertisg: %s\n", rtp_content.info_Advert);
- if (rtp_content.info_Url != NULL)
- fprintf(fd, " Url: %s\n", rtp_content.info_Url);
-
- if (rtp_content.item_Index >= 0) {
- fprintf(fd, "--- Item-Playlist ---\n");
- ind = rtp_content.item_Index;
- if (ind < (MAX_RTPC - 1) && rtp_content.item_Title[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.item_Title[i] != NULL
- && rtp_content.item_Artist[i] != NULL) {
- ts = localtime_r(&rtp_content.item_Start[i], &tm_store);
- fprintf(fd,
- " %02d:%02d Title: '%s' | Artist: '%s'\n",
- ts->tm_hour, ts->tm_min,
- rtp_content.item_Title[i],
- rtp_content.item_Artist[i]);
- }
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.item_Title[i] != NULL
- && rtp_content.item_Artist[i] != NULL) {
- ts = localtime_r(&rtp_content.item_Start[i], &tm_store);
- fprintf(fd, " %02d:%02d Title: '%s' | Artist: '%s'\n",
- ts->tm_hour, ts->tm_min, rtp_content.item_Title[i],
- rtp_content.item_Artist[i]);
- }
- }
- }
-
- if (rtp_content.info_SportIndex >= 0) {
- fprintf(fd, "--- Sports ---\n");
- ind = rtp_content.info_SportIndex;
- if (ind < (MAX_RTPC - 1) && rtp_content.info_Sport[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Sport[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Sport[i]);
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Sport[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Sport[i]);
- }
- }
-
- if (rtp_content.info_LotteryIndex >= 0) {
- fprintf(fd, "--- Lottery ---\n");
- ind = rtp_content.info_LotteryIndex;
- if (ind
- < (MAX_RTPC - 1)&& rtp_content.info_Lottery[ind+1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Lottery[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Lottery[i]);
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Lottery[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Lottery[i]);
- }
- }
-
- if (rtp_content.info_WeatherIndex >= 0) {
- fprintf(fd, "--- Weather ---\n");
- ind = rtp_content.info_WeatherIndex;
- if (ind
- < (MAX_RTPC - 1)&& rtp_content.info_Weather[ind+1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Weather[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Weather[i]);
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Weather[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Weather[i]);
- }
- }
-
- if (rtp_content.info_StockIndex >= 0) {
- fprintf(fd, "--- Stockmarket ---\n");
- ind = rtp_content.info_StockIndex;
- if (ind < (MAX_RTPC - 1) && rtp_content.info_Stock[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Stock[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Stock[i]);
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Stock[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Stock[i]);
- }
- }
-
- if (rtp_content.info_OtherIndex >= 0) {
- fprintf(fd, "--- Other ---\n");
- ind = rtp_content.info_OtherIndex;
- if (ind < (MAX_RTPC - 1) && rtp_content.info_Other[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Other[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Other[i]);
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Other[i] != NULL)
- fprintf(fd, " %02d. %s\n", ++lfd,
- rtp_content.info_Other[i]);
- }
- }
-
- fprintf(fd, "--- Last seen Radiotext ---\n");
- ind = rtp_content.rt_Index;
- if (ind < (2 * MAX_RTPC - 1) && rtp_content.radiotext[ind + 1] != NULL) {
- for (int i = ind + 1; i < 2 * MAX_RTPC; i++) {
- if (rtp_content.radiotext[i] != NULL)
- fprintf(fd, " %03d. %s\n", ++lfd,
- rtp_content.radiotext[i]);
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.radiotext[i] != NULL)
- fprintf(fd, " %03d. %s\n", ++lfd, rtp_content.radiotext[i]);
- }
-
- fprintf(fd, "<<<\n");
- fclose(fd);
-
- char *infotext;
- asprintf(&infotext, "%s: %s",
- InfoRequest ? tr("Info-File saved") : tr("RTplus-File saved"),
- fpath);
- Skins.Message(mtInfo, infotext, Setup.OSDMessageTime);
- free(infotext);
- } else
- esyslog("radio: ERROR writing RTplus-File failed '%s'", fpath);
-
- free(fpath);
- free(fname);
-}
-
-eOSState cRTplusOsd::ProcessKey(eKeys Key) {
- int typ, ind;
- eOSState state = cOsdMenu::ProcessKey(Key);
-
- if (HasSubMenu())
- return osContinue;
-
- if (state == osUnknown) {
- switch (Key) {
- case kBack:
- case kOk:
- return osEnd;
- case kBlue:
- if (bcount >= 4 && helpmode == 0) {
- helpmode += 1;
- Update();
- } else if (bcount >= 6 && helpmode == 1) {
- helpmode += 1;
- Update();
- } else
- return osEnd;
- break;
- case k0:
- Update();
- break;
- case k8:
- rtp_fileprint();
- break;
- case kRed:
- if (helpmode == 0) {
- if (btext[0] != NULL)
- if ((typ = rtptyp(btext[0])) >= 0)
- AddSubMenu(new cRTplusList(typ));
- } else {
- helpmode -= 1;
- Update();
- }
- break;
- case kGreen:
- ind = (helpmode * 2) + 1;
- if (btext[ind] != NULL) {
- if ((typ = rtptyp(btext[ind])) >= 0)
- AddSubMenu(new cRTplusList(typ));
- }
- break;
- case kYellow:
- ind = (helpmode * 2) + 2;
- if (btext[ind] != NULL) {
- if ((typ = rtptyp(btext[ind])) >= 0)
- AddSubMenu(new cRTplusList(typ));
- }
- break;
- default:
- state = osContinue;
- }
- }
-
- static int ct;
- if (++ct >= 60) {
- ct = 0;
- Update();
- }
-
- return state;
-}
-
-// --- cRTplusList ------------------------------------------------------
-
-cRTplusList::cRTplusList(int Typ) :
- cOsdMenu(RTp_Titel, 4), cCharSetConv(
- (RT_Charset == 0) ? "ISO-8859-1" : NULL) {
- typ = Typ;
- refresh = false;
-
- Load();
- Display();
-}
-
-cRTplusList::~cRTplusList() {
- typ = 0;
-}
-
-void cRTplusList::Load(void) {
- char text[80];
- struct tm *ts, tm_store;
- int ind, lfd = 0;
- char ctitle[80];
-
- ts = localtime_r(&rtp_content.start, &tm_store);
- switch (typ) {
- case 0:
- snprintf(text, sizeof(text), "-- %s (max. %d) --",
- tr("last seen Radiotext"), 2 * MAX_RTPC);
- Add(new cOsdItem(hk(text)));
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
- ind = rtp_content.rt_Index;
- if (ind < (2 * MAX_RTPC - 1) && rtp_content.radiotext[ind + 1] != NULL) {
- for (int i = ind + 1; i < 2 * MAX_RTPC; i++) {
- if (rtp_content.radiotext[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.radiotext[i]));
- Add(new cOsdItem(hk(text)));
- }
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.radiotext[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.radiotext[i]));
- Add(new cOsdItem(hk(text)), refresh);
- }
- }
- break;
- case 1:
- SetCols(6, 19, 1);
- snprintf(text, sizeof(text), "-- %s --", tr("Playlist"));
- Add(new cOsdItem(hk(text)));
- snprintf(text, sizeof(text), "%s\t%s\t\t%s", tr("Time"), tr("Title"),
- tr("Artist"));
- Add(new cOsdItem(hk(text)));
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
- ind = rtp_content.item_Index;
- if (ind < (MAX_RTPC - 1) && rtp_content.item_Title[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.item_Title[i] != NULL
- && rtp_content.item_Artist[i] != NULL) {
- ts = localtime_r(&rtp_content.item_Start[i], &tm_store);
- snprintf(ctitle, sizeof(ctitle), "%s",
- Convert(rtp_content.item_Title[i]));
- snprintf(text, sizeof(text), "%02d:%02d\t%s\t\t%s",
- ts->tm_hour, ts->tm_min, ctitle,
- Convert(rtp_content.item_Artist[i]));
- Add(new cOsdItem(hk(text)));
- }
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.item_Title[i] != NULL
- && rtp_content.item_Artist[i] != NULL) {
- ts = localtime_r(&rtp_content.item_Start[i], &tm_store);
- snprintf(ctitle, sizeof(ctitle), "%s",
- Convert(rtp_content.item_Title[i]));
- snprintf(text, sizeof(text), "%02d:%02d\t%s\t\t%s", ts->tm_hour,
- ts->tm_min, ctitle,
- Convert(rtp_content.item_Artist[i]));
- Add(new cOsdItem(hk(text)), refresh);
- }
- }
- break;
- case 2:
- snprintf(text, sizeof(text), "-- %s --", tr("Sports"));
- Add(new cOsdItem(hk(text)));
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
- ind = rtp_content.info_SportIndex;
- if (ind < (MAX_RTPC - 1) && rtp_content.info_Sport[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Sport[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Sport[i]));
- Add(new cOsdItem(hk(text)));
- }
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Sport[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Sport[i]));
- Add(new cOsdItem(hk(text)), refresh);
- }
- }
- break;
- case 3:
- snprintf(text, sizeof(text), "-- %s --", tr("Lottery"));
- Add(new cOsdItem(hk(text)));
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
- ind = rtp_content.info_LotteryIndex;
- if (ind < (MAX_RTPC - 1) && rtp_content.info_Lottery[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Lottery[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Lottery[i]));
- Add(new cOsdItem(hk(text)));
- }
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Lottery[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Lottery[i]));
- Add(new cOsdItem(hk(text)), refresh);
- }
- }
- break;
- case 4:
- snprintf(text, sizeof(text), "-- %s --", tr("Weather"));
- Add(new cOsdItem(hk(text)));
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
- ind = rtp_content.info_WeatherIndex;
- if (ind < (MAX_RTPC - 1) && rtp_content.info_Weather[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Weather[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Weather[i]));
- Add(new cOsdItem(hk(text)));
- }
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Weather[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Weather[i]));
- Add(new cOsdItem(hk(text)), refresh);
- }
- }
- break;
- case 5:
- snprintf(text, sizeof(text), "-- %s --", tr("Stockmarket"));
- Add(new cOsdItem(hk(text)));
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
- ind = rtp_content.info_StockIndex;
- if (ind < (MAX_RTPC - 1) && rtp_content.info_Stock[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Stock[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Stock[i]));
- Add(new cOsdItem(hk(text)));
- }
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Stock[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Stock[i]));
- Add(new cOsdItem(hk(text)), refresh);
- }
- }
- break;
- case 6:
- snprintf(text, sizeof(text), "-- %s --", tr("Other"));
- Add(new cOsdItem(hk(text)));
- snprintf(text, sizeof(text), "%s", " ");
- Add(new cOsdItem(hk(text)));
- ind = rtp_content.info_OtherIndex;
- if (ind < (MAX_RTPC - 1) && rtp_content.info_Other[ind + 1] != NULL) {
- for (int i = ind + 1; i < MAX_RTPC; i++) {
- if (rtp_content.info_Other[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Other[i]));
- Add(new cOsdItem(hk(text)));
- }
- }
- }
- for (int i = 0; i <= ind; i++) {
- if (rtp_content.info_Other[i] != NULL) {
- snprintf(text, sizeof(text), "%d.\t%s", ++lfd,
- Convert(rtp_content.info_Other[i]));
- Add(new cOsdItem(hk(text)), refresh);
- }
- }
- break;
- }
-
- SetHelp(NULL, NULL, refresh ? tr("Refresh Off") : tr("Refresh On"),
- tr("Back"));
-}
-
-void cRTplusList::Update(void) {
- Clear();
- Load();
- Display();
-}
-
-eOSState cRTplusList::ProcessKey(eKeys Key) {
- eOSState state = cOsdMenu::ProcessKey(Key);
-
- if (state == osUnknown) {
- switch (Key) {
- case k0:
- Update();
- break;
- case kYellow:
- refresh = (refresh) ? false : true;
- Update();
- break;
- case kBack:
- case kOk:
- case kBlue:
- return osBack;
- default:
- state = osContinue;
- }
- }
-
- static int ct;
- if (refresh) {
- if (++ct >= 20) {
- ct = 0;
- Update();
- }
- }
-
- return state;
-}
-
//--------------- End -----------------------------------------------------------------