aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/DabMux.cpp48
-rw-r--r--src/MuxElements.cpp2
-rw-r--r--src/MuxElements.h13
-rw-r--r--src/ParserCmdline.cpp18
-rw-r--r--src/ParserConfigfile.cpp14
-rw-r--r--src/utils.cpp8
6 files changed, 52 insertions, 51 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 704de4c..fa74bcf 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -468,16 +468,16 @@ int main(int argc, char *argv[])
protection = &(*subchannel)->protection;
switch ((*subchannel)->type) {
- case 0: // Audio
+ case Audio:
{
if (protection->form != 0) {
(*component)->type = 0x3f; // DAB+
}
}
break;
- case 1:
- case 2:
- case 3:
+ case DataDmb:
+ case Fidc:
+ case Packet:
break;
default:
etiLog.log(error,
@@ -617,7 +617,7 @@ int main(int argc, char *argv[])
returnCode = -1;
throw MuxInitException();
}
- if ((*subchannel)->type != 3) continue;
+ if ((*subchannel)->type != Packet) continue;
(*component)->packet.id = cur++;
}
@@ -1055,30 +1055,30 @@ int main(int argc, char *argv[])
}
switch ((*subchannel)->type) {
- case 0: // Audio
+ case Audio:
audio_description =
(FIGtype0_2_audio_component*)&etiFrame[index];
- audio_description->TMid = 0;
- audio_description->ASCTy = (*component)->type;
+ audio_description->TMid = 0;
+ audio_description->ASCTy = (*component)->type;
audio_description->SubChId = (*subchannel)->id;
- audio_description->PS = ((curCpnt == 0) ? 1 : 0);
+ audio_description->PS = ((curCpnt == 0) ? 1 : 0);
audio_description->CA_flag = 0;
break;
- case 1: // Data
+ case DataDmb:
data_description =
(FIGtype0_2_data_component*)&etiFrame[index];
- data_description->TMid = 1;
- data_description->DSCTy = (*component)->type;
+ data_description->TMid = 1;
+ data_description->DSCTy = (*component)->type;
data_description->SubChId = (*subchannel)->id;
- data_description->PS = ((curCpnt == 0) ? 1 : 0);
+ data_description->PS = ((curCpnt == 0) ? 1 : 0);
data_description->CA_flag = 0;
break;
- case 3: // Packet
+ case Packet:
packet_description =
(FIGtype0_2_packet_component*)&etiFrame[index];
- packet_description->TMid = 3;
+ packet_description->TMid = 3;
packet_description->setSCId((*component)->packet.id);
- packet_description->PS = ((curCpnt == 0) ? 1 : 0);
+ packet_description->PS = ((curCpnt == 0) ? 1 : 0);
packet_description->CA_flag = 0;
break;
default:
@@ -1171,7 +1171,7 @@ int main(int argc, char *argv[])
}
switch ((*subchannel)->type) {
- case 0: // Audio
+ case Audio:
audio_description =
(FIGtype0_2_audio_component*)&etiFrame[index];
audio_description->TMid = 0;
@@ -1180,7 +1180,7 @@ int main(int argc, char *argv[])
audio_description->PS = ((curCpnt == 0) ? 1 : 0);
audio_description->CA_flag = 0;
break;
- case 1: // Data
+ case DataDmb:
data_description =
(FIGtype0_2_data_component*)&etiFrame[index];
data_description->TMid = 1;
@@ -1189,7 +1189,7 @@ int main(int argc, char *argv[])
data_description->PS = ((curCpnt == 0) ? 1 : 0);
data_description->CA_flag = 0;
break;
- case 3: // Packet
+ case Packet:
packet_description =
(FIGtype0_2_packet_component*)&etiFrame[index];
packet_description->TMid = 3;
@@ -1236,7 +1236,7 @@ int main(int argc, char *argv[])
throw MuxInitException();
}
- if ((*subchannel)->type != 3) continue;
+ if ((*subchannel)->type != Packet) continue;
if (fig0_3_header == NULL) {
fig0_3_header = (FIGtype0_3_header*)&etiFrame[index];
@@ -1400,7 +1400,7 @@ int main(int argc, char *argv[])
figSize += 2;
}
- if ((*subchannel)->type == 3) { // Data packet
+ if ((*subchannel)->type == Packet) { // Data packet
if (figSize > 30 - 5) {
break;
}
@@ -1481,7 +1481,7 @@ int main(int argc, char *argv[])
figSize += 2;
}
- if ((*subchannel)->type == 3) { // Data packet
+ if ((*subchannel)->type == Packet) { // Data packet
if (figSize > 30 - 7) {
break;
}
@@ -1575,7 +1575,7 @@ int main(int argc, char *argv[])
}
if (transmitFIG0_13programme &&
- (*subchannel)->type == 0) { // audio
+ (*subchannel)->type == Audio) { // audio
if (fig0 == NULL) {
fig0 = (FIGtype0*)&etiFrame[index];
fig0->FIGtypeNumber = 0;
@@ -1621,7 +1621,7 @@ int main(int argc, char *argv[])
fig0->Length += 2 + app->length;
}
else if (!transmitFIG0_13programme &&
- (*subchannel)->type == 3 && // packet
+ (*subchannel)->type == Packet &&
(*componentFIG0_13)->packet.appType != 0xffff) {
if (fig0 == NULL) {
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index c7ac076..4dd226b 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -210,7 +210,7 @@ bool DabComponent::isPacketComponent(vector<dabSubchannel*>& subchannels)
"for defining packet ");
return false;
}
- if ((*getSubchannel(subchannels, subchId))->type != 3) {
+ if ((*getSubchannel(subchannels, subchId))->type != Packet) {
etiLog.log(error,
"Invalid component type for defining packet ");
return false;
diff --git a/src/MuxElements.h b/src/MuxElements.h
index 9895956..0f9fa18 100644
--- a/src/MuxElements.h
+++ b/src/MuxElements.h
@@ -144,18 +144,19 @@ struct dabProtection {
};
};
+enum dab_subchannel_type_t {
+ Audio = 0,
+ DataDmb = 1,
+ Fidc = 2,
+ Packet = 3
+};
struct dabSubchannel {
const char* inputProto;
const char* inputName;
DabInputBase* input;
unsigned char id;
- /* The type is:
- * 0 for mpeg, dabplus
- * 1 for data, dmb
- * 3 for packet
- */
- unsigned char type;
+ dab_subchannel_type_t type;
uint16_t startAddress;
uint16_t bitrate;
dabProtection protection;
diff --git a/src/ParserCmdline.cpp b/src/ParserCmdline.cpp
index 13523f2..b393091 100644
--- a/src/ParserCmdline.cpp
+++ b/src/ParserCmdline.cpp
@@ -217,13 +217,13 @@ bool parse_cmdline(char **argv,
#if defined(HAVE_INPUT_FILE) && defined(HAVE_FORMAT_MPEG)
} else if (c == 'A') {
(*subchannel)->inputProto = "file";
- (*subchannel)->type = 0;
+ (*subchannel)->type = Audio;
(*subchannel)->bitrate = 0;
operations = dabInputMpegFileOperations;
#endif // defined(HAVE_INPUT_FILE) && defined(HAVE_FORMAT_MPEG)
#if defined(HAVE_FORMAT_DABPLUS)
} else if (c == 'F') {
- (*subchannel)->type = 0;
+ (*subchannel)->type = Audio;
(*subchannel)->bitrate = 32;
char* proto;
@@ -307,19 +307,19 @@ bool parse_cmdline(char **argv,
goto EXIT;
}
- (*subchannel)->type = 1;
+ (*subchannel)->type = DataDmb;
(*subchannel)->bitrate = DEFAULT_DATA_BITRATE;
#if defined(HAVE_INPUT_TEST) && defined(HAVE_FORMAT_RAW)
} else if (c == 'T') {
(*subchannel)->inputProto = "test";
- (*subchannel)->type = 1;
+ (*subchannel)->type = DataDmb;
(*subchannel)->bitrate = DEFAULT_DATA_BITRATE;
operations = dabInputTestOperations;
#endif // defined(HAVE_INPUT_TEST)) && defined(HAVE_FORMAT_RAW)
#ifdef HAVE_FORMAT_PACKET
} else if (c == 'P') {
(*subchannel)->inputProto = "file";
- (*subchannel)->type = 3;
+ (*subchannel)->type = Packet;
(*subchannel)->bitrate = DEFAULT_PACKET_BITRATE;
#ifdef HAVE_INPUT_FILE
operations = dabInputPacketFileOperations;
@@ -331,7 +331,7 @@ bool parse_cmdline(char **argv,
#ifdef HAVE_FORMAT_EPM
} else if (c == 'E') {
(*subchannel)->inputProto = "file";
- (*subchannel)->type = 3;
+ (*subchannel)->type = Packet;
(*subchannel)->bitrate = DEFAULT_PACKET_BITRATE;
operations = dabInputEnhancedPacketFileOperations;
#endif // defined(HAVE_FORMAT_EPM)
@@ -360,7 +360,7 @@ bool parse_cmdline(char **argv,
goto EXIT;
}
- (*subchannel)->type = 1;
+ (*subchannel)->type = DataDmb;
(*subchannel)->bitrate = DEFAULT_DATA_BITRATE;
#endif
} else {
@@ -514,7 +514,7 @@ bool parse_cmdline(char **argv,
}
switch ((*subchannel)->type) {
#ifdef HAVE_FORMAT_PACKET
- case 3:
+ case Packet:
if ( ((DabInputCompatible*)(*subchannel)->input)->getOpts() == dabInputPacketFileOperations) {
operations = dabInputFifoOperations;
#ifdef HAVE_FORMAT_EPM
@@ -532,7 +532,7 @@ bool parse_cmdline(char **argv,
break;
#endif // defined(HAVE_FORMAT_PACKET)
#ifdef HAVE_FORMAT_MPEG
- case 0:
+ case Audio:
if ( ((DabInputCompatible*)(*subchannel)->input)->getOpts() == dabInputMpegFileOperations) {
operations = dabInputMpegFifoOperations;
} else if (((DabInputCompatible*)(*subchannel)->input)->getOpts() ==
diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp
index 1302c11..7a990a3 100644
--- a/src/ParserConfigfile.cpp
+++ b/src/ParserConfigfile.cpp
@@ -568,7 +568,7 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
if (0) {
#if defined(HAVE_FORMAT_MPEG)
} else if (type == "audio") {
- subchan->type = 0;
+ subchan->type = Audio;
subchan->bitrate = 0;
char* proto;
@@ -643,7 +643,7 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
#endif // defined(HAVE_INPUT_FILE) && defined(HAVE_FORMAT_MPEG)
#if defined(HAVE_FORMAT_DABPLUS)
} else if (type == "dabplus") {
- subchan->type = 0;
+ subchan->type = Audio;
subchan->bitrate = 32;
char* proto;
@@ -780,19 +780,19 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
throw runtime_error(ss.str());
}
- subchan->type = 1;
+ subchan->type = DataDmb;
subchan->bitrate = DEFAULT_DATA_BITRATE;
#if defined(HAVE_INPUT_TEST) && defined(HAVE_FORMAT_RAW)
} else if (type == "test") {
subchan->inputProto = "test";
- subchan->type = 1;
+ subchan->type = DataDmb;
subchan->bitrate = DEFAULT_DATA_BITRATE;
operations = dabInputTestOperations;
#endif // defined(HAVE_INPUT_TEST)) && defined(HAVE_FORMAT_RAW)
#ifdef HAVE_FORMAT_PACKET
} else if (type == "packet") {
subchan->inputProto = "file";
- subchan->type = 3;
+ subchan->type = Packet;
subchan->bitrate = DEFAULT_PACKET_BITRATE;
#ifdef HAVE_INPUT_FILE
operations = dabInputPacketFileOperations;
@@ -804,7 +804,7 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
#ifdef HAVE_FORMAT_EPM
} else if (type == "enhancedpacked") {
subchan->inputProto = "file";
- subchan->type = 3;
+ subchan->type = Packet;
subchan->bitrate = DEFAULT_PACKET_BITRATE;
operations = dabInputEnhancedPacketFileOperations;
#endif // defined(HAVE_FORMAT_EPM)
@@ -833,7 +833,7 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
throw runtime_error(ss.str());
}
- subchan->type = 1;
+ subchan->type = DataDmb;
subchan->bitrate = DEFAULT_DATA_BITRATE;
#endif
} else {
diff --git a/src/utils.cpp b/src/utils.cpp
index d81ec71..5a30b1b 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -393,16 +393,16 @@ void printSubchannels(vector<dabSubchannel*>& subchannels)
etiLog.log(info, " name: %s",
(*subchannel)->inputName);
switch ((*subchannel)->type) {
- case 0:
+ case Audio:
etiLog.log(info, " type: audio");
break;
- case 1:
+ case DataDmb:
etiLog.log(info, " type: data");
break;
- case 2:
+ case Fidc:
etiLog.log(info, " type: fidc");
break;
- case 3:
+ case Packet:
etiLog.log(info, " type: packet");
break;
default: