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

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

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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/media/framework/refs.h ('k') | services/media/framework/safe_clone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/media/framework/refs.cc
diff --git a/services/media/framework/refs.cc b/services/media/framework/refs.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c2670a2640407064152b253c7392369e685b897c
--- /dev/null
+++ b/services/media/framework/refs.cc
@@ -0,0 +1,97 @@
+// 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.
+
+#include "base/logging.h"
+#include "services/media/framework/refs.h"
+#include "services/media/framework/stages/input.h"
+#include "services/media/framework/stages/output.h"
+#include "services/media/framework/stages/stage.h"
+
+namespace mojo {
+namespace media {
+
+size_t PartRef::input_count() const {
+ DCHECK(valid());
+ return stage_->input_count();
+}
+
+InputRef PartRef::input(size_t index) const {
+ DCHECK(valid());
+ DCHECK(index < stage_->input_count());
+ return InputRef(stage_, index);
+}
+
+InputRef PartRef::input() const {
+ DCHECK(valid());
+ DCHECK(stage_->input_count() == 1);
+ return InputRef(stage_, 0);
+}
+
+size_t PartRef::output_count() const {
+ DCHECK(valid());
+ return stage_->output_count();
+}
+
+OutputRef PartRef::output(size_t index) const {
+ DCHECK(valid());
+ DCHECK(index < stage_->output_count());
+ return OutputRef(stage_, index);
+}
+
+OutputRef PartRef::output() const {
+ DCHECK(valid());
+ DCHECK(stage_->output_count() == 1);
+ return OutputRef(stage_, 0);
+}
+
+bool InputRef::connected() const {
+ DCHECK(valid());
+ return actual().connected();
+}
+
+const OutputRef& InputRef::mate() const {
+ DCHECK(valid());
+ return actual().mate();
+}
+
+InputRef::InputRef(Stage* stage, size_t index) :
+ stage_(stage), index_(index) {
+ DCHECK(valid());
+}
+
+Input& InputRef::actual() const {
+ DCHECK(valid());
+ return stage_->input(index_);
+}
+
+bool InputRef::valid() const {
+ return stage_ != nullptr && index_ < stage_->input_count();
+}
+
+bool OutputRef::connected() const {
+ DCHECK(valid());
+ return actual().connected();
+}
+
+const InputRef& OutputRef::mate() const {
+ DCHECK(valid());
+ return actual().mate();
+}
+
+OutputRef::OutputRef(Stage* stage, size_t index) :
+ stage_(stage), index_(index) {
+ DCHECK(valid());
+}
+
+Output& OutputRef::actual() const {
+ DCHECK(valid());
+ return stage_->output(index_);
+}
+
+bool OutputRef::valid() const {
+ return stage_ != nullptr && index_ < stage_->output_count();
+}
+
+} // namespace media
+} // namespace mojo
« no previous file with comments | « services/media/framework/refs.h ('k') | services/media/framework/safe_clone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698