| Index: services/media/framework/stages/output.h
|
| diff --git a/services/media/framework/stages/output.h b/services/media/framework/stages/output.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4cebeb57b7c75406154b39d9fb7ecc7e28d5c264
|
| --- /dev/null
|
| +++ b/services/media/framework/stages/output.h
|
| @@ -0,0 +1,68 @@
|
| +// 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_STAGES_OUTPUT_H_
|
| +#define SERVICES_MEDIA_FRAMEWORK_STAGES_OUTPUT_H_
|
| +
|
| +#include "services/media/framework/packet.h"
|
| +#include "services/media/framework/payload_allocator.h"
|
| +#include "services/media/framework/refs.h"
|
| +
|
| +namespace mojo {
|
| +namespace media {
|
| +
|
| +class Stage;
|
| +class Engine;
|
| +class Input;
|
| +
|
| +// Represents a stage's connector to an adjacent downstream stage.
|
| +class Output {
|
| + public:
|
| + Output();
|
| +
|
| + ~Output();
|
| +
|
| + // The input to which this output is connected.
|
| + const InputRef& mate() const { return mate_; }
|
| +
|
| + // Establishes a connection.
|
| + void Connect(const InputRef& input);
|
| +
|
| + // Breaks a connection. Called only by the engine.
|
| + void Disconnect() { mate_ = nullptr; }
|
| +
|
| + // Determines whether the output is connected to an input.
|
| + bool connected() const { return static_cast<bool>(mate_); }
|
| +
|
| + // The connected input.
|
| + Input& actual_mate() const;
|
| +
|
| + // Sets the allocator the output must use to copy the payload of output
|
| + // packets. This is used when the connected input insists that a specific
|
| + // allocator be used, but the stage can't use it.
|
| + void SetCopyAllocator(PayloadAllocator* copy_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 SupplyPacket(PacketPtr packet, Engine* engine) const;
|
| +
|
| + // Updates packet demand. Called only by Input instances.
|
| + bool UpdateDemandFromInput(Demand demand);
|
| +
|
| + // Flushes retained media.
|
| + void Flush();
|
| +
|
| + private:
|
| + InputRef mate_;
|
| + Demand demand_;
|
| + PayloadAllocator* copy_allocator_;
|
| +};
|
| +
|
| +} // namespace media
|
| +} // namespace mojo
|
| +
|
| +#endif // SERVICES_MEDIA_FRAMEWORK_STAGES_OUTPUT_H_
|
|
|