2 * $Id: ait.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/ait.h>
24 ApplicationIdentifier::ApplicationIdentifier(const uint8_t * const buffer)
26 organisationId = (buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3];
27 applicationId = (buffer[4] << 8) | buffer[5];
30 uint32_t ApplicationIdentifier::getOrganisationId(void) const
32 return organisationId;
35 uint16_t ApplicationIdentifier::getApplicationId(void) const
40 ApplicationInformation::ApplicationInformation(const uint8_t * const buffer)
42 applicationIdentifier = new ApplicationIdentifier(&buffer[0]);
43 applicationControlCode = buffer[6];
44 reserved = (buffer[7] >> 4) & 0x0f;
45 applicationDescriptorsLoopLength = ((buffer[7] & 0x0f) << 8) | buffer[8];
47 for (uint16_t i = 0; i < applicationDescriptorsLoopLength; i += buffer[i + 10] + 2)
48 descriptor(&buffer[i + 9]);
51 ApplicationInformation::~ApplicationInformation(void)
53 delete applicationIdentifier;
56 const ApplicationIdentifier *ApplicationInformation::getApplicationIdentifier(void) const
58 return applicationIdentifier;
61 uint8_t ApplicationInformation::getApplicationControlCode(void) const
63 return applicationControlCode;
66 ApplicationInformationTable::ApplicationInformationTable(const uint8_t * const buffer) : LongCrcTable(buffer)
68 reserved4 = (buffer[8] >> 4) & 0x0f;
69 commonDescriptorsLength = ((buffer[8] & 0x0f) << 8) | buffer[9];
71 for (uint16_t i = 0; i < commonDescriptorsLength; i += buffer[i + 11] + 2)
72 descriptor(&buffer[i + 10]);
74 reserved5 = (buffer[commonDescriptorsLength + 10] >> 4) & 0x0f;
75 applicationLoopLength = ((buffer[commonDescriptorsLength + 10] & 0x0f) << 8) | buffer[commonDescriptorsLength + 11];
77 for (uint16_t i = 0; i < applicationLoopLength; i += 9) {
78 ApplicationInformation *a = new ApplicationInformation(&buffer[commonDescriptorsLength + 12]);
79 applicationInformation.push_back(a);
80 i += a->applicationDescriptorsLoopLength;
84 ApplicationInformationTable::~ApplicationInformationTable(void)
86 for (ApplicationInformationIterator i = applicationInformation.begin(); i != applicationInformation.end(); ++i)
90 const ApplicationInformationVector *ApplicationInformationTable::getApplicationInformation(void) const
92 return &applicationInformation;