mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-17 02:13:35 +02:00
add support for radiotext (needs testing) -> http://www.dbox2world.net/board293-coolstream-hd1/board296-coolstream-software/10635-radiotext-einbauen/
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1501 e54a6e83-5905-42d5-8d5c-058d10e6a962
Origin commit data
------------------
Commit: ec402d9518
Author: gixxpunk <thomas.harfmann@gmail.com>
Date: 2011-06-02 (Thu, 02 Jun 2011)
Origin message was:
------------------
- add support for radiotext (needs testing) -> http://www.dbox2world.net/board293-coolstream-hd1/board296-coolstream-software/10635-radiotext-einbauen/
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1501 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -5,6 +5,7 @@ INCLUDES = \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/zapit/include \
|
||||
-I$(top_srcdir)/lib/libeventserver \
|
||||
-I$(top_srcdir)/lib/libcoolstream \
|
||||
-I$(top_srcdir)/lib/libconfigfile \
|
||||
-I$(top_srcdir)/lib/libnet \
|
||||
-I$(top_srcdir)/lib/xmltree \
|
||||
|
@@ -33,7 +33,10 @@ libneutrino_driver_a_SOURCES = \
|
||||
shutdown_count.cpp \
|
||||
genpsi.c \
|
||||
streamts.cpp \
|
||||
rfmod.cpp
|
||||
rfmod.cpp \
|
||||
radiotools.cpp \
|
||||
radiotext.cpp \
|
||||
ringbuffer.c
|
||||
|
||||
if BOXTYPE_COOL
|
||||
libneutrino_driver_a_SOURCES += \
|
||||
|
2674
src/driver/radiotext.cpp
Normal file
2674
src/driver/radiotext.cpp
Normal file
File diff suppressed because it is too large
Load Diff
298
src/driver/radiotext.h
Normal file
298
src/driver/radiotext.h
Normal file
@@ -0,0 +1,298 @@
|
||||
/*
|
||||
$Id: radiotext.h,v 1.4 2009/10/31 10:11:02 seife Exp $
|
||||
|
||||
Neutrino-GUI - DBoxII-Project
|
||||
|
||||
License: GPL
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA
|
||||
|
||||
ripped from:
|
||||
*/
|
||||
|
||||
/*
|
||||
* radioaudio.h: A plugin for the Video Disk Recorder
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* This is a "plugin" for the Video Disk Recorder (VDR).
|
||||
*
|
||||
* Written by: Lars Tegeler <email@host.dom>
|
||||
*
|
||||
* Project's homepage: www.math.uni-paderborn.de/~tegeler/vdr
|
||||
*
|
||||
* Latest version available at: URL
|
||||
*
|
||||
* See the file COPYING for license information.
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This Plugin display an background image while the vdr is switcht to radio channels.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __RADIO_AUDIO_H
|
||||
#define __RADIO_AUDIO_H
|
||||
|
||||
#include <driver/framebuffer.h>
|
||||
#include <driver/fontrenderer.h>
|
||||
|
||||
#if 0
|
||||
#include <vdr/player.h>
|
||||
#include <vdr/device.h>
|
||||
#include <vdr/audio.h>
|
||||
#include <vdr/osd.h>
|
||||
#include <vdr/menu.h>
|
||||
#include <vdr/receiver.h>
|
||||
#endif
|
||||
|
||||
#include <dmx_cs.h>
|
||||
|
||||
//#define ENABLE_RASS
|
||||
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned int uint;
|
||||
|
||||
extern const char *ConfigDir;
|
||||
extern const char *DataDir;
|
||||
extern char *ReplayFile;
|
||||
|
||||
|
||||
#if 0
|
||||
// RDS-Receiver for seperate Data-Pids
|
||||
class cRDSReceiver : public cReceiver {
|
||||
private:
|
||||
int pid;
|
||||
bool rt_start;
|
||||
bool rt_bstuff;
|
||||
protected:
|
||||
virtual void Receive(uchar *Data, int Length);
|
||||
public:
|
||||
cRDSReceiver(int Pid);
|
||||
virtual ~cRDSReceiver(void);
|
||||
};
|
||||
#endif
|
||||
|
||||
#define RT_MEL 65
|
||||
#define tr(a) a
|
||||
|
||||
class CRadioText {
|
||||
|
||||
public:
|
||||
typedef struct {
|
||||
CRadioText *rt_object;
|
||||
int fd;
|
||||
} s_rt_thread;
|
||||
|
||||
private:
|
||||
bool enabled;
|
||||
bool have_radiotext;
|
||||
char *imagepath;
|
||||
bool imageShown;
|
||||
int imagedelay;
|
||||
void send_pes_packet(unsigned char *data, int len, int timestamp);
|
||||
void ShowImage (const char *file);
|
||||
int first_packets;
|
||||
|
||||
//Radiotext
|
||||
// cDevice *rdsdevice;
|
||||
void RadiotextCheckPES(const uchar *Data, int Length);
|
||||
void RadioStatusMsg(void);
|
||||
void AudioRecorderService(void);
|
||||
void RassDecode(uchar *Data, int Length);
|
||||
bool DividePes(char *data, int length, int *substart, int *subend);
|
||||
|
||||
uint pid;
|
||||
pthread_t threadRT;
|
||||
int dmxfd;
|
||||
|
||||
public:
|
||||
CRadioText(void);
|
||||
~CRadioText(void);
|
||||
int PES_Receive(char *data, int len);
|
||||
int RassImage(int QArchiv, int QKey, bool DirUp);
|
||||
void EnableRadioTextProcessing(const char *Titel, bool replay = false);
|
||||
void DisableRadioTextProcessing();
|
||||
void RadiotextDecode(uchar *Data, int Length);
|
||||
void RDS_PsPtynDecode(bool PTYN, uchar *Data, int Length);
|
||||
void ShowText(void);
|
||||
char* ptynr2string(int nr);
|
||||
char *rds_entitychar(char *text);
|
||||
|
||||
void setPid(uint inPid);
|
||||
uint getPid(){ return pid; }
|
||||
int run(void);
|
||||
int getDMXfd(void) { return dmxfd; }
|
||||
// s_rt_thread& getThreadParams(void) { return rt; }
|
||||
pthread_t getThread(void) { return threadRT; }
|
||||
void radiotext_stop(void);
|
||||
bool haveRadiotext(void) {return have_radiotext; }
|
||||
|
||||
cDemux *audioDemux;
|
||||
s_rt_thread rt;
|
||||
|
||||
//Setup-Params
|
||||
int S_RtFunc;
|
||||
int S_RtOsd;
|
||||
int S_RtOsdTitle;
|
||||
int S_RtOsdTags;
|
||||
int S_RtOsdPos;
|
||||
int S_RtOsdRows;
|
||||
int S_RtOsdLoop;
|
||||
int S_RtOsdTO;
|
||||
int S_RtSkinColor;
|
||||
int S_RtBgCol;
|
||||
int S_RtBgTra;
|
||||
int S_RtFgCol;
|
||||
int S_RtDispl;
|
||||
int S_RassText;
|
||||
int S_RtMsgItems;
|
||||
// uint32_t rt_color[9];
|
||||
int S_Verbose;
|
||||
|
||||
// Radiotext
|
||||
int RTP_ItemToggle, RTP_TToggle;
|
||||
bool RT_MsgShow, RT_PlusShow;
|
||||
bool RT_Replay, RT_ReOpen;
|
||||
char RT_Text[5][RT_MEL];
|
||||
char RTP_Artist[RT_MEL], RTP_Title[RT_MEL];
|
||||
int RT_Info, RT_Index, RT_PTY;
|
||||
time_t RTP_Starttime;
|
||||
bool RT_OsdTO, RTplus_Osd;
|
||||
int RT_OsdTOTemp;
|
||||
char RDS_PTYN[9];
|
||||
char *RT_Titel, *RTp_Titel;
|
||||
|
||||
#if ENABLE_RASS
|
||||
// Rass ...
|
||||
int Rass_Show; // -1=No, 0=Yes, 1=display
|
||||
int Rass_Archiv; // -1=Off, 0=Index, 1000-9990=Slidenr.
|
||||
bool Rass_Flags[11][4]; // Slides+Gallery existent
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#if 0
|
||||
class cRadioTextOsd : public cOsdObject {
|
||||
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;
|
||||
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);
|
||||
virtual void ShowText(void);
|
||||
virtual void RTOsdClose(void);
|
||||
int RassImage(int QArchiv, int QKey, bool DirUp);
|
||||
virtual void RassOsd(void);
|
||||
virtual void RassOsdTip(void);
|
||||
virtual void RassOsdClose(void);
|
||||
virtual void RassImgSave(char *size, int pos);
|
||||
virtual eOSState ProcessKey(eKeys Key);
|
||||
virtual bool IsInteractive(void) { return false; }
|
||||
};
|
||||
|
||||
class cRTplusOsd : public cOsdMenu {
|
||||
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 {
|
||||
private:
|
||||
int typ;
|
||||
bool refresh;
|
||||
public:
|
||||
cRTplusList(int Typ = 0);
|
||||
~cRTplusList();
|
||||
virtual void Load(void);
|
||||
virtual void Update(void);
|
||||
virtual eOSState ProcessKey(eKeys Key);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Radiotext-Memory
|
||||
#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_Station; // 31
|
||||
char *prog_Now; // 32
|
||||
char *prog_Next; // 33
|
||||
char *prog_Part; // 34
|
||||
char *prog_Host; // 35
|
||||
char *prog_EditStaff; // 36
|
||||
char *prog_Homepage; // 38
|
||||
// Interactivity
|
||||
char *phone_Hotline; // 39
|
||||
char *phone_Studio; // 40
|
||||
char *email_Hotline; // 44
|
||||
char *email_Studio; // 45
|
||||
// to be continue...
|
||||
};
|
||||
|
||||
#endif //__RADIO_AUDIO_H
|
101
src/driver/radiotools.cpp
Normal file
101
src/driver/radiotools.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* radiotools.c: A plugin for the Video Disk Recorder
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* This is a "plugin" for the Video Disk Recorder (VDR).
|
||||
*
|
||||
* Written by: Lars Tegeler <email@host.dom>
|
||||
*
|
||||
* Project's homepage: www.math.uni-paderborn.de/~tegeler/vdr
|
||||
*
|
||||
* Latest version available at: URL
|
||||
*
|
||||
* See the file COPYING for license information.
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This Plugin display an background image while the vdr is switcht to radio channels.
|
||||
*
|
||||
* $Id: radiotools.cpp,v 1.1 2009/08/07 07:22:31 rhabarber1848 Exp $
|
||||
|
||||
*/
|
||||
|
||||
#include "radiotools.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/* for timetest */
|
||||
//#include <time.h>
|
||||
//#include <sys/time.h>
|
||||
unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst)
|
||||
{
|
||||
/* timetest */
|
||||
//struct timeval t;
|
||||
//unsigned long long tstart = 0;
|
||||
//if (gettimeofday(&t, NULL) == 0)
|
||||
// tstart = t.tv_sec*1000000 + t.tv_usec;
|
||||
|
||||
// CRC16-CCITT: x^16 + x^12 + x^5 + 1
|
||||
// with start 0xffff and result invers
|
||||
register unsigned short crc = 0xffff;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* timetest */
|
||||
//if (tstart > 0 && gettimeofday(&t, NULL) == 0)
|
||||
// printf("vdr-radio: crc-calctime = %d usec\n", (int)((t.tv_sec*1000000 + t.tv_usec) - tstart));
|
||||
|
||||
return ~(crc);
|
||||
}
|
||||
|
||||
char *rtrim(char *text)
|
||||
{
|
||||
char *s = text + strlen(text) - 1;
|
||||
while (s >= text && (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r'))
|
||||
*s-- = 0;
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
// --- cTimeMs ---------------------------------------------------------------
|
||||
|
||||
cTimeMs::cTimeMs(void)
|
||||
{
|
||||
Set();
|
||||
}
|
||||
|
||||
#if 0
|
||||
uint64_t cTimeMs::Now(void)
|
||||
{
|
||||
struct timeval t;
|
||||
if (gettimeofday(&t, NULL) == 0)
|
||||
return (uint64_t(t.tv_sec)) * 1000 + t.tv_usec / 1000;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void cTimeMs::Set(int Ms)
|
||||
{
|
||||
begin = Now() + Ms;
|
||||
}
|
||||
|
||||
bool cTimeMs::TimedOut(void)
|
||||
{
|
||||
return Now() >= begin;
|
||||
}
|
||||
|
||||
uint64_t cTimeMs::Elapsed(void)
|
||||
{
|
||||
return Now() - begin;
|
||||
}
|
||||
|
||||
#endif
|
||||
//--------------- End -----------------------------------------------------------------
|
46
src/driver/radiotools.h
Normal file
46
src/driver/radiotools.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* radiotools.h: A plugin for the Video Disk Recorder
|
||||
*
|
||||
* See the README file for copyright information and how to reach the author.
|
||||
*
|
||||
* This is a "plugin" for the Video Disk Recorder (VDR).
|
||||
*
|
||||
* Written by: Lars Tegeler <email@host.dom>
|
||||
*
|
||||
* Project's homepage: www.math.uni-paderborn.de/~tegeler/vdr
|
||||
*
|
||||
* Latest version available at: URL
|
||||
*
|
||||
* See the file COPYING for license information.
|
||||
*
|
||||
* Description:
|
||||
*
|
||||
* This Plugin display an background image while the vdr is switcht to radio channels.
|
||||
*
|
||||
* $Id: radiotools.h,v 1.1 2009/08/07 07:22:31 rhabarber1848 Exp $
|
||||
|
||||
*/
|
||||
|
||||
#ifndef __RADIO_TOOLS_H
|
||||
#define __RADIO_TOOLS_H
|
||||
|
||||
|
||||
unsigned short crc16_ccitt(unsigned char *daten, int len, bool skipfirst);
|
||||
|
||||
char *rtrim(char *text);
|
||||
|
||||
typedef long long unsigned int uint64_t;
|
||||
|
||||
class cTimeMs {
|
||||
private:
|
||||
uint64_t begin;
|
||||
|
||||
public:
|
||||
cTimeMs(void);
|
||||
static uint64_t Now(void);
|
||||
void Set(int Ms = 0);
|
||||
bool TimedOut(void);
|
||||
uint64_t Elapsed(void);
|
||||
};
|
||||
|
||||
#endif //__RADIO_TOOLS_H
|
378
src/driver/ringbuffer.c
Normal file
378
src/driver/ringbuffer.c
Normal file
@@ -0,0 +1,378 @@
|
||||
/*
|
||||
* Copyright (C) 2000 Paul Davis
|
||||
* Copyright (C) 2003 Rohan Drape
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* ISO/POSIX C version of Paul Davis's lock free ringbuffer C++ code.
|
||||
* This is safe for the case of one read thread and one write thread.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h>
|
||||
#include "ringbuffer.h"
|
||||
|
||||
|
||||
/* Create a new ringbuffer to hold at least `sz' bytes of data. The
|
||||
* actual buffer size is rounded up to the next power of two.
|
||||
*/
|
||||
ringbuffer_t * ringbuffer_create (int sz)
|
||||
{
|
||||
int power_of_two;
|
||||
ringbuffer_t *rb;
|
||||
|
||||
rb = malloc (sizeof (ringbuffer_t));
|
||||
|
||||
for(power_of_two = 1; 1 << power_of_two < sz; power_of_two++)
|
||||
;
|
||||
|
||||
rb->size = 1 << power_of_two;
|
||||
rb->size_mask = rb->size;
|
||||
rb->size_mask -= 1;
|
||||
rb->write_ptr = 0;
|
||||
rb->read_ptr = 0;
|
||||
rb->buf = malloc (rb->size);
|
||||
rb->mlocked = 0;
|
||||
rb->helpbufsize = 1;
|
||||
rb->helpbuf = malloc (rb->helpbufsize);
|
||||
|
||||
if( rb->buf )
|
||||
return rb;
|
||||
|
||||
free( rb );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Free all data associated with the ringbuffer `rb'.
|
||||
*/
|
||||
void ringbuffer_free (ringbuffer_t * rb)
|
||||
{
|
||||
if (rb->mlocked)
|
||||
munlock (rb->buf, rb->size);
|
||||
|
||||
free (rb->buf);
|
||||
rb->buf=0;
|
||||
free (rb->helpbuf);
|
||||
rb->helpbuf=0;
|
||||
free (rb);
|
||||
rb=0;
|
||||
}
|
||||
|
||||
/* Lock the data block of `rb' using the system call 'mlock'. */
|
||||
int ringbuffer_mlock (ringbuffer_t * rb)
|
||||
{
|
||||
if (mlock (rb->buf, rb->size))
|
||||
return -1;
|
||||
|
||||
rb->mlocked = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Reset the read and write pointers to zero. This is not thread
|
||||
* safe.
|
||||
*/
|
||||
void ringbuffer_reset (ringbuffer_t * rb)
|
||||
{
|
||||
rb->read_ptr = 0;
|
||||
rb->write_ptr = 0;
|
||||
}
|
||||
|
||||
/* Return the number of bytes available for reading. This is the
|
||||
* number of bytes in front of the read pointer and behind the write
|
||||
* pointer.
|
||||
*/
|
||||
size_t ringbuffer_read_space (ringbuffer_t * rb)
|
||||
{
|
||||
size_t w, r;
|
||||
|
||||
w = rb->write_ptr;
|
||||
r = rb->read_ptr;
|
||||
|
||||
if (w > r)
|
||||
return w - r;
|
||||
else
|
||||
return (w - r + rb->size) & rb->size_mask;
|
||||
}
|
||||
|
||||
/* Return the number of bytes available for writing. This is the
|
||||
* number of bytes in front of the write pointer and behind the read
|
||||
* pointer.
|
||||
*/
|
||||
size_t ringbuffer_write_space (ringbuffer_t * rb)
|
||||
{
|
||||
size_t w, r;
|
||||
|
||||
w = rb->write_ptr;
|
||||
r = rb->read_ptr;
|
||||
|
||||
if (w > r)
|
||||
return ((r - w + rb->size) & rb->size_mask) - 1;
|
||||
else if (w < r)
|
||||
return (r - w) - 1;
|
||||
else
|
||||
return rb->size - 1;
|
||||
}
|
||||
|
||||
/* The copying data reader. Copy at most `cnt' bytes from `rb' to
|
||||
* `dest'. Returns the actual number of bytes copied.
|
||||
*/
|
||||
size_t ringbuffer_read (ringbuffer_t * rb, char *dest, size_t cnt)
|
||||
{
|
||||
size_t free_cnt;
|
||||
size_t cnt2;
|
||||
size_t to_read;
|
||||
size_t n1, n2;
|
||||
|
||||
if ((free_cnt = ringbuffer_read_space (rb)) == 0)
|
||||
return 0;
|
||||
|
||||
to_read = cnt > free_cnt ? free_cnt : cnt;
|
||||
|
||||
cnt2 = rb->read_ptr + to_read;
|
||||
|
||||
if (cnt2 > rb->size)
|
||||
{
|
||||
n1 = rb->size - rb->read_ptr;
|
||||
n2 = cnt2 & rb->size_mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
n1 = to_read;
|
||||
n2 = 0;
|
||||
}
|
||||
|
||||
memcpy (dest, &(rb->buf[rb->read_ptr]), n1);
|
||||
rb->read_ptr += n1;
|
||||
rb->read_ptr &= rb->size_mask;
|
||||
|
||||
if (n2)
|
||||
{
|
||||
memcpy (dest + n1, &(rb->buf[rb->read_ptr]), n2);
|
||||
rb->read_ptr += n2;
|
||||
rb->read_ptr &= rb->size_mask;
|
||||
}
|
||||
|
||||
return to_read;
|
||||
}
|
||||
|
||||
/* The copying data writer. Copy at most `cnt' bytes to `rb' from
|
||||
* `src'. Returns the actual number of bytes copied.
|
||||
*/
|
||||
size_t ringbuffer_write (ringbuffer_t * rb, char *src, size_t cnt)
|
||||
{
|
||||
size_t free_cnt;
|
||||
size_t cnt2;
|
||||
size_t to_write;
|
||||
size_t n1, n2;
|
||||
|
||||
if ((free_cnt = ringbuffer_write_space (rb)) == 0)
|
||||
return 0;
|
||||
|
||||
to_write = cnt > free_cnt ? free_cnt : cnt;
|
||||
|
||||
cnt2 = rb->write_ptr + to_write;
|
||||
|
||||
if (cnt2 > rb->size) {
|
||||
n1 = rb->size - rb->write_ptr;
|
||||
n2 = cnt2 & rb->size_mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
n1 = to_write;
|
||||
n2 = 0;
|
||||
}
|
||||
|
||||
memcpy (&(rb->buf[rb->write_ptr]), src, n1);
|
||||
rb->write_ptr += n1;
|
||||
rb->write_ptr &= rb->size_mask;
|
||||
|
||||
if (n2)
|
||||
{
|
||||
memcpy (&(rb->buf[rb->write_ptr]), src + n1, n2);
|
||||
rb->write_ptr += n2;
|
||||
rb->write_ptr &= rb->size_mask;
|
||||
}
|
||||
|
||||
return to_write;
|
||||
}
|
||||
|
||||
/* Advance the read pointer `cnt' places.
|
||||
*/
|
||||
void ringbuffer_read_advance (ringbuffer_t * rb, size_t cnt)
|
||||
{
|
||||
rb->read_ptr += cnt;
|
||||
rb->read_ptr &= rb->size_mask;
|
||||
}
|
||||
|
||||
/* Advance the write pointer `cnt' places.
|
||||
*/
|
||||
void ringbuffer_write_advance (ringbuffer_t * rb, size_t cnt)
|
||||
{
|
||||
rb->write_ptr += cnt;
|
||||
rb->write_ptr &= rb->size_mask;
|
||||
}
|
||||
|
||||
/* The non-copying data reader. `vec' is an array of two places. Set
|
||||
* the values at `vec' to hold the current readable data at `rb'. If
|
||||
* the readable data is in one segment the second segment has zero
|
||||
* length.
|
||||
*/
|
||||
void ringbuffer_get_read_vector (ringbuffer_t * rb, ringbuffer_data_t * vec)
|
||||
{
|
||||
size_t free_cnt;
|
||||
size_t cnt2;
|
||||
size_t w, r;
|
||||
|
||||
w = rb->write_ptr;
|
||||
r = rb->read_ptr;
|
||||
|
||||
if (w > r)
|
||||
free_cnt = w - r;
|
||||
else
|
||||
free_cnt = (w - r + rb->size) & rb->size_mask;
|
||||
|
||||
cnt2 = r + free_cnt;
|
||||
|
||||
if (cnt2 > rb->size)
|
||||
{
|
||||
/* Two part vector: the rest of the buffer after the current write
|
||||
* ptr, plus some from the start of the buffer.
|
||||
*/
|
||||
vec[0].buf = &(rb->buf[r]);
|
||||
vec[0].len = rb->size - r;
|
||||
vec[1].buf = rb->buf;
|
||||
vec[1].len = cnt2 & rb->size_mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Single part vector: just the rest of the buffer */
|
||||
vec[0].buf = &(rb->buf[r]);
|
||||
vec[0].len = free_cnt;
|
||||
vec[1].len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* The non-copying data writer. `vec' is an array of two places. Set
|
||||
* the values at `vec' to hold the current writeable data at `rb'. If
|
||||
* the writeable data is in one segment the second segment has zero
|
||||
* length.
|
||||
*/
|
||||
void ringbuffer_get_write_vector (ringbuffer_t * rb, ringbuffer_data_t * vec)
|
||||
{
|
||||
size_t free_cnt;
|
||||
size_t cnt2;
|
||||
size_t w, r;
|
||||
|
||||
w = rb->write_ptr;
|
||||
r = rb->read_ptr;
|
||||
|
||||
if (w > r)
|
||||
free_cnt = ((r - w + rb->size) & rb->size_mask) - 1;
|
||||
else if (w < r)
|
||||
free_cnt = (r - w) - 1;
|
||||
else
|
||||
free_cnt = rb->size - 1;
|
||||
|
||||
cnt2 = w + free_cnt;
|
||||
|
||||
if (cnt2 > rb->size)
|
||||
{
|
||||
/* Two part vector: the rest of the buffer after the current write
|
||||
* ptr, plus some from the start of the buffer.
|
||||
*/
|
||||
vec[0].buf = &(rb->buf[w]);
|
||||
vec[0].len = rb->size - w;
|
||||
vec[1].buf = rb->buf;
|
||||
vec[1].len = cnt2 & rb->size_mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
vec[0].buf = &(rb->buf[w]);
|
||||
vec[0].len = free_cnt;
|
||||
vec[1].len = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get read pointer at most `cnt' bytes from `rb' to
|
||||
`dest'. Returns the actual readable number of bytes . */
|
||||
size_t ringbuffer_get_readpointer (ringbuffer_t * rb, char **dest, size_t cnt)
|
||||
{
|
||||
size_t free_cnt;
|
||||
size_t cnt2;
|
||||
size_t to_read;
|
||||
size_t n1, n2;
|
||||
size_t tmp_read_ptr = rb->read_ptr;
|
||||
|
||||
if ((free_cnt = ringbuffer_read_space (rb)) == 0)
|
||||
return 0;
|
||||
|
||||
to_read = cnt > free_cnt ? free_cnt : cnt;
|
||||
|
||||
cnt2 = rb->read_ptr + to_read;
|
||||
|
||||
if (cnt2 > rb->size)
|
||||
{
|
||||
n1 = rb->size - rb->read_ptr;
|
||||
n2 = cnt2 & rb->size_mask;
|
||||
}
|
||||
else
|
||||
{
|
||||
n1 = to_read;
|
||||
n2 = 0;
|
||||
}
|
||||
if (n2)
|
||||
{
|
||||
if (to_read > rb->helpbufsize)
|
||||
{
|
||||
rb->helpbufsize = to_read;
|
||||
rb->helpbuf = realloc (rb->helpbuf, rb->helpbufsize);
|
||||
}
|
||||
memcpy (rb->helpbuf, &(rb->buf[rb->read_ptr]), n1);
|
||||
tmp_read_ptr += n1;
|
||||
tmp_read_ptr &= rb->size_mask;
|
||||
memcpy (rb->helpbuf + n1, &(rb->buf[tmp_read_ptr]), n2);
|
||||
*dest = rb->helpbuf;
|
||||
}
|
||||
else
|
||||
*dest = &(rb->buf[rb->read_ptr]);
|
||||
|
||||
return to_read;
|
||||
}
|
||||
|
||||
|
||||
/* Get write pointer at most `cnt' bytes to `rb' from
|
||||
`src'. Returns the actual number of bytes can insert. */
|
||||
size_t ringbuffer_get_writepointer (ringbuffer_t * rb, char **src, size_t cnt)
|
||||
{
|
||||
size_t free_cnt;
|
||||
size_t cnt2;
|
||||
size_t to_write;
|
||||
|
||||
if ((free_cnt = ringbuffer_write_space (rb)) == 0)
|
||||
return 0;
|
||||
|
||||
to_write = cnt > free_cnt ? free_cnt : cnt;
|
||||
|
||||
cnt2 = rb->write_ptr + to_write;
|
||||
|
||||
if (cnt2 > rb->size)
|
||||
return 0;
|
||||
else
|
||||
*src = &(rb->buf[rb->write_ptr]);
|
||||
|
||||
return to_write;
|
||||
}
|
45
src/driver/ringbuffer.h
Normal file
45
src/driver/ringbuffer.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef _RINGBUFFER_H
|
||||
#define _RINGBUFFER_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *buf;
|
||||
size_t len;
|
||||
} ringbuffer_data_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *buf;
|
||||
volatile size_t write_ptr;
|
||||
volatile size_t read_ptr;
|
||||
size_t size;
|
||||
size_t size_mask;
|
||||
int mlocked;
|
||||
char *helpbuf;
|
||||
size_t helpbufsize;
|
||||
} ringbuffer_t;
|
||||
|
||||
ringbuffer_t *ringbuffer_create(int sz);
|
||||
void ringbuffer_free(ringbuffer_t *rb);
|
||||
|
||||
int ringbuffer_mlock(ringbuffer_t *rb);
|
||||
void ringbuffer_reset(ringbuffer_t *rb);
|
||||
|
||||
void ringbuffer_write_advance(ringbuffer_t *rb, size_t cnt);
|
||||
void ringbuffer_read_advance(ringbuffer_t *rb, size_t cnt);
|
||||
|
||||
size_t ringbuffer_write_space(ringbuffer_t *rb);
|
||||
size_t ringbuffer_read_space(ringbuffer_t *rb);
|
||||
|
||||
size_t ringbuffer_read(ringbuffer_t *rb, char *dest, size_t cnt);
|
||||
size_t ringbuffer_write(ringbuffer_t *rb, char *src, size_t cnt);
|
||||
|
||||
void ringbuffer_get_read_vector(ringbuffer_t *rb, ringbuffer_data_t *vec);
|
||||
void ringbuffer_get_write_vector(ringbuffer_t *rb, ringbuffer_data_t *vec);
|
||||
|
||||
size_t ringbuffer_get_readpointer(ringbuffer_t * rb, char **dest, size_t cnt);
|
||||
size_t ringbuffer_get_writepointer(ringbuffer_t * rb, char **src, size_t cnt);
|
||||
|
||||
#endif
|
@@ -56,6 +56,7 @@
|
||||
#include "gui/infoviewer.h"
|
||||
#include "gui/eventlist.h"
|
||||
#include "gui/videosettings.h"
|
||||
#include "driver/radiotext.h"
|
||||
|
||||
#ifndef NEUTRINO_CPP
|
||||
#define NEUTRINO_CPP extern
|
||||
@@ -97,7 +98,7 @@ NEUTRINO_CPP CLocaleManager *g_Locale;
|
||||
#if HAVE_COOL_HARDWARE
|
||||
NEUTRINO_CPP RFmod *g_RFmod;
|
||||
#endif
|
||||
|
||||
NEUTRINO_CPP CVideoSettings *g_videoSettings;
|
||||
NEUTRINO_CPP CRadioText *g_Radiotext;
|
||||
|
||||
#endif /* __neutrino_global_h__ */
|
||||
|
@@ -6,6 +6,7 @@ INCLUDES = \
|
||||
-I$(top_srcdir)/src/zapit/include \
|
||||
-I$(top_srcdir)/lib/libeventserver \
|
||||
-I$(top_srcdir)/lib/libconfigfile \
|
||||
-I$(top_srcdir)/lib/libcoolstream \
|
||||
-I$(top_srcdir)/lib/xmltree \
|
||||
@FREETYPE_CFLAGS@ \
|
||||
-I$(top_srcdir)/lib
|
||||
|
@@ -1126,6 +1126,13 @@ void CChannelList::zapTo(int pos, bool /* forceStoreToLastChannels */)
|
||||
CZapitChannel* chan = chanlist[pos];
|
||||
printf("**************************** CChannelList::zapTo me %p %s tuned %d new %d %s -> %llx\n", this, name.c_str(), tuned, pos, chan->name.c_str(), chan->channel_id);
|
||||
if ( pos!=(int)tuned ) {
|
||||
|
||||
if ((g_settings.radiotext_enable) && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio) && (g_Radiotext))
|
||||
{
|
||||
// stop radiotext PES decoding before zapping
|
||||
g_Radiotext->radiotext_stop();
|
||||
}
|
||||
|
||||
tuned = pos;
|
||||
g_RemoteControl->zapTo_ChannelID(chan->channel_id, chan->name, !chan->bAlwaysLocked); // UTF-8
|
||||
// TODO check is it possible bouquetList is NULL ?
|
||||
|
@@ -496,6 +496,10 @@ void CInfoViewer::showMovieTitle(const int playState, const std::string Channel,
|
||||
if (!gotTime)
|
||||
gotTime = timeset;
|
||||
|
||||
if (g_settings.radiotext_enable && g_Radiotext) {
|
||||
g_Radiotext->RT_MsgShow = true;
|
||||
}
|
||||
|
||||
int fadeValue;
|
||||
if (fadeIn) {
|
||||
fadeValue = 100;
|
||||
@@ -735,6 +739,14 @@ void CInfoViewer::showTitle (const int ChanNum, const std::string & Channel, con
|
||||
g_Sectionsd->setServiceChanged (channel_id & 0xFFFFFFFFFFFFULL, true);
|
||||
}
|
||||
|
||||
// Radiotext
|
||||
if (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio)
|
||||
{
|
||||
if ((g_settings.radiotext_enable) && (!recordModeActive) && (!calledFromNumZap))
|
||||
showRadiotext();
|
||||
else
|
||||
showIcon_RadioText(false);
|
||||
}
|
||||
|
||||
if (!calledFromNumZap) {
|
||||
loop(fadeValue, show_dot , fadeIn);
|
||||
@@ -811,6 +823,8 @@ void CInfoViewer::loop(int fadeValue, bool show_dot ,bool fadeIn)
|
||||
paintTime (show_dot, false);
|
||||
showRecordIcon (show_dot);
|
||||
show_dot = !show_dot;
|
||||
if ((g_settings.radiotext_enable) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio))
|
||||
showRadiotext();
|
||||
|
||||
showIcon_16_9();
|
||||
showIcon_Resolution();
|
||||
@@ -821,7 +835,10 @@ void CInfoViewer::loop(int fadeValue, bool show_dot ,bool fadeIn)
|
||||
} else if (!fileplay && !CMoviePlayerGui::getInstance().timeshift) {
|
||||
CNeutrinoApp *neutrino = CNeutrinoApp::getInstance ();
|
||||
if ((msg == (neutrino_msg_t) g_settings.key_quickzap_up) || (msg == (neutrino_msg_t) g_settings.key_quickzap_down) || (msg == CRCInput::RC_0) || (msg == NeutrinoMessages::SHOW_INFOBAR)) {
|
||||
hideIt = false;
|
||||
if ((g_settings.radiotext_enable) && (CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio))
|
||||
hideIt = true;
|
||||
else
|
||||
hideIt = false;
|
||||
//hideIt = (g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR] == 0) ? true : false;
|
||||
g_RCInput->postMsg (msg, data);
|
||||
res = messages_return::cancel_info;
|
||||
@@ -973,6 +990,25 @@ void CInfoViewer::showSubchan ()
|
||||
}
|
||||
}
|
||||
|
||||
void CInfoViewer::showIcon_RadioText(bool /*rt_available*/) const
|
||||
// painting the icon for radiotext mode
|
||||
{
|
||||
#if 0
|
||||
if (showButtonBar)
|
||||
{
|
||||
int mode = CNeutrinoApp::getInstance()->getMode();
|
||||
std::string rt_icon = "radiotextoff.raw";
|
||||
if ((!virtual_zap_mode) && (!recordModeActive) && (mode == NeutrinoMessages::mode_radio))
|
||||
{
|
||||
if (g_settings.radiotext_enable){
|
||||
rt_icon = rt_available ? "radiotextget.raw" : "radiotextwait.raw";
|
||||
}
|
||||
}
|
||||
frameBuffer->paintIcon(rt_icon, BoxEndX - (ICON_LARGE_WIDTH + 2 + ICON_LARGE_WIDTH + 2 + ICON_SMALL_WIDTH + 2 + ICON_SMALL_WIDTH + 6),BoxEndY + (InfoHeightY_Info - ICON_HEIGHT) / 2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CInfoViewer::showIcon_16_9 ()
|
||||
{
|
||||
if ((aspectRatio == 0) || ( g_RemoteControl->current_PIDs.PIDs.vpid == 0 ) || (aspectRatio != videoDecoder->getAspectRatio())) {
|
||||
@@ -1111,6 +1147,145 @@ void CInfoViewer::showMotorMoving (int duration)
|
||||
ShowHintUTF (LOCALE_MESSAGEBOX_INFO, text, g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth (text, true) + 10, duration); // UTF-8
|
||||
}
|
||||
|
||||
void CInfoViewer::killRadiotext()
|
||||
{
|
||||
frameBuffer->paintBackgroundBox(rt_x, rt_y, rt_w, rt_h);
|
||||
}
|
||||
|
||||
void CInfoViewer::showRadiotext()
|
||||
{
|
||||
char stext[3][100];
|
||||
int yoff = 8, ii = 0;
|
||||
bool RTisIsUTF = false;
|
||||
|
||||
if (g_Radiotext == NULL) return;
|
||||
showIcon_RadioText(g_Radiotext->haveRadiotext());
|
||||
|
||||
if (g_Radiotext->S_RtOsd) {
|
||||
// dimensions of radiotext window
|
||||
rt_dx = BoxEndX - BoxStartX;
|
||||
rt_dy = 25;
|
||||
rt_x = BoxStartX;
|
||||
rt_y = g_settings.screen_StartY + 10;
|
||||
rt_h = rt_y + 7 + rt_dy*(g_Radiotext->S_RtOsdRows+1)+SHADOW_OFFSET;
|
||||
rt_w = rt_x+rt_dx+SHADOW_OFFSET;
|
||||
|
||||
int lines = 0;
|
||||
for (int i = 0; i < g_Radiotext->S_RtOsdRows; i++) {
|
||||
if (g_Radiotext->RT_Text[i][0] != '\0') lines++;
|
||||
}
|
||||
if (lines == 0)
|
||||
frameBuffer->paintBackgroundBox(rt_x, rt_y, rt_w, rt_h);
|
||||
|
||||
if (g_Radiotext->RT_MsgShow) {
|
||||
|
||||
if (g_Radiotext->S_RtOsdTitle == 1) {
|
||||
|
||||
// Title
|
||||
// sprintf(stext[0], g_Radiotext->RT_PTY == 0 ? "%s - %s %s%s" : "%s - %s (%s)%s",
|
||||
// g_Radiotext->RT_Titel, tr("Radiotext"), g_Radiotext->RT_PTY == 0 ? g_Radiotext->RDS_PTYN : g_Radiotext->ptynr2string(g_Radiotext->RT_PTY), g_Radiotext->RT_MsgShow ? ":" : tr(" [waiting ...]"));
|
||||
if ((lines) || (g_Radiotext->RT_PTY !=0)) {
|
||||
sprintf(stext[0], g_Radiotext->RT_PTY == 0 ? "%s %s%s" : "%s (%s)%s", tr("Radiotext"), g_Radiotext->RT_PTY == 0 ? g_Radiotext->RDS_PTYN : g_Radiotext->ptynr2string(g_Radiotext->RT_PTY), ":");
|
||||
|
||||
// shadow
|
||||
frameBuffer->paintBoxRel(rt_x+SHADOW_OFFSET, rt_y+SHADOW_OFFSET, rt_dx, rt_dy, COL_INFOBAR_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_TOP);
|
||||
frameBuffer->paintBoxRel(rt_x, rt_y, rt_dx, rt_dy, COL_INFOBAR_PLUS_0, RADIUS_LARGE, CORNER_TOP);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(rt_x+10, rt_y+ 30, rt_dx-20, stext[0], COL_INFOBAR, 0, RTisIsUTF); // UTF-8
|
||||
}
|
||||
yoff = 17;
|
||||
ii = 1;
|
||||
#if 0
|
||||
// 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 {
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// Body
|
||||
if (lines) {
|
||||
frameBuffer->paintBoxRel(rt_x+SHADOW_OFFSET, rt_y+rt_dy+SHADOW_OFFSET, rt_dx, 7+rt_dy* g_Radiotext->S_RtOsdRows, COL_INFOBAR_SHADOW_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
||||
frameBuffer->paintBoxRel(rt_x, rt_y+rt_dy, rt_dx, 7+rt_dy* g_Radiotext->S_RtOsdRows, COL_INFOBAR_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM);
|
||||
|
||||
// RT-Text roundloop
|
||||
int ind = (g_Radiotext->RT_Index == 0) ? g_Radiotext->S_RtOsdRows - 1 : g_Radiotext->RT_Index - 1;
|
||||
int rts_x = rt_x+10;
|
||||
int rts_y = rt_y+ 30;
|
||||
int rts_dx = rt_dx-20;
|
||||
if (g_Radiotext->S_RtOsdLoop == 1) { // latest bottom
|
||||
for (int i = ind+1; i < g_Radiotext->S_RtOsdRows; i++)
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(rts_x, rts_y + (ii++)*rt_dy, rts_dx, g_Radiotext->RT_Text[i], COL_INFOBAR, 0, RTisIsUTF); // UTF-8
|
||||
for (int i = 0; i <= ind; i++)
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(rts_x, rts_y + (ii++)*rt_dy, rts_dx, g_Radiotext->RT_Text[i], COL_INFOBAR, 0, RTisIsUTF); // UTF-8
|
||||
}
|
||||
else { // latest top
|
||||
for (int i = ind; i >= 0; i--)
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(rts_x, rts_y + (ii++)*rt_dy, rts_dx, g_Radiotext->RT_Text[i], COL_INFOBAR, 0, RTisIsUTF); // UTF-8
|
||||
for (int i = g_Radiotext->S_RtOsdRows-1; i > ind; i--)
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(rts_x, rts_y + (ii++)*rt_dy, rts_dx, g_Radiotext->RT_Text[i], COL_INFOBAR, 0, RTisIsUTF); // UTF-8
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
// + 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 %s", tr("Title :"), RTP_Title);
|
||||
sprintf(stext[2], "> %s %s", tr("Artist :"), RTP_Artist);
|
||||
osd->DrawText(4, 6+yoff+fheight*(ii++), stext[1], fcolor, clrTransparent, ftext, Setup.OSDWidth-4, ftext->Height());
|
||||
osd->DrawText(4, 3+yoff+fheight*(ii++), stext[2], fcolor, clrTransparent, ftext, Setup.OSDWidth-4, ftext->Height());
|
||||
}
|
||||
else {
|
||||
char *temp = "";
|
||||
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);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
// framebuffer can only display raw images
|
||||
// show mpeg-still
|
||||
char *image;
|
||||
if (g_Radiotext->Rass_Archiv >= 0)
|
||||
asprintf(&image, "%s/Rass_%d.mpg", DataDir, g_Radiotext->Rass_Archiv);
|
||||
else
|
||||
asprintf(&image, "%s/Rass_show.mpg", DataDir);
|
||||
frameBuffer->useBackground(frameBuffer->loadBackground(image));// set useBackground true or false
|
||||
frameBuffer->paintBackground();
|
||||
// RadioAudio->SetBackgroundImage(image);
|
||||
free(image);
|
||||
#endif
|
||||
}
|
||||
g_Radiotext->RT_MsgShow = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
{
|
||||
if ((msg == NeutrinoMessages::EVT_CURRENTNEXT_EPG) || (msg == NeutrinoMessages::EVT_NEXTPROGRAM)) {
|
||||
@@ -1164,6 +1339,8 @@ int CInfoViewer::handleMsg (const neutrino_msg_t msg, neutrino_msg_data_t data)
|
||||
if ((*(t_channel_id *) data) == channel_id) {
|
||||
if (is_visible && showButtonBar)
|
||||
showButton_Audio ();
|
||||
if (g_settings.radiotext_enable && g_Radiotext && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio))
|
||||
g_Radiotext->setPid(g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid);
|
||||
}
|
||||
return messages_return::handled;
|
||||
} else if (msg == NeutrinoMessages::EVT_ZAP_GOT_SUBSERVICES) {
|
||||
@@ -1411,6 +1588,7 @@ void CInfoViewer::display_Info(const char *current, const char *next,
|
||||
pb_p = pb_w;
|
||||
timescale->paintProgressBar(BoxEndX - pb_w - SHADOW_OFFSET, ChanNameY - (pb_h + 10) , pb_w, pb_h, pb_p, pb_w,
|
||||
0, 0, g_settings.progressbar_color ? COL_INFOBAR_SHADOW_PLUS_0 : COL_INFOBAR_PLUS_0, COL_INFOBAR_SHADOW_PLUS_0, "", COL_INFOBAR);
|
||||
printf("paintProgressBar(%d, %d, %d, %d)\n", BoxEndX - pb_w - SHADOW_OFFSET, ChanNameY - (pb_h + 10) , pb_w, pb_h);
|
||||
}
|
||||
|
||||
int currTimeW = 0;
|
||||
@@ -1741,7 +1919,12 @@ void CInfoViewer::killTitle()
|
||||
int bottom = BoxEndY + SHADOW_OFFSET + bottom_bar_offset;
|
||||
if (showButtonBar)
|
||||
bottom += InfoHeightY_Info;
|
||||
printf("killTitle(%d, %d, %d, %d)\n", BoxStartX, BoxStartY, BoxEndX+ SHADOW_OFFSET-BoxStartX, bottom-BoxStartY);
|
||||
frameBuffer->paintBackgroundBox(BoxStartX, BoxStartY, BoxEndX+ SHADOW_OFFSET, bottom);
|
||||
if (g_settings.radiotext_enable && g_Radiotext) {
|
||||
g_Radiotext->S_RtOsd = g_Radiotext->haveRadiotext() ? 1 : 0;
|
||||
killRadiotext();
|
||||
}
|
||||
}
|
||||
showButtonBar = false;
|
||||
}
|
||||
|
@@ -66,6 +66,14 @@ class CInfoViewer
|
||||
int BoxStartY;
|
||||
int ButtonWidth;
|
||||
|
||||
// dimensions of radiotext window
|
||||
int rt_dx;
|
||||
int rt_dy;
|
||||
int rt_x;
|
||||
int rt_y;
|
||||
int rt_h;
|
||||
int rt_w;
|
||||
|
||||
std::string ChannelName;
|
||||
|
||||
int ChanNameX;
|
||||
@@ -125,7 +133,7 @@ class CInfoViewer
|
||||
void showButton_SubServices();
|
||||
|
||||
void showIcon_16_9();
|
||||
|
||||
void showIcon_RadioText(bool rt_available) const;
|
||||
void showIcon_CA_Status(int);
|
||||
void paint_ca_icons(int, char*, int&);
|
||||
void paintCA_bar(int,int);
|
||||
@@ -141,6 +149,8 @@ class CInfoViewer
|
||||
void showLcdPercentOver();
|
||||
int showChannelLogo(const t_channel_id logo_channel_id, const int channel_number_width);
|
||||
void showSNR();
|
||||
void showRadiotext();
|
||||
void killRadiotext();
|
||||
void showInfoFile();
|
||||
void loop(int fadeValue, bool show_dot ,bool fadeIn);
|
||||
std::string eventname;
|
||||
|
@@ -227,6 +227,9 @@ void CMiscMenue::showMiscSettingsMenuGeneral(CMenuWidget *ms_general)
|
||||
//standby after boot
|
||||
ms_general->addItem(new CMenuOptionChooser(LOCALE_EXTRA_START_TOSTANDBY, &g_settings.power_standby, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
|
||||
ms_general->addItem(new CMenuOptionChooser(LOCALE_EXTRA_CACHE_TXT, (int *)&g_settings.cacheTXT, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
|
||||
CRadiotextNotifier *radiotextNotifier = new CRadiotextNotifier;
|
||||
ms_general->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_RADIOTEXT, &g_settings.radiotext_enable, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, radiotextNotifier));
|
||||
|
||||
ms_general->addItem(new CMenuOptionNumberChooser(LOCALE_MISCSETTINGS_ZAPTO_PRE_TIME, &g_settings.zapto_pre_time, true, 0, 10));
|
||||
//fan speed
|
||||
if (g_info.has_fan)
|
||||
|
@@ -82,12 +82,18 @@ void CProgressBar::paintProgressBar ( const int pos_x,
|
||||
upper_labeltext, uppertext_col, iconfile, paintZero);
|
||||
}
|
||||
|
||||
void CProgressBar::paintProgressBar2(const int pos_x, const int pos_y,
|
||||
const int value, const int max_value,
|
||||
const fb_pixel_t activebar_col, const fb_pixel_t passivebar_col,
|
||||
const fb_pixel_t frame_col, const fb_pixel_t shadowbar_col,
|
||||
const char * upper_labeltext, const uint8_t uppertext_col,
|
||||
const char * iconfile, bool paintZero)
|
||||
void CProgressBar::paintProgressBar2(const int pos_x,
|
||||
const int pos_y,
|
||||
const int value,
|
||||
const int max_value,
|
||||
const fb_pixel_t activebar_col,
|
||||
const fb_pixel_t passivebar_col,
|
||||
const fb_pixel_t frame_col,
|
||||
const fb_pixel_t shadowbar_col,
|
||||
const char * upper_labeltext,
|
||||
const uint8_t uppertext_col,
|
||||
const char * iconfile,
|
||||
bool paintZero)
|
||||
{
|
||||
if (height < 0 || width < 0)
|
||||
{
|
||||
|
@@ -129,6 +129,8 @@ class CProgressBar
|
||||
const int max_value);
|
||||
|
||||
void reset() { last_width = -1; } /* force update on next paint */
|
||||
|
||||
void hide();
|
||||
};
|
||||
|
||||
#endif /* __gui_widget_progressbar_h__ */
|
||||
|
@@ -274,6 +274,7 @@ static void initGlobals(void)
|
||||
g_PluginList = NULL;
|
||||
InfoClock = NULL;
|
||||
g_CamHandler = NULL;
|
||||
g_Radiotext = NULL;
|
||||
}
|
||||
|
||||
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
@@ -468,6 +469,7 @@ int CNeutrinoApp::loadSetup(const char * fname)
|
||||
g_settings.infobar_show_var_hdd = configfile.getBool("infobar_show_var_hdd" , true );
|
||||
g_settings.show_infomenu = configfile.getInt32("show_infomenu", 0 );
|
||||
g_settings.infobar_show_res = configfile.getInt32("infobar_show_res", 0 );
|
||||
g_settings.radiotext_enable = configfile.getBool("radiotext_enable" , false);
|
||||
//audio
|
||||
g_settings.audio_AnalogMode = configfile.getInt32( "audio_AnalogMode", 0 );
|
||||
g_settings.audio_DolbyDigital = configfile.getBool("audio_DolbyDigital" , false);
|
||||
@@ -1021,7 +1023,7 @@ void CNeutrinoApp::saveSetup(const char * fname)
|
||||
configfile.setInt32("infobar_show_var_hdd" , g_settings.infobar_show_var_hdd );
|
||||
configfile.setInt32("show_infomenu" , g_settings.show_infomenu );
|
||||
configfile.setInt32("infobar_show_res" , g_settings.infobar_show_res );
|
||||
|
||||
configfile.setBool("radiotext_enable" , g_settings.radiotext_enable);
|
||||
//audio
|
||||
configfile.setInt32( "audio_AnalogMode", g_settings.audio_AnalogMode );
|
||||
configfile.setBool("audio_DolbyDigital" , g_settings.audio_DolbyDigital );
|
||||
@@ -3819,6 +3821,11 @@ printf("CNeutrinoApp::setVolume dx %d dy %d\n", dx, dy);
|
||||
void CNeutrinoApp::tvMode( bool rezap )
|
||||
{
|
||||
if(mode==mode_radio ) {
|
||||
if (g_settings.radiotext_enable && g_Radiotext) {
|
||||
delete g_Radiotext;
|
||||
g_Radiotext = NULL;
|
||||
}
|
||||
|
||||
videoDecoder->StopPicture();
|
||||
g_RCInput->killTimer(g_InfoViewer->lcdUpdateTimer);
|
||||
g_InfoViewer->lcdUpdateTimer = g_RCInput->addTimer( LCD_UPDATE_TIME_TV_MODE, false );
|
||||
@@ -4075,6 +4082,11 @@ printf("radioMode: rezap %s\n", rezap ? "yes" : "no");
|
||||
channelList->zapTo( firstchannel.channelNumber -1 );
|
||||
}
|
||||
videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg");
|
||||
|
||||
if (g_settings.radiotext_enable) {
|
||||
g_Radiotext = new CRadioText;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CNeutrinoApp::startNextRecording()
|
||||
|
@@ -794,6 +794,7 @@ typedef enum
|
||||
LOCALE_MISCSETTINGS_NOAVIAWATCHDOG,
|
||||
LOCALE_MISCSETTINGS_NOENXWATCHDOG,
|
||||
LOCALE_MISCSETTINGS_PMTUPDATE,
|
||||
LOCALE_MISCSETTINGS_RADIOTEXT,
|
||||
LOCALE_MISCSETTINGS_SHOW_INFOMENU,
|
||||
LOCALE_MISCSETTINGS_SHUTDOWN_COUNT,
|
||||
LOCALE_MISCSETTINGS_SHUTDOWN_COUNT_HINT1,
|
||||
|
@@ -794,6 +794,7 @@ const char * locale_real_names[] =
|
||||
"miscsettings.noaviawatchdog",
|
||||
"miscsettings.noenxwatchdog",
|
||||
"miscsettings.pmtupdate",
|
||||
"miscsettings.radiotext",
|
||||
"miscsettings.show_infomenu",
|
||||
"miscsettings.shutdown_count",
|
||||
"miscsettings.shutdown_count_hint1",
|
||||
|
@@ -399,6 +399,27 @@ bool CSectionsdConfigNotifier::changeNotify(const neutrino_locale_t, void *)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CRadiotextNotifier::changeNotify(const neutrino_locale_t, void *)
|
||||
{
|
||||
if (g_settings.radiotext_enable)
|
||||
{
|
||||
if (g_Radiotext == NULL)
|
||||
g_Radiotext = new CRadioText;
|
||||
if (g_Radiotext && ((CNeutrinoApp::getInstance()->getMode()) == NeutrinoMessages::mode_radio))
|
||||
g_Radiotext->setPid(g_RemoteControl->current_PIDs.APIDs[g_RemoteControl->current_PIDs.PIDs.selected_apid].pid);
|
||||
}
|
||||
else
|
||||
{
|
||||
// stop radiotext PES decoding
|
||||
if (g_Radiotext)
|
||||
g_Radiotext->radiotext_stop();
|
||||
delete g_Radiotext;
|
||||
g_Radiotext = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CTouchFileNotifier::changeNotify(const neutrino_locale_t, void * data)
|
||||
{
|
||||
if ((*(int *)data) != 0)
|
||||
|
@@ -314,4 +314,10 @@ public:
|
||||
bool changeNotify(const neutrino_locale_t, void * data);
|
||||
};
|
||||
|
||||
class CRadiotextNotifier : public CChangeObserver
|
||||
{
|
||||
public:
|
||||
bool changeNotify(const neutrino_locale_t, void * Data);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -102,7 +102,8 @@ struct SNeutrinoSettings
|
||||
int clockrec;
|
||||
int rounded_corners;
|
||||
int ci_standby_reset;
|
||||
|
||||
int radiotext_enable;
|
||||
|
||||
//vcr
|
||||
int vcr_AutoSwitch;
|
||||
|
||||
|
Reference in New Issue
Block a user