1
0
mirror of https://github.com/JvanKatwijk/qt-dab.git synced 2025-10-06 00:02:40 +02:00

further development of epg/spi

This commit is contained in:
Jan
2025-02-23 11:54:05 +01:00
parent 2fd02093de
commit cbc518dc02
22 changed files with 342 additions and 283 deletions

View File

@@ -30,32 +30,6 @@
#include <QString>
#include <QDomElement>
class epgProgramme {
public:
uint32_t shortId;
QString shortName;
QString mediumName;
QString longName;
struct {
uint32_t startTime;
uint32_t stopTime;
} programTime;
};
class programSchedule {
public:
uint32_t time;
int version;
struct {
uint32_t Eid;
uint32_t SId;
} identity;
QString mediumName;
QString longName;
QString mediaDescription;
QList<epgProgramme> programmes;
};
class epgCompiler: public QObject {
Q_OBJECT
public:
@@ -124,6 +98,8 @@ private:
void process_obsolete (const std::vector<uint8_t> &v, int &index);
QString fetchString (const std::vector<uint8_t> &v,
int &index, int endPoint);
void ignore (const std::vector<uint8_t> &v,
int &index);
void process_forgotten (const QString s,

View File

@@ -33,7 +33,11 @@ typedef struct {
bool valid;
QDateTime startTime;
int duration;
QString program;
QString shortName;
QString mediumName;
QString longName;
QString shortDescriptor;
QString longDescriptor;
} programDescriptor;

View File

@@ -51,8 +51,8 @@ public:
int16_t segmentNumber,
int32_t segmentSize,
bool lastFlag);
uint16_t get_transportId();
int get_headerSize();
uint16_t get_transportId ();
int get_headerSize ();
private:
bool backgroundFlag;
bool dirElement;

View File

@@ -8,7 +8,7 @@ endif()
include(${CMAKE_CURRENT_LIST_DIR}/cmake/Modules/CMakeFunctions.cmake)
project(Qt-DAB VERSION 6)
set (objectName qt-dab-6.9)
set (objectName qt-dab-6.9.1)
set (objectName "Qt-DAB")
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)

View File

@@ -4,4 +4,4 @@ HERE="$(dirname "$(readlink -f "${0}")")"
# Try to run using sudo, if this does not work ask the user for password
#sudo -n -E -- "/tmp/udev-rules-helper" || pkexec "/tmp/udev-rules-helper"
#rm "/tmp/udev-rules-helper"
exec "${HERE}/usr/bin/qt-dab-6.9" "$@"
exec "${HERE}/usr/bin/qt-dab-6.9.1" "$@"

View File

@@ -445,7 +445,7 @@
<item row="0" column="2">
<widget class="QCheckBox" name="epg2xmlSelector">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The EPG detector has two components, one collecting data to present as &amp;quot;time table&amp;quot; for today,&lt;/p&gt;&lt;p&gt;the other one - using a library written by Julian Cable from the BBC - to generate textual xml.&lt;/p&gt;&lt;p&gt;If selected, the xml will be generated. Note howevet that we encountered at least one example&lt;/p&gt;&lt;p&gt;where the library generating the textual xml causes a crash.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The EPG processor reads and processes the EPG data. In doing so, it extracts the xml description of the EPG/SPI data from binary encoded xml to xml. If this selector is enabled, the software writes the xml as textual data to files that are stored in the Qt-DAB-files folder (or directory, or map)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string> epg to xml</string>
@@ -465,7 +465,7 @@
<item row="1" column="1">
<widget class="QCheckBox" name="epg_selector">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When set, the software is instructed to start an EPG handler when an EPG sevice is detected on starting an ensemble.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When set, the software is instructed to start an EPG processor when an EPG service is detected on starting an ensemble.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>epg automatic</string>

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>612</width>
<height>267</height>
<height>277</height>
</rect>
</property>
<property name="sizePolicy">
@@ -63,7 +63,7 @@
<x>0</x>
<y>0</y>
<width>224</width>
<height>91</height>
<height>101</height>
</rect>
</property>
</widget>
@@ -221,6 +221,13 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="epgLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="clickablelabel" name="serviceLabel">
<property name="toolTip">

View File

@@ -11,7 +11,7 @@ mkdir -p ./appdir/usr/share/applications
mkdir -p ./appdir/usr/share/icons/hicolor/128x128/apps/
mkdir -p ./appdir/usr/share/icons/hicolor/256x256/apps/
cp linux-bin/qt-dab* appdir/usr/bin/qt-dab-6.9
cp linux-bin/qt-dab* appdir/usr/bin/qt-dab-6.9.1
cp qt-dab-6.9.desktop appdir/usr/share/applications
cp ../res/radio-pcitures/qt-dab-6.9-256x256.png appdir/qt-dab-RC.png
cp ../res/radio-pictures/qt-dab-6.9-128x128.png appdir/usr/share/icons/hicolor/128x128/apps/

View File

@@ -1,6 +1,6 @@
[Desktop Entry]
Name=Qt6_DAB-6.9
Exec=qt-dab-6.9
Name=Qt6_DAB-6.9.1
Exec=qt-dab-6.9.1
Icon=qt-dab-6.9
Type=Application
Categories=AudioVideo;

View File

