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

Unified Diff: services/media/framework/refs.h

Issue 1678433002: Motown: Remove LPCM optimizations, fix prepare, add flush, add ActiveMultistreamSink model/stage (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: services/media/framework/refs.h
diff --git a/services/media/framework/refs.h b/services/media/framework/refs.h
new file mode 100644
index 0000000000000000000000000000000000000000..f725ad3614665a642b72217a592062a4e16239c1
--- /dev/null
+++ b/services/media/framework/refs.h
@@ -0,0 +1,123 @@
+// 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_REFS_H_
+#define SERVICES_MEDIA_FRAMEWORK_REFS_H_
+
+#include <stdint.h>
+
+namespace mojo {
+namespace media {
+
+class Graph;
+class Stage;
+class Input;
+class Output;
+class Engine;
+class InputRef;
+class OutputRef;
+
+// Opaque Stage pointer used for graph building.
+class PartRef {
+ public:
+ PartRef() : stage_(nullptr) {}
+
+ size_t input_count() const;
+ InputRef input(size_t index) const;
+ InputRef input() const;
+ size_t output_count() const;
+ OutputRef output(size_t index) const;
+ OutputRef output() const;
+
+ private:
+ explicit PartRef(Stage* stage) : stage_(stage) {}
+
+ explicit operator bool() const { return stage_ != nullptr; }
+
+ bool valid() const { return stage_ != nullptr; }
johngro 2016/02/08 22:33:36 why make valid() (and its operator bool form) priv
dalesat 2016/02/09 00:34:11 The operator should be public...did that. I don't
+
+ Stage* stage_;
+
+ friend Graph;
+ friend InputRef;
+ friend OutputRef;
+ friend Engine;
+};
+
+// Opaque Input pointer used for graph building.
+class InputRef {
+ public:
+ InputRef() : stage_(nullptr), index_(0) {}
+
+ InputRef& operator=(std::nullptr_t) {
+ stage_ = nullptr;
+ index_ = 0;
+ return *this;
+ }
+
+ explicit operator bool() const { return stage_ != nullptr; }
johngro 2016/02/08 22:33:36 Note; everything here applies to OutputRef as well
dalesat 2016/02/09 00:34:11 The operator is essentially a null check while val
+
+ PartRef part() const { return PartRef(stage_); }
+
+ bool connected() const;
+
+ const OutputRef& mate() const;
+
+ private:
+ InputRef(Stage* stage, size_t index);
+
+ Input& actual() const;
+
+ bool valid() const;
+
+ Stage* stage_;
+ size_t index_;
+
+ friend Graph;
+ friend PartRef;
+ friend OutputRef;
+ friend Output;
+ friend Engine;
+};
+
+// Opaque Output pointer used for graph building.
+class OutputRef {
+ public:
+ OutputRef() : stage_(nullptr), index_(0) {}
+
+ OutputRef& operator=(std::nullptr_t) {
+ stage_ = nullptr;
+ index_ = 0;
+ return *this;
+ }
+
+ explicit operator bool() const { return stage_ != nullptr; }
+
+ PartRef part() const { return PartRef(stage_); }
+
+ bool connected() const;
+
+ const InputRef& mate() const;
+
+ private:
+ OutputRef(Stage* stage, size_t index);
+
+ Output& actual() const;
+
+ bool valid() const;
+
+ Stage* stage_;
+ size_t index_;
+
+ friend Graph;
+ friend PartRef;
+ friend InputRef;
+ friend Input;
+ friend Engine;
+};
+
+} // namespace media
+} // namespace mojo
+
+#endif // SERVICES_MEDIA_FRAMEWORK_REFS_H_

Powered by Google App Engine
This is Rietveld 408576698