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

Unified Diff: services/media/framework/stages/stage.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, updates based on feedback, some functions declared const. 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
Index: services/media/framework/stages/stage.h
diff --git a/services/media/framework/stages/stage.h b/services/media/framework/stages/stage.h
new file mode 100644
index 0000000000000000000000000000000000000000..6088c98aa5f568018b8cb7640146ba75d45c43d0
--- /dev/null
+++ b/services/media/framework/stages/stage.h
@@ -0,0 +1,71 @@
+// 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_ENGINE_STAGE_H_
+#define SERVICES_MEDIA_FRAMEWORK_ENGINE_STAGE_H_
+
+#include <vector>
+
+#include "services/media/framework/packet.h"
+#include "services/media/framework/stages/lpcm_stage_input.h"
+#include "services/media/framework/stages/lpcm_stage_output.h"
+#include "services/media/framework/stages/stage_input.h"
+#include "services/media/framework/stages/stage_output.h"
+
+namespace mojo {
+namespace media {
+
+class Engine;
+
+// Host for a source, sink or transform.
+class Stage {
+ public:
+ using UpdateCallback = std::function<void(Stage* stage)>;
+
+ Stage();
+
+ virtual ~Stage();
+
+ // Returns the number of input connections.
+ virtual uint32_t input_count() const = 0;
jeffbrown 2016/02/02 05:35:48 Why virtual? Seems like something the base class
dalesat 2016/02/02 21:46:40 We should discuss. The reason I make this virtual
+
+ // Returns the indicated input connection.
+ virtual StageInput& input(uint32_t index) = 0;
+
+ // Returns the number of output connections.
+ virtual uint32_t output_count() const = 0;
+
+ // Returns the indicated output connection.
+ virtual StageOutput& output(uint32_t index) = 0;
+
+ // Prepares the stage for operation, providing a callback used to signal the
+ // need to update this stage. Returns true if the stage will call the
+ // callback, false if not. The default implementation of this method returns
+ // false.
+ virtual bool Prepare(UpdateCallback update_callback);
+
+ // Initiates demand. Called on sink stages after the graph is prepared. The
+ // default implementation does nothing.
+ virtual void Prime();
+
+ // Performs processing.
+ virtual void Update(Engine* engine) = 0;
+
+ // Returns a bool indicating whether the stage is prepared.
+ bool prepared() {
+ return prepared_;
+ }
+
+ private:
+ bool prepared_;
+ bool in_supply_backlog_;
+ bool in_demand_backlog_;
+
+ friend class Engine;
+};
+
+} // namespace media
+} // namespace mojo
+
+#endif // SERVICES_MEDIA_FRAMEWORK_ENGINE_STAGE_H_

Powered by Google App Engine
This is Rietveld 408576698