#include "components/cast_streaming/browser/cast_message_port_impl.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/values.h"
#include "components/cast_streaming/browser/cast_message_port_converter.h"
#include "components/cast_streaming/common/message_serialization.h"
#include "third_party/openscreen/src/platform/base/error.h"
namespace cast_streaming {
namespace {
const char kKeyMediaSessionId[] = …;
const char kKeyPlaybackRate[] = …;
const char kKeyPlayerState[] = …;
const char kKeyCurrentTime[] = …;
const char kKeySupportedMediaCommands[] = …;
const char kKeyDisableStreamGrouping[] = …;
const char kKeyMedia[] = …;
const char kKeyContentId[] = …;
const char kKeyStreamType[] = …;
const char kKeyContentType[] = …;
const char kValuePlaying[] = …;
const char kValueLive[] = …;
const char kValueVideoWebm[] = …;
base::Value::Dict GetMediaCurrentStatusValue() { … }
class CastMessagePortConverterImpl : public CastMessagePortConverter { … };
}
std::unique_ptr<CastMessagePortConverter> CastMessagePortConverter::Create(
ReceiverSession::MessagePortProvider message_port_provider,
base::OnceClosure on_close) { … }
CastMessagePortImpl::CastMessagePortImpl(
std::unique_ptr<cast_api_bindings::MessagePort> message_port,
base::OnceClosure on_close)
: … { … }
CastMessagePortImpl::~CastMessagePortImpl() = default;
void CastMessagePortImpl::MaybeClose() { … }
void CastMessagePortImpl::SetClient(
openscreen::cast::MessagePort::Client& client) { … }
void CastMessagePortImpl::ResetClient() { … }
void CastMessagePortImpl::SendInjectResponse(const std::string& sender_id,
const std::string& message) { … }
void CastMessagePortImpl::HandleMediaMessage(const std::string& sender_id,
const std::string& message) { … }
void CastMessagePortImpl::PostMessage(const std::string& sender_id,
const std::string& message_namespace,
const std::string& message) { … }
bool CastMessagePortImpl::OnMessage(
std::string_view message,
std::vector<std::unique_ptr<cast_api_bindings::MessagePort>> ports) { … }
void CastMessagePortImpl::OnPipeError() { … }
}