forked from ebu/MXFTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetadataEngine.hpp
398 lines (341 loc) · 8.63 KB
/
metadataEngine.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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
#ifndef CPP_METADATAENGINE_CLASS_H
#define CPP_METADATAENGINE_CLASS_H
/*!
* \project_name EBU Player
* \file metadataEngine.hpp
* \brief metadata engine specifications
* \details This class is used to load the EBUCore metadata engine and his functionnalities
* \authors Marco Dos Santos Oliveira
* \version 0.1
* \date 26 march 2013
* \copyright This software is published under MPL v2.0
*
*/
// c++
#include <iostream>
// xerces
#include <xercesc/dom/DOM.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
#include <xercesc/framework/StdOutFormatTarget.hpp>
#include <xercesc/util/PlatformUtils.hpp>
// gtk/gtkmm
#include <gtkmm/widget.h>
#include <gtkmm/expander.h>
#include <gtkmm/viewport.h>
#include <gtkmm/box.h>
#include <gtkmm/eventbox.h>
#include <gtkmm/label.h>
#include <gtkmm/scrolledwindow.h>
#include <gtkmm/entry.h>
#include <gtkmm/treeview.h>
#include <gtkmm/liststore.h>
#include <gtkmm/textview.h>
#include <gtkmm/stock.h>
#include <gtkmm/assistant.h>
#include <gtkmm/aspectframe.h>
#include <gtkmm/radiobutton.h>
#include <gtkmm/switch.h>
#include <gtkmm/comboboxtext.h>
// glib/glibmm
#include <glibmm/miscutils.h>
// internal classes
#include "EBUCoreFeatures.hpp"
#include "genericFeatures.hpp"
#include "customEntry.hpp"
/*! \class metadataEngine
* \brief this class represent the metadata engine
*
* This class controls all the metadata features
*/
class metadataEngine {
public:
/*!*
* @brief Class constructor
* @brief The metadataEngine class constructor instantiates a new metadata engine and all its features.
*/
metadataEngine
(
Gtk::Label * statusRef,
Gtk::Label * sourceRef,
Gtk::Label * sourceLabelRef,
Gtk::Label * sizeRef,
Gtk::Label * sizeValueRef,
Gtk::Box * lineOneRef,
Gtk::Box * lineTwoRef,
Gtk::ScrolledWindow * FirstScrolledWindowBoxRef,
Gtk::Box * SecondScrolledWindowBoxRef,
Gtk::Box * boxEntriesRef,
Gtk::Box * boxStatusRef,
Gtk::Expander * expanderRootRef,
Gtk::Viewport * viewportTreeRef,
Gtk::Switch * SwitchEBUCoreRef
);
/*!*
* @brief Class destructor
* @brief The metadatarEngine 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 ~metadataEngine
(
void
);
void setRightSide
(
std::string filename
);
void constructTreeViewFromXML
(
std::string XMLfile
);
void constructTreeViewFromMXF
(
std::string MXFfile
);
void embedEBUCore
(
std::string MXFFilename,
bool setHeader,
bool isDark,
bool isSidecar
);
void embedEBUCore
(
std::string MXFFilename,
std::string XMLEBUCoreFilename,
bool setHeader,
bool isDark,
bool isSidecar
);
void removeEBUCore
(
std::string MXFFilename
);
void removeEBUCore
(
std::string MXFFilename,
std::string XMLEBUCoreFilename
);
void exportMXF2XMLEBUCore
(
std::string MXFFilename,
std::string XMLEBUCoreOutputFilename
);
void exportXMLEBUCore
(
std::string XMLEBUCoreOutputFilename
);
unsigned int getViewportSize
(
void
);
protected:
//Node attributes Tree model columns:
class NodeAttributesModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
NodeAttributesModelColumns()
{
add(metadataNodeAttributeIdCol);
add(metadataNodeAttributeNameCol);
add(metadataNodeAttributeValueCol);
add(metadataNodeAttributeBgColorCol);
}
Gtk::TreeModelColumn<int> metadataNodeAttributeIdCol;
Gtk::TreeModelColumn<Glib::ustring> metadataNodeAttributeNameCol;
Gtk::TreeModelColumn<Glib::ustring> metadataNodeAttributeValueCol;
Gtk::TreeModelColumn<Glib::ustring> metadataNodeAttributeBgColorCol;
};
NodeAttributesModelColumns metadataNodeAttributesColumns;
Glib::RefPtr<Gtk::TreeSelection> metadataNodeAttributesTreeviewSelection;
//Node attributes Tree model columns:
class NodeChildrenModelColumns : public Gtk::TreeModel::ColumnRecord
{
public:
NodeChildrenModelColumns()
{
add(metadataNodeChildrenIdCol);
add(metadataNodeChildrenNameCol);
add(metadataNodeChildrenBgColorCol);
}
Gtk::TreeModelColumn<int> metadataNodeChildrenIdCol;
Gtk::TreeModelColumn<Glib::ustring> metadataNodeChildrenNameCol;
Gtk::TreeModelColumn<Glib::ustring> metadataNodeChildrenStateCol;
Gtk::TreeModelColumn<Glib::ustring> metadataNodeChildrenBgColorCol;
};
NodeChildrenModelColumns metadataNodeChildrenColumns;
Glib::RefPtr<Gtk::TreeSelection> metadataNodeChildrenTreeviewSelection;
unsigned int viewportTreeMinimumWidth;
std::vector<xercesc::DOMElement *> elReferences;
std::vector<std::string> elSchemaRef;
std::string schemaPath;
Gtk::Assistant * metadataAssistant;
Glib::RefPtr<Gtk::TextBuffer> metadataTextBuffer;
Glib::RefPtr<Gtk::TextBuffer> assistantTextBuffer;
Glib::RefPtr<Gtk::TextBuffer> assistantNodeChildrenBuffer;
Gtk::Entry * attributeNameEntry;
Gtk::ComboBoxText * attributeComboBoxText;
customEntry * attributeValueEntry;
Gtk::Label * attributeValueSample;
Gtk::Entry * tagValueEntry;
bool addNode_type;
std::string mxffilename; /*!< mxffilename Pointer to store temporarly the current played node */
//left side widgets
Gtk::ScrolledWindow * FirstScrolledWindowBox; /*!< FirstScrolledWindowBox */
Gtk::Expander * expanderRoot;
Gtk::Viewport * viewportTree;
// right side widgets
Gtk::Label * status;
Gtk::Label * source, * sourceLabel;
Gtk::Label * size, * sizeValue;
Gtk::Box * lineOne, * lineTwo;
Gtk::Box * SecondScrolledWindowBox;
Gtk::Box * boxEntries, * boxStatus;
Gtk::Switch * EBUCoreSet;
// gdk color
Gdk::RGBA black;
Gdk::RGBA white;
Gdk::RGBA whiteghost;
Gdk::RGBA red;
Gdk::RGBA blue;
// registers
Gtk::Expander * previousnode; /*!< previousnode Pointer to store temporarly the current node selected */
Gtk::EventBox * previousnnodeevent; /*!< previousnode Pointer to store temporarly the current node selected */
Gtk::Label * previousnodelabel; /*!< previousnode Pointer to store temporarly the current node selected */
bool previouslabel;
int previousnodepos;
// EBUCore Wrapper
EBUCoreFeatures * SDKWrapper;
xercesc::DOMDocument* xercescdoc;
EBUCoreFeatures::ElementStruct ebucoreRef;
void on_EBUCoreSet_changed
(
void
);
void recursiveConstructTreeView
(
xercesc::DOMElement * el,
Gtk::Expander * seed,
int depth
);
void configureEncapsultedBox
(
Gtk::Box * b
);
void configureExpander
(
Gtk::Expander * e
);
void configureEventLabel
(
Gtk::EventBox * evLabel,
Gtk::Label * label
);
void configureLabel
(
Gtk::Label * l
);
void finishEncapsulation
(
Gtk::Box * root,
Gtk::Expander * node
);
void finishEncapsulation
(
Gtk::Box * root,
Gtk::EventBox * evLabel
);
void constructEditableNode
(
xercesc::DOMElement * el
);
void on_openExpander_changed
(
Gtk::Expander * exp
);
bool on_enter_label
(
GdkEventCrossing*,
Gtk::EventBox *evLabel
);
bool on_leave_label
(
GdkEventCrossing*,
Gtk::EventBox *evLabel
);
bool on_press_label
(
GdkEventButton* event,
Gtk::EventBox *evLabel,
Gtk::Label * txtLabel
);
void configureNodeAttributesTreeview
(
xercesc::DOMNamedNodeMap *dom_attrs,
Gtk::Box * nodebox
);
void configureNodeChildrenTreeview
(
xercesc::DOMElement * children,
Gtk::Box * nodebox
);
void configureNodeText
(
std::string nodetext,
Gtk::Box * nodebox
);
void configureNodeAttributeEditionButtonsTreeview
(
Gtk::Box * nodebox,
Glib::RefPtr<Gtk::ListStore> attributeStore
);
void configureNodeEditionButtonsTreeview
(
Gtk::Box * nodebox,
Glib::RefPtr<Gtk::ListStore> nodeStore
);
void on_attribute_changed
(
Gtk::Box * attributeValueBox,
Gtk::Box * attributeSampleBox
);
void addNodeAttribute // virtual
(
Glib::RefPtr<Gtk::ListStore> metadataStore
);
void removeNodeAttribute // virtual
(
Glib::RefPtr<Gtk::ListStore> metadataStore
);
void addNode // virtual
(
Glib::RefPtr<Gtk::ListStore> metadataStore
);
void removeNode // virtual
(
Glib::RefPtr<Gtk::ListStore> metadataStore
);
void on_addAttribute_assistant_apply
(
Glib::RefPtr<Gtk::ListStore> metadataStore
);
void on_assistant_cancel
(
void
);
void on_assistant_close
(
void
);
void on_addNodeText_assistant
(
Gtk::Box * text,
Gtk::Box * children
);
void on_addNode_assistant_apply
(
Glib::RefPtr<Gtk::ListStore> metadataStore
);
};
#endif