xref: /haiku/src/apps/cortex/RouteApp/route_app_io.h (revision ba499cdc3336fb89429027418871bf263f1f5e14)
1 // route_app_io.h
2 // * PURPOSE
3 //   Central definitions of constants used to import/export
4 //   XML-formatted data in Cortex.
5 //
6 // * HISTORY
7 //   e.moon		8dec99		Begun
8 
9 #ifndef __route_app_io_h__
10 #define __route_app_io_h__
11 
12 #include "ImportContext.h"
13 #include "ExportContext.h"
14 #include "XML.h"
15 
16 #include <MediaDefs.h>
17 #include <String.h>
18 
19 #include "cortex_defs.h"
20 __BEGIN_CORTEX_NAMESPACE
21 
22 class NodeManager;
23 class NodeSetIOContext;
24 
25 // IPersistent elements
26 extern const char* const _DORMANT_NODE_ELEMENT;
27 extern const char* const _LIVE_NODE_ELEMENT;
28 extern const char* const _CONNECTION_ELEMENT;
29 
30 extern const char* const _NODE_GROUP_ELEMENT;
31 
32 // simple string-content elements
33 extern const char* const _NAME_ELEMENT;
34 extern const char* const _FLAG_ELEMENT;
35 extern const char* const _KIND_ELEMENT;
36 extern const char* const _FLAVOR_ID_ELEMENT;
37 extern const char* const _CYCLE_ELEMENT;
38 extern const char* const _RUN_MODE_ELEMENT;
39 extern const char* const _TIME_SOURCE_ELEMENT;
40 extern const char* const _RECORDING_DELAY_ELEMENT;
41 extern const char* const _REF_ELEMENT;
42 
43 // intermediate elements
44 extern const char* const _OUTPUT_ELEMENT;
45 extern const char* const _INPUT_ELEMENT;
46 extern const char* const _NODE_SET_ELEMENT;
47 extern const char* const _UI_STATE_ELEMENT;
48 
49 // system-defined node keys
50 extern const char* const _AUDIO_INPUT_KEY;
51 extern const char* const _AUDIO_OUTPUT_KEY;
52 extern const char* const _AUDIO_MIXER_KEY;
53 extern const char* const _VIDEO_INPUT_KEY;
54 extern const char* const _VIDEO_OUTPUT_KEY;
55 
56 // helper functions
57 
58 void _write_simple(
59 	const char* element,
60 	const char* value,
61 	ExportContext& context);
62 
63 void _write_node_kinds(
64 	int64 kinds,
65 	ExportContext& context);
66 
67 void _read_node_kind(
68 	int64& ioKind,
69 	const char* data,
70 	ImportContext& context);
71 
72 // fills in either key or outName/kind for the provided
73 // node.  If the given node is one of the default system nodes,
74 // an appropriate 'preset' key value will be returned.
75 
76 status_t _get_node_signature(
77 	const NodeManager*			manager,
78 	const NodeSetIOContext*	context,
79 	media_node_id						node,
80 	BString&								outKey,
81 	BString&								outName,
82 	int64&									outKind);
83 
84 // given a name and kind, looks for a matching node
85 
86 status_t _match_node_signature(
87 	const char*							name,
88 	int64										kind,
89 	media_node_id*					outNode);
90 
91 // given a key, looks for a system-default node
92 
93 status_t _match_system_node_key(
94 	const char*							key,
95 	const NodeManager*			manager,
96 	media_node_id*					outNode);
97 
98 // adds mappings for the simple string-content elements to the
99 // given document type
100 
101 void _add_string_elements(
102 	XML::DocumentType*			docType);
103 
104 __END_CORTEX_NAMESPACE
105 #endif /*__route_app_io_h__*/
106 
107