summaryrefslogtreecommitdiffstats
path: root/src/DabMux.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-08-02 12:28:19 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-08-02 12:28:19 +0200
commitca7dd07261de50576590fea227c8fbf345282e1f (patch)
tree3a25dab3e1af8b5891cad9f3a4c32d1ffb39b733 /src/DabMux.cpp
parentf5b16079b7174a04160cf265b6362311fb497e62 (diff)
downloaddabmux-ca7dd07261de50576590fea227c8fbf345282e1f.tar.gz
dabmux-ca7dd07261de50576590fea227c8fbf345282e1f.tar.bz2
dabmux-ca7dd07261de50576590fea227c8fbf345282e1f.zip
Add the possibility to specify protection profile
Diffstat (limited to 'src/DabMux.cpp')
-rw-r--r--src/DabMux.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 6f826c0..655985f 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -308,7 +308,6 @@ int main(int argc, char *argv[])
unsigned long currentFrame;
int returnCode = 0;
- int result;
int cur;
unsigned char etiFrame[6144];
unsigned short index = 0;
@@ -567,14 +566,14 @@ int main(int argc, char *argv[])
}
// TODO Check errors
- result = (*subchannel)->input->setBitrate( (*subchannel)->bitrate);
- if (result <= 0) {
+ int subch_bitrate = (*subchannel)->input->setBitrate( (*subchannel)->bitrate);
+ if (subch_bitrate <= 0) {
etiLog.log(error, "can't set bitrate for source %s\n",
(*subchannel)->inputName);
returnCode = -1;
throw MuxInitException();
}
- (*subchannel)->bitrate = result;
+ (*subchannel)->bitrate = subch_bitrate;
/* Use EEP unless we find a UEP configuration
* UEP is only used for MPEG audio, but some bitrates don't
@@ -593,10 +592,24 @@ int main(int argc, char *argv[])
}
}
}
+
+ /* EEP B can only be used for subchannels with bitrates
+ * multiple of 32kbit/s
+ */
+ if ( protection->form == EEP &&
+ protection->eep.profile == EEP_B &&
+ subch_bitrate % 32 != 0 ) {
+ etiLog.level(error) <<
+ "Cannot use EEP_B protection for subchannel " <<
+ (*subchannel)->inputName <<
+ ": bitrate not multiple of 32kbit/s";
+ returnCode = -1;
+ throw MuxInitException();
+ }
}
if (ensemble->subchannels.size() == 0) {
- etiLog.log(error, "can't multiplexed no subchannel!\n");
+ etiLog.log(error, "can't multiplex no subchannel!\n");
returnCode = -1;
throw MuxInitException();
}
@@ -1920,7 +1933,7 @@ int main(int argc, char *argv[])
TagESTn* tag = edi_subchannelToTag[*subchannel];
int sizeSubchannel = getSizeByte(*subchannel);
- result = (*subchannel)->input->readFrame(
+ int result = (*subchannel)->input->readFrame(
&etiFrame[index], sizeSubchannel);
if (result < 0) {