2 * $Id: sdt.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/sdt.h>
24 ServiceDescription::ServiceDescription(const uint8_t * const buffer)
26 serviceId = (buffer[0] << 8) | buffer[1];
27 reserved1 = (buffer[2] >> 2) & 0x3F;
28 eitScheduleFlag = (buffer[2] >> 1) & 0x01;
29 eitPresentFollowingFlag = buffer[2] & 0x01;
30 runningStatus = (buffer[3] >> 5) & 0x07;
31 freeCaMode = (buffer[3] >> 4) & 0x01;
32 descriptorsLoopLength = ((buffer[3] & 0x0F) << 8) | buffer[4];
34 for (uint16_t i = 5; i < descriptorsLoopLength + 5; i += buffer[i + 1] + 2)
35 descriptor(&buffer[i]);
38 uint16_t ServiceDescription::getServiceId(void) const
43 uint8_t ServiceDescription::getEitScheduleFlag(void) const
45 return eitScheduleFlag;
48 uint8_t ServiceDescription::getEitPresentFollowingFlag(void) const
50 return eitPresentFollowingFlag;
53 uint8_t ServiceDescription::getRunningStatus(void) const
58 uint8_t ServiceDescription::getFreeCaMode(void) const
63 ServiceDescriptionTable::ServiceDescriptionTable(const uint8_t * const buffer) : LongCrcTable (buffer)
65 originalNetworkId = (buffer[8] << 8) | buffer[9];
66 reserved4 = buffer[10];
68 for (uint16_t i = 11; i < sectionLength - 1; i += ((buffer[i + 3] & 0x0F) | buffer[i + 4]) + 5)
69 description.push_back(new ServiceDescription(&buffer[i]));
72 ServiceDescriptionTable::~ServiceDescriptionTable(void)
74 for (ServiceDescriptionIterator i = description.begin(); i != description.end(); ++i)
78 uint16_t ServiceDescriptionTable::getOriginalNetworkId(void) const
80 return originalNetworkId;
83 const ServiceDescriptionVector *ServiceDescriptionTable::getDescriptions(void) const