forked from ebu/MXFTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEBUCoreFeatures.hpp
291 lines (248 loc) · 5.97 KB
/
EBUCoreFeatures.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
#ifndef CPP_EBUCOREFEATURES_CLASS_H
#define CPP_EBUCOREFEATURES_CLASS_H
/*!
* \project_name EBU Player
* \file EBUCoreFeatures.hpp
* \brief EBUCore features specifications
* \details This class is used to load the EBUCore features. Basically, it will encapsulate and desencapsulate the EBUCore metadatas into the MXF file
* \authors Marco Dos Santos Oliveira
* \version 0.1
* \date 28 march 2013
* \copyright This software is published under MPL v2.0
*
*/
#include <bmx/mxf_reader/MXFFileReader.h>
#include <bmx/mxf_reader/MXFGroupReader.h>
#include <bmx/mxf_reader/MXFSequenceReader.h>
#include <bmx/mxf_reader/MXFFrameMetadata.h>
#include <bmx/essence_parser/SoundConversion.h>
#include <bmx/MD5.h>
#include <bmx/CRC32.h>
#include <bmx/MXFUtils.h>
#include <bmx/Utils.h>
#include <bmx/Version.h>
#include <bmx/as11/AS11Info.h>
#include <bmx/BMXException.h>
#include <bmx/Logging.h>
#ifdef _WIN64
#include <mxf/mxf_win32_file.h>
//define libraries for Windows (64-bit)
#elif _WIN32
#include <mxf/mxf_win32_file.h>
//#elif __APPLE__
// #if TARGET_OS_IPHONE
// iOS device
// #elif TARGET_IPHONE_SIMULATOR
// iOS Simulator
// #elif TARGET_OS_MAC
// Other kinds of Mac OS
// #else
// Unsupported platform
// #endif
#elif __linux
#include <EBUCoreProcessor.h>
// linux
//#elif __unix // all unices not caught above
// Unix
//#elif __posix
// POSIX
#endif
#include <xercesc/dom/DOM.hpp>
#include <exception>
#include <list>
#include "genericFeatures.hpp"
/*! \class EBUCore Features
* \brief this class represent the EBUCore Wrapping features
*
* This class controls all the EBUCore Wrapping features
*/
class EBUCoreFeatures {
public:
/*!*
* @brief Class constructor
* @brief The EBUCoreFeatures class constructor instantiates a new EBUCore Wrapper and all its features.
*/
EBUCoreFeatures
(
void
);
/*!*
* @brief Class destructor
* @brief The EBUCoreFeatures class destructor destroys all variables and instanciate objects. This is the garbage collector class. It is always called at the end of class life.
*
*/
virtual ~EBUCoreFeatures
(
void
);
void UnwrapEBUCore
(
std::string MXFFilename
);
void UnwrapEBUCore
(
std::string MXFFilename,
std::string XMLEBUCoreOutputFilename
);
void eraseEBUCore
(
std::string MXFFilename
);
void eraseEBUCore
(
std::string MXFFilename,
std::string XMLEBUCoreOutputFilename
);
void WrapEBUCore
(
std::string MXFFilename,
std::string XMLEBUCoreFilename,
bool setHeader,
bool isDark,
bool isSidecar
);
void WrapEBUCore
(
std::string MXFFilename,
bool setHeader,
bool isDark,
bool isSidecar,
std::string XMLEBUCoreFilename = ""
);
void WrapEBUCore
(
xercesc::DOMDocument * EBUCoreMetadata,
std::string MXFFilename,
bool setHeader,
bool isDark,
bool isSidecar,
std::string XMLEBUCoreFilename = ""
);
xercesc::DOMDocument * getEBUCore
(
void
);
bool hasEBUCore
(
void
);
void setEBUCore
(
xercesc::DOMDocument * new_dom_doc
);
static void progress_cb
(
float progress,
EBUSDK::EBUCore::ProgressCallbackLevel level,
const char *function,
const char *msg_format,
...
);
struct AttributeStruct {
std::string name;
std::string type;
bool hasDefaultValue;
std::string defaultValue;
bool hasEnumeration;
std::vector<std::string> Enumeration;
};
struct ElementStruct {
std::string name;
std::string type;
std::list<AttributeStruct> attribute;
std::list<ElementStruct> children;
int minCardinality;
int maxCardinality;
bool leaf;
bool hasChoice;
std::list<std::list<std::string>> choices;
};
ElementStruct getReference(std::string path);
std::vector<std::string> listEnumeration(xercesc::DOMElement * el);
protected:
std::vector<ElementStruct> ebucoremodel; // ebucore model
std::vector<std::string> ebucoreStack; //ebucore stack
int getSchemas (std::string dir, std::vector<std::string> &files);
bool isExtension(std::string str, std::string extension);
bool isDCSimpleType(std::string str);
bool isStandardType(std::string str);
bool isEBUCoreType(std::string str);
int isUnbounded(std::string max);
bool groupExist(std::string str);
void extractSchema(std::string pathtofile);
AttributeStruct DCAttribute(void);
std::list<AttributeStruct> DCAttr;
std::string DCType
(
void
);
AttributeStruct packAttribute
(
xercesc::DOMElement * el
);
std::list<std::list<std::string>> generateChoices
(
std::string father,
xercesc::DOMElement * el
);
std::list<AttributeStruct> generateAttributes
(
std::string father,
xercesc::DOMElement * el
);
std::list<ElementStruct> generateChildren
(
std::string father,
xercesc::DOMElement * el
);
std::list<EBUCoreFeatures::ElementStruct> generateLocalChildren
(
std::string father,
xercesc::DOMElement * el,
xercesc::DOMElement * cursor
);
std::list<ElementStruct> generateGroupChildren
(
std::list<ElementStruct> brothers,
std::string father,
xercesc::DOMElement * el
);
std::list<ElementStruct> generateExtensionChildren
(
std::list<ElementStruct> brothers,
std::string father,
xercesc::DOMElement * el
);
std::list<ElementStruct> generateChoiceChildren
(
std::list<ElementStruct> brothers,
xercesc::DOMElement * el,
xercesc::DOMElement * parent
);
ElementStruct constructSchema
(
xercesc::DOMElement * el
);
void generateSkeletonElement
(
ElementStruct skeleton
);
void generateSkeleton
(
void
);
bool hasTypeReference
(
std::vector<std::pair<std::string, ElementStruct>> typelist,
std::string newtype
);
ElementStruct loopTypeReference
(
std::vector<std::pair<std::string, ElementStruct>> typelist,
std::string newtype
);
std::ofstream out;
xercesc::DOMDocument * dom_doc;
xercesc::DOMElement* dom_root;
};
#endif