aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcm/PcmFormat.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-01 19:24:37 +0100
committerMax Kellermann <max@duempel.org>2013-12-01 19:24:37 +0100
commite1436063ffb236ac22d69531782f7056b8b5ae30 (patch)
tree3424c26adddfd8783587416b3cabd8ff3091922f /src/pcm/PcmFormat.cxx
parent3e11a28cd9c204076407f02a600fcc617c7e0f3e (diff)
downloadmpd-e1436063ffb236ac22d69531782f7056b8b5ae30.tar.gz
mpd-e1436063ffb236ac22d69531782f7056b8b5ae30.tar.xz
mpd-e1436063ffb236ac22d69531782f7056b8b5ae30.zip
pcm/PcmFormat: move generic definitions to Traits.hxx
Diffstat (limited to 'src/pcm/PcmFormat.cxx')
-rw-r--r--src/pcm/PcmFormat.cxx46
1 files changed, 1 insertions, 45 deletions
diff --git a/src/pcm/PcmFormat.cxx b/src/pcm/PcmFormat.cxx
index b7a496264..348437a12 100644
--- a/src/pcm/PcmFormat.cxx
+++ b/src/pcm/PcmFormat.cxx
@@ -22,51 +22,7 @@
#include "PcmDither.hxx"
#include "PcmBuffer.hxx"
#include "PcmUtils.hxx"
-
-#include <type_traits>
-
-template<SampleFormat F>
-struct SampleTraits {};
-
-template<>
-struct SampleTraits<SampleFormat::S8> {
- typedef int8_t value_type;
- typedef value_type *pointer_type;
- typedef const value_type *const_pointer_type;
-
- static constexpr size_t SAMPLE_SIZE = sizeof(value_type);
- static constexpr unsigned BITS = sizeof(value_type) * 8;
-};
-
-template<>
-struct SampleTraits<SampleFormat::S16> {
- typedef int16_t value_type;
- typedef value_type *pointer_type;
- typedef const value_type *const_pointer_type;
-
- static constexpr size_t SAMPLE_SIZE = sizeof(value_type);
- static constexpr unsigned BITS = sizeof(value_type) * 8;
-};
-
-template<>
-struct SampleTraits<SampleFormat::S32> {
- typedef int32_t value_type;
- typedef value_type *pointer_type;
- typedef const value_type *const_pointer_type;
-
- static constexpr size_t SAMPLE_SIZE = sizeof(value_type);
- static constexpr unsigned BITS = sizeof(value_type) * 8;
-};
-
-template<>
-struct SampleTraits<SampleFormat::S24_P32> {
- typedef int32_t value_type;
- typedef value_type *pointer_type;
- typedef const value_type *const_pointer_type;
-
- static constexpr size_t SAMPLE_SIZE = sizeof(value_type);
- static constexpr unsigned BITS = 24;
-};
+#include "Traits.hxx"
static void
pcm_convert_8_to_16(int16_t *out, const int8_t *in, const int8_t *in_end)