pcm/PcmExport: add flag to export to DSD_U32

This commit is contained in:
Max Kellermann
2016-02-26 18:17:11 +01:00
parent d1be643c0d
commit fb4f02cd38
4 changed files with 49 additions and 0 deletions

View File

@@ -125,6 +125,7 @@ class PcmExportTest : public CppUnit::TestFixture {
CPPUNIT_TEST(TestShift8);
CPPUNIT_TEST(TestPack24);
CPPUNIT_TEST(TestReverseEndian);
CPPUNIT_TEST(TestDsdU32);
CPPUNIT_TEST(TestDop);
CPPUNIT_TEST(TestAlsaChannelOrder);
CPPUNIT_TEST_SUITE_END();
@@ -133,6 +134,7 @@ public:
void TestShift8();
void TestPack24();
void TestReverseEndian();
void TestDsdU32();
void TestDop();
void TestAlsaChannelOrder();
};

View File

@@ -115,6 +115,30 @@ PcmExportTest::TestReverseEndian()
CPPUNIT_ASSERT(memcmp(dest.data, expected4, dest.size) == 0);
}
void
PcmExportTest::TestDsdU32()
{
static constexpr uint8_t src[] = {
0x01, 0x23, 0x45, 0x67,
0x89, 0xab, 0xcd, 0xef,
};
static constexpr uint32_t expected[] = {
0xcd894501,
0xefab6723,
};
PcmExport::Params params;
params.dsd_u32 = true;
PcmExport e;
e.Open(SampleFormat::DSD, 2, params);
auto dest = e.Export({src, sizeof(src)});
CPPUNIT_ASSERT_EQUAL(sizeof(expected), dest.size);
CPPUNIT_ASSERT(memcmp(dest.data, expected, dest.size) == 0);
}
void
PcmExportTest::TestDop()
{