-
Notifications
You must be signed in to change notification settings - Fork 1
/
klv.hpp
68 lines (53 loc) · 1.33 KB
/
klv.hpp
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
67
68
#ifndef KLV_HPP___
#define KLV_HPP___
#include <string>
#include <cstdint>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <memory>
#include <list>
#include <map>
#include "bit_extractor.hpp"
#include "dictionary.hpp"
#define KLV_UL_HEADER_IOD 0x06
#define KLV_UL_HEADER_ULSIZE 0x0E
#define KLV_UL_DESIGNATOR_ULCODE 0x2B
#define KLV_UL_DESIGNATOR_SMPTE_DESIGNATOR 0x34
#define KLV_GROUP_UNIVERSAL_SET 0x01
#define KLV_GROUP_GLOBAL_SET 0x02
#define KLV_GROUP_LOCAL_SET 0x03
#define KLV_GROUP_VARIABLE_LENGTH_PACK 0x04
#define KLV_GROUP_FIXED_LENGTH_PACK 0x05
// Octet 5
enum klv_registry_category {
KLV_RC_DICTIONARY = 0x01,
KLV_RC_GROUP = 0x02,
KLV_RC_WRAPPER = 0x03,
KLV_RC_LABEL = 0x04
};
class klv_item {
public:
klv_item();
~klv_item();
Key<16> mKey;
uint32_t mLength;
uint8_t *mValue;
bool parse_value();
void output(std::ostream &os, std::string indent);
bool validate();
// Used for Groups and Sets
std::list<std::shared_ptr<klv_item>> *mKLVList;
};
class klv_parser {
public:
klv_parser();
bool get_klv_item(klv_item &klvi, bit_extractor &be);
void set_verbosity(bool v);
void set_validation(bool v);
private:
int32_t mState;
bool mVerbose;
bool mValidate;
};
#endif