@@ -394,10 +394,10 @@ SOURCES += ./main.cpp \
unix {
DESTDIR = ./linux-bin
equals (QT_MAJOR_VERSION, 5) {
TARGET = qt-dab-qt5-6.9
TARGET = qt-dab-qt5-6.9.1
}
else {
TARGET = qt-dab-qt6-6.9
TARGET = qt-dab-qt6-6.9.1
}
exists ("../.git") {
GITHASHSTRING = $$system(git rev-parse --short HEAD)
@@ -521,17 +521,17 @@ isEmpty(GITHASHSTRING) {
#
#for win32, comment out the lines above
equals (QT_MAJOR_VERSION, 5) {
TARGET = qt-dab32-qt5-6.9V3
TARGET = qt-dab32-qt5-6.9V3.1
}
else {
TARGET = qt-dab32-qt6-6.9V3
TARGET = qt-dab32-qt6-6.9V3.1
}
CONFIG += dabstick-win-v3
# equals (QT_MAJOR_VERSION, 5) {
# TARGET = qt-dab32-qt5-6.9
# TARGET = qt-dab32-qt5-6.9.1
# }
# else {
# TARGET = qt-dab32-qt6-6.9
# TARGET = qt-dab32-qt6-6.9.1
# }
# CONFIG += dabstick-win-v4
CONFIG += airspy-2

View File

@@ -386,10 +386,10 @@ SOURCES += ./main.cpp \
unix {
DESTDIR = ./linux-bin
equals (QT_MAJOR_VERSION, 5) {
TARGET = qt-dab-qt5-6.9
TARGET = qt-dab-qt5-6.9.1
}
else {
TARGET = qt-dab-qt6-6.9
TARGET = qt-dab-qt6-6.9.1
}
exists ("../.git") {
GITHASHSTRING = $$system(git rev-parse --short HEAD)
@@ -485,10 +485,10 @@ isEmpty(GITHASHSTRING) {
#for for 64 bit
equals (QT_MAJOR_VERSION, 5) {
TARGET = qt-dab64-qt5-6.9
TARGET = qt-dab64-qt5-6.9.1
}
else {
TARGET = qt-dab64-qt6-6.9
TARGET = qt-dab64-qt6-6.9.1
}
DEFINES += __BITS64__

View File

@@ -290,11 +290,11 @@ QString h;
connect (&theNewDisplay, &displayWidget::frameClosed,
this, &RadioInterface::handle_newDisplayFrame_closed);
#ifdef HAVE_RTLSDR_V3
SystemVersion = QString ("9") + " with RTLSDR-V3";
SystemVersion = QString ("9.1") + " with RTLSDR-V3";
#elif HAVE_RTLSDR_V4
SystemVersion = QString ("9") + " with RTLSDR-V4";
SystemVersion = QString ("9.1") + " with RTLSDR-V4";
#else
SystemVersion = QString ("9");
SystemVersion = QString ("9.1");
#endif
#if QT_VERSION > QT_VERSION_CHECK (6, 0, 0)
version = "Qt6-DAB-6." + SystemVersion;
@@ -522,7 +522,12 @@ QString h;
// httpButton -> setEnabled (false);
channel. etiActive = false;
QPixmap epgP;
epgP. load (":res/epgLabel.png", "png");
epgLabel -> setPixmap (epgP. scaled (30, 30,
Qt::KeepAspectRatio));
epgLabel -> setToolTip ("this icon is visible when the EPG processor runs, in the background");
epgLabel -> hide ();
show_pauzeSlide ();
// and start the timer(s)
@@ -973,7 +978,7 @@ void RadioInterface::showMOTlabel (QByteArray &data,
int dirs,
bool backgroundFlag) {
const char *type;
if (!running. load() || (pictureName == QString ("")))
if (!running. load () || (pictureName == QString ("")))
return;
switch (static_cast<MOTContentType>(contentType)) {
@@ -997,10 +1002,9 @@ const char *type;
return;
}
if (dirs || (value_i (dabSettings_p, CONFIG_HANDLER,
if (dirs || ((value_i (dabSettings_p, CONFIG_HANDLER,
SAVE_SLIDES_SETTING, 0) != 0) &&
(path_for_pictures != "")) {
(path_for_pictures != ""))) {
QString pict;
if (!dirs)
pict = path_for_pictures + pictureName;
@@ -2117,10 +2121,35 @@ void RadioInterface::stopService (dabService &s) {
cleanScreen ();
}
//
void RadioInterface::start_epgService (packetdata &pd) {
theOFDMHandler -> setDataChannel (pd, &theDataBuffer, BACK_GROUND);
dabService s;
s. channel = pd. channel;
s. serviceName = pd. serviceName;
s. SId = pd. SId;
s. SCIds = pd. SCIds;
s. subChId = pd. subchId;
s. fd = nullptr;
channel. backgroundServices. push_back (s);
epgLabel -> show ();
}
//
void RadioInterface::startService (dabService &s) {
QString serviceName = s. serviceName;
for (auto bs : channel. backgroundServices) {
if (bs. serviceName == serviceName) {
return;
}
}
packetdata pd;
theOFDMHandler -> data_for_packetservice (s. serviceName, pd, 0);
if (pd. defined && pd. appType == 7) {
start_epgService (pd);
return;
}
channel. currentService = s;
channel. currentService. frameDumper = nullptr;
channel. currentService. valid = false;
@@ -2187,8 +2216,6 @@ void RadioInterface::startAudioservice (audiodata &ad) {
for (int i = 1; i < nrComps; i ++) {
packetdata pd;
theOFDMHandler -> data_for_packetservice (ad. serviceName, pd, i);
// fprintf (stderr, "pd for comp %d is %s defined\n", i,
// pd. defined ? " " : "not");
if (pd. defined) {
theOFDMHandler -> setDataChannel (pd, &theDataBuffer, FORE_GROUND);
break;
@@ -2437,6 +2464,7 @@ void RadioInterface::stopChannel () {
return;
epgTimer. stop (); // if running
epgLabel -> hide ();
presetTimer. stop (); // if running
channelTimer. stop (); // if running
inputDevice_p -> stopReader ();
@@ -3097,6 +3125,7 @@ QString tiiButton_font =
}
void RadioInterface::color_scanButton () {
fprintf (stderr, "dit moet werken\n");
setButtonColors (scanButton, SCAN_BUTTON);
}
@@ -3270,15 +3299,7 @@ void RadioInterface::epgTimer_timeOut () {
// LOG hidden service starts
fprintf (stderr, "Starting hidden service %s\n",
serv. toUtf8 (). data ());
theOFDMHandler -> setDataChannel (pd, &theDataBuffer, BACK_GROUND);
dabService s;
s. channel = pd. channel;
s. serviceName = pd. serviceName;
s. SId = pd. SId;
s. SCIds = pd. SCIds;
s. subChId = pd. subchId;
s. fd = nullptr;
channel. backgroundServices. push_back (s);
start_epgService (pd);
}
}
}
@@ -4367,9 +4388,7 @@ void RadioInterface::process_schedule (QDomElement &theSchedule,
uint32_t ensembleId) {
scheduleDescriptor theDescriptor = xmlHandler.
getScheduleDescriptor (theSchedule);
if (!theDescriptor. valid)
return;
if (theDescriptor. Eid != ensembleId)
if (!theDescriptor. valid || (theDescriptor. Eid != ensembleId))
return;
QDate startDate = theDescriptor. startTime. date ();
QDate stopDate = theDescriptor. stopTime. date ();
@@ -4383,7 +4402,7 @@ scheduleDescriptor theDescriptor = xmlHandler.
continue;
theDescriptor.thePrograms. push_back (res);
}
for (int i = 0; i < channel. programGuides. size (); i ++)
for (int i = 0; i < (int)channel. programGuides. size (); i ++)
if (channel. programGuides [i]. Sid == theDescriptor. Sid)
return;
QString serviceName =
@@ -4437,10 +4456,8 @@ void RadioInterface::process_service (const QDomElement &service) {
xmlHandler. serviceSid (service);
QString url =
xmlHandler. service_url (service);
bool alreadySeen = false;
for (int i = 0; i < channel. servicePictures. size (); i ++) {
for (int i = 0; i < (int)channel. servicePictures. size (); i ++) {
if (channel. servicePictures [i]. serviceId == serviceSid) {
alreadySeen = true;
return;
}
}
@@ -4453,7 +4470,7 @@ void RadioInterface::process_service (const QDomElement &service) {
bool RadioInterface::get_servicePicture (QPixmap &p, const audiodata &ad) {
bool res = false;
for (auto &ss : channel. servicePictures) {
if (ss. serviceId == ad. SId) {
if (ss. serviceId == (uint32_t)ad. SId) {
QString pict = path_for_pictures + QString::number (channel. Eid, 16) + "/" + ss. url;
FILE *tt = fopen (pict. toLatin1 (). data (), "r + b");
if (tt == nullptr)

View File

@@ -379,6 +379,7 @@ private:
void stopChannel ();
void stopService (dabService &);
void startService (dabService &);
void start_epgService (packetdata &);
void localSelect (const QString &c,
const QString &s);
void scheduleSelect (const QString &s);

View File

@@ -43,5 +43,6 @@
<file>../res/globstyle.qss</file>
<file>../res/Combinear.qss</file>
<file>../res/Diffnes.qss</file>
<file>../res/epgLabel.png</file>
</qresource>
</RCC>

BIN
res/epgLabel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@@ -79,13 +79,15 @@ uint16_t i;
case UnicodeUcs2:
for (int i = 0; i < size / 2; i ++) {
uint16_t xx = buffer [2 * i + 1] & 0xFF;
for (uint16_t j = 10;
j < sizeof (ebuLatinToUcs2) / sizeof (uint16_t); j ++)
if (ebuLatinToUcs2 [j] == xx) {
s += QString (char (j));
break;
}
s += QChar (buffer [2 * i + 1]);
}
// for (uint16_t j = 10;
// j < sizeof (ebuLatinToUcs2) / sizeof (uint16_t); j ++)
// if (ebuLatinToUcs2 [j] == xx) {
// s += QString (char (j));
// break;
// }
// }
// s = QString::fromStdWString ((const short *) buffer, size);
break;

View File

@@ -132,7 +132,7 @@ int index = 0;
while (index < endPoint) {
switch (v [index]) {
case 0x06: { // default language
QDomElement child = process_defaultLanguage (doc, v, index);
QDomElement child = process_defaultLanguage (doc, v, index);
serviceInformation. appendChild (child);
break;
}
@@ -167,6 +167,14 @@ int index = 0;
serviceInformation. setAttribute ("serviceprovider", s);
break;
}
case 0x84: { // not used
ignore (v, index);
break;
}
case 0x85: { // alphabet
ignore (v, index);
break;
}
default:
process_forgotten ("serviceInformation:", v, index);
break;
@@ -184,7 +192,8 @@ QDomElement child;
child = doc. createElement ("defaultLanguage");
QString res;
for (int i = index; i < endPoint; i ++)
res = res + QChar (v [i]);
res += QChar (v [i]);
child. setAttribute ("defaultLanguage", res);
index = endPoint;
return child;
@@ -197,18 +206,10 @@ QDomElement child;
int endPoint = setLength (v, index);
QString s;
child = doc. createElement ("shortName");
if (v [index] == 0x80)
if (v [index] == 0x80) { // xml:lang
ignore (v, index);
if (v [index] == 1) {
QByteArray text;
if (v [index + 1] < 20)
s = stringTable [v [index + 1]];
else {
for (;index < endPoint; index ++)
text. push_back (v [index]);
s = QString::fromUtf8 (text);
}
}
s = fetchString (v, index, endPoint);
QDomText t = doc. createTextNode (s);
child. appendChild (t);
index = endPoint;
@@ -222,18 +223,9 @@ QDomElement child;
int endPoint = setLength (v, index);
QString res;
child = doc. createElement ("mediumName");
if (v [index] == 0x80)
if (v [index] == 0x80) // xml:lang
ignore (v, index);
if (v [index] == 1) {
QByteArray text;
if (v [index + 1] < 20)
res = stringTable [v [index + 1]];
else {
for (;index < endPoint; index ++)
text. push_back (v [index]);
res = QString::fromUtf8 (text);
}
}
res = fetchString (v, index, endPoint);
QDomText t = doc. createTextNode (res);
child. appendChild (t);
index = endPoint;
@@ -247,18 +239,9 @@ QDomElement child;
QString res;
int endPoint = setLength (v, index);
child = doc. createElement ("longName");
if (v [index] == 0x80)
if (v [index] == 0x80) // xml:lang
ignore (v, index);
if (v [index] == 1) {
QByteArray text;
if (v [index + 1] < 20)
res = stringTable [v [index + 1]];
else {
for (;index < endPoint; index ++)
text. push_back (v [index]);
res = QString::fromUtf8 (text);
}
}
res = fetchString (v, index, endPoint);
QDomText t = doc. createTextNode (res);
child. appendChild (t);
index = endPoint;
@@ -310,7 +293,6 @@ QString s;
while (index < endPoint) {
switch (v [index]) {
case 0x80: {
int oldIndex = index;
int localEnd = setLength (v, index);
s = QString::number (v [index]);
for (int i = index + 1; i < localEnd; i ++)
@@ -361,18 +343,9 @@ int endPoint = setLength (v, index);
QDomElement child;
QString res;
child = doc. createElement ("keyWords");
if (v [index] == 0x80)
if (v [index] == 0x80) // xml:lang
ignore (v, index);
if (v [index] == 1) {
QByteArray text;
if (v [index + 1] < 20)
res = stringTable [v [index + 1]];
else {
for (;index < endPoint; index ++)
text. push_back (v [index]);
res = QString::fromUtf8 (text);
}
}
res = fetchString (v, index, endPoint);
QDomText t = doc. createTextNode (res);
child. appendChild (t);
index = endPoint;
@@ -389,9 +362,7 @@ QDomElement t;
switch (v [index]) {
case 0x80: { // 4.7.1, id
int localEnd = setLength (v, index);
QString s;
for (int i = index; i < localEnd; i ++)
s += QChar (v [i]);
QString s = fetchString (v, index, endPoint);
t. setAttribute ("id", s);
index = localEnd;
break;
@@ -422,9 +393,10 @@ QDomElement t;
switch (v [index]) {
case 0x80: { //uri
int localEnd = setLength (v, index);
QString res;
QByteArray text;
for (int i = index; i < localEnd; i ++)
res += QChar (v [i]);
text. push_back (v [i]);
QString res = QString::fromUtf8 (text);
t. setAttribute ("uri", res);
index = localEnd;
break;
@@ -440,14 +412,12 @@ QDomElement t;
}
case 0x83: { // description 440
int localEnd = setLength (v, index);
QString res;
for (int i = index; i < localEnd; i ++)
res += QChar (v [i]);
QString res = fetchString (v, index, endPoint);
t. setAttribute ("description", res);
index = localEnd;
break;
}
case 0x84: { //expiry time
case 0x84: { // expiry time
QString s = process_474 (v, index);
t. setAttribute ("expiryTime", s);
break;
@@ -496,67 +466,32 @@ QDomElement epgCompiler::process_shortDescription (QDomDocument &doc,
const std::vector<uint8_t> &v,
int &index) {
int endPoint = setLength (v, index);
QDomElement t;
QDomElement child;
QString res;
t = doc. createElement ("shortDescription");
switch (v [index]) {
case 0x80: { // xml:lang, ignore
ignore (v, index);
break;
}
case 0x01: {
QString s;
if (v [index + 1] < 20)
s = stringTable [v [index + 1]];
else {
QByteArray text;
for (int i = index + 1; i < endPoint; i ++)
text. push_back (v [i]);
s = QString::fromUtf8 (text);
}
QDomText n = doc. createTextNode (s);
t. appendChild (n);
break;
}
default:
process_forgotten ("shortDescription", v, index);
break;
}
child = doc. createElement ("shortDescription");
if (v [index] == 0x80) // xml:lang
ignore (v, index);
QString s = fetchString (v, index, endPoint);
QDomText n = doc. createTextNode (res);
child. appendChild (n);
index = endPoint;
return t;
return child;
}
QDomElement epgCompiler::process_longDescription (QDomDocument &doc,
const std::vector<uint8_t> &v,
int &index) {
int endPoint = setLength (v, index);
QDomElement t;
QDomElement child;
QString res;
t = doc. createElement ("longDescription");
switch (v [index]) {
case 0x80: { // xml:lang
ignore (v, index);
}
case 0x01: {
QString s;
if (v [index + 1] < 20)
s = stringTable [v [index + 1]];
else {
QByteArray text;
for (int i = index + 1; i < endPoint; i ++)
text. push_back (v [i]);
s = QString::fromUtf8 (text);
}
QDomText dt = doc. createTextNode (s);
t. appendChild (dt);
break;
}
default:
process_forgotten ("shortName", v, index);
break;
}
child = doc. createElement ("longDescription");
if (v [index] == 0x80) // xml:lang
ignore (v, index);
QString s = fetchString (v, index, endPoint);
QDomText n = doc. createTextNode (res);
child. appendChild (n);
index = endPoint;
return t;
return child;
}
QDomElement epgCompiler::process_programme (QDomDocument &doc,
@@ -614,19 +549,21 @@ bool broadcasting = false;
program. appendChild (child);
break;
}
case 0x29: { // bearer
QDomElement child = process_bearer (doc, v, index);
program. appendChild (child);
break;
}
case 0x31: { // radiodns
QDomElement child = process_radiodns (doc, v, index);
case 0x36: { // onDemand
QDomElement child = process_onDemand (doc, v, index);
program. appendChild (child);
break;
}
case 0x32: { // geolocation
QDomElement child = process_geolocation (doc, v, index);
program. appendChild (child);
case 0x2A: { // presentation language
ignore (v, index);
break;
}
case 0x39: { // alias
ignore (v, index);
break;
}
case 0x3A: { // phoneme
ignore (v, index);
break;
}
case 0x80: { // 4.7.1 Id
@@ -661,7 +598,7 @@ bool broadcasting = false;
break;
}
default:
process_forgotten ("program::xml:lan", v, index);
process_forgotten ("programme", v, index);
break;
}
}
@@ -697,7 +634,6 @@ QString s;
t. setAttribute ("creationTime", s);
break;
}
case 0x82: { // originator
QString s = process_440 (v, index);
t. setAttribute ("originator", s);
@@ -708,6 +644,8 @@ QString s;
process_forgotten ("programGroups", v, index);
}
}
if (!t. hasAttribute ("version"))
t. setAttribute ("version", 1);
index = endPoint;
return t;
}
@@ -718,7 +656,6 @@ QDomElement epgCompiler::process_schedule (QDomDocument &doc,
int endPoint = setLength (v, index);
QDomElement schedule;
schedule = doc. createElement ("schedule");
while (index < endPoint) {
QString s;
switch (v [index]) {
@@ -757,6 +694,10 @@ QDomElement schedule;
schedule. appendChild (t);
break;
}
case 0x2A: { // presentation language
ignore (v, index);
break;
}
case 0x80: { // version
QString s = process_483 (v, index);
schedule. setAttribute ("version", s);
@@ -772,12 +713,16 @@ QDomElement schedule;
schedule. setAttribute ("originator", s);
break;
}
case 0x83: { // alphabet
ignore (v, index);
break;
}
default:
process_forgotten ("schedule", v, index);
break;
}
}
if (!schedule. hasAttribute ("version");
if (!schedule. hasAttribute ("version"))
schedule. setAttribute ("version", 1);
index = endPoint;
return schedule;
@@ -860,6 +805,8 @@ QDomElement t;
process_forgotten ("programGroup", v, index);
}
}
if (!t. hasAttribute ("version"))
t. setAttribute ("version", 1);
index = endPoint;
return t;
}
@@ -956,12 +903,16 @@ QDomElement ensemble;
ensemble. appendChild (child);
break;
}
case 0x37: { // not used anymore
ignore (v, index);
break;
}
case 0x28: { // service
QDomElement child = process_service (doc, v, index);
ensemble. appendChild (child);
break;
}
case 0x80: { //id
case 0x80: { // id
int localEnd = setLength (v, index);
int ecc = v [index];
int Eid = (v [index + 1] << 8) | v [index + 2];
@@ -970,8 +921,12 @@ QDomElement ensemble;
index = localEnd;
break;
}
case 0x81: { // not used
ignore (v, index);
break;
}
default:
process_forgotten ("enemble", v, index);
process_forgotten ("ensemble", v, index);
break;
}
}
@@ -1018,6 +973,10 @@ QDomElement service;
service. appendChild (child);
break;
}
case 0x2A: { // presentation language
ignore (v, index);
break;
}
case 0x29: { // bearer
QDomElement child = process_bearer (doc, v, index);
service. appendChild (child);
@@ -1033,6 +992,14 @@ QDomElement service;
service. appendChild (child);
break;
}
case 0x39: { //alias
ignore (v, index);
break;
}
case 0x3A: { // phoneme
ignore (v, index);
break;
}
case 0x80: { // version
QString s = process_483 (v, index);
service. setAttribute ("version", s);
@@ -1061,9 +1028,7 @@ QDomElement bearer;
}
case 0x82: { // url, 440
int localEnd = setLength (v, index);
QString s;
for (int i = index; i < endPoint; i ++)
s += QChar (v [i]);
QString s = fetchString (v, index, localEnd);
bearer. setAttribute ("url", s);
index = localEnd;
break;
@@ -1097,8 +1062,10 @@ QString s;
}
case 0x82: { //440, url
int localEnd = setLength (v, index);
QByteArray text;
for (int i = index; i < localEnd; i ++)
s += QChar (v [i]);
text . push_back (v [i]);
s = QString::fromUtf8 (text);
multimedia. setAttribute ("url", s);
index = localEnd;
break;
@@ -1273,11 +1240,23 @@ QDomElement programmeEvent;
programmeEvent. appendChild (s);
break;
}
case 0x2A: { // presentationLanguage
ignore (v, index);
break;
}
case 0x36: { // onDemand
QDomElement s = process_onDemand (doc, v, index);
programmeEvent. appendChild (s);
break;
}
case 0x39: { // alias
ignore (v, index);
break;
}
case 0x3A: { // phoneme
ignore (v, index);
break;
}
//
// the attributes
case 0x80: { // Id
@@ -1324,6 +1303,21 @@ QDomElement epgCompiler::process_radiodns (QDomDocument &doc,
int endPoint = setLength (v, index);
QDomElement radiodns;
radiodns = doc. createElement ("radiodns");
while (index < endPoint) {
switch (v [index]) {
case 0x80: { // fqdn
ignore (v, index);
break;
}
case 0x81: { // service identifier
ignore (v, index);
break;
}
default:
process_forgotten ("radiodns", v, index);
break;
}
}
index = endPoint;
return radiodns;
}
@@ -1342,17 +1336,25 @@ QDomElement geolocation;
break;
}
case 0x34: { // point
QDomElement t = process_point (doc, v, index);
geolocation. appendChild (t);
// QDomElement t = process_point (doc, v, index);
// geolocation. appendChild (t);
ignore (v, index); // not yet implemented
break;
}
case 0x35: { // polygon
QDomElement t = process_polygon (doc, v, index);
geolocation. appendChild (t);
// QDomElement t = process_polygon (doc, v, index);
// geolocation. appendChild (t);
ignore (v, index); // not yet implemented
break;
}
case 0x80: { // xml:id
ignore (v, index);
break;
}
case 0x81: { // ref
ignore (v, index);
break;
}
case 0x80: // xml:id
case 0x81: // ref
default:
process_forgotten ("geolocation", v, index);
break;
@@ -1366,20 +1368,23 @@ QDomElement epgCompiler::process_country (QDomDocument &doc,
const std::vector<uint8_t> &v,
int &index) {
int endPoint = setLength (v, index);
QDomElement t;
t = doc. createElement ("country");
QDomElement child;
child = doc. createElement ("country");
QString res = fetchString (v, index, endPoint);
QDomText t = doc. createTextNode (res);
child. appendChild (t);
index = endPoint;
return t;
return child;
}
QDomElement epgCompiler::process_point (QDomDocument &doc,
const std::vector<uint8_t> &v,
int &index) {
int endPoint = setLength (v, index);
QDomElement t;
t = doc. createElement ("point");
QDomElement child;
child = doc. createElement ("point");
index = endPoint;
return t;
return child;
}
QDomElement epgCompiler::process_polygon (QDomDocument &doc,
@@ -1485,10 +1490,7 @@ QDomElement t;
QString epgCompiler::process_440 (const std::vector<uint8_t> &v, int &index) {
int endPoint = setLength (v, index);
QString res;
for (int i = index; i < endPoint; i ++)
res += QChar (v [i]);
QString res = fetchString (v, index, endPoint);
index = endPoint;
return res;
}
@@ -1496,10 +1498,7 @@ int endPoint = setLength (v, index);
// CRId datatype
QString epgCompiler::process_471 (const std::vector<uint8_t> &v, int &index) {
int endPoint = setLength (v, index);
QString s;
for (int i = index; i < endPoint; i ++)
s += QChar (v [i]);
QString s = fetchString (v, index, endPoint);
index = endPoint;
return s;
}
@@ -1515,14 +1514,8 @@ uint32_t res = (v [index] << 16) | (v [index + 1] << 8) | v [index + 2];
QString epgCompiler::process_473 (const std::vector<uint8_t> &v, int &index) {
int endPoint = setLength (v, index);
QString s;
if (v [index] < 20)
s = stringTable [v [index + 1]];
else {
QByteArray text;
for (int i = index; i < endPoint; i ++)
text.push_back (v [i]);
s = QString::fromUtf8 (text);
}
s = fetchString (v, index, endPoint);
index = endPoint;
return s;
}
@@ -1547,9 +1540,9 @@ QString epgCompiler::process_474 (const std::vector<uint8_t> &v, int &index) {
int16_t M = dateOut [1];
int16_t D = dateOut [2];
// we need to know whether it is today or not
int ltoFlag = getBit (v, 8 * index + 19);
int utcFlag = getBit (v, 8 * index + 20);
int ltoBase = utcFlag == 1 ? 48 : 32;
// int ltoFlag = getBit (v, 8 * index + 19);
// int utcFlag = getBit (v, 8 * index + 20);
// int ltoBase = utcFlag == 1 ? 48 : 32;
int hours = getBits (v, 8 * index + 21, 5);
int minutes = getBits (v, 8 * index + 26, 6);
index = endPoint;
@@ -1635,15 +1628,13 @@ int endPoint = setLength (v, index);
void epgCompiler::process_token (const std::vector<uint8_t> &v,
int &index) {
uint8_t tag = v [index];
int endPoint = index + 2 + v [index + 1];
int length = v [index + 1];
index += 2;
uint8_t tag = v [index];
int endPoint = setLength (v, index);
QByteArray text;
for (int i = index; i < endPoint; i ++) {
text. push_back (v [i]);
}
if (tag <= 20) {
if (tag < 20) {
stringTable [tag] = QString::fromUtf8 (text);
}
index = endPoint;
@@ -1696,9 +1687,33 @@ const char *typeList [] = {
else
return "unknown Type";
}
//
// for the "not Used" and the not yet implemented
void epgCompiler::ignore (const std::vector<uint8_t> &v, int &index) {
int endPoint = setLength (v, index);
index = endPoint;
}
QString epgCompiler::fetchString (const std::vector<uint8_t> &v,
int &index, int endPoint) {
QString res;
if (v [index] != 1) { // should not happen, but it does
QByteArray text;
for (int i = index; i < endPoint; i ++)
text. push_back (v [i]);
res = QString::fromUtf8 (text);
}
else
if ((v [index + 1] < 20)) {
res = stringTable [v [index + 1]];
}
else {
QByteArray text;
for (int i = index + 2; i < endPoint; i ++)
text. push_back (v [i]);
res = QString::fromUtf8 (text);
}
index = endPoint;
return res;
}

View File

@@ -128,22 +128,18 @@ programDescriptor res;
res. startTime = stringToDateTime (tt);
QString dd = time. attribute ("duration");
res. duration = durationToInt (dd);
QDomElement sn = node. firstChildElement ("shortName");
res. shortName = sn. text ();
QDomElement mn = node. firstChildElement ("mediumName");
res. mediumName = mn. text ();
QDomElement ln = node. firstChildElement ("longName");
res. longName = ln. text ();
QDomElement md = node. firstChildElement ("mediaDescription");
QString ps;
if (!md. isNull ()) {
QDomElement sd = md. firstChildElement ("shortDescription");
if (!sd. isNull ())
ps = sd. text ();
}
if (ps == "") {
QDomElement name = node. firstChildElement ("longName");
if (name. isNull ())
name = node. firstChildElement ("mediumName");
ps = name. text ();
}
res. program = ps;
if (res. program != "")
res. valid = true;
QDomElement sd = md. firstChildElement ("shortDescriptor");
res. shortDescriptor = sd. text ();
QDomElement ld = md. firstChildElement ("longDescriptor");
res. longDescriptor = ld. text ();
res. valid = true;
return res;
}

View File

@@ -42,8 +42,8 @@
this -> dirSize = dirSize;
this -> numObjects = objects;
this -> dir_segmentSize = segmentSize;
fprintf (stderr, "transportId %d, dirSize %d, numObjects %d, segmentSize %d\n",
transportId, dirSize, objects, segmentSize);
// fprintf (stderr, "transportId %d, dirSize %d, numObjects %d, segmentSize %d\n",
// transportId, dirSize, objects, segmentSize);
dir_segments. resize (dirSize);
motComponents. resize (objects);
for (int i = 0; i < objects; i ++) {
@@ -114,7 +114,7 @@ int16_t i;
return;
// yes we have all data to build up the directory
analyse_theDirectory();
fprintf (stderr, "Going to inspect the directory\n");
// fprintf (stderr, "Going to inspect the directory\n");
}
}
//

View File

@@ -43,6 +43,7 @@ uint16_t rawContentType = 0;
this -> dirElement = dirElement;
this -> backgroundFlag = backgroundFlag;
this -> name = "";
connect (this, &motObject::handle_motObject,
mr, &RadioInterface::handle_motObject);
this -> transportId = transportId;
@@ -74,7 +75,6 @@ uint16_t rawContentType = 0;
uint8_t PLI = (segment [pointer] & 0300) >> 6;
uint8_t paramId = (segment [pointer] & 077);
uint16_t length;
// fprintf (stderr, "motobject PLI %d, paramId %d\n", PLI, paramId);
switch (PLI) {
case 00:
pointer += 1;
@@ -137,7 +137,7 @@ uint16_t rawContentType = 0;
motObject::~motObject () {
}
uint16_t motObject::get_transportId() {
uint16_t motObject::get_transportId () {
return transportId;
}
@@ -191,12 +191,14 @@ QByteArray result;
for (const auto &it : motMap)
result. append (it. second);
// fprintf (stderr,
// "Handling complete %X %s, type %X\n",
// "Handling complete %X %s, type %X, dirElement %d\n",
// transportId, name. toLatin1 (). data (),
// (int)contentType);
if (name == "")
name = QString::number (get_transportId (), 16);
handle_motObject (result, name, (int)contentType,
// (int)contentType,
// dirElement);
// if ((name == "") && !dirElement)
// name = QString::number (get_transportId (), 16);
if (name != "")
handle_motObject (result, name, (int)contentType,
dirElement, backgroundFlag);
}

View File

@@ -186,6 +186,12 @@ DABFLOAT toFirstQuadrant (DABFLOAT phase) {
}
Complex makeComplex (DABFLOAT phase) {
DABFLOAT p2 = phase * phase;
DABFLOAT p3 = p2 * phase;
DABFLOAT p4 = p3 * phase;
DABFLOAT sine = phase - p3/ 6;
DABFLOAT cosi = 1 - p2 / 2 + p4 / 24;
return complex (cosi, sine);
return Complex (cos (phase), sin (phase));
}

View File

@@ -1,6 +1,6 @@
#
/*
* Copyright (C) 2016 .. 2024
* Copyright (C) 2016 .. 2025
* Jan van Katwijk (J.vanKatwijk@gmail.com)
* Lazy Chair Computing
*
@@ -32,8 +32,10 @@
myWidget -> setWidgetResizable (true);
programDisplay = new QTableWidget (0, 4);
programDisplay -> setColumnWidth (0, 250);
programDisplay -> setColumnWidth (3, 350);
programDisplay -> setColumnWidth (0, 150);
programDisplay -> setColumnWidth (1, 150);
programDisplay -> setColumnWidth (2, 20);
programDisplay -> setColumnWidth (3, 450);
myWidget -> setWidget (programDisplay);
programDisplay -> setHorizontalHeaderLabels (
QStringList () << "program");
@@ -56,20 +58,22 @@ void timeTableHandler::display (const scheduleDescriptor &schedule) {
void timeTableHandler::addHeader (const scheduleDescriptor &schedule) {
int row = programDisplay -> rowCount ();
QString name = schedule. name;
QString start = schedule. startTime. toString ();
QString stop = schedule. stopTime. toString ();
QDate date = schedule. startTime. date ();
QString start = schedule. startTime. date (). toString ();
QString stop = schedule. stopTime. date (). toString ();
programDisplay -> insertRow (row);
QTableWidgetItem *item0 = new QTableWidgetItem;
item0 -> setTextAlignment (Qt::AlignLeft);
name = name + "(" + QString::number (schedule. Sid, 16) + ")";
item0 -> setText (name);
programDisplay -> setItem (row, 0, item0);
QTableWidgetItem *item1 = new QTableWidgetItem;
item1 -> setTextAlignment (Qt::AlignLeft);
item1 -> setText (QString::number (schedule. Sid, 16));
item1 -> setTextAlignment (Qt::AlignRight);
item1 -> setText (date. toString ());
programDisplay -> setItem (row, 1, item1);
QTableWidgetItem *item2 = new QTableWidgetItem;
item2 -> setTextAlignment (Qt::AlignLeft);
item2 -> setText (start);
// item2 -> setText (start);
programDisplay -> setItem (row, 2, item2);
QTableWidgetItem *item3 = new QTableWidgetItem;
item3 -> setTextAlignment (Qt::AlignLeft);
@@ -79,15 +83,20 @@ QString stop = schedule. stopTime. toString ();
void timeTableHandler::addProgram (const programDescriptor &program) {
int row = programDisplay -> rowCount ();
QString start = program. startTime. toString ();
QString duration = QString::number (program. duration) + "min";
QString start = program. startTime. time (). toString ();
QString duration;
if (program. duration < 60)
duration = QString::number (program. duration) + "M";
else
duration = QString::number (program. duration / 60) + "H " +
QString::number (program. duration % 60) + "M";
programDisplay -> insertRow (row);
QTableWidgetItem *item0 = new QTableWidgetItem;
item0 -> setTextAlignment (Qt::AlignLeft);
item0 -> setText (start);
programDisplay -> setItem (row, 0, item0);
QTableWidgetItem *item1 = new QTableWidgetItem;
item1 -> setTextAlignment (Qt::AlignLeft);
item1 -> setTextAlignment (Qt::AlignRight);
item1 -> setText (duration);
programDisplay -> setItem (row, 1, item1);
QTableWidgetItem *item2 = new QTableWidgetItem;
@@ -96,9 +105,32 @@ QString duration = QString::number (program. duration) + "min";
programDisplay -> setItem (row, 2, item2);
QTableWidgetItem *item3 = new QTableWidgetItem;
item3 -> setTextAlignment (Qt::AlignLeft);
QString bodyText = program. program;
if (bodyText. size () >= 35)
bodyText = bodyText. left (35) + "...";
QString bodyText;
if (program. longDescriptor. size () >= 10)
bodyText = program. longDescriptor;
else
if (program. shortDescriptor. size () >= 10)
bodyText = program. shortDescriptor;
else
if (program. longName. size () >= 10)
bodyText = program. longName;
else
if (program. mediumName. size () >= 10)
bodyText = program. mediumName;
else
if (program. longName. size () > 0)
bodyText = program. longName;
else
if (program. mediumName. size () > 0)
bodyText = program. mediumName;
else
if (program. shortName. size () > 0)
bodyText = program. shortName;
else
bodyText = "No Information";
bodyText = bodyText. replace ("\n", " ");
if (bodyText. size () >= 45)
bodyText = bodyText. left (55) + "...";
item3 -> setText (bodyText);
programDisplay -> setItem (row, 3, item3);
}