summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-02-13 09:29:47 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-02-13 09:29:47 +0100
commit8594e81beadc395b3fc2568dc29b48712acb2561 (patch)
treeb22d00fc01aa81a095b0664b3b947781a1064a49 /src
parentc4833640f8dddbe556cc6d40211223a05d5270b8 (diff)
parent7eb97a486a8a39ef3986b9c2c7c452e9ccf2693a (diff)
downloaddabmux-8594e81beadc395b3fc2568dc29b48712acb2561.tar.gz
dabmux-8594e81beadc395b3fc2568dc29b48712acb2561.tar.bz2
dabmux-8594e81beadc395b3fc2568dc29b48712acb2561.zip
Merge KuntzeM's pull request fixing #35 into next
ETI with DAB (MUSICAM) and EEP_A protection level was not possible.
Diffstat (limited to 'src')
-rw-r--r--src/ConfigParser.cpp7
-rw-r--r--src/DabMultiplexer.cpp17
-rw-r--r--src/MuxElements.cpp5
-rw-r--r--src/MuxElements.h11
-rw-r--r--src/fig/FIG0_13.cpp2
-rw-r--r--src/fig/FIG0_2.cpp17
-rw-r--r--src/fig/FIG0_24.cpp6
-rw-r--r--src/fig/FIG1.cpp20
-rw-r--r--src/fig/FIG2.cpp6
-rw-r--r--src/utils.cpp7
10 files changed, 69 insertions, 29 deletions
diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp
index 07aee0e..62d81c7 100644
--- a/src/ConfigParser.cpp
+++ b/src/ConfigParser.cpp
@@ -880,7 +880,12 @@ static void setup_subchannel_from_ptree(shared_ptr<DabSubchannel>& subchan,
subchan->inputUri = inputUri;
if (type == "dabplus" or type == "audio") {
- subchan->type = subchannel_type_t::Audio;
+ if(type == "dabplus") {
+ subchan->type = subchannel_type_t::DABPlusAudio;
+ } else {
+ subchan->type = subchannel_type_t::DABAudio;
+ }
+
subchan->bitrate = 0;
if (proto == "file") {
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp
index 5763c8a..f56a4ff 100644
--- a/src/DabMultiplexer.cpp
+++ b/src/DabMultiplexer.cpp
@@ -276,7 +276,7 @@ void DabMultiplexer::prepare_services_components()
protection = &(*subchannel)->protection;
switch ((*subchannel)->type) {
- case subchannel_type_t::Audio:
+ case subchannel_type_t::DABPlusAudio:
{
if (protection->form == EEP) {
/* According to ETSI TS 102 563 Clause 7.1 FIC signalling:
@@ -291,6 +291,15 @@ void DabMultiplexer::prepare_services_components()
}
}
break;
+ case subchannel_type_t::DABAudio:
+ {
+ if (protection->form == EEP) {
+ /* ASCTy change to 0x0, because DAB mp2 is using
+ */
+ (*component)->type = 0x0;
+ }
+ }
+ break;
case subchannel_type_t::DataDmb:
case subchannel_type_t::Fidc:
case subchannel_type_t::Packet:
@@ -720,7 +729,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
edi_time += chrono::seconds(1);
}
- /**********************************************************************
+ /**********************************************************************
*********** Section FRPD *****************************************
**********************************************************************/
@@ -748,7 +757,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
}
#if HAVE_OUTPUT_EDI
- /**********************************************************************
+ /**********************************************************************
*********** Finalise and send EDI ********************************
**********************************************************************/
@@ -817,7 +826,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
#endif // HAVE_OUTPUT_EDI
#if _DEBUG
- /**********************************************************************
+ /**********************************************************************
*********** Output a small message *********************************
**********************************************************************/
if (currentFrame % 100 == 0) {
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index 5bdbcdc..44e097c 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -511,7 +511,10 @@ bool DabService::isProgramme(const std::shared_ptr<dabEnsemble>& ensemble) const
{
bool ret = false;
switch (getType(ensemble)) {
- case subchannel_type_t::Audio: // Audio
+ case subchannel_type_t::DABAudio: // DAB
+ ret = true;
+ break;
+ case subchannel_type_t::DABPlusAudio: // DABPlus
ret = true;
break;
case subchannel_type_t::DataDmb:
diff --git a/src/MuxElements.h b/src/MuxElements.h
index 635f55f..b2be73f 100644
--- a/src/MuxElements.h
+++ b/src/MuxElements.h
@@ -58,10 +58,11 @@ class MuxInitException : public std::exception
enum class subchannel_type_t {
- Audio = 0,
- DataDmb = 1,
- Fidc = 2,
- Packet = 3
+ DABAudio = 0,
+ DABPlusAudio = 1,
+ DataDmb = 2,
+ Fidc = 3,
+ Packet = 4
};
@@ -336,7 +337,7 @@ public:
std::string inputUri;
std::shared_ptr<Inputs::InputBase> input;
unsigned char id = 0;
- subchannel_type_t type = subchannel_type_t::Audio;
+ subchannel_type_t type = subchannel_type_t::DABAudio;
uint16_t startAddress = 0;
uint16_t bitrate = 0;
struct dabProtection protection;
diff --git a/src/fig/FIG0_13.cpp b/src/fig/FIG0_13.cpp
index 0bb7fd7..433838e 100644
--- a/src/fig/FIG0_13.cpp
+++ b/src/fig/FIG0_13.cpp
@@ -90,7 +90,7 @@ FillStatus FIG0_13::fill(uint8_t *buf, size_t max_size)
}
if ( m_transmit_programme &&
- (*subchannel)->type == subchannel_type_t::Audio &&
+ ((*subchannel)->type == subchannel_type_t::DABPlusAudio || (*subchannel)->type == subchannel_type_t::DABAudio) &&
(*componentFIG0_13)->audio.uaType != 0xffff) {
const int required_size = 3+4+11;
diff --git a/src/fig/FIG0_2.cpp b/src/fig/FIG0_2.cpp
index e587c2b..5275a22 100644
--- a/src/fig/FIG0_2.cpp
+++ b/src/fig/FIG0_2.cpp
@@ -161,7 +161,8 @@ FillStatus FIG0_2::fill(uint8_t *buf, size_t max_size)
etiLog.log(FIG0_2_TRACE, "FIG0_2::fill loop SId=%04x %s/%s",
(*serviceFIG0_2)->id,
m_inserting_audio_not_data ? "AUDIO" : "DATA",
- type == subchannel_type_t::Audio ? "Audio" :
+ type == subchannel_type_t::DABPlusAudio ? "DABPlusAudio" :
+ type == subchannel_type_t::DABAudio ? "DABAudio" :
type == subchannel_type_t::Packet ? "Packet" :
type == subchannel_type_t::DataDmb ? "DataDmb" :
type == subchannel_type_t::Fidc ? "Fidc" : "?");
@@ -202,7 +203,7 @@ FillStatus FIG0_2::fill(uint8_t *buf, size_t max_size)
break;
}
- if (type == subchannel_type_t::Audio) {
+ if (type == subchannel_type_t::DABPlusAudio || type == subchannel_type_t::DABAudio) {
auto fig0_2serviceAudio = (FIGtype0_2_Service*)buf;
fig0_2serviceAudio->SId = htons((*serviceFIG0_2)->id);
@@ -257,7 +258,17 @@ FillStatus FIG0_2::fill(uint8_t *buf, size_t max_size)
}
switch ((*subchannel)->type) {
- case subchannel_type_t::Audio:
+ case (subchannel_type_t::DABAudio):
+ {
+ auto audio_description = (FIGtype0_2_audio_component*)buf;
+ audio_description->TMid = 0;
+ audio_description->ASCTy = (*component)->type;
+ audio_description->SubChId = (*subchannel)->id;
+ audio_description->PS = ((curCpnt == 0) ? 1 : 0);
+ audio_description->CA_flag = 0;
+ }
+ break;
+ case (subchannel_type_t::DABPlusAudio):
{
auto audio_description = (FIGtype0_2_audio_component*)buf;
audio_description->TMid = 0;
diff --git a/src/fig/FIG0_24.cpp b/src/fig/FIG0_24.cpp
index 1441df2..960d261 100644
--- a/src/fig/FIG0_24.cpp
+++ b/src/fig/FIG0_24.cpp
@@ -93,7 +93,7 @@ FillStatus FIG0_24::fill(uint8_t *buf, size_t max_size)
}
}
- subchannel_type_t type = subchannel_type_t::Audio;
+ subchannel_type_t type = subchannel_type_t::DABAudio;
bool isProgramme = true;
bool oe = true;
@@ -107,7 +107,7 @@ FillStatus FIG0_24::fill(uint8_t *buf, size_t max_size)
oe,
serviceFIG0_24->service_id,
m_inserting_audio_not_data ? "AUDIO" : "DATA",
- type == subchannel_type_t::Audio ? "Audio" :
+ type == subchannel_type_t::DABAudio ? "Audio" :
type == subchannel_type_t::Packet ? "Packet" :
type == subchannel_type_t::DataDmb ? "DataDmb" :
type == subchannel_type_t::Fidc ? "Fidc" : "?");
@@ -147,7 +147,7 @@ FillStatus FIG0_24::fill(uint8_t *buf, size_t max_size)
break;
}
- if (type == subchannel_type_t::Audio) {
+ if (type == subchannel_type_t::DABAudio) {
auto fig0_2serviceAudio = (FIGtype0_24_audioservice*)buf;
fig0_2serviceAudio->SId = htons(serviceFIG0_24->service_id);
diff --git a/src/fig/FIG1.cpp b/src/fig/FIG1.cpp
index 7171a87..d0b6a17 100644
--- a/src/fig/FIG1.cpp
+++ b/src/fig/FIG1.cpp
@@ -94,10 +94,11 @@ FillStatus FIG1_1::fill(uint8_t *buf, size_t max_size)
break;
}
- if ((*service)->getType(ensemble) == subchannel_type_t::Audio and
- (*service)->label.has_fig1_label()) {
+ const auto type = (*service)->getType(ensemble);
- auto fig1_1 = (FIGtype1_1*)buf;
+ if ( (type == subchannel_type_t::DABPlusAudio or type == subchannel_type_t::DABAudio) and
+ (*service)->label.has_fig1_label()) {
+ auto fig1_1 = (FIGtype1_1 *)buf;
fig1_1->FIGtypeNumber = 1;
fig1_1->Length = 21;
@@ -154,8 +155,11 @@ FillStatus FIG1_4::fill(uint8_t *buf, size_t max_size)
/* We check in the config parser if the primary component has
* a label, which is forbidden since V2.1.1 */
- if ((*component)->label.has_fig1_label() ) {
- if ((*service)->getType(ensemble) == subchannel_type_t::Audio) {
+ const auto type = (*service)->getType(ensemble);
+
+ if (not (*component)->label.long_label().empty() ) {
+ if (type == subchannel_type_t::DABAudio or type == subchannel_type_t::DABPlusAudio) {
+
if (remaining < 5 + 16 + 2) {
break;
}
@@ -241,8 +245,10 @@ FillStatus FIG1_5::fill(uint8_t *buf, size_t max_size)
break;
}
- if ((*service)->getType(ensemble) != subchannel_type_t::Audio and
- (*service)->label.has_fig1_label()) {
+ const auto type = (*service)->getType(ensemble);
+ const bool is_audio = (type == subchannel_type_t::DABAudio or type == subchannel_type_t::DABPlusAudio);
+
+ if (not is_audio) {
auto fig1_5 = (FIGtype1_5 *)buf;
fig1_5->FIGtypeNumber = 1;
fig1_5->Length = 23;
diff --git a/src/fig/FIG2.cpp b/src/fig/FIG2.cpp
index fefde6e..afa64eb 100644
--- a/src/fig/FIG2.cpp
+++ b/src/fig/FIG2.cpp
@@ -202,7 +202,8 @@ FillStatus FIG2_1_and_5::fill(uint8_t *buf, size_t max_size)
// Rotate through the subchannels until there is no more space
while (service != ensemble->services.end()) {
- const bool is_programme = (*service)->getType(ensemble) == subchannel_type_t::Audio;
+ const bool is_programme = (*service)->getType(ensemble) == subchannel_type_t::DABAudio or
+ ((*service)->getType(ensemble) == subchannel_type_t::DABPlusAudio);
if (not (m_programme xor is_programme) and (*service)->label.has_fig2_label()) {
@@ -315,7 +316,8 @@ FillStatus FIG2_4::fill(uint8_t *buf, size_t max_size)
}
}
- const bool is_programme = (*service)->getType(ensemble) == subchannel_type_t::Audio;
+ const bool is_programme = (*service)->getType(ensemble) == subchannel_type_t::DABAudio or
+ ((*service)->getType(ensemble) == subchannel_type_t::DABPlusAudio);
const size_t id_length = is_programme ?
sizeof(FIGtype2_4_Programme_Identifier) :
diff --git a/src/utils.cpp b/src/utils.cpp
index 02595b7..5f81083 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -327,8 +327,11 @@ void printSubchannels(const vec_sp_subchannel& subchannels)
etiLog.log(info, " input");
etiLog.level(info) << " URI: " << subchannel->inputUri;
switch (subchannel->type) {
- case subchannel_type_t::Audio:
- etiLog.log(info, " type: audio");
+ case subchannel_type_t::DABAudio:
+ etiLog.log(info, " type: DAbAudio");
+ break;
+ case subchannel_type_t::DABPlusAudio:
+ etiLog.log(info, " type: DABPlusAudio");
break;
case subchannel_type_t::DataDmb:
etiLog.log(info, " type: data");