Some checks failed
dev release / build (push) Failing after 12s
Builds out the full v1 scope: a vendored+patched openscreen subset for low-latency Cast Streaming (Mirroring receiver 0F5096E8) alongside the existing Cast V2/HLS and new DLNA/AVTransport casting paths, breadcastd's Idle/Casting state machine with a private IPC socket, the breadcast GTK4 popup as a thin IPC client, and bread.cast.*/bread.command.cast.* breadd integration (device discovery, start/stop, mirroring lifecycle events). Also adds bakery/systemd/Forgejo CI packaging. Validated end-to-end against a real Chromecast/Google TV: negotiated Cast Streaming session, live pipeline playback, and daemon+GUI click-to-cast/ stop through the actual popup.
117 lines
2.9 KiB
C++
117 lines
2.9 KiB
C++
// Copyright 2020 The Chromium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef CAST_STREAMING_PUBLIC_RECEIVER_MESSAGE_H_
|
|
#define CAST_STREAMING_PUBLIC_RECEIVER_MESSAGE_H_
|
|
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <variant>
|
|
#include <vector>
|
|
|
|
#include "cast/streaming/public/answer_messages.h"
|
|
#include "json/value.h"
|
|
#include "util/osp_logging.h"
|
|
|
|
namespace openscreen::cast {
|
|
|
|
enum class MediaCapability {
|
|
kAudio,
|
|
kAac,
|
|
kOpus,
|
|
kVideo,
|
|
k4k,
|
|
kH264,
|
|
kVp8,
|
|
kVp9,
|
|
kHevc,
|
|
kAv1
|
|
};
|
|
|
|
struct ReceiverCapability {
|
|
static constexpr int kRemotingVersionUnknown = -1;
|
|
|
|
Json::Value ToJson() const;
|
|
static ErrorOr<ReceiverCapability> Parse(const Json::Value& value);
|
|
|
|
// The remoting version that the receiver uses.
|
|
int remoting_version = kRemotingVersionUnknown;
|
|
|
|
// Set of capabilities (e.g., ac3, 4k, hevc, vp9, dolby_vision, etc.).
|
|
std::vector<MediaCapability> media_capabilities;
|
|
};
|
|
|
|
// To avoid collisions with legacy error values, all Open Screen receiver errors
|
|
// are offset.
|
|
struct ReceiverError {
|
|
explicit ReceiverError(int code, std::string_view description = "");
|
|
explicit ReceiverError(Error::Code code, std::string_view description = "");
|
|
explicit ReceiverError(const Error& error);
|
|
|
|
ReceiverError(const ReceiverError&);
|
|
ReceiverError(ReceiverError&&) noexcept;
|
|
ReceiverError& operator=(const ReceiverError&);
|
|
ReceiverError& operator=(ReceiverError&&);
|
|
~ReceiverError();
|
|
|
|
Json::Value ToJson() const;
|
|
static ErrorOr<ReceiverError> Parse(const Json::Value& value);
|
|
Error ToError() const;
|
|
|
|
// All Open Screen errors are offset by a fixed value to avoid overlapping
|
|
// with legacy values.
|
|
static constexpr int kOpenscreenErrorOffset = 10000;
|
|
|
|
// Raw error code.
|
|
int32_t code = -1;
|
|
|
|
// Parsed openscreen::Error code. May be nullopt if not a match.
|
|
std::optional<Error::Code> openscreen_code;
|
|
|
|
// Error description.
|
|
std::string description;
|
|
};
|
|
|
|
struct ReceiverMessage {
|
|
public:
|
|
// Receiver response message type.
|
|
enum class Type {
|
|
// Unknown message type.
|
|
kUnknown,
|
|
|
|
// Response to OFFER message.
|
|
kAnswer,
|
|
|
|
// Response to GET_CAPABILITIES message.
|
|
kCapabilitiesResponse,
|
|
|
|
// Rpc binary messages. The payload is base64-encoded.
|
|
kRpc,
|
|
|
|
// Input-related binary messages. The payload is base64-encoded.
|
|
kInput,
|
|
};
|
|
|
|
static ErrorOr<ReceiverMessage> Parse(const Json::Value& value);
|
|
ErrorOr<Json::Value> ToJson() const;
|
|
|
|
Type type = Type::kUnknown;
|
|
|
|
int32_t sequence_number = -1;
|
|
|
|
bool valid = false;
|
|
|
|
std::variant<std::monostate,
|
|
Answer,
|
|
std::vector<uint8_t>, // Binary-encoded protobuf message.
|
|
ReceiverCapability,
|
|
ReceiverError>
|
|
body;
|
|
};
|
|
|
|
} // namespace openscreen::cast
|
|
|
|
#endif // CAST_STREAMING_PUBLIC_RECEIVER_MESSAGE_H_
|