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