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

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 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/stages/packet_transform_stage.cc ('k') | services/media/framework/stages/stage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..20b21c4302c71afe8483a44071011af568c820dd
--- /dev/null
+++ b/services/media/framework/stages/stage.h
@@ -0,0 +1,72 @@
+// 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;
+
+ // 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.
+ // TODO(dalesat): Should this be const UpdateCallback&?
+ 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_
« no previous file with comments | « services/media/framework/stages/packet_transform_stage.cc ('k') | services/media/framework/stages/stage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698