summaryrefslogtreecommitdiff
path: root/radioaudio.h
blob: a09d1893b7fdc1b6e35a010b56d842b955ddc27a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/*
 * radioaudio.h - part of radio.c, a plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#ifndef __RADIO_AUDIO_H
#define __RADIO_AUDIO_H

#include <linux/types.h>
#include <linux/dvb/video.h>
#include <vdr/player.h>
#include <vdr/device.h>
#include <vdr/audio.h>
#include <vdr/osd.h>
#include <vdr/menu.h>
#include <vdr/receiver.h>

extern char *ConfigDir;
extern char *DataDir;
extern char *ReplayFile;

#define RASS_GALMAX 999
extern bool Rass_Gallery[];
extern int Rass_GalStart, Rass_GalEnd, Rass_GalCount, Rass_SlideFoto;

//Setup-Params
extern int S_RtFunc;
extern int S_StillPic;
extern int S_RtOsdTitle;
extern int S_RtOsdTags;
extern int S_RtOsdPos;
extern int S_RtOsdRows;
extern int S_RtOsdLoop;
extern int S_RtOsdTO;
extern int S_RtSkinColor;
extern int S_RtBgCol;
extern int S_RtBgTra;
extern int S_RtFgCol;
extern int S_RtDispl;
extern int S_RtMsgItems;
extern int S_RassText;
extern int S_RockAnt;
extern uint32_t rt_color[9];
extern int S_Verbose;
//Radiotext
#define RT_MEL 65
extern char RT_Text[5][RT_MEL];
extern char RTP_Artist[RT_MEL], RTP_Title[RT_MEL];
extern int RT_Info, RT_Index, RT_PTY;
extern time_t RTP_Starttime;
extern bool RT_OsdTO, RTplus_Osd, RT_ReOpen;
extern int Radio_CA;
extern int RT_OsdTOTemp;
extern int IsRadioOrReplay;
extern int RT_Charset;
// Info
extern bool InfoRequest;

void radioStatusMsg(void);

// seperate thread for showing RadioImages
class cRadioImage: public cThread {
private:
    char *imagepath;
    bool imageShown;
    void Show (const char *file);
    void send_pes_packet(unsigned char *data, int len, int timestamp);
protected:
    virtual void Action(void);
    void Stop(void);
public:
    cRadioImage(void);
    virtual ~cRadioImage();
    static void Init(void);
    static void Exit(void);
    void SetBackgroundImage(const char *Image);
};

// RDS-Receiver for seperate Data-Pids
class cRDSReceiver : public cReceiver {
private:
    int pid;
    bool rt_start;
    bool rt_bstuff;
protected:
#if VDRVERSNUM >= 20300
    virtual void Receive(const uchar *Data, int Length);
#else
    virtual void Receive(uchar *Data, int Length);
#endif
public:
    cRDSReceiver(int Pid);
    virtual ~cRDSReceiver(void);
};

class cRadioAudio : public cAudio {
private:
    bool enabled;
    int first_packets;
    int audiopid;
    bool bratefound;
    //Radiotext
    cDevice *rdsdevice;
    void RadiotextCheckPES(const uchar *Data, int Length);
    void RadiotextCheckTS(const uchar *Data, int Length);
    void AudioRecorderService(void);
    void RassDecode(uchar *Data, int Length);
protected:
    virtual void Play(const uchar *Data, int Length, uchar Id);
    virtual void PlayTs(const uchar *Data, int Length);
    virtual void Mute(bool On) {};
    virtual void Clear(void) {};
public:
    cRadioAudio(void);
    virtual ~cRadioAudio(void);
    char *bitrate;
    void EnableRadioTextProcessing(const char *Titel, int apid, bool replay = false);
    void DisableRadioTextProcessing();
    void RadiotextDecode(uchar *Data, int Length);
    void RDS_PsPtynDecode(bool PTYN, uchar *Data, int Length);
};

class cRadioTextOsd : public cOsdObject, public cCharSetConv {
private:
    cOsd *osd;
    cOsd *qosd;
    cOsd *qiosd;
    const cFont *ftitel;
    const cFont *ftext;
    int fheight;
    int bheight;
    eKeys LastKey;
    cTimeMs osdtimer;
    void rtp_print(void);
    bool rtclosed;
    bool rassclosed;
    static cBitmap rds, arec, rass, radio;
    static cBitmap index, marker, page1, pages2, pages3, pages4, pageE;
    static cBitmap no0, no1, no2, no3, no4, no5, no6, no7, no8, no9, bok;
public:
    cRadioTextOsd();
    ~cRadioTextOsd();
    virtual void Hide(void);
    virtual void Show(void);
    void ShowText(void);
    void RTOsdClose(void);
    int RassImage(int QArchiv, int QKey, bool DirUp);
    void RassOsd(void);
    void RassOsdTip(void);
    void RassOsdClose(void);
    void RassImgSave(const char *size, int pos);
    virtual eOSState ProcessKey(eKeys Key);
    virtual bool IsMenu(void) const { return false; }
};

class cRTplusOsd : public cOsdMenu, public cCharSetConv {
private:
    int bcount;
    int helpmode;
    const char *listtyp[7];
    char *btext[7];
    int rtptyp(char *btext);
    void rtp_fileprint(void);
public:
    cRTplusOsd(void);
    virtual ~cRTplusOsd();
    virtual void Load(void);
    virtual void Update(void);
    virtual eOSState ProcessKey(eKeys Key); 
};

class cRTplusList : public cOsdMenu, public cCharSetConv {
private:
    int typ;
    bool refresh;
public:
    cRTplusList(int Typ = 0);
    ~cRTplusList();
    virtual void Load(void);
    virtual void Update(void);
    virtual eOSState ProcessKey(eKeys Key); 
};


// Radiotext-Memory RT+Classes 2.1
#define MAX_RTPC 50
struct rtp_classes {
    time_t start;
    char temptext[RT_MEL];
    char *radiotext[2*MAX_RTPC];
    int rt_Index;
    // Item
    bool item_New;
    char *item_Title[MAX_RTPC];     // 1
    char *item_Artist[MAX_RTPC];    // 4    
    time_t item_Start[MAX_RTPC];
    int item_Index;
    // Info
    char *info_News;                // 12
    char *info_NewsLocal;           // 13
    char *info_Stock[MAX_RTPC];     // 14
    int info_StockIndex;
    char *info_Sport[MAX_RTPC];     // 15
    int info_SportIndex;
    char *info_Lottery[MAX_RTPC];   // 16
    int info_LotteryIndex;
    char *info_DateTime;            // 24
    char *info_Weather[MAX_RTPC];   // 25
    int info_WeatherIndex;
    char *info_Traffic;             // 26
    char *info_Alarm;               // 27
    char *info_Advert;              // 28
    char *info_Url;                 // 29
    char *info_Other[MAX_RTPC];     // 30
    int info_OtherIndex;
    // Programme
    char *prog_StatShort;           // 31
    char *prog_Station;             // 32
    char *prog_Now;                 // 33
    char *prog_Next;                // 34
    char *prog_Part;                // 35
    char *prog_Host;                // 36
    char *prog_EditStaff;           // 37
    char *prog_Homepage;            // 39
    // Interactivity
    char *phone_Hotline;            // 41
    char *phone_Studio;             // 42
    char *sms_Studio;               // 44
    char *email_Hotline;            // 46
    char *email_Studio;             // 47
// to be continue...
};

// plugin audiorecorder service
struct Audiorecorder_StatusRtpChannel_v1_0 {
    const cChannel *channel;
    int status;
    /*
    * 0 = channel is unknown ...
    * 1 = no receiver is attached
    * 2 = receiver is attached
    * 3 = actual recording
    */
};
extern const cChannel *chan;

#endif //__RADIO_AUDIO_H