libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / apps / cortex / Persistence / Wrappers / MediaFormatIO.h
blob626602b35e55446b176e75b11af75d23fa7754ad
1 /*
2 * Copyright (c) 1999-2000, Eric Moon.
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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.
32 // MediaFormatIO.h
33 // * PURPOSE
34 // Wrapper class for media_format, providing XML
35 // serialization support using the Cortex::XML package.
37 // * TO DO +++++
38 // - import & export user data?
39 // - import & export metadata?
41 // * HISTORY
42 // e.moon 1jul99 Begun.
44 #ifndef __MediaFormatIO_H__
45 #define __MediaFormatIO_H__
47 #include "XML.h"
48 #include <MediaDefs.h>
49 #include <String.h>
51 #include "cortex_defs.h"
52 __BEGIN_CORTEX_NAMESPACE
54 class MediaFormatIO :
55 public IPersistent {
57 public: // *** ctor/dtor
58 virtual ~MediaFormatIO();
60 MediaFormatIO();
61 MediaFormatIO(const media_format& format);
63 public: // *** accessors
64 // returns B_OK if the object contains a valid format,
65 // or B_ERROR if not.
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
97 // void xmlExport(
98 // ostream& stream,
99 // ExportContext& context) const;
101 // EXPORT:
103 void xmlExportBegin(
104 ExportContext& context) const;
106 void xmlExportAttributes(
107 ExportContext& context) const;
109 void xmlExportContent(
110 ExportContext& context) const;
112 void xmlExportEnd(
113 ExportContext& context) const;
115 // IMPORT
117 void xmlImportBegin(
118 ImportContext& context);
120 void xmlImportAttribute(
121 const char* key,
122 const char* value,
123 ImportContext& context);
125 void xmlImportContent(
126 const char* data,
127 uint32 length,
128 ImportContext& context);
130 void xmlImportChild(
131 IPersistent* child,
132 ImportContext& context);
134 void xmlImportComplete(
135 ImportContext& context);
137 void xmlImportChildBegin(
138 const char* name,
139 ImportContext& context);
141 void xmlImportChildAttribute(
142 const char* key,
143 const char* value,
144 ImportContext& context);
146 void xmlImportChildContent(
147 const char* data,
148 uint32 length,
149 ImportContext& context);
151 void xmlImportChildComplete(
152 const char* name,
153 ImportContext& context);
155 private: // *** state
156 bool m_complete;
157 media_format m_format;
159 BString m_mediaType;
162 __END_CORTEX_NAMESPACE
163 #endif /*__MediaFormatIO_H__*/