2 * $Id: mosaic_descriptor.cpp,v 1.1 2003-10-17 15:36:37 tmbinc Exp $
4 * (C) 2002-2003 Andreas Oberritter <obi@saftware.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include <lib/dvb_si/mosaic_descriptor.h>
24 ElementaryCellField::ElementaryCellField (const uint8_t * const buffer)
26 reserved = (buffer[0] >> 6) & 0x03;
27 elementaryCellId = buffer[0] & 0x3F;
30 uint8_t ElementaryCellField::getElementaryCellId(void) const
32 return elementaryCellId;
35 MosaicCell::MosaicCell (const uint8_t * const buffer)
37 logicalCellId = (buffer[0] >> 2) & 0x3F;
38 reserved = (((buffer[0] & 0x03) << 8) | (buffer[1] & 0xF1)) >> 3;
39 logicalCellPresentationInfo = buffer[1] & 0x07;
40 elementaryCellFieldLength = buffer[2];
42 for (uint16_t i = 0; i < elementaryCellFieldLength; ++i)
43 elementaryCellFields.push_back(new ElementaryCellField(&buffer[i + 3]));
45 cellLinkageInfo = buffer[elementaryCellFieldLength + 3];
47 switch (cellLinkageInfo) {
49 bouquetId = (buffer[elementaryCellFieldLength + 4] << 8) | buffer[elementaryCellFieldLength + 5];
54 originalNetworkId = (buffer[elementaryCellFieldLength + 4] << 8) | buffer[elementaryCellFieldLength + 5];
55 transportStreamId = (buffer[elementaryCellFieldLength + 6] << 8) | buffer[elementaryCellFieldLength + 7];
56 serviceId = (buffer[elementaryCellFieldLength + 8] << 8) | buffer[elementaryCellFieldLength + 9];
62 if (cellLinkageInfo == 0x04)
63 eventId = (buffer[elementaryCellFieldLength + 10] << 8) | buffer[elementaryCellFieldLength + 11];
66 MosaicCell::~MosaicCell(void)
68 for (ElementaryCellFieldIterator i = elementaryCellFields.begin(); i != elementaryCellFields.end(); ++i)
72 uint8_t MosaicCell::getLogicalCellId(void) const
77 uint8_t MosaicCell::getLogicalCellPresentationInfo(void) const
79 return logicalCellPresentationInfo;
82 const ElementaryCellFieldVector *MosaicCell::getElementaryCellFields(void) const
84 return &elementaryCellFields;
87 uint8_t MosaicCell::getCellLinkageInfo(void) const
89 return cellLinkageInfo;
92 uint16_t MosaicCell::getBouquetId(void) const
97 uint16_t MosaicCell::getOriginalNetworkId(void) const
99 return originalNetworkId;
102 uint16_t MosaicCell::getTransportStreamId(void) const
104 return transportStreamId;
107 uint16_t MosaicCell::getServiceId(void) const
112 uint16_t MosaicCell::getEventId(void) const
117 MosaicDescriptor::MosaicDescriptor(const uint8_t * const buffer) : Descriptor(buffer)
119 if (descriptorLength < 1)
122 mosaicEntryPoint = (buffer[2] >> 7) & 0x01;
123 numberOfHorizontalElementaryCells = (buffer[2] >> 4) & 0x07;
124 reserved = (buffer[2] >> 3) & 0x01;
125 numberOfVerticalElementaryCells = buffer[2] & 0x07;
127 for (uint16_t i = 0; i < descriptorLength - 1; i += buffer[i + 6] + 2) {
128 mosaicCells.push_back(new MosaicCell(&buffer[i + 1]));
129 switch (buffer[i + 6 + buffer[i + 6] + 1]) {
146 MosaicDescriptor::~MosaicDescriptor(void)
148 for (MosaicCellIterator i = mosaicCells.begin(); i != mosaicCells.end(); ++i)
152 uint8_t MosaicDescriptor::getMosaicEntryPoint(void) const
154 return mosaicEntryPoint;
157 uint8_t MosaicDescriptor::getNumberOfHorizontalElementaryCells(void) const
159 return numberOfHorizontalElementaryCells;
162 uint8_t MosaicDescriptor::getNumberOfVerticalElementaryCells(void) const
164 return numberOfVerticalElementaryCells;
167 const MosaicCellVector *MosaicDescriptor::getMosaicCells(void) const