/*
* Copyright (C) 2025 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see .
*/
#pragma once
#include
#include
#include "core/LiteralString.hpp"
#include "audio/AudioProperties.hpp"
#include "audio/TranscodeTypes.hpp"
#include "payloads/StreamDetails.hpp"
namespace lms::api::subsonic
{
struct ClientInfo;
namespace details
{
enum class TranscodeReason
{
AudioCodecNotSupported,
AudioBitrateNotSupported,
AudioChannelsNotSupported,
AudioSampleRateNotSupported,
AudioBitdepthNotSupported,
ContainerNotSupported,
ProtocolNotSupported
};
core::LiteralString transcodeReasonToString(TranscodeReason reason);
struct DirectPlayResult
{
bool operator==(const DirectPlayResult&) const = default;
};
struct TranscodeResult
{
std::vector reasons;
StreamDetails targetStreamInfo;
bool operator==(const TranscodeResult&) const = default;
};
struct FailureResult
{
std::string reason;
bool operator==(const FailureResult&) const = default;
};
using TranscodeDecisionResult = std::variant;
TranscodeDecisionResult computeTranscodeDecision(const ClientInfo& clientInfo, const audio::AudioProperties& source);
const audio::TranscodeOutputFormat* selectTranscodeOutputFormat(std::string_view containerName, std::string_view codecName);
} // namespace details
} // namespace lms::api::subsonic