// sbstreamer.h -- HTTP request broker that serves the FLAC stream to Sonos // // Copyright (c) 2026 Jaap van Vliet // // Original implementation for the YeneY project. // SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0 // Licensed under the PolyForm Noncommercial License 1.0.0. See LICENSE. // // THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. #ifndef SBSTREAMER_H #define SBSTREAMER_H #include "upnp/stream_server.h" #include #include #define SBSTREAMER_CNAME "squeezebox" #define SBSTREAMER_URI "/music/yeney.flac" namespace bridge { // Registers "/music/yeney.flac" as a Sonos-facing HTTP resource and // serves the live FLAC-encoded PCM the core feeder hands to encode_squeezebox_audio(). class SBStreamer { public: SBStreamer() = default; void registerWith(upnp::StreamServer& server); bool HandleRequest(upnp::StreamRequest* handle); void Abort() { aborted = true; } bool IsAborted() const { return aborted.load(); } private: std::atomic aborted{false}; void streamSqueezeBox(upnp::StreamRequest* handle, int stream, unsigned long long requestId); }; } // namespace bridge #endif