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

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: removed build/util/LASTCHANGE 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..57bbe69abd2c2e72a05dc2a86f07e57cc6d0e7ee
--- /dev/null
+++ b/services/media/framework/stages/stage.h
@@ -0,0 +1,180 @@
+// 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:
+ 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.
+ using UpdateCallback = std::function<void(Stage* stage)>;
+ virtual bool Prepare(UpdateCallback update_callback);
+
+ // Performs processing.
+ virtual void Update(Engine& engine) = 0;
+
+ class EnginePrivate {
+ public:
+ EnginePrivate() :
+ in_supply_backlog_(false),
+ in_demand_backlog_(false),
+ prepared_(false) {}
+
+ private:
+ bool in_supply_backlog_;
+ bool in_demand_backlog_;
+ bool prepared_;
+
+ friend class Engine;
+ };
+
+ // Stage-related context for use by the engine.
+ EnginePrivate& engine_private() { return engine_private_; }
+
+ private:
+ EnginePrivate engine_private_;
+};
+
+// Stage with no inputs.
+class SourceStage : public virtual Stage {
+ public:
+ uint32_t input_count() const override;
+
+ StageInput& input(uint32_t index) override;
+};
+
+// Stage with no outputs.
+class SinkStage : public virtual Stage {
+ public:
+ uint32_t output_count() const override;
+
+ StageOutput& output(uint32_t index) override;
+};
+
+// Stage with one input.
+class SingleInputStage : public virtual Stage {
+ public:
+ uint32_t input_count() const override;
+
+ StageInput& input(uint32_t index) override;
+
+ protected:
+ StageInput input_;
+};
+
+// Stage with one output.
+class SingleOutputStage : public virtual Stage {
+ public:
+ uint32_t output_count() const override;
+
+ StageOutput& output(uint32_t index) override;
+
+ protected:
+ StageOutput output_;
+};
+
+// Stage with multiple inputs.
+class MultiInputStage : public virtual Stage {
+ public:
+ MultiInputStage();
+
+ ~MultiInputStage() override;
+
+ uint32_t input_count() const override;
+
+ StageInput& input(uint32_t index) override;
+
+ protected:
+ std::vector<StageInput> inputs_;
+};
+
+// Stage with multiple outputs.
+class MultiOutputStage : public virtual Stage {
+ public:
+ MultiOutputStage();
+
+ ~MultiOutputStage() override;
+
+ uint32_t output_count() const override;
+
+ StageOutput& output(uint32_t index) override;
+
+ protected:
+ std::vector<StageOutput> outputs_;
+};
+
+// LPCM stage with one input.
+class LpcmSingleInputStage : public virtual Stage {
+ public:
+ uint32_t input_count() const override;
+
+ StageInput& input(uint32_t index) override;
+
+ protected:
+ LpcmStageInput input_;
+};
+
+// LPCM stage with multiple inputs.
+class LpcmMultiInputStage : public virtual Stage {
+ public:
+ LpcmMultiInputStage();
+
+ ~LpcmMultiInputStage() override;
+
+ uint32_t input_count() const override;
+
+ StageInput& input(uint32_t index) override;
+
+ protected:
+ std::vector<LpcmStageInput> inputs_;
+};
+
+// LPCM stage with one output.
+class LpcmSingleOutputStage : public virtual Stage {
+ public:
+ uint32_t output_count() const override;
+
+ StageOutput& output(uint32_t index) override;
+
+ protected:
+ LpcmStageOutput output_;
+};
+
+} // namespace media
+} // namespace mojo
+
+#endif // SERVICES_MEDIA_FRAMEWORK_ENGINE_STAGE_H_

Powered by Google App Engine
This is Rietveld 408576698