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

Side by Side Diff: services/media/framework/formatting.h

Issue 1577953002: Motown in-proc streaming framework used to implement media services. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: sync Created 4 years, 10 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
« no previous file with comments | « services/media/framework/engine.cc ('k') | services/media/framework/formatting.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_
6 #define SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_
7
8 #include <ostream>
9
10 #include "services/media/framework/models/demand.h"
11 #include "services/media/framework/packet.h"
12 #include "services/media/framework/result.h"
13 #include "services/media/framework/stream_type.h"
14
15 //
16 // This file declares a bunch of << operator overloads for dumping media stuff.
17 // Unless you want to add new operators, it's sufficient to know that you can
18 // just use the operators as expected, except that some of the overloads can
19 // produce multiple lines and therefore provide their own newlines.
20 //
21 // These operators are intended to be called after a label has been added to
22 // the stream with a trailing space. If the text generated by an operator is
23 // sufficiently short, the operator may add that text with no preamble and
24 // terminate it with std::endl. If the text has to be multiline, the operator
25 // first adds std::endl, then the multiline text with std::endl termination.
26 // Each line starts with begl in order to apply the appropriate indentation.
27 // The Indenter class is provided to adjust the identation level. Operators
28 // that take pointers need to handle nullptr.
29 //
30
31 namespace mojo {
32 namespace media {
33
34 int ostream_indent_index();
35
36 std::ostream& begl(std::ostream& os) {
37 for (int i = 0; i < os.iword(ostream_indent_index()); i++) {
38 os << " ";
39 }
40 return os;
41 }
42
43 inline std::ostream& indent(std::ostream& os) {
44 ++os.iword(ostream_indent_index());
45 return os;
46 }
47
48 inline std::ostream& outdent(std::ostream& os) {
49 --os.iword(ostream_indent_index());
50 return os;
51 }
52
53 // The following overloads don't add newlines.
54
55 std::ostream& operator<<(std::ostream& os, Result value);
56 std::ostream& operator<<(std::ostream& os, Demand value);
57 std::ostream& operator<<(std::ostream& os, const PacketPtr& value);
58 std::ostream& operator<<(std::ostream& os, StreamType::Scheme value);
59 std::ostream& operator<<(std::ostream& os, LpcmStreamType::SampleFormat value);
60 std::ostream& operator<<(
61 std::ostream& os,
62 CompressedAudioStreamType::AudioEncoding value);
63 std::ostream& operator<<(
64 std::ostream& os,
65 VideoStreamType::VideoEncoding value);
66 std::ostream& operator<<(std::ostream& os, VideoStreamType::VideoProfile value);
67 std::ostream& operator<<(std::ostream& os, VideoStreamType::PixelFormat value);
68 std::ostream& operator<<(std::ostream& os, VideoStreamType::ColorSpace value);
69 std::ostream& operator<<(std::ostream& os, const BytesPtr& value);
70
71 template<typename T>
72 std::ostream& operator<<(std::ostream& os, Range<T> value) {
73 return os << value.min << ".." << value.max;
74 }
75
76 std::ostream& operator<<(std::ostream& os, Range<bool> value);
77
78 // The following overloads add newlines.
79
80 std::ostream& operator<<(std::ostream& os, const StreamTypePtr& value);
81 std::ostream& operator<<(std::ostream& os, const StreamTypeSetPtr& value);
82 std::ostream& operator<<(std::ostream& os, const StreamTypesPtr& value);
83 std::ostream& operator<<(std::ostream& os, const StreamTypeSetsPtr& value);
84
85 } // namespace media
86 } // namespace mojo
87
88 #endif // SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_
OLDNEW
« no previous file with comments | « services/media/framework/engine.cc ('k') | services/media/framework/formatting.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698