| Index: services/media/framework/stages/lpcm_stage_input.h
|
| diff --git a/services/media/framework/stages/lpcm_stage_input.h b/services/media/framework/stages/lpcm_stage_input.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a84064b8d18f64a2c8857013158dbca9f33ffd7e
|
| --- /dev/null
|
| +++ b/services/media/framework/stages/lpcm_stage_input.h
|
| @@ -0,0 +1,77 @@
|
| +// 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_LPCM_STAGE_INPUT_H_
|
| +#define SERVICES_MEDIA_FRAMEWORK_ENGINE_LPCM_STAGE_INPUT_H_
|
| +
|
| +#include "services/media/framework/lpcm_util.h"
|
| +#include "services/media/framework/models/demand.h"
|
| +#include "services/media/framework/stages/lpcm_demand.h"
|
| +#include "services/media/framework/stages/stage_input.h"
|
| +
|
| +namespace mojo {
|
| +namespace media {
|
| +
|
| +class LpcmStageOutput;
|
| +
|
| +// Represents a stage's connector to an adjacent upstream stage.
|
| +class LpcmStageInput : public StageInput {
|
| + public:
|
| + LpcmStageInput();
|
| +
|
| + ~LpcmStageInput();
|
| +
|
| + // Sets the stream type.
|
| + void set_stream_type(LpcmStreamType& stream_type) {
|
| + lpcm_demand_.frames_.bytes_per_frame_ = stream_type.bytes_per_frame();
|
| + lpcm_util_.reset(LpcmUtil::Create(stream_type));
|
| + }
|
| +
|
| + // Whether demanded frames have been supplied.
|
| + bool frames_supplied() const { return frames_supplied_; }
|
| +
|
| + // Whether we've reached end of stream.
|
| + bool end_of_stream() const { return end_of_stream_; }
|
| +
|
| + // Updates mate's demand. Called only by Stage::Update implementations.
|
| + // Callers need to check frames_supplied after calling this method, because
|
| + // the stage isn't pushed to the supply backlog in that case.
|
| + void set_lpcm_demand(
|
| + void* buffer,
|
| + uint64_t frames,
|
| + bool mix,
|
| + Engine& engine);
|
| +
|
| + // Indicates demanded frames were supplied. Called only by LpcmStageOutput
|
| + // instances.
|
| + bool supply_frames_internal(bool end_of_stream) {
|
| + frames_supplied_ = true;
|
| + end_of_stream_ = end_of_stream;
|
| + return true;
|
| + }
|
| +
|
| + // StageInput overrides.
|
| + bool update_packet_internal(PacketPtr packet) override;
|
| +
|
| + LpcmStageInput* get_lpcm() override;
|
| +
|
| + private:
|
| + // Copies or mixes frames from packet_from_upstream() to the demand buffer.
|
| + bool SupplyFramesFromPacket();
|
| +
|
| + bool frames_supplied_;
|
| + bool end_of_stream_;
|
| +
|
| + std::unique_ptr<LpcmUtil> lpcm_util_;
|
| +
|
| + // Fields below are used when the connected output isn't lpcm.
|
| + LpcmDemand lpcm_demand_;
|
| + void* remaining_packet_buffer_;
|
| + uint64_t remaining_packet_frames_;
|
| +};
|
| +
|
| +} // namespace media
|
| +} // namespace mojo
|
| +
|
| +#endif // SERVICES_MEDIA_FRAMEWORK_ENGINE_LPCM_STAGE_INPUT_H_
|
|
|