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

Unified 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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/media/framework/engine.cc ('k') | services/media/framework/formatting.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/media/framework/formatting.h
diff --git a/services/media/framework/formatting.h b/services/media/framework/formatting.h
new file mode 100644
index 0000000000000000000000000000000000000000..a455ae14c042d73edeb2d815dec52e4e7d1b2e90
--- /dev/null
+++ b/services/media/framework/formatting.h
@@ -0,0 +1,88 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_
+#define SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_
+
+#include <ostream>
+
+#include "services/media/framework/models/demand.h"
+#include "services/media/framework/packet.h"
+#include "services/media/framework/result.h"
+#include "services/media/framework/stream_type.h"
+
+//
+// This file declares a bunch of << operator overloads for dumping media stuff.
+// Unless you want to add new operators, it's sufficient to know that you can
+// just use the operators as expected, except that some of the overloads can
+// produce multiple lines and therefore provide their own newlines.
+//
+// These operators are intended to be called after a label has been added to
+// the stream with a trailing space. If the text generated by an operator is
+// sufficiently short, the operator may add that text with no preamble and
+// terminate it with std::endl. If the text has to be multiline, the operator
+// first adds std::endl, then the multiline text with std::endl termination.
+// Each line starts with begl in order to apply the appropriate indentation.
+// The Indenter class is provided to adjust the identation level. Operators
+// that take pointers need to handle nullptr.
+//
+
+namespace mojo {
+namespace media {
+
+int ostream_indent_index();
+
+std::ostream& begl(std::ostream& os) {
+ for (int i = 0; i < os.iword(ostream_indent_index()); i++) {
+ os << " ";
+ }
+ return os;
+}
+
+inline std::ostream& indent(std::ostream& os) {
+ ++os.iword(ostream_indent_index());
+ return os;
+}
+
+inline std::ostream& outdent(std::ostream& os) {
+ --os.iword(ostream_indent_index());
+ return os;
+}
+
+// The following overloads don't add newlines.
+
+std::ostream& operator<<(std::ostream& os, Result value);
+std::ostream& operator<<(std::ostream& os, Demand value);
+std::ostream& operator<<(std::ostream& os, const PacketPtr& value);
+std::ostream& operator<<(std::ostream& os, StreamType::Scheme value);
+std::ostream& operator<<(std::ostream& os, LpcmStreamType::SampleFormat value);
+std::ostream& operator<<(
+ std::ostream& os,
+ CompressedAudioStreamType::AudioEncoding value);
+std::ostream& operator<<(
+ std::ostream& os,
+ VideoStreamType::VideoEncoding value);
+std::ostream& operator<<(std::ostream& os, VideoStreamType::VideoProfile value);
+std::ostream& operator<<(std::ostream& os, VideoStreamType::PixelFormat value);
+std::ostream& operator<<(std::ostream& os, VideoStreamType::ColorSpace value);
+std::ostream& operator<<(std::ostream& os, const BytesPtr& value);
+
+template<typename T>
+std::ostream& operator<<(std::ostream& os, Range<T> value) {
+ return os << value.min << ".." << value.max;
+}
+
+std::ostream& operator<<(std::ostream& os, Range<bool> value);
+
+// The following overloads add newlines.
+
+std::ostream& operator<<(std::ostream& os, const StreamTypePtr& value);
+std::ostream& operator<<(std::ostream& os, const StreamTypeSetPtr& value);
+std::ostream& operator<<(std::ostream& os, const StreamTypesPtr& value);
+std::ostream& operator<<(std::ostream& os, const StreamTypeSetsPtr& value);
+
+} // namespace media
+} // namespace mojo
+
+#endif // SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_
« 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