Factorized some container/codec handling code + removed the no longer needed transcode output formats mka and webm
This commit is contained in:
@@ -13,6 +13,10 @@ configure_file(
|
||||
add_library(lmscore STATIC
|
||||
impl/http/Client.cpp
|
||||
impl/http/SendQueue.cpp
|
||||
impl/media/CodecType.cpp
|
||||
impl/media/ContainerType.cpp
|
||||
impl/media/ImageType.cpp
|
||||
impl/media/MimeType.cpp
|
||||
impl/ArchiveZipper.cpp
|
||||
impl/ChildProcess.cpp
|
||||
impl/ChildProcessManager.cpp
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "core/media/CodecType.hpp"
|
||||
|
||||
namespace lms::core::media
|
||||
{
|
||||
core::LiteralString codecTypeToString(CodecType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CodecType::AAC:
|
||||
return "AAC";
|
||||
case CodecType::AC3:
|
||||
return "AC3";
|
||||
case CodecType::ALAC:
|
||||
return "ALAC";
|
||||
case CodecType::APE:
|
||||
return "APE";
|
||||
case CodecType::DSD:
|
||||
return "DSD";
|
||||
case CodecType::EAC3:
|
||||
return "E-AC3";
|
||||
case CodecType::FLAC:
|
||||
return "FLAC";
|
||||
case CodecType::MP3:
|
||||
return "MP3";
|
||||
case CodecType::MP4ALS:
|
||||
return "MP4ALS";
|
||||
case CodecType::MPC7:
|
||||
return "MPC7";
|
||||
case CodecType::MPC8:
|
||||
return "MPC8";
|
||||
case CodecType::Opus:
|
||||
return "Opus";
|
||||
case CodecType::PCM:
|
||||
return "PCM";
|
||||
case CodecType::Shorten:
|
||||
return "Shorten";
|
||||
case CodecType::TrueAudio:
|
||||
return "TrueAudio";
|
||||
case CodecType::Vorbis:
|
||||
return "Vorbis";
|
||||
case CodecType::WavPack:
|
||||
return "WavPack";
|
||||
case CodecType::WMA1:
|
||||
return "WMA1";
|
||||
case CodecType::WMA2:
|
||||
return "WMA2";
|
||||
case CodecType::WMA9Pro:
|
||||
return "WMA9Pro";
|
||||
case CodecType::WMA9Lossless:
|
||||
return "WMA9Lossless";
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
} // namespace lms::core::media
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "core/media/ContainerType.hpp"
|
||||
|
||||
namespace lms::core::media
|
||||
{
|
||||
core::LiteralString containerTypeToString(ContainerType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ContainerType::AIFF:
|
||||
return "AIFF";
|
||||
case ContainerType::APE:
|
||||
return "APE";
|
||||
case ContainerType::ASF:
|
||||
return "ASF";
|
||||
case ContainerType::DSF:
|
||||
return "DSF";
|
||||
case ContainerType::FLAC:
|
||||
return "FLAC";
|
||||
case ContainerType::MP4:
|
||||
return "MP4";
|
||||
case ContainerType::MPC:
|
||||
return "MPC";
|
||||
case ContainerType::MPEG:
|
||||
return "MPEG";
|
||||
case ContainerType::Ogg:
|
||||
return "Ogg";
|
||||
case ContainerType::Shorten:
|
||||
return "Shorten";
|
||||
case ContainerType::TrueAudio:
|
||||
return "TrueAudio";
|
||||
case ContainerType::WAV:
|
||||
return "WAV";
|
||||
case ContainerType::WavPack:
|
||||
return "WavPack";
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
} // namespace lms::core::media
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "core/media/ImageType.hpp"
|
||||
|
||||
namespace lms::core::media
|
||||
{
|
||||
core::LiteralString imageTypeToString(ImageType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ImageType::Other:
|
||||
return "Other";
|
||||
case ImageType::FileIcon:
|
||||
return "FileIcon";
|
||||
case ImageType::OtherFileIcon:
|
||||
return "OtherFileIcon";
|
||||
case ImageType::FrontCover:
|
||||
return "FrontCover";
|
||||
case ImageType::BackCover:
|
||||
return "BackCover";
|
||||
case ImageType::LeafletPage:
|
||||
return "LeafletPage";
|
||||
case ImageType::Media:
|
||||
return "Media";
|
||||
case ImageType::LeadArtist:
|
||||
return "LeadArtist";
|
||||
case ImageType::Artist:
|
||||
return "Artist";
|
||||
case ImageType::Conductor:
|
||||
return "Conductor";
|
||||
case ImageType::Band:
|
||||
return "Band";
|
||||
case ImageType::Composer:
|
||||
return "Composer";
|
||||
case ImageType::Lyricist:
|
||||
return "Lyricist";
|
||||
case ImageType::RecordingLocation:
|
||||
return "RecordingLocation";
|
||||
case ImageType::DuringRecording:
|
||||
return "DuringRecording";
|
||||
case ImageType::DuringPerformance:
|
||||
return "DuringPerformance";
|
||||
case ImageType::MovieScreenCapture:
|
||||
return "MovieScreenCapture";
|
||||
case ImageType::ColouredFish:
|
||||
return "ColouredFish";
|
||||
case ImageType::Illustration:
|
||||
return "Illustration";
|
||||
case ImageType::BandLogo:
|
||||
return "BandLogo";
|
||||
case ImageType::PublisherLogo:
|
||||
return "PublisherLogo";
|
||||
case ImageType::Unknown:
|
||||
break;
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
} // namespace lms::core::media
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "core/media/MimeType.hpp"
|
||||
|
||||
namespace lms::core::media
|
||||
{
|
||||
core::LiteralString getMimeType(ContainerType container, CodecType codec)
|
||||
{
|
||||
switch (container)
|
||||
{
|
||||
case ContainerType::AIFF:
|
||||
return "audio/x-aiff";
|
||||
case ContainerType::APE:
|
||||
return "audio/x-monkeys-audio";
|
||||
case ContainerType::ASF:
|
||||
return "audio/x-ms-wma";
|
||||
case ContainerType::DSF:
|
||||
return "audio/x-dsd-dsf";
|
||||
case ContainerType::FLAC:
|
||||
return "audio/flac";
|
||||
case ContainerType::MP4:
|
||||
switch (codec)
|
||||
{
|
||||
case CodecType::AAC:
|
||||
return "audio/mp4; codecs=\"mp4a.40.2\"";
|
||||
case CodecType::ALAC:
|
||||
return "audio/mp4; codecs=\"alac\"";
|
||||
case CodecType::MP4ALS:
|
||||
return "audio/mp4; codecs=\"mp4als\"";
|
||||
default:
|
||||
return "audio/mp4";
|
||||
}
|
||||
|
||||
case ContainerType::MPC:
|
||||
return "audio/x-musepack";
|
||||
case ContainerType::MPEG:
|
||||
return "audio/mpeg";
|
||||
case ContainerType::Ogg:
|
||||
switch (codec)
|
||||
{
|
||||
case CodecType::Opus:
|
||||
return "audio/opus";
|
||||
case CodecType::Vorbis:
|
||||
return "audio/ogg; codecs=\"vorbis\"";
|
||||
case CodecType::FLAC:
|
||||
return "audio/ogg; codecs=\"flac\"";
|
||||
default:
|
||||
return "audio/ogg";
|
||||
}
|
||||
|
||||
case ContainerType::Shorten:
|
||||
return "audio/x-shn";
|
||||
case ContainerType::TrueAudio:
|
||||
return "audio/x-tta";
|
||||
case ContainerType::WAV:
|
||||
return "audio/wav";
|
||||
case ContainerType::WavPack:
|
||||
return "audio/x-wavpack";
|
||||
}
|
||||
|
||||
return "application/octet-stream";
|
||||
}
|
||||
} // namespace lms::core::media
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/LiteralString.hpp"
|
||||
|
||||
namespace lms::core::media
|
||||
{
|
||||
enum class CodecType
|
||||
{
|
||||
AAC,
|
||||
AC3,
|
||||
ALAC, // Apple Lossless Audio Codec (ALAC)
|
||||
APE, // Monkey's Audio
|
||||
DSD, // DSD
|
||||
EAC3,
|
||||
FLAC, // Flac
|
||||
MP3,
|
||||
MP4ALS, // MPEG-4 Audio Lossless Coding
|
||||
MPC7, // Musepack
|
||||
MPC8, // Musepack
|
||||
Opus, // Opus
|
||||
PCM,
|
||||
Shorten, // Shorten (shn)
|
||||
TrueAudio,
|
||||
Vorbis,
|
||||
WavPack, // WavPack
|
||||
WMA1,
|
||||
WMA2,
|
||||
WMA9Pro,
|
||||
WMA9Lossless,
|
||||
};
|
||||
|
||||
core::LiteralString codecTypeToString(CodecType type);
|
||||
} // namespace lms::core::media
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/LiteralString.hpp"
|
||||
|
||||
namespace lms::core::media
|
||||
{
|
||||
enum class ContainerType
|
||||
{
|
||||
AIFF,
|
||||
APE, // Monkey's Audio
|
||||
ASF, // Advanced Systems Format
|
||||
DSF,
|
||||
FLAC,
|
||||
MP4,
|
||||
MPC, // Musepack
|
||||
MPEG,
|
||||
Ogg,
|
||||
Shorten,
|
||||
TrueAudio,
|
||||
WAV,
|
||||
WavPack,
|
||||
};
|
||||
|
||||
core::LiteralString containerTypeToString(ContainerType type);
|
||||
} // namespace lms::core::media
|
||||
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/LiteralString.hpp"
|
||||
|
||||
namespace lms::core::media
|
||||
{
|
||||
// Based on ID3v2 APIC types
|
||||
enum class ImageType
|
||||
{
|
||||
// No information
|
||||
Unknown,
|
||||
// A type not enumerated below
|
||||
Other,
|
||||
// 32x32 PNG image that should be used as the file icon
|
||||
FileIcon,
|
||||
// File icon of a different size or format
|
||||
OtherFileIcon,
|
||||
// Front cover image of the album
|
||||
FrontCover,
|
||||
// Back cover image of the album
|
||||
BackCover,
|
||||
// Inside leaflet page of the album
|
||||
LeafletPage,
|
||||
// Image from the album itself
|
||||
Media,
|
||||
// Picture of the lead artist or soloist
|
||||
LeadArtist,
|
||||
// Picture of the artist or performer
|
||||
Artist,
|
||||
// Picture of the conductor
|
||||
Conductor,
|
||||
// Picture of the band or orchestra
|
||||
Band,
|
||||
// Picture of the composer
|
||||
Composer,
|
||||
// Picture of the lyricist or text writer
|
||||
Lyricist,
|
||||
// Picture of the recording location or studio
|
||||
RecordingLocation,
|
||||
// Picture of the artists during recording
|
||||
DuringRecording,
|
||||
// Picture of the artists during performance
|
||||
DuringPerformance,
|
||||
// Picture from a movie or video related to the track
|
||||
MovieScreenCapture,
|
||||
// Picture of a large, coloured fish
|
||||
ColouredFish,
|
||||
// Illustration related to the track
|
||||
Illustration,
|
||||
// Logo of the band or performer
|
||||
BandLogo,
|
||||
// Logo of the publisher (record company)
|
||||
PublisherLogo
|
||||
};
|
||||
|
||||
core::LiteralString imageTypeToString(ImageType type);
|
||||
} // namespace lms::core::media
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/LiteralString.hpp"
|
||||
#include "core/media/CodecType.hpp"
|
||||
#include "core/media/ContainerType.hpp"
|
||||
|
||||
namespace lms::core::media
|
||||
{
|
||||
core::LiteralString getMimeType(ContainerType container, CodecType codec);
|
||||
}
|
||||
Reference in New Issue
Block a user