aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-04-15 11:06:53 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-04-15 11:06:53 +0200
commit8ee90d42fc999d4048d789fa719aff20df3dfba4 (patch)
tree2206ae33aaf1bb577e9546faae89d885315c6ad9 /src
parent1aeaeb05aadf196636ea5b6a0613c38111821436 (diff)
downloaddabmux-8ee90d42fc999d4048d789fa719aff20df3dfba4.tar.gz
dabmux-8ee90d42fc999d4048d789fa719aff20df3dfba4.tar.bz2
dabmux-8ee90d42fc999d4048d789fa719aff20df3dfba4.zip
Make all getSizeXYZ dabSubchannel member functions
Diffstat (limited to 'src')
-rw-r--r--src/DabMultiplexer.cpp14
-rw-r--r--src/MuxElements.cpp13
-rw-r--r--src/MuxElements.h16
3 files changed, 23 insertions, 20 deletions
diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp
index 3b28bd0..201e710 100644
--- a/src/DabMultiplexer.cpp
+++ b/src/DabMultiplexer.cpp
@@ -451,7 +451,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
subchannel != ensemble->subchannels.end();
++subchannel) {
// Add STLsbch
- FLtmp += getSizeWord(*subchannel);
+ FLtmp += (*subchannel)->getSizeWord();
}
fc->setFrameLength(FLtmp);
@@ -480,8 +480,8 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
}
// Sub-channel Stream Length, multiple of 64 bits
- sstc->STL_high = getSizeDWord(*subchannel) / 256;
- sstc->STL_low = getSizeDWord(*subchannel) % 256;
+ sstc->STL_high = (*subchannel)->getSizeDWord() / 256;
+ sstc->STL_low = (*subchannel)->getSizeDWord() % 256;
TagESTn tag_ESTn;
tag_ESTn.id = edi_stream_id++;
@@ -489,9 +489,9 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
tag_ESTn.sad = (*subchannel)->startAddress;
tag_ESTn.tpl = sstc->TPL;
tag_ESTn.rfa = 0; // two bits
- tag_ESTn.mst_length = getSizeByte(*subchannel) / 8;
+ tag_ESTn.mst_length = (*subchannel)->getSizeByte() / 8;
tag_ESTn.mst_data = nullptr;
- assert(getSizeByte(*subchannel) % 8 == 0);
+ assert((*subchannel)->getSizeByte() % 8 == 0);
edi_subchannelToTag[*subchannel] = tag_ESTn;
index += 4;
@@ -577,7 +577,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
TagESTn& tag = edi_subchannelToTag[*subchannel];
- int sizeSubchannel = getSizeByte(*subchannel);
+ int sizeSubchannel = (*subchannel)->getSizeByte();
int result = (*subchannel)->input->readFrame(
&etiFrame[index], sizeSubchannel);
@@ -598,7 +598,7 @@ void DabMultiplexer::mux_frame(std::vector<std::shared_ptr<DabOutput> >& outputs
for (subchannel = ensemble->subchannels.begin();
subchannel != ensemble->subchannels.end();
++subchannel) {
- index += getSizeByte(*subchannel);
+ index += (*subchannel)->getSizeByte();
}
/******* Section EOF **************************************************/
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index 9892acd..be837b1 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -570,20 +570,19 @@ unsigned short dabSubchannel::getSizeCu() const
return 0;
}
-unsigned short getSizeDWord(dabSubchannel* subchannel)
+unsigned short dabSubchannel::getSizeByte(void) const
{
- return (subchannel->bitrate * 3) >> 3;
+ return bitrate * 3;
}
-unsigned short getSizeByte(dabSubchannel* subchannel)
+unsigned short dabSubchannel::getSizeWord(void) const
{
- return subchannel->bitrate * 3;
+ return (bitrate * 3) >> 2;
}
-
-unsigned short getSizeWord(dabSubchannel* subchannel)
+unsigned short dabSubchannel::getSizeDWord(void) const
{
- return (subchannel->bitrate * 3) >> 2;
+ return (bitrate * 3) >> 3;
}
diff --git a/src/MuxElements.h b/src/MuxElements.h
index d4a8ad3..ef5957f 100644
--- a/src/MuxElements.h
+++ b/src/MuxElements.h
@@ -256,8 +256,18 @@ public:
{
}
+ // Calculate subchannel size in number of CU
unsigned short getSizeCu(void) const;
+ // Calculate subchannel size in number of bytes
+ unsigned short getSizeByte(void) const;
+
+ // Calculate subchannel size in number of uint32_t
+ unsigned short getSizeWord(void) const;
+
+ // Calculate subchannel size in number of uint64_t
+ unsigned short getSizeDWord(void) const;
+
std::string uid;
std::string inputUri;
@@ -412,11 +422,5 @@ std::vector<std::shared_ptr<DabService> >::iterator getService(
DabComponent* component,
std::vector<std::shared_ptr<DabService> >& services);
-unsigned short getSizeDWord(dabSubchannel* subchannel);
-
-unsigned short getSizeByte(dabSubchannel* subchannel);
-
-unsigned short getSizeWord(dabSubchannel* subchannel);
-
#endif