vfs: check userland buffers before reading them.
[haiku.git] / src / apps / cortex / support / MediaString.h
blob024375a93b6976b322f9c0cd6beb84ba46d24b0e
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 // MediaStrings.h (Cortex/Support)
34 // * PURPOSE
35 // Provide routines to translate MediaKit objects, values
36 // and constants into human-readable text
38 // * HISTORY
39 // c.lenz 2nov99 Begun
40 // c.lenz 11nov99 Format strings are now aware
41 // of wildcard-fields
42 // c.lenz 25dec99 Added functions to retrieve strings
43 // for single format fields
46 #ifndef __MediaString_H__
47 #define __MediaString_H__
49 // Interface Kit
50 #include <InterfaceDefs.h>
51 // Media Kit
52 #include <MediaDefs.h>
53 #include <MediaNode.h>
55 class BString;
57 #include "cortex_defs.h"
58 __BEGIN_CORTEX_NAMESPACE
60 class MediaString
63 public: // media_node strings
65 static BString getStringFor(
66 node_kind kinds,
67 bool complete = true);
68 static BString getStringFor(
69 BMediaNode::run_mode runMode,
70 bool complete = true);
72 public: // media_format strings
74 static BString getStringFor(
75 const media_format &format,
76 bool complete = true);
77 static BString getStringFor(
78 media_format_family family,
79 bool complete = true);
80 static BString getStringFor(
81 media_type type,
82 bool complete = true);
83 static BString getStringFor(
84 const media_multi_audio_format &format,
85 bool complete = true);
86 static BString getStringFor(
87 const media_raw_video_format &format,
88 bool complete = true);
89 static BString getStringFor(
90 const media_encoded_audio_format &format,
91 bool complete = true);
92 static BString getStringFor(
93 const media_encoded_video_format &format,
94 bool complete = true);
95 static BString getStringFor(
96 const media_multistream_format &format,
97 bool complete = true);
99 public: // media_source / media_destination strings
101 static BString getStringFor(
102 const media_source &source,
103 bool complete = true);
104 static BString getStringFor(
105 const media_destination &destination,
106 bool complete = true);
108 public: // strings for single fields in media_raw_audio_format
110 static BString forAudioFormat(
111 uint32 format,
112 int32 validBits);
113 static BString forAudioFrameRate(
114 float frameRate);
115 static BString forAudioChannelCount(
116 uint32 channelCount);
117 static BString forAudioByteOrder(
118 uint32 byteOrder);
119 static BString forAudioBufferSize(
120 size_t bufferSize);
121 static BString forAudioChannelMask(
122 uint32 channelMask);
123 static BString forAudioMatrixMask(
124 uint16 matrixMask);
126 public: // strings for single fields in media_encoded_audio_format
128 static BString forAudioBitRate(
129 float bitRate);
130 static BString forAudioFrameSize(
131 size_t frameSize);
133 public: // strings for single fields in media_raw_video_format
135 static BString forVideoFormat(
136 color_space format);
137 static BString forVideoFieldRate(
138 float fieldRate,
139 uint32 interlace);
140 static BString forVideoResolution(
141 uint32 lineWidth,
142 uint32 lineCount);
143 static BString forVideoAspectRatio(
144 uint16 pixelWidth,
145 uint16 pixelHeight);
146 static BString forVideoOrientation(
147 uint32 orientation);
148 static BString forVideoActiveLines(
149 uint32 firstActive,
150 uint32 lastActive);
151 static BString forVideoBytesPerRow(
152 uint32 bytesPerRow);
153 static BString forVideoOffset(
154 uint32 pixelOffset,
155 uint32 lineOffset);
157 public: // strings for single fields in media_encoded_video_format
159 static BString forVideoBitRate(
160 float avgBitRate,
161 float maxBitRate);
162 static BString forVideoFrameSize(
163 size_t frameSize);
164 static BString forVideoHistory(
165 int16 forwardHistory,
166 int16 backwardHistory);
168 public: // strings for single fields media_multistream_format
170 static BString forMultistreamFormat(
171 int32 format);
172 static BString forMultistreamBitRate(
173 float avgBitRate,
174 float maxBitRate);
175 static BString forMultistreamChunkSize(
176 uint32 avgChunkSize,
177 uint32 maxChunkSize);
178 static BString forMultistreamFlags(
179 uint32 flags);
182 __END_CORTEX_NAMESPACE
183 #endif /* __MediaStrings_H__ */