diff --git a/src/libs/audio/impl/PcmTypes.cpp b/src/libs/audio/impl/PcmTypes.cpp
new file mode 100644
index 00000000..e0379efc
--- /dev/null
+++ b/src/libs/audio/impl/PcmTypes.cpp
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2026 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 .
+ */
+
+#include "audio/PcmTypes.hpp"
+#include "audio/Exception.hpp"
+
+namespace lms::audio
+{
+ std::size_t getSampleSize(PcmSampleType type)
+ {
+ switch (type)
+ {
+ case PcmSampleType::Signed16:
+ return 2;
+ case PcmSampleType::Signed32:
+ case PcmSampleType::Float32:
+ return 4;
+ case PcmSampleType::Float64:
+ return 8;
+ };
+
+ throw Exception{ "Unhandled sample type" };
+ }
+
+} // namespace lms::audio
\ No newline at end of file
diff --git a/src/libs/audio/impl/ffmpeg/PcmDecoder.cpp b/src/libs/audio/impl/ffmpeg/PcmDecoder.cpp
index 0fa8e312..32cd3b6a 100644
--- a/src/libs/audio/impl/ffmpeg/PcmDecoder.cpp
+++ b/src/libs/audio/impl/ffmpeg/PcmDecoder.cpp
@@ -167,6 +167,11 @@ namespace lms::audio::ffmpeg
PcmDecoder::~PcmDecoder() = default;
+ const PcmParameters& PcmDecoder::getParameters() const
+ {
+ return _parameters;
+ }
+
std::size_t PcmDecoder::readSamples(std::span outputChannelBuffers)
{
if (_finished)
diff --git a/src/libs/audio/impl/ffmpeg/PcmDecoder.hpp b/src/libs/audio/impl/ffmpeg/PcmDecoder.hpp
index 2f90bae4..8ad1a1d4 100644
--- a/src/libs/audio/impl/ffmpeg/PcmDecoder.hpp
+++ b/src/libs/audio/impl/ffmpeg/PcmDecoder.hpp
@@ -35,6 +35,8 @@ namespace lms::audio::ffmpeg
PcmDecoder& operator=(const PcmDecoder&) = delete;
private:
+ const PcmParameters& getParameters() const;
+
std::size_t readSamples(std::span outputChannelBuffers) override;
bool finished() const override;
diff --git a/src/libs/audio/include/audio/IPcmDecoder.hpp b/src/libs/audio/include/audio/IPcmDecoder.hpp
index 022ce23b..93e87521 100644
--- a/src/libs/audio/include/audio/IPcmDecoder.hpp
+++ b/src/libs/audio/include/audio/IPcmDecoder.hpp
@@ -35,6 +35,8 @@ namespace lms::audio
using WritableBuffer = std::span;
+ virtual const PcmParameters& getParameters() const = 0;
+
// Returns the number of samples written per channel. Returns 0 only once all remaining samples are drained.
// Provide one buffer per channel if planar, or a single buffer containing all channels interleaved
// Each buffer must be sized to hold an integer number of samples according to the requested sample type.
diff --git a/src/libs/audio/include/audio/PcmTypes.hpp b/src/libs/audio/include/audio/PcmTypes.hpp
index 3d60c6d6..90338db3 100644
--- a/src/libs/audio/include/audio/PcmTypes.hpp
+++ b/src/libs/audio/include/audio/PcmTypes.hpp
@@ -31,6 +31,8 @@ namespace lms::audio
Float64,
};
+ std::size_t getSampleSize(PcmSampleType type);
+
struct PcmParameters
{
unsigned channelCount;