summaryrefslogtreecommitdiffstats
path: root/src/MuxElements.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-04-15 10:50:59 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-04-15 10:50:59 +0200
commit97cbd6234058ce1514b5696609ee7bd1f8e6a761 (patch)
tree245cd0ccac28f6c1670da3223bcaf269cc8f8028 /src/MuxElements.cpp
parentd4ab701073e4876aa3d2e5f6c883cebf08783ac4 (diff)
downloaddabmux-97cbd6234058ce1514b5696609ee7bd1f8e6a761.tar.gz
dabmux-97cbd6234058ce1514b5696609ee7bd1f8e6a761.tar.bz2
dabmux-97cbd6234058ce1514b5696609ee7bd1f8e6a761.zip
Replace DabService::program by function
Diffstat (limited to 'src/MuxElements.cpp')
-rw-r--r--src/MuxElements.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index b47a1ae..a4102b8 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -254,7 +254,7 @@ std::vector<std::shared_ptr<DabService> >::iterator getService(
throw std::runtime_error("Service not included in any component");
}
-bool DabComponent::isPacketComponent(vector<dabSubchannel*>& subchannels)
+bool DabComponent::isPacketComponent(vector<dabSubchannel*>& subchannels) const
{
if (subchId > 63) {
etiLog.log(error,
@@ -335,8 +335,7 @@ const string DabComponent::get_parameter(const string& parameter) const
}
-
-subchannel_type_t DabService::getType(std::shared_ptr<dabEnsemble> ensemble)
+subchannel_type_t DabService::getType(std::shared_ptr<dabEnsemble> ensemble) const
{
vector<dabSubchannel*>::iterator subchannel;
vector<DabComponent*>::iterator component =
@@ -353,7 +352,30 @@ subchannel_type_t DabService::getType(std::shared_ptr<dabEnsemble> ensemble)
return (*subchannel)->type;
}
-unsigned char DabService::nbComponent(vector<DabComponent*>& components)
+bool DabService::isProgramme(std::shared_ptr<dabEnsemble> ensemble) const
+{
+ bool ret = false;
+ switch (getType(ensemble)) {
+ case subchannel_type_t::Audio: // Audio
+ ret = true;
+ break;
+ case subchannel_type_t::DataDmb:
+ case subchannel_type_t::Fidc:
+ case subchannel_type_t::Packet:
+ ret = false;
+ break;
+ default:
+ etiLog.log(error,
+ "Error, unknown service type: %u\n",
+ getType(ensemble));
+ throw std::runtime_error("DabService::isProgramme unknown service type");
+ }
+
+ return ret;
+}
+
+
+unsigned char DabService::nbComponent(vector<DabComponent*>& components) const
{
int nb = 0;
vector<DabComponent*>::iterator current;