From 97cbd6234058ce1514b5696609ee7bd1f8e6a761 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 15 Apr 2016 10:50:59 +0200 Subject: Replace DabService::program by function --- src/MuxElements.cpp | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/MuxElements.cpp') 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 >::iterator getService( throw std::runtime_error("Service not included in any component"); } -bool DabComponent::isPacketComponent(vector& subchannels) +bool DabComponent::isPacketComponent(vector& 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 ensemble) +subchannel_type_t DabService::getType(std::shared_ptr ensemble) const { vector::iterator subchannel; vector::iterator component = @@ -353,7 +352,30 @@ subchannel_type_t DabService::getType(std::shared_ptr ensemble) return (*subchannel)->type; } -unsigned char DabService::nbComponent(vector& components) +bool DabService::isProgramme(std::shared_ptr 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& components) const { int nb = 0; vector::iterator current; -- cgit v1.2.3