diff options
-rw-r--r-- | doc/example.mux | 3 | ||||
-rw-r--r-- | src/ConfigParser.cpp | 28 | ||||
-rw-r--r-- | src/DabMultiplexer.cpp | 1 | ||||
-rw-r--r-- | src/MuxElements.h | 1 | ||||
-rw-r--r-- | src/fig/FIG0.cpp | 9 | ||||
-rw-r--r-- | src/fig/FIG0.h | 17 | ||||
-rw-r--r-- | src/utils.cpp | 7 | ||||
-rw-r--r-- | src/utils.h | 2 |
8 files changed, 62 insertions, 6 deletions
diff --git a/doc/example.mux b/doc/example.mux index 1b0059c..c818dbb 100644 --- a/doc/example.mux +++ b/doc/example.mux @@ -101,6 +101,9 @@ services { ProgrammeInfo false Sports false Finance false + + ; a comma separated list of clusters in which the service belongs to + clusters "1,2" } } srv-lu { diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 5290b0f..7840a60 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -37,6 +37,8 @@ #endif #include <boost/property_tree/ptree.hpp> +#include <boost/algorithm/string/classification.hpp> +#include <boost/algorithm/string/split.hpp> #include <exception> #include <iostream> #include <vector> @@ -261,6 +263,32 @@ void parse_ptree(boost::property_tree::ptree& pt, } } + auto clusterlist = pt_service.get<std::string>("announcements.clusters", ""); + vector<string> clusters_s; + boost::split(clusters_s, + clusterlist, + boost::is_any_of(",")); + + for (const auto& cluster_s : clusters_s) { + if (cluster_s == "") { + continue; + } + try { + service->clusters.push_back(std::stoi(cluster_s)); + } + catch (std::logic_error& e) { + etiLog.level(warn) << "Cannot parse '" << clusterlist << + "' announcement clusters for service " << serviceuid << + ": " << e.what(); + } + } + + if (service->ASu != 0 and service->clusters.empty()) { + etiLog.level(warn) << "Cluster list for service " << serviceuid << + "is empty, but announcements are defined"; + } + + int success = -5; string servicelabel = pt_service.get<string>("label"); diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index 195ae2c..c7a5554 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -1853,7 +1853,6 @@ void DabMultiplexer::mux_frame(std::vector<boost::shared_ptr<DabOutput> >& outpu void DabMultiplexer::print_info(void) { - return; // Print settings before starting etiLog.log(info, "--- Multiplex configuration ---"); printEnsemble(ensemble); diff --git a/src/MuxElements.h b/src/MuxElements.h index 5eeac51..e1cc3a9 100644 --- a/src/MuxElements.h +++ b/src/MuxElements.h @@ -323,6 +323,7 @@ class DabService : public RemoteControllable * field shall be as defined in TS 101 756, table 14. */ uint16_t ASu; + std::vector<uint8_t> clusters; subchannel_type_t getType(boost::shared_ptr<dabEnsemble> ensemble); unsigned char nbComponent(std::vector<DabComponent*>& components); diff --git a/src/fig/FIG0.cpp b/src/fig/FIG0.cpp index 7cb3dde..9f89109 100644 --- a/src/fig/FIG0.cpp +++ b/src/fig/FIG0.cpp @@ -953,8 +953,7 @@ FillStatus FIG0_18::fill(uint8_t *buf, size_t max_size) continue; } - // TODO support more than one cluster - const int numclusters = 1; + const ssize_t numclusters = (*service)->clusters.size(); if (remaining < (int)sizeof(FIGtype0_18) + numclusters) { break; @@ -982,8 +981,10 @@ FillStatus FIG0_18::fill(uint8_t *buf, size_t max_size) programme->Rfa = 0; programme->NumClusters = numclusters; buf += sizeof(FIGtype0_18); - buf[0] = 0x1; // TODO support not only cluster 1 - buf += numclusters; + + for (uint8_t cluster : (*service)->clusters) { + *(buf++) = cluster; + } fig0->Length += sizeof(FIGtype0_18) + numclusters; remaining -= sizeof(FIGtype0_18) + numclusters; diff --git a/src/fig/FIG0.h b/src/fig/FIG0.h index 0c11ced..9015b00 100644 --- a/src/fig/FIG0.h +++ b/src/fig/FIG0.h @@ -214,6 +214,23 @@ class FIG0_18 : public IFIG std::vector<std::shared_ptr<DabService> >::iterator service; }; +// FIG type 0/19 +class FIG0_19 : public IFIG +{ + public: + FIG0_19(FIGRuntimeInformation* rti); + virtual FillStatus fill(uint8_t *buf, size_t max_size); + virtual FIG_rate repetition_rate(void) { return FIG_rate::A; } + + virtual const int figtype(void) const { return 0; } + virtual const int figextension(void) const { return 19; } + + private: + FIGRuntimeInformation *m_rti; + bool m_initialised; + std::vector<std::shared_ptr<DabService> >::iterator service; +}; + } // namespace FIC #endif // __FIG0_H_ diff --git a/src/utils.cpp b/src/utils.cpp index 2559cb0..1f6754d 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -25,6 +25,7 @@ #include <cstring> #include <iostream> #include <boost/shared_ptr.hpp> +#include <boost/algorithm/string/join.hpp> #include "DabMux.h" #include "utils.h" @@ -389,6 +390,12 @@ void printServices(const vector<shared_ptr<DabService> >& services) service->language, service->language); etiLog.log(info, " announcements: 0x%x", service->ASu); + + std::vector<std::string> clusters_s; + for (const auto& cluster : service->clusters) { + clusters_s.push_back(std::to_string(cluster)); + } + etiLog.level(info) << " clusters: " << boost::join(clusters_s, ","); ++index; } } diff --git a/src/utils.h b/src/utils.h index 1756adf..3a5cf1c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -52,7 +52,7 @@ void printUsageConfigfile(char *name, FILE* out = stderr); * resp. subchannels*/ void printOutputs(std::vector<boost::shared_ptr<DabOutput> >& outputs); -void printServices(std::vector<std::shared_ptr<DabService> >& services); +void printServices(const std::vector<std::shared_ptr<DabService> >& services); void printComponents(std::vector<DabComponent*>& components); |