35 lines
921 B
C++
35 lines
921 B
C++
#pragma once
|
|
|
|
#include "TrackSource.hpp"
|
|
|
|
namespace Echoion::Core
|
|
{
|
|
|
|
// Pass-through for URLs that already point at an audio stream (radio
|
|
// streams, .mp3/.ogg/.opus/.m3u8 files, icecast mounts). No network work
|
|
// at resolve time — ffmpeg opens the URL directly.
|
|
class DirectUrlSource : public ITrackSource
|
|
{
|
|
public:
|
|
|
|
[[nodiscard]] std::string_view name() const override
|
|
{
|
|
return "direct-url";
|
|
}
|
|
[[nodiscard]] bool canHandle(const std::string& query) const override;
|
|
[[nodiscard]] bool isAvailable() const override { return true; }
|
|
[[nodiscard]] bool supportsSearch() const override
|
|
{
|
|
return false;
|
|
}
|
|
|
|
Api::Result<Api::SearchResult>
|
|
search(std::string_view query) override;
|
|
Api::Result<Api::TrackInfo>
|
|
resolve(const std::string& urlOrId) override;
|
|
Api::Result<StreamHandle>
|
|
getStream(const Api::TrackInfo& track) override;
|
|
};
|
|
|
|
} // namespace Echoion::Core
|