Refactored namespaces
This commit is contained in:
@@ -31,10 +31,10 @@ extern "C"
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "utils/ILogger.hpp"
|
||||
#include "utils/String.hpp"
|
||||
#include "core/ILogger.hpp"
|
||||
#include "core/String.hpp"
|
||||
|
||||
namespace Av
|
||||
namespace lms::av
|
||||
{
|
||||
namespace
|
||||
{
|
||||
@@ -48,11 +48,11 @@ namespace Av
|
||||
return "Unknown error";
|
||||
}
|
||||
|
||||
class AudioFileException : public Av::Exception
|
||||
class AudioFileException : public Exception
|
||||
{
|
||||
public:
|
||||
AudioFileException(int avError)
|
||||
: Av::Exception{ "AudioFileException: " + averror_to_string(avError) }
|
||||
: Exception{ "AudioFileException: " + averror_to_string(avError) }
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Av
|
||||
AVDictionaryEntry* tag = NULL;
|
||||
while ((tag = ::av_dict_get(dictionnary, "", tag, AV_DICT_IGNORE_SUFFIX)))
|
||||
{
|
||||
res[StringUtils::stringToUpper(tag->key)] = tag->value;
|
||||
res[core::stringUtils::stringToUpper(tag->key)] = tag->value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,10 +320,10 @@ namespace Av
|
||||
{".mka", "audio/x-matroska"},
|
||||
};
|
||||
|
||||
auto it{ entries.find(StringUtils::stringToLower(fileExtension.string())) };
|
||||
auto it{ entries.find(core::stringUtils::stringToLower(fileExtension.string())) };
|
||||
if (it == std::cend(entries))
|
||||
return "";
|
||||
|
||||
return it->second;
|
||||
}
|
||||
} // namespace Av
|
||||
} // namespace lms::av
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
struct AVFormatContext;
|
||||
|
||||
namespace Av
|
||||
namespace lms::av
|
||||
{
|
||||
|
||||
class AudioFile final : public IAudioFile
|
||||
@@ -53,5 +53,5 @@ namespace Av
|
||||
AVFormatContext* _context{};
|
||||
};
|
||||
|
||||
} // namespace Av
|
||||
} // namespace lms::av
|
||||
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
#include "av/RawResourceHandlerCreator.hpp"
|
||||
|
||||
#include "av/IAudioFile.hpp"
|
||||
#include "utils/FileResourceHandlerCreator.hpp"
|
||||
#include "core/FileResourceHandlerCreator.hpp"
|
||||
|
||||
namespace Av
|
||||
namespace lms::av
|
||||
{
|
||||
std::unique_ptr<IResourceHandler> createRawResourceHandler(const std::filesystem::path& path)
|
||||
{
|
||||
std::string_view mimeType{ Av::getMimeType(path.extension()) };
|
||||
std::string_view mimeType{ getMimeType(path.extension()) };
|
||||
return createFileResourceHandler(path, mimeType.empty() ? "application/octet-stream" : mimeType);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@
|
||||
#include <atomic>
|
||||
#include <iomanip>
|
||||
|
||||
#include "utils/IChildProcessManager.hpp"
|
||||
#include "utils/IConfig.hpp"
|
||||
#include "utils/Path.hpp"
|
||||
#include "utils/ILogger.hpp"
|
||||
#include "utils/Service.hpp"
|
||||
#include "core/IChildProcessManager.hpp"
|
||||
#include "core/IConfig.hpp"
|
||||
#include "core/Path.hpp"
|
||||
#include "core/ILogger.hpp"
|
||||
#include "core/Service.hpp"
|
||||
|
||||
namespace Av::Transcoding
|
||||
namespace lms::av::transcoding
|
||||
{
|
||||
|
||||
#define LOG(severity, message) LMS_LOG(TRANSCODING, severity, "[" << _debugId << "] - " << message)
|
||||
@@ -52,7 +52,7 @@ namespace Av::Transcoding
|
||||
|
||||
void Transcoder::init()
|
||||
{
|
||||
ffmpegPath = Service<IConfig>::get()->getPath("ffmpeg-file", "/usr/bin/ffmpeg");
|
||||
ffmpegPath = core::Service<core::IConfig>::get()->getPath("ffmpeg-file", "/usr/bin/ffmpeg");
|
||||
if (!std::filesystem::exists(ffmpegPath))
|
||||
throw Exception{ "File '" + ffmpegPath.string() + "' does not exist!" };
|
||||
}
|
||||
@@ -183,9 +183,9 @@ namespace Av::Transcoding
|
||||
// Caution: stdin must have been closed before
|
||||
try
|
||||
{
|
||||
_childProcess = Service<IChildProcessManager>::get()->spawnChildProcess(ffmpegPath, args);
|
||||
_childProcess = core::Service<core::IChildProcessManager>::get()->spawnChildProcess(ffmpegPath, args);
|
||||
}
|
||||
catch (ChildProcessException& exception)
|
||||
catch (core::ChildProcessException& exception)
|
||||
{
|
||||
throw Exception{ "Cannot execute '" + ffmpegPath.string() + "': " + exception.what() };
|
||||
}
|
||||
@@ -195,7 +195,7 @@ namespace Av::Transcoding
|
||||
{
|
||||
assert(_childProcess);
|
||||
|
||||
return _childProcess->asyncRead(buffer, bufferSize, [readCallback{ std::move(readCallback) }](IChildProcess::ReadResult /*res*/, std::size_t nbBytesRead)
|
||||
return _childProcess->asyncRead(buffer, bufferSize, [readCallback{ std::move(readCallback) }](core::IChildProcess::ReadResult /*res*/, std::size_t nbBytesRead)
|
||||
{
|
||||
readCallback(nbBytesRead);
|
||||
});
|
||||
@@ -215,4 +215,4 @@ namespace Av::Transcoding
|
||||
return _childProcess->finished();
|
||||
}
|
||||
|
||||
} // namespace Av::Transcoding
|
||||
} // namespace lms::av::Transcoding
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
#include "av/TranscodingParameters.hpp"
|
||||
#include "av/Types.hpp"
|
||||
|
||||
class IChildProcess;
|
||||
namespace lms::core
|
||||
{
|
||||
class IChildProcess;
|
||||
}
|
||||
|
||||
namespace Av::Transcoding
|
||||
namespace lms::av::transcoding
|
||||
{
|
||||
class Transcoder
|
||||
{
|
||||
@@ -60,7 +63,6 @@ namespace Av::Transcoding
|
||||
const OutputParameters _outputParameters;
|
||||
std::string _outputMimeType;
|
||||
|
||||
std::unique_ptr<IChildProcess> _childProcess;
|
||||
std::unique_ptr<core::IChildProcess> _childProcess;
|
||||
};
|
||||
|
||||
} // namespace Av::Transcoding
|
||||
}
|
||||
@@ -18,9 +18,9 @@
|
||||
*/
|
||||
|
||||
#include "TranscodingResourceHandler.hpp"
|
||||
#include "utils/ILogger.hpp"
|
||||
#include "core/ILogger.hpp"
|
||||
|
||||
namespace Av::Transcoding
|
||||
namespace lms::av::transcoding
|
||||
{
|
||||
namespace
|
||||
{
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
#include <optional>
|
||||
|
||||
#include "av/TranscodingParameters.hpp"
|
||||
#include "utils/IResourceHandler.hpp"
|
||||
#include "core/IResourceHandler.hpp"
|
||||
#include "Transcoder.hpp"
|
||||
|
||||
namespace Av::Transcoding
|
||||
namespace lms::av::transcoding
|
||||
{
|
||||
class TranscodingResourceHandler final : public IResourceHandler
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user