Chromium Code Reviews| Index: services/media/framework/stages/stage_output.h |
| diff --git a/services/media/framework/stages/stage_output.h b/services/media/framework/stages/stage_output.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0c023105c52336ac151104717c52d5c20632895b |
| --- /dev/null |
| +++ b/services/media/framework/stages/stage_output.h |
| @@ -0,0 +1,79 @@ |
| +// 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_OUTPUT_H_ |
| +#define SERVICES_MEDIA_FRAMEWORK_ENGINE_STAGE_OUTPUT_H_ |
| + |
| +#include "services/media/framework/allocator.h" |
| +#include "services/media/framework/packet.h" |
| + |
| +namespace mojo { |
| +namespace media { |
| + |
| +class Stage; |
| +class Engine; |
| +class StageInput; |
| +class LpcmStageOutput; |
| + |
| +// Represents a stage's connector to an adjacent downstream stage. |
| +class StageOutput { |
| + public: |
| + StageOutput(); |
| + |
| + ~StageOutput(); |
| + |
| + // The stage to which this output is connected. |
| + Stage* downstream_stage() const { return downstream_stage_; } |
| + |
| + // The index of the input to which this output is connected. |
| + uint32_t input_index() const { return input_index_; } |
| + |
| + // Establishes a connection. Called only by the engine. |
| + void connect(Stage* downstream_stage, uint32_t input_index) { |
| + downstream_stage_ = downstream_stage; |
| + input_index_ = input_index; |
| + } |
| + |
| + // Determines whether the output is connected to an input. |
| + bool connected() const { |
| + return downstream_stage_ != nullptr; |
| + } |
| + |
| + // The connected input. |
| + StageInput& mate() const; |
| + |
| + // Gets ready to move packets by negotiating the use of allocators. If the |
| + // downstream input provides an allocator, and we can use it, this method |
| + // returns the provided allocator. Otherwise, it returns nullptr. |
| + virtual Allocator* Prepare(bool can_accept_allocator); |
| + |
| + // Demand signalled from downstream, or kNegative if the downstream input |
| + // is currently holding a packet. |
| + Demand demand() const; |
| + |
| + // Supplies a packet to mate. Called only by Stage::Update implementations. |
| + void supply_packet(PacketPtr packet, Engine* engine) const; |
|
johngro
2016/01/26 23:47:30
this method is not a simple accessor, it takes act
dalesat
2016/01/28 18:49:17
Done.
|
| + |
| + // Updates packet demand. Called only by StageInput instances. |
| + bool update_demand_internal(Demand demand); |
| + |
| + // Returns the LPCM specialization if this instance is an LpcmStageOutput, |
| + // nullptr otherwise. |
| + virtual LpcmStageOutput* get_lpcm(); |
| + |
| + protected: |
| + void supply_packet_internal(PacketPtr packet, Engine* engine) const; |
|
johngro
2016/01/26 23:47:30
SupplyPacketInternal
dalesat
2016/01/28 18:49:16
Done.
|
| + |
| + Allocator* copy_allocator_; |
| + |
| + private: |
| + Stage* downstream_stage_; |
| + uint32_t input_index_; |
| + Demand demand_; |
| +}; |
| + |
| +} // namespace media |
| +} // namespace mojo |
| + |
| +#endif // SERVICES_MEDIA_FRAMEWORK_ENGINE_STAGE_OUTPUT_H_ |