// Copyright 2020 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 CAST_STANDALONE_RECEIVER_MIRRORING_APPLICATION_H_ #define CAST_STANDALONE_RECEIVER_MIRRORING_APPLICATION_H_ #include #include #include #include "cast/receiver/application_agent.h" #include "cast/standalone_receiver/streaming_playback_controller.h" #include "platform/api/scoped_wake_lock.h" #include "platform/api/serial_delete_ptr.h" #include "platform/base/error.h" #include "platform/base/ip_address.h" namespace openscreen { class TaskRunner; namespace cast { class MessagePort; class ReceiverSession; // Implements a basic Cast V2 Mirroring Application which, at launch time, // bootstraps a ReceiverSession and StreamingPlaybackController, which set-up // and manage the media data streaming and play it out in an on-screen window. class MirroringApplication final : public ApplicationAgent::Application, public StreamingPlaybackController::Client { public: MirroringApplication(TaskRunner* task_runner, const IPAddress& interface_address, ApplicationAgent* agent); ~MirroringApplication() final; // ApplicationAgent::Application overrides. const std::vector& GetAppIds() const final; bool Launch(const std::string& app_id, const Json::Value& app_params, MessagePort* message_port) final; std::string GetSessionId() final; std::string GetDisplayName() final; std::vector GetSupportedNamespaces() final; void Stop() final; // StreamingPlaybackController::Client overrides void OnPlaybackError(StreamingPlaybackController* controller, Error error) final; private: TaskRunner* const task_runner_; const IPAddress interface_address_; const std::vector app_ids_; ApplicationAgent* const agent_; SerialDeletePtr wake_lock_; std::unique_ptr environment_; std::unique_ptr controller_; std::unique_ptr current_session_; }; } // namespace cast } // namespace openscreen #endif // CAST_STANDALONE_RECEIVER_MIRRORING_APPLICATION_H_