diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-02-14 11:14:41 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2014-02-14 11:14:41 +0100 |
commit | 6b9857cb1b2ab6b58e6e42df4b0cce54448b10a0 (patch) | |
tree | a59216616d9fd1d0c6468bdc300f9b6c9b6a04e1 /src/DabMux.cpp | |
parent | 00f1d412ad410eca7e4032686b907c5e8f7915ec (diff) | |
download | dabmux-6b9857cb1b2ab6b58e6e42df4b0cce54448b10a0.tar.gz dabmux-6b9857cb1b2ab6b58e6e42df4b0cce54448b10a0.tar.bz2 dabmux-6b9857cb1b2ab6b58e6e42df4b0cce54448b10a0.zip |
improve handling of labels
Diffstat (limited to 'src/DabMux.cpp')
-rw-r--r-- | src/DabMux.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/DabMux.cpp b/src/DabMux.cpp index 5fb9c17..b7095c6 100644 --- a/src/DabMux.cpp +++ b/src/DabMux.cpp @@ -3,8 +3,8 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Includes modifications - 2012, Matthias P. Braendli, matthias.braendli@mpb.li + Copyright (C) 2014 + Matthias P. Braendli, matthias.braendli@mpb.li */ /* This file is part of ODR-DabMux. @@ -269,9 +269,8 @@ int main(int argc, char *argv[]) dabEnsemble* ensemble = new dabEnsemble; - strncpy(ensemble->label.text, DEFAULT_ENSEMBLE_LABEL, 16); + ensemble->label.setLabel(DEFAULT_ENSEMBLE_LABEL, DEFAULT_ENSEMBLE_SHORT_LABEL); ensemble->mode = DEFAULT_DAB_MODE; - ensemble->label.flag = DEFAULT_ENSEMBLE_SHORT_LABEL; ensemble->id = DEFAULT_ENSEMBLE_ID; ensemble->ecc = DEFAULT_ENSEMBLE_ECC; @@ -1470,11 +1469,11 @@ int main(int argc, char *argv[]) fig1_0->EId = htons(ensemble->id); index = index + 4; - memcpy(&etiFrame[index], ensemble->label.text, 16); + memcpy(&etiFrame[index], ensemble->label.text(), 16); index = index + 16; - etiFrame[index++] = ((char *) &ensemble->label.flag)[1]; - etiFrame[index++] = ((char *) &ensemble->label.flag)[0]; + etiFrame[index++] = ensemble->label.flag() >> 8; + etiFrame[index++] = ensemble->label.flag() & 0xFF; figSize += 22; break; @@ -1601,7 +1600,7 @@ int main(int argc, char *argv[]) if (alterneFIB < ensemble->services.size()) { service = ensemble->services.begin() + alterneFIB; - // FIG type 1/1, SI, Service label, une instance par sous-canal + // FIG type 1/1, SI, Service label, one instance per subchannel if ((*service)->getType(ensemble) == 0) { fig1_1 = (FIGtype1_1 *) & etiFrame[index]; @@ -1626,12 +1625,11 @@ int main(int argc, char *argv[]) index += 6; figSize += 6; } - memcpy(&etiFrame[index], (*service)->label.text, 16); + memcpy(&etiFrame[index], (*service)->label.text(), 16); index += 16; figSize += 16; - - etiFrame[index++] = ((char *) &(*service)->label.flag)[1]; - etiFrame[index++] = ((char *) &(*service)->label.flag)[0]; + etiFrame[index++] = (*service)->label.flag() >> 8; + etiFrame[index++] = (*service)->label.flag() & 0xFF; figSize += 2; } else if (alterneFIB < ensemble->services.size() + ensemble->components.size()) { @@ -1641,7 +1639,7 @@ int main(int argc, char *argv[]) subchannel = getSubchannel(ensemble->subchannels, (*component)->subchId); - if ((*component)->label.text[0] != 0) { + if ((*component)->label.text()[0] != 0) { if ((*service)->getType(ensemble) == 0) { // Programme FIGtype1_4_programme *fig1_4; fig1_4 = (FIGtype1_4_programme*)&etiFrame[index]; @@ -1674,12 +1672,12 @@ int main(int argc, char *argv[]) index += 7; figSize += 7; } - memcpy(&etiFrame[index], (*component)->label.text, 16); + memcpy(&etiFrame[index], (*component)->label.text(), 16); index += 16; figSize += 16; - etiFrame[index++] = ((char *) &(*component)->label.flag)[1]; - etiFrame[index++] = ((char *) &(*component)->label.flag)[0]; + etiFrame[index++] = (*component)->label.flag() >> 8; + etiFrame[index++] = (*component)->label.flag() & 0xFF; figSize += 2; } } |