Implement Cast Streaming mirroring, DLNA casting, daemon+GUI, and breadd integration
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.
This commit is contained in:
Breadway 2026-08-03 09:07:21 +08:00
parent 887c29002f
commit 8c745d18e0
283 changed files with 36788 additions and 0 deletions

View file

@ -0,0 +1,115 @@
// Copyright 2019 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_OFFER_MESSAGES_H_
#define CAST_STREAMING_PUBLIC_OFFER_MESSAGES_H_
#include <chrono>
#include <string>
#include <vector>
#include "cast/streaming/impl/rtp_defines.h"
#include "cast/streaming/message_fields.h"
#include "cast/streaming/public/session_config.h"
#include "cast/streaming/resolution.h"
#include "json/value.h"
#include "platform/base/error.h"
#include "util/simple_fraction.h"
// This file contains the implementation of the Cast V2 Mirroring Control
// Protocol offer object definition.
namespace openscreen::cast {
// If the target delay provided by the sender is not bounded by
// [kMinTargetDelay, kMaxTargetDelay], it will be set to
// kDefaultTargetPlayoutDelay.
inline constexpr auto kMinTargetPlayoutDelay = std::chrono::milliseconds(0);
inline constexpr auto kMaxTargetPlayoutDelay = std::chrono::milliseconds(5000);
// If the sender provides an invalid maximum frame rate, it ill
// be set to kDefaultMaxFrameRate.
inline constexpr int kDefaultMaxFrameRate = 30;
inline constexpr int kDefaultNumVideoChannels = 1;
inline constexpr int kDefaultNumAudioChannels = 2;
// A stream, as detailed by the CastV2 protocol spec, is a segment of an
// offer message specifically representing a configuration object for
// a codec and its related fields, such as maximum bit rate, time base,
// and other fields.
// Composed classes include AudioStream and VideoStream, which contain
// fields specific to audio and video respectively.
struct Stream {
enum class Type : uint8_t { kAudioSource, kVideoSource };
static ErrorOr<Stream> TryParse(const Json::Value& root, Stream::Type type);
Json::Value ToJson() const;
bool IsValid() const;
int index = 0;
Type type = {};
// Default channel count is 1, e.g. for video.
int channels = 0;
RtpPayloadType rtp_payload_type = {};
Ssrc ssrc = {};
std::chrono::milliseconds target_delay = {};
// AES Key and IV mask format is very strict: a 32 digit hex string that
// must be converted to a 16 digit byte array.
std::array<uint8_t, 16> aes_key = {};
std::array<uint8_t, 16> aes_iv_mask = {};
// The event logs are generally recommended for use in gathering statistics
// for the sender session.
bool receiver_rtcp_event_log = true;
std::optional<int> receiver_rtcp_dscp;
int rtp_timebase = 0;
// The codec parameter field honors the format laid out in RFC 6381:
// https://datatracker.ietf.org/doc/html/rfc6381.
std::string codec_parameter;
std::vector<std::string> rtp_extensions;
};
struct AudioStream {
static ErrorOr<AudioStream> TryParse(const Json::Value& root);
Json::Value ToJson() const;
bool IsValid() const;
Stream stream;
AudioCodec codec = AudioCodec::kNotSpecified;
int bit_rate = 0;
};
struct VideoStream {
static ErrorOr<VideoStream> TryParse(const Json::Value& root);
Json::Value ToJson() const;
bool IsValid() const;
Stream stream;
VideoCodec codec = VideoCodec::kNotSpecified;
SimpleFraction max_frame_rate;
int max_bit_rate = 0;
std::string protection;
std::string profile;
std::string level;
std::vector<Resolution> resolutions;
std::string error_recovery_mode;
};
struct Offer {
static ErrorOr<Offer> TryParse(const Json::Value& root);
Json::Value ToJson() const;
bool IsValid() const;
CastMode cast_mode = CastMode::kMirroring;
std::vector<AudioStream> audio_streams;
std::vector<VideoStream> video_streams;
};
} // namespace openscreen::cast
#endif // CAST_STREAMING_PUBLIC_OFFER_MESSAGES_H_