1/*
2 * Copyright (c) 1999-2000, Eric Moon.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions, and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions, and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * 3. The name of the author may not be used to endorse or promote products
17 *    derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
27 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31
32// route_app_io.h
33// * PURPOSE
34//   Central definitions of constants used to import/export
35//   XML-formatted data in Cortex.
36//
37// * HISTORY
38//   e.moon		8dec99		Begun
39
40#ifndef __route_app_io_h__
41#define __route_app_io_h__
42
43#include "ImportContext.h"
44#include "ExportContext.h"
45#include "XML.h"
46
47#include <MediaDefs.h>
48#include <String.h>
49
50#include "cortex_defs.h"
51__BEGIN_CORTEX_NAMESPACE
52
53class NodeManager;
54class NodeSetIOContext;
55
56// IPersistent elements
57extern const char* const _DORMANT_NODE_ELEMENT;
58extern const char* const _LIVE_NODE_ELEMENT;
59extern const char* const _CONNECTION_ELEMENT;
60
61extern const char* const _NODE_GROUP_ELEMENT;
62
63// simple string-content elements
64extern const char* const _NAME_ELEMENT;
65extern const char* const _FLAG_ELEMENT;
66extern const char* const _KIND_ELEMENT;
67extern const char* const _FLAVOR_ID_ELEMENT;
68extern const char* const _CYCLE_ELEMENT;
69extern const char* const _RUN_MODE_ELEMENT;
70extern const char* const _TIME_SOURCE_ELEMENT;
71extern const char* const _RECORDING_DELAY_ELEMENT;
72extern const char* const _REF_ELEMENT;
73
74// intermediate elements
75extern const char* const _OUTPUT_ELEMENT;
76extern const char* const _INPUT_ELEMENT;
77extern const char* const _NODE_SET_ELEMENT;
78extern const char* const _UI_STATE_ELEMENT;
79
80// system-defined node keys
81extern const char* const _AUDIO_INPUT_KEY;
82extern const char* const _AUDIO_OUTPUT_KEY;
83extern const char* const _AUDIO_MIXER_KEY;
84extern const char* const _VIDEO_INPUT_KEY;
85extern const char* const _VIDEO_OUTPUT_KEY;
86
87// helper functions
88
89void _write_simple(
90	const char* element,
91	const char* value,
92	ExportContext& context);
93
94void _write_node_kinds(
95	int64 kinds,
96	ExportContext& context);
97
98void _read_node_kind(
99	int64& ioKind,
100	const char* data,
101	ImportContext& context);
102
103// fills in either key or outName/kind for the provided
104// node.  If the given node is one of the default system nodes,
105// an appropriate 'preset' key value will be returned.
106
107status_t _get_node_signature(
108	const NodeManager*			manager,
109	const NodeSetIOContext*	context,
110	media_node_id						node,
111	BString&								outKey,
112	BString&								outName,
113	int64&									outKind);
114
115// given a name and kind, looks for a matching node
116
117status_t _match_node_signature(
118	const char*							name,
119	int64										kind,
120	media_node_id*					outNode);
121
122// given a key, looks for a system-default node
123
124status_t _match_system_node_key(
125	const char*							key,
126	const NodeManager*			manager,
127	media_node_id*					outNode);
128
129// adds mappings for the simple string-content elements to the
130// given document type
131
132void _add_string_elements(
133	XML::DocumentType*			docType);
134
135__END_CORTEX_NAMESPACE
136#endif /*__route_app_io_h__*/
137
138