xref: /haiku/src/apps/cortex/support/MediaString.h (revision d3d8b26997fac34a84981e6d2b649521de2cc45a)
1 // MediaStrings.h (Cortex/Support)
2 //
3 // * PURPOSE
4 //   Provide routines to translate MediaKit objects, values
5 //   and constants into human-readable text
6 //
7 // * HISTORY
8 //   c.lenz		2nov99			Begun
9 //	 c.lenz		11nov99			Format strings are now aware
10 //								of wildcard-fields
11 //	 c.lenz		25dec99			Added functions to retrieve strings
12 //								for single format fields
13 //
14 
15 #ifndef __MediaString_H__
16 #define __MediaString_H__
17 
18 // Interface Kit
19 #include <InterfaceDefs.h>
20 // Media Kit
21 #include <MediaDefs.h>
22 #include <MediaNode.h>
23 
24 class BString;
25 
26 #include "cortex_defs.h"
27 __BEGIN_CORTEX_NAMESPACE
28 
29 class MediaString
30 {
31 
32 public:						// media_node strings
33 
34 	static BString			getStringFor(
35 								node_kind kinds,
36 								bool complete = true);
37 	static BString			getStringFor(
38 								BMediaNode::run_mode runMode,
39 								bool complete = true);
40 
41 public:						// media_format strings
42 
43 	static BString			getStringFor(
44 								const media_format &format,
45 								bool complete = true);
46 	static BString			getStringFor(
47 								media_format_family family,
48 								bool complete = true);
49 	static BString			getStringFor(
50 								media_type type,
51 								bool complete = true);
52 	static BString			getStringFor(
53 								const media_multi_audio_format &format,
54 								bool complete = true);
55 	static BString			getStringFor(
56 								const media_raw_video_format &format,
57 								bool complete = true);
58 	static BString			getStringFor(
59 								const media_encoded_audio_format &format,
60 								bool complete = true);
61 	static BString			getStringFor(
62 								const media_encoded_video_format &format,
63 								bool complete = true);
64 	static BString			getStringFor(
65 								const media_multistream_format &format,
66 								bool complete = true);
67 
68 public:						// media_source / media_destination strings
69 
70 	static BString			getStringFor(
71 								const media_source &source,
72 								bool complete = true);
73 	static BString			getStringFor(
74 								const media_destination &destination,
75 								bool complete = true);
76 
77 public:						// strings for single fields in media_raw_audio_format
78 
79 	static BString			forAudioFormat(
80 								uint32 format,
81 								int32 validBits);
82 	static BString			forAudioFrameRate(
83 								float frameRate);
84 	static BString			forAudioChannelCount(
85 								uint32 channelCount);
86 	static BString			forAudioByteOrder(
87 								uint32 byteOrder);
88 	static BString			forAudioBufferSize(
89 								size_t bufferSize);
90 	static BString			forAudioChannelMask(
91 								uint32 channelMask);
92 	static BString			forAudioMatrixMask(
93 								uint16 matrixMask);
94 
95 public:						// strings for single fields in media_encoded_audio_format
96 
97 	static BString			forAudioBitRate(
98 								float bitRate);
99 	static BString			forAudioFrameSize(
100 								size_t frameSize);
101 
102 public:						// strings for single fields in media_raw_video_format
103 
104 	static BString			forVideoFormat(
105 								color_space format);
106 	static BString			forVideoFieldRate(
107 								float fieldRate,
108 								uint32 interlace);
109 	static BString			forVideoResolution(
110 								uint32 lineWidth,
111 								uint32 lineCount);
112 	static BString			forVideoAspectRatio(
113 								uint16 pixelWidth,
114 								uint16 pixelHeight);
115 	static BString			forVideoOrientation(
116 								uint32 orientation);
117 	static BString			forVideoActiveLines(
118 								uint32 firstActive,
119 								uint32 lastActive);
120 	static BString			forVideoBytesPerRow(
121 								uint32 bytesPerRow);
122 	static BString			forVideoOffset(
123 								uint32 pixelOffset,
124 								uint32 lineOffset);
125 
126 public:						// strings for single fields in media_encoded_video_format
127 
128 	static BString			forVideoBitRate(
129 								float avgBitRate,
130 								float maxBitRate);
131 	static BString			forVideoFrameSize(
132 								size_t frameSize);
133 	static BString			forVideoHistory(
134 								int16 forwardHistory,
135 								int16 backwardHistory);
136 
137 public:						// strings for single fields media_multistream_format
138 
139 	static BString			forMultistreamFormat(
140 								int32 format);
141 	static BString			forMultistreamBitRate(
142 								float avgBitRate,
143 								float maxBitRate);
144 	static BString			forMultistreamChunkSize(
145 								uint32 avgChunkSize,
146 								uint32 maxChunkSize);
147 	static BString			forMultistreamFlags(
148 								uint32 flags);
149 };
150 
151 __END_CORTEX_NAMESPACE
152 #endif /* __MediaStrings_H__ */
153