From 3b9073ec178d1ebd8563d94ebbb9b95726e31835 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli (think)" Date: Thu, 23 Aug 2012 20:20:30 +0200 Subject: crc-dabmux: configuration file support for ensemble definition --- src/MuxElements.h | 187 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 src/MuxElements.h (limited to 'src/MuxElements.h') diff --git a/src/MuxElements.h b/src/MuxElements.h new file mode 100644 index 0000000..a27f805 --- /dev/null +++ b/src/MuxElements.h @@ -0,0 +1,187 @@ +/* + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011, 2012 Her Majesty the Queen in Right of Canada (Communications + Research Center Canada) + + Includes modifications + 2012, Matthias P. Braendli, matthias.braendli@mpb.li + + This file defines all data structures used in DabMux to represent + and save ensemble data. + */ +/* + This file is part of CRC-DabMux. + + CRC-DabMux is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + CRC-DabMux is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with CRC-DabMux. If not, see . +*/ +#ifndef _MUX_ELEMENTS +#define _MUX_ELEMENTS + +#include +#include +#include +#include +#include "dabOutput.h" +#include "dabInput.h" +#include "Eti.h" + +using namespace std; + +struct dabOutput { + const char* outputProto; + const char* outputName; + void* data; + dabOutputOperations operations; +}; + + +struct dabLabel { + char text[16]; + uint16_t flag; +}; + + +struct dabService; +struct dabComponent; +struct dabSubchannel; +struct dabEnsemble { + uint16_t id; + uint8_t ecc; + dabLabel label; + uint8_t mode; + vector services; + vector components; + vector subchannels; +}; + + +struct dabProtectionShort { + unsigned char tableSwitch; + unsigned char tableIndex; +}; + + +struct dabProtectionLong { + unsigned char option; +}; + + +struct dabProtection { + unsigned char level; + unsigned char form; + union { + dabProtectionShort shortForm; + dabProtectionLong longForm; + }; +}; + + +struct dabSubchannel { + const char* inputProto; + const char* inputName; + void* data; + dabInputOperations operations; + unsigned char id; + unsigned char type; + uint16_t startAddress; + uint16_t bitrate; + dabProtection protection; +}; + + +class SubchannelId : public std::binary_function { +public: + bool operator()(const dabSubchannel* subchannel, const int id) const { + return subchannel->id == id; + } +}; + + + + +struct dabAudioComponent { +}; + + +struct dabDataComponent { +}; + + +struct dabFidcComponent { +}; + + +struct dabPacketComponent { + uint16_t id; + uint16_t address; + uint16_t appType; + bool datagroup; +}; + + +struct dabComponent { + dabLabel label; + uint32_t serviceId; + uint8_t subchId; + uint8_t type; + uint8_t SCIdS; + union { + dabAudioComponent audio; + dabDataComponent data; + dabFidcComponent fidc; + dabPacketComponent packet; + }; + + bool isPacketComponent(vector& subchannels); +}; + + + +struct dabService { + dabLabel label; + uint32_t id; + unsigned char pty; + unsigned char language; + bool program; + + unsigned char getType(dabEnsemble* ensemble); + unsigned char nbComponent(vector& components); +}; + +vector::iterator getSubchannel( + vector& subchannels, int id); + +vector::iterator getComponent( + vector& components, + uint32_t serviceId, + vector::iterator current); + +vector::iterator getComponent( + vector& components, + uint32_t serviceId); + +vector::iterator getService( + dabComponent* component, + vector& services); + +unsigned short getSizeCu(dabSubchannel* subchannel); + +unsigned short getSizeDWord(dabSubchannel* subchannel); + +unsigned short getSizeByte(dabSubchannel* subchannel); + +unsigned short getSizeWord(dabSubchannel* subchannel); + + +#endif -- cgit v1.2.3