2 * Copyright (c) 1999-2000, Eric Moon.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
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.
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.
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.
34 // Wrapper class for media_format, providing XML
35 // serialization support using the Cortex::XML package.
38 // - import & export user data?
39 // - import & export metadata?
42 // e.moon 1jul99 Begun.
44 #ifndef __MediaFormatIO_H__
45 #define __MediaFormatIO_H__
48 #include <MediaDefs.h>
51 #include "cortex_defs.h"
52 __BEGIN_CORTEX_NAMESPACE
57 public: // *** ctor/dtor
58 virtual ~MediaFormatIO();
61 MediaFormatIO(const media_format
& format
);
63 public: // *** accessors
64 // returns B_OK if the object contains a valid format,
66 status_t
getFormat(media_format
& outFormat
) const;
68 public: // *** static setup method
69 // call this method to install hooks for the tags needed by
70 // MediaFormatIO into the given document type
71 static void AddTo(XML::DocumentType
* pDocType
);
73 public: // *** top-level tags
75 // these tags map directly to MediaFormatIO
76 static const char* const s_multi_audio_tag
;
77 static const char* const s_raw_audio_tag
;
78 static const char* const s_raw_video_tag
;
79 static const char* const s_multistream_tag
;
80 static const char* const s_encoded_audio_tag
;
81 static const char* const s_encoded_video_tag
;
83 public: // *** nested tags
85 static const char* const s_video_display_info_tag
;
87 static const char* const s_multistream_flags_tag
;
88 static const char* const s_multistream_vid_info_tag
;
89 static const char* const s_multistream_avi_info_tag
;
91 static const char* const s_multi_audio_info_tag
;
93 static const char* const s_media_type_tag
;
95 public: // *** IPersistent
99 // ExportContext& context) const;
104 ExportContext
& context
) const;
106 void xmlExportAttributes(
107 ExportContext
& context
) const;
109 void xmlExportContent(
110 ExportContext
& context
) const;
113 ExportContext
& context
) const;
118 ImportContext
& context
);
120 void xmlImportAttribute(
123 ImportContext
& context
);
125 void xmlImportContent(
128 ImportContext
& context
);
132 ImportContext
& context
);
134 void xmlImportComplete(
135 ImportContext
& context
);
137 void xmlImportChildBegin(
139 ImportContext
& context
);
141 void xmlImportChildAttribute(
144 ImportContext
& context
);
146 void xmlImportChildContent(
149 ImportContext
& context
);
151 void xmlImportChildComplete(
153 ImportContext
& context
);
155 private: // *** state
157 media_format m_format
;
162 __END_CORTEX_NAMESPACE
163 #endif /*__MediaFormatIO_H__*/