2 * $Id: announcement_support_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/announcement_support_descriptor.h>
24 Announcement::Announcement(const uint8_t * const buffer)
26 announcementType = (buffer[0] >> 4) & 0x0f;
27 reserved = (buffer[0] >> 3) & 0x01;
28 referenceType = buffer[0] & 0x07;
30 if ((referenceType >= 0x01) && (referenceType <= 0x03)) {
31 originalNetworkId = (buffer[1] << 8) | buffer[2];
32 transportStreamId = (buffer[3] << 8) | buffer[4];
33 serviceId = (buffer[5] << 8) | buffer[6];
34 componentTag = buffer[7];
38 uint8_t Announcement::getAnnouncementType(void) const
40 return announcementType;
43 uint8_t Announcement::getReferenceType(void) const
48 uint16_t Announcement::getOriginalNetworkId(void) const
50 return originalNetworkId;
53 uint16_t Announcement::getTransportStreamId(void) const
55 return transportStreamId;
58 uint16_t Announcement::getServiceId(void) const
63 uint8_t Announcement::getComponentTag(void) const
68 AnnouncementSupportDescriptor::AnnouncementSupportDescriptor(const uint8_t * const buffer) : Descriptor(buffer)
72 announcementSupportIndicator = (buffer[2] << 8) | buffer[3];
74 if (descriptorLength < 2)
77 for (uint16_t i = 0; i < descriptorLength - 2; ++i) {
78 a = new Announcement(&buffer[i + 4]);
79 announcements.push_back(a);
80 switch (a->getReferenceType()) {
92 AnnouncementSupportDescriptor::~AnnouncementSupportDescriptor(void)
94 for (AnnouncementIterator i = announcements.begin(); i != announcements.end(); ++i)
98 uint16_t AnnouncementSupportDescriptor::getAnnouncementSupportIndicator(void) const
100 return announcementSupportIndicator;
103 const AnnouncementVector *AnnouncementSupportDescriptor::getAnnouncements(void) const
105 return &announcements;