Added a new transcoding mode: transcode if and only if the format is not handled by the browser. Made the subsonic API configurable again in conf file. Moved the subsonic's artist list mode in the per-user settings page. fixes #46
This commit is contained in:
@@ -104,35 +104,35 @@ Transcoder::start()
|
||||
args.emplace_back(std::to_string(_parameters.bitrate));
|
||||
|
||||
// Codecs and formats
|
||||
switch (_parameters.encoding)
|
||||
switch (_parameters.format)
|
||||
{
|
||||
case Encoding::MP3:
|
||||
case Format::MP3:
|
||||
args.emplace_back("-f");
|
||||
args.emplace_back("mp3");
|
||||
break;
|
||||
|
||||
case Encoding::OGG_OPUS:
|
||||
case Format::OGG_OPUS:
|
||||
args.emplace_back("-acodec");
|
||||
args.emplace_back("libopus");
|
||||
args.emplace_back("-f");
|
||||
args.emplace_back("ogg");
|
||||
break;
|
||||
|
||||
case Encoding::MATROSKA_OPUS:
|
||||
case Format::MATROSKA_OPUS:
|
||||
args.emplace_back("-acodec");
|
||||
args.emplace_back("libopus");
|
||||
args.emplace_back("-f");
|
||||
args.emplace_back("matroska");
|
||||
break;
|
||||
|
||||
case Encoding::OGG_VORBIS:
|
||||
case Format::OGG_VORBIS:
|
||||
args.emplace_back("-acodec");
|
||||
args.emplace_back("libvorbis");
|
||||
args.emplace_back("-f");
|
||||
args.emplace_back("ogg");
|
||||
break;
|
||||
|
||||
case Encoding::WEBM_VORBIS:
|
||||
case Format::WEBM_VORBIS:
|
||||
args.emplace_back("-acodec");
|
||||
args.emplace_back("libvorbis");
|
||||
args.emplace_back("-f");
|
||||
@@ -143,7 +143,7 @@ Transcoder::start()
|
||||
return false;
|
||||
}
|
||||
|
||||
_outputMimeType = encodingToMimetype(_parameters.encoding);
|
||||
_outputMimeType = formatToMimetype(_parameters.format);
|
||||
|
||||
args.emplace_back("pipe:1");
|
||||
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
|
||||
namespace Av {
|
||||
|
||||
const char* encodingToMimetype(Encoding encoding)
|
||||
const char* formatToMimetype(Format format)
|
||||
{
|
||||
switch (encoding)
|
||||
switch (format)
|
||||
{
|
||||
case Encoding::MP3: return "audio/mpeg";
|
||||
case Encoding::OGG_OPUS: return "audio/opus";
|
||||
case Encoding::MATROSKA_OPUS: return "audio/x-matroska";
|
||||
case Encoding::OGG_VORBIS: return "audio/ogg";
|
||||
case Encoding::WEBM_VORBIS: return "audio/webm";
|
||||
case Format::MP3: return "audio/mpeg";
|
||||
case Format::OGG_OPUS: return "audio/opus";
|
||||
case Format::MATROSKA_OPUS: return "audio/x-matroska";
|
||||
case Format::OGG_VORBIS: return "audio/ogg";
|
||||
case Format::WEBM_VORBIS: return "audio/webm";
|
||||
}
|
||||
|
||||
throw AvException {"Invalid encoding"};
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Av {
|
||||
|
||||
struct TranscodeParameters
|
||||
{
|
||||
Encoding encoding;
|
||||
Format format;
|
||||
std::size_t bitrate {128000};
|
||||
std::optional<std::size_t> stream; // Id of the stream to be transcoded (auto detect by default)
|
||||
std::optional<std::chrono::seconds> offset;
|
||||
|
||||
@@ -31,17 +31,17 @@ class AvException : public LmsException
|
||||
AvException(const std::string& msg) : LmsException(msg) {}
|
||||
};
|
||||
|
||||
enum class Encoding
|
||||
enum class Format
|
||||
{
|
||||
// Values are important and must not be changed
|
||||
MP3,
|
||||
OGG_OPUS,
|
||||
MATROSKA_OPUS,
|
||||
OGG_VORBIS,
|
||||
WEBM_VORBIS,
|
||||
MP3 = 0,
|
||||
OGG_OPUS = 1,
|
||||
MATROSKA_OPUS = 2,
|
||||
OGG_VORBIS = 3,
|
||||
WEBM_VORBIS = 4,
|
||||
};
|
||||
|
||||
const char* encodingToMimetype(Encoding encoding);
|
||||
const char* formatToMimetype(Format encoding);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user