-
Notifications
You must be signed in to change notification settings - Fork 1
/
DVBDescriptor.cpp
66 lines (63 loc) · 2.04 KB
/
DVBDescriptor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "DVBDescriptor.h"
#include "LanguageDescriptor.h"
#include "StreamIdentifierDescriptor.h"
#include "AncillaryDataDescriptor.h"
#include "AC3Descriptor.h"
#include "ApplicationSignalingDescriptor.h"
#include "TeletextDescriptor.h"
#include "CopyrightDescriptor.h"
#include "DataBroadcastIDDescriptor.h"
#include "ServiceDescriptor.h"
#include "ServiceListDescriptor.h"
#include "PrivateDataSpecifierDescriptor.h"
#include "CableDeliverySystemDescriptor.h"
#include "SatelliteDeliverySystemDescriptor.h"
#include "TerrestrialDeliverySystemDescriptor.h"
#include "Util.h"
#include <cxxabi.h>
DVBDescriptor *DVBDescriptor::get(unsigned char *&where) {
DVBDescriptor *d=new DVBDescriptor(where);
switch(d->tag()) {
case Language:
return new LanguageDescriptor(d);
case Copyright:
return new CopyrightDescriptor(d);
case StreamIdentifier:
return new StreamIdentifierDescriptor(d);
case Teletext:
return new TeletextDescriptor(d);
case AncillaryData:
return new AncillaryDataDescriptor(d);
case AC3:
return new AC3Descriptor(d);
case ApplicationSignaling:
return new ApplicationSignalingDescriptor(d);
case DataBroadcastID:
return new DataBroadcastIdDescriptor(d);
case Service:
return new ServiceDescriptor(d);
case ServiceList:
return new ServiceListDescriptor(d);
case PrivateDataSpecifier:
return new PrivateDataSpecifierDescriptor(d);
case CableDeliverySystem:
return new CableDeliverySystemDescriptor(d);
case SatelliteDeliverySystem:
return new SatelliteDeliverySystemDescriptor(d);
case TerrestrialDeliverySystem:
return new TerrestrialDeliverySystemDescriptor(d);
default:
return d;
}
}
DVBDescriptor::DVBDescriptor(unsigned char *&where) {
_tag = *where++;
_length = *where++;
_data = where;
where += _length;
}
void DVBDescriptor::dump(std::ostream &where, std::string const &indent) const {
Util::SaveIOState sis(where);
where << indent << abi::__cxa_demangle(typeid(this).name(), nullptr, nullptr, nullptr) << " tag " << std::hex << static_cast<int>(_tag) << std::endl;
Util::hexdump(_data, _length, where, indent);
}