-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCopyrightDescriptor.h
More file actions
29 lines (28 loc) · 860 Bytes
/
CopyrightDescriptor.h
File metadata and controls
29 lines (28 loc) · 860 Bytes
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
#pragma once
#include "DVBDescriptor.h"
#include "Util.h"
#include <cstring>
class CopyrightDescriptor:public DVBDescriptor {
public:
CopyrightDescriptor(DVBDescriptor * const d):DVBDescriptor(d) {
}
uint32_t identifier() const {
return (_data[0]<<24)|(_data[1]<<16)|(_data[2]<<8)|_data[3];
}
uint8_t *additionalInfo() const {
if(_length == 4)
return nullptr;
uint8_t *info = new uint8_t[_length-4];
memcpy(info, _data+4, _length-4);
return info;
}
void dump(std::ostream &where=std::cerr, std::string const &indent="") const override {
Util::SaveIOState s(where);
where << indent << "Copyright: " << std::endl;
where << indent << "\t" << "Owner ID: " << std::hex << identifier() << std::endl;
if(uint8_t *info = additionalInfo()) {
where << indent << "\t" << "Additional info: " << info << std::endl;
delete info;
}
}
};