Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: services/media/framework_mojo/mojo_formatting.cc

Issue 1692443002: Motown: Framework parts for mojo transport (producer/consumer/mediapipe) and control (audiotrack). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Added comments to AudioTrackController::SetRate regarding the proper way to implement it. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "services/media/framework_mojo/mojo_formatting.h"
6
7 namespace mojo {
8 namespace media {
9
10 template<typename T>
11 std::ostream& operator<<(std::ostream& os, const InterfacePtr<T>& value) {
12 if (!value.is_bound()) {
13 return os << "<not bound>" << std::endl;
14 } else {
15 return os << "<bound>" << std::endl;
16 }
17 }
18
19 std::ostream& operator<<(
20 std::ostream& os,
21 const MediaSourceStreamDescriptorPtr& value) {
22 if (!value) {
23 return os << "<nullptr>" << std::endl;
24 } else {
25 os << std::endl;
26 }
27
28 os << indent;
29 os << begl << "uint32_t index: " << int(value->index) << std::endl;
30 os << begl << "MediaTypePtr media_type: " << value->media_type;
31 os << begl << "MediaTypePtr original_media_type: " <<
32 value->original_media_type;
33 return os << outdent;
34 }
35
36 std::ostream& operator<<(std::ostream& os, const MediaTypePtr& value) {
37 if (!value) {
38 return os << "<nullptr>" << std::endl;
39 } else {
40 os << std::endl;
41 }
42
43 os << indent;
44 os << begl << "MediaTypeScheme scheme: " <<
45 StringFromMediaTypeScheme(value->scheme) << std::endl;
46 os << begl << "MediaTypeDetailsPtr details: " << value->details;
47 return os << outdent;
48 }
49
50 std::ostream& operator<<(std::ostream& os, const MediaTypeSetPtr& value) {
51 if (!value) {
52 return os << "<nullptr>" << std::endl;
53 } else {
54 os << std::endl;
55 }
56
57 os << indent;
58 os << begl << "MediaTypeScheme scheme: " <<
59 StringFromMediaTypeScheme(value->scheme) << std::endl;
60 os << begl << "MediaTypeSetDetailsPtr details: " << value->details;
61 return os << outdent;
62 }
63
64 std::ostream& operator<<(std::ostream& os, const MediaTypeDetailsPtr& value) {
65 if (!value) {
66 return os << "<nullptr>" << std::endl;
67 } else if (value->has_unknown_tag()) {
68 return os << "<empty>" << std::endl;
69 } else {
70 os << std::endl;
71 }
72
73 os << indent;
74 if (value->is_multiplexed()) {
75 return os << begl << "MultiplexedMediaTypeDetailsPtr* multiplexed: " <<
76 value->get_multiplexed() << outdent;
77 }
78 if (value->is_lpcm()) {
79 return os << begl << "LpcmMediaTypeDetailsPtr* lpcm: " <<
80 value->get_lpcm() << outdent;
81 }
82 if (value->is_compressed_audio()) {
83 return os << begl <<
84 "CompressedAudiomMediaTypeDetailsPtr* compressed_audio: " <<
85 value->get_compressed_audio() << outdent;
86 }
87 if (value->is_video()) {
88 return os << begl << "VideoMediaTypeDetailsPtr* video: " <<
89 value->get_video() << outdent;
90 }
91 return os << begl << "UNKNOWN TAG" << std::endl << outdent;
92 }
93
94 std::ostream& operator<<(
95 std::ostream& os,
96 const MediaTypeSetDetailsPtr& value) {
97 if (!value) {
98 return os << "<nullptr>" << std::endl;
99 } else if (value->has_unknown_tag()) {
100 return os << "<empty>" << std::endl;
101 } else {
102 os << std::endl;
103 }
104
105 os << indent;
106 if (value->is_multiplexed()) {
107 return os << begl << "MultiplexedMediaTypeSetDetailsPtr* multiplexed: " <<
108 value->get_multiplexed() << outdent;
109 }
110 if (value->is_lpcm()) {
111 return os << begl << "LpcmMediaTypeSetDetailsPtr* lpcm: " <<
112 value->get_lpcm() << outdent;
113 }
114 if (value->is_compressed_audio()) {
115 return os << begl <<
116 "CompressedAudioMediaTypeSetDetailsPtr* compressed_audio: " <<
117 value->get_compressed_audio() << outdent;
118 }
119 if (value->is_video()) {
120 return os << begl << "VideoMediaTypeSetDetailsPtr* video: " <<
121 value->get_video() << outdent;
122 }
123 return os << begl << "UNKNOWN TAG" << std::endl << outdent;
124 }
125
126 std::ostream& operator<<(
127 std::ostream& os,
128 const MultiplexedMediaTypeDetailsPtr& value) {
129 if (!value) {
130 return os << "<nullptr>" << std::endl;
131 } else {
132 os << std::endl;
133 }
134
135 os << indent;
136 os << begl << "MediaTypePtr multiplex_type: " << value->multiplex_type;
137 os << begl << "Array<MediaTypePtr> substream_types: " <<
138 value->substream_types;
139 return os << outdent;
140 }
141
142 std::ostream& operator<<(
143 std::ostream& os,
144 const MultiplexedMediaTypeSetDetailsPtr& value) {
145 if (!value) {
146 return os << "<nullptr>" << std::endl;
147 } else {
148 os << std::endl;
149 }
150
151 os << indent;
152 os << begl << "MediaTypeSetPtr multiplex_type_set: " <<
153 value->multiplex_type_set;
154 os << begl << "Array<MediaTypeSetPtr> substream_type_sets: " <<
155 value->substream_type_sets;
156 return os << outdent;
157 }
158
159 std::ostream& operator<<(
160 std::ostream& os,
161 const LpcmMediaTypeDetailsPtr& value) {
162 if (!value) {
163 return os << "<nullptr>" << std::endl;
164 } else {
165 os << std::endl;
166 }
167
168 os << indent;
169 os << begl << "LpcmSampleFormat sample_format: " <<
170 StringFromLpcmSampleFormat(value->sample_format) << std::endl;
171 os << begl << "uint32_t channels: " << int(value->channels) << std::endl;
172 os << begl << "uint32_t frames_per_second: " << value->frames_per_second <<
173 std::endl;
174 return os << outdent;
175 }
176
177 std::ostream& operator<<(
178 std::ostream& os,
179 const LpcmMediaTypeSetDetailsPtr& value) {
180 if (!value) {
181 return os << "<nullptr>" << std::endl;
182 } else {
183 os << std::endl;
184 }
185
186 os << indent;
187 os << begl << "LpcmSampleFormat sample_format: " <<
188 StringFromLpcmSampleFormat(value->sample_format) << std::endl;
189 os << begl << "uint32_t min_channels: " << int(value->min_channels) <<
190 std::endl;
191 os << begl << "uint32_t max_channels: " << int(value->max_channels) <<
192 std::endl;
193 os << begl << "uint32_t min_frames_per_second: " <<
194 value->min_frames_per_second << std::endl;
195 os << begl << "uint32_t max_cframes_per_second: " <<
196 value->max_frames_per_second << std::endl;
197 return os << outdent;
198 }
199
200 std::ostream& operator<<(
201 std::ostream& os,
202 const CompressedAudioMediaTypeDetailsPtr& value) {
203 if (!value) {
204 return os << "<nullptr>" << std::endl;
205 } else {
206 os << std::endl;
207 }
208
209 os << indent;
210 os << begl << "AudioEncoding encoding: " <<
211 StringFromAudioEncoding(value->encoding) << std::endl;
212 os << begl << "LpcmSampleFormat sample_format: " <<
213 StringFromLpcmSampleFormat(value->sample_format) << std::endl;
214 os << begl << "uint32_t channels: " << int(value->channels) << std::endl;
215 os << begl << "uint32_t frames_per_second: " << value->frames_per_second <<
216 std::endl;
217 return os << outdent;
218 }
219
220 std::ostream& operator<<(
221 std::ostream& os,
222 const CompressedAudioMediaTypeSetDetailsPtr& value) {
223 if (!value) {
224 return os << "<nullptr>" << std::endl;
225 } else {
226 os << std::endl;
227 }
228
229 os << indent;
230 os << begl << "AudioEncoding encoding: " <<
231 StringFromAudioEncoding(value->encoding) << std::endl;
232 os << begl << "LpcmSampleFormat sample_format: " <<
233 StringFromLpcmSampleFormat(value->sample_format) << std::endl;
234 os << begl << "uint32_t min_channels: " << int(value->min_channels) <<
235 std::endl;
236 os << begl << "uint32_t max_channels: " << int(value->max_channels) <<
237 std::endl;
238 os << begl << "uint32_t min_frames_per_second: " <<
239 value->min_frames_per_second << std::endl;
240 os << begl << "uint32_t max_cframes_per_second: " <<
241 value->max_frames_per_second << std::endl;
242 return os << outdent;
243 }
244
245 std::ostream& operator<<(
246 std::ostream& os,
247 const VideoMediaTypeDetailsPtr& value) {
248 if (!value) {
249 return os << "<nullptr>" << std::endl;
250 } else {
251 os << std::endl;
252 }
253
254 os << indent;
255 os << begl << "VideoEncoding encoding: " <<
256 StringFromVideoEncoding(value->encoding) << std::endl;
257 os << begl << "VideoProfile profile: " << value->profile << std::endl;
258 os << begl << "PixelFormat pixel_format: " <<
259 value->pixel_format << std::endl;
260 os << begl << "ColorSpace color_space: " << value->color_space << std::endl;
261 os << begl << "uint32_t width: " << value->width << std::endl;
262 os << begl << "uint32_t height: " << value->height << std::endl;
263 os << begl << "uint32_t coded_width: " << value->coded_width << std::endl;
264 os << begl << "uint32_t coded_height: " << value->coded_height << std::endl;
265 return os << outdent;
266 }
267
268 std::ostream& operator<<(
269 std::ostream& os,
270 const VideoMediaTypeSetDetailsPtr& value) {
271 if (!value) {
272 return os << "<nullptr>" << std::endl;
273 } else {
274 os << std::endl;
275 }
276
277 os << indent;
278 os << begl << "VideoEncoding encoding: " <<
279 StringFromVideoEncoding(value->encoding) << std::endl;
280 os << begl << "uint32_t min_width: " << value->min_width << std::endl;
281 os << begl << "uint32_t max_width: " << value->max_width << std::endl;
282 os << begl << "uint32_t min_height: " << value->min_height << std::endl;
283 os << begl << "uint32_t max_height: " << value->max_height << std::endl;
284 return os << outdent;
285 }
286
287 const char* StringFromMediaTypeScheme(MediaTypeScheme value) {
288 switch (value) {
289 case MediaTypeScheme::UNKNOWN:
290 return "UNKNOWN";
291 case MediaTypeScheme::NONE:
292 return "NONE";
293 case MediaTypeScheme::ANY_ELEMENTARY:
294 return "ANY_ELEMENTARY";
295 case MediaTypeScheme::ANY_AUDIO:
296 return "ANY_AUDIO";
297 case MediaTypeScheme::ANY_VIDEO:
298 return "ANY_VIDEO";
299 case MediaTypeScheme::ANY_TEXT:
300 return "ANY_TEXT";
301 case MediaTypeScheme::ANY_SUBPICTURE:
302 return "ANY_SUBPICTURE";
303 case MediaTypeScheme::ANY_MULTIPLEXED:
304 return "ANY_MULTIPLEXED";
305 case MediaTypeScheme::MULTIPLEXED:
306 return "MULTIPLEXED";
307 case MediaTypeScheme::ANY:
308 return "ANY";
309 case MediaTypeScheme::LPCM:
310 return "LPCM";
311 case MediaTypeScheme::COMPRESSED_AUDIO:
312 return "COMPRESSED_AUDIO";
313 case MediaTypeScheme::VIDEO:
314 return "VIDEO";
315 }
316 return "UNKNOWN SCHEME";
317 }
318
319 const char* StringFromLpcmSampleFormat(LpcmSampleFormat value) {
320 switch (value) {
321 case LpcmSampleFormat::UNKNOWN:
322 return "UNKNOWN";
323 case LpcmSampleFormat::ANY:
324 return "ANY";
325 case LpcmSampleFormat::UNSIGNED_8:
326 return "UNSIGNED_8";
327 case LpcmSampleFormat::SIGNED_16:
328 return "SIGNED_16";
329 case LpcmSampleFormat::SIGNED_24_IN_32:
330 return "SIGNED_24_IN_32";
331 case LpcmSampleFormat::FLOAT:
332 return "FLOAT";
333 }
334 return "UNKNOWN FORMAT";
335 }
336
337 const char* StringFromAudioEncoding(AudioEncoding value) {
338 switch (value) {
339 case AudioEncoding::UNKNOWN:
340 return "UNKNOWN";
341 case AudioEncoding::ANY:
342 return "ANY";
343 case AudioEncoding::VORBIS:
344 return "VORBIS";
345 }
346 return "UNKNOWN AUDIO ENCODING";
347 }
348
349 const char* StringFromVideoEncoding(VideoEncoding value) {
350 switch (value) {
351 case VideoEncoding::UNKNOWN:
352 return "UNKNOWN";
353 case VideoEncoding::ANY:
354 return "ANY";
355 case VideoEncoding::THEORA:
356 return "THEORA";
357 case VideoEncoding::VP8:
358 return "VP8";
359 }
360 return "UNKNOWN VIDEO ENCODING";
361 }
362
363 const char* StringFromMediaState(MediaState value) {
364 switch (value) {
365 case MediaState::FAULT:
366 return "FAULT";
367 case MediaState::UNPREPARED:
368 return "UNPREPARED";
369 case MediaState::PAUSED:
370 return "PAUSED";
371 case MediaState::PLAYING:
372 return "PLAYING";
373 case MediaState::ENDED:
374 return "ENDED";
375 }
376 return "UNKNOWN MEDIA STATE";
377 }
378
379 } // namespace media
380 } // namespace mojo
OLDNEW
« no previous file with comments | « services/media/framework_mojo/mojo_formatting.h ('k') | services/media/framework_mojo/mojo_producer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698