2 * $Id: linkage_descriptor.cpp,v 1.1 2003-10-17 15:36:37 tmbinc Exp $
4 * (C) 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/linkage_descriptor.h>
24 LinkageDescriptor::LinkageDescriptor(const uint8_t * const buffer) : Descriptor(buffer)
26 transportStreamId = (buffer[2] << 8) | buffer[3];
27 originalNetworkId = (buffer[4] << 8) | buffer[5];
28 serviceId = (buffer[6] << 8) | buffer[7];
29 linkageType = buffer[8];
31 if (linkageType != 0x08)
33 if (descriptorLength < 7)
36 for (uint16_t i = 0; i < descriptorLength - 7; ++i)
37 privateDataBytes.push_back(buffer[i + 9]);
41 handOverType = (buffer[9] >> 4) & 0x0f;
42 reserved = (buffer[9] >> 1) & 0x07;
43 originType = buffer[9] & 0x01;
47 if ((handOverType >= 0x01) && (handOverType <= 0x03)) {
48 networkId = (buffer[10] << 8) | buffer[11];
52 if (originType == 0x00) {
53 initialServiceId = (buffer[offset + 10] << 8) | buffer[offset + 11];
57 if (descriptorLength >= (unsigned)(offset+8))
58 for (uint16_t i = 0; i < descriptorLength - (offset + 8); ++i)
59 privateDataBytes.push_back(buffer[i + offset + 10]);
63 uint16_t LinkageDescriptor::getTransportStreamId(void) const
65 return transportStreamId;
68 uint16_t LinkageDescriptor::getOriginalNetworkId(void) const
70 return originalNetworkId;
73 uint16_t LinkageDescriptor::getServiceId(void) const
78 uint8_t LinkageDescriptor::getLinkageType(void) const
83 const PrivateDataByteVector *LinkageDescriptor::getPrivateDataBytes(void) const
85 return &privateDataBytes;
88 uint8_t LinkageDescriptor::getHandOverType(void) const
93 uint8_t LinkageDescriptor::getOriginType(void) const
98 uint16_t LinkageDescriptor::getNetworkId(void) const
103 uint16_t LinkageDescriptor::getInitialServiceId(void) const
105 return initialServiceId;