mirror of
https://github.com/taglib/taglib.git
synced 2025-07-18 21:14:23 -04:00
DSD Stream File (DSF) support
This commit is contained in:
committed by
Urs Fleisch
parent
e275abb8a3
commit
39d1d68237
@ -24,6 +24,7 @@ INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/s3m
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/it
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/xm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../taglib/dsf
|
||||
)
|
||||
|
||||
SET(test_runner_SRCS
|
||||
@ -66,6 +67,7 @@ SET(test_runner_SRCS
|
||||
test_mpc.cpp
|
||||
test_opus.cpp
|
||||
test_speex.cpp
|
||||
test_dsf.cpp
|
||||
test_sizes.cpp
|
||||
)
|
||||
|
||||
|
BIN
tests/data/empty10ms.dsf
Normal file
BIN
tests/data/empty10ms.dsf
Normal file
Binary file not shown.
57
tests/test_dsf.cpp
Normal file
57
tests/test_dsf.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
#include <tbytevectorlist.h>
|
||||
#include <dsffile.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace TagLib;
|
||||
|
||||
class TestDSF : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(TestDSF);
|
||||
CPPUNIT_TEST(testBasic);
|
||||
CPPUNIT_TEST(testTags);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
|
||||
void testBasic()
|
||||
{
|
||||
DSF::File f(TEST_FILE_PATH_C("empty10ms.dsf"));
|
||||
CPPUNIT_ASSERT(f.audioProperties());
|
||||
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->length());
|
||||
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->lengthInSeconds());
|
||||
CPPUNIT_ASSERT_EQUAL(10, f.audioProperties()->lengthInMilliseconds());
|
||||
CPPUNIT_ASSERT_EQUAL(5645, f.audioProperties()->bitrate());
|
||||
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channels());
|
||||
CPPUNIT_ASSERT_EQUAL(2822400, f.audioProperties()->sampleRate());
|
||||
CPPUNIT_ASSERT_EQUAL(1, f.audioProperties()->formatVersion());
|
||||
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->formatID());
|
||||
CPPUNIT_ASSERT_EQUAL(2, f.audioProperties()->channelType());
|
||||
CPPUNIT_ASSERT_EQUAL(1, f.audioProperties()->bitsPerSample());
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<long long>(28224), f.audioProperties()->sampleCount());
|
||||
CPPUNIT_ASSERT_EQUAL(4096, f.audioProperties()->blockSizePerChannel());
|
||||
}
|
||||
|
||||
void testTags()
|
||||
{
|
||||
ScopedFileCopy copy("empty10ms", ".dsf");
|
||||
string newname = copy.fileName();
|
||||
|
||||
DSF::File *f = new DSF::File(newname.c_str());
|
||||
CPPUNIT_ASSERT_EQUAL(String(""), f->tag()->artist());
|
||||
f->tag()->setArtist("The Artist");
|
||||
f->save();
|
||||
delete f;
|
||||
|
||||
f = new DSF::File(newname.c_str());
|
||||
CPPUNIT_ASSERT_EQUAL(String("The Artist"), f->tag()->artist());
|
||||
delete f;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestDSF);
|
@ -45,6 +45,7 @@
|
||||
#include "wavpackfile.h"
|
||||
#include "opusfile.h"
|
||||
#include "xmfile.h"
|
||||
#include "dsffile.h"
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "utils.h"
|
||||
|
||||
@ -99,6 +100,7 @@ class TestFileRef : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testAIFF_2);
|
||||
CPPUNIT_TEST(testWavPack);
|
||||
CPPUNIT_TEST(testOpus);
|
||||
CPPUNIT_TEST(testDSF);
|
||||
CPPUNIT_TEST(testUnsupported);
|
||||
CPPUNIT_TEST(testCreate);
|
||||
CPPUNIT_TEST(testAudioProperties);
|
||||
@ -331,6 +333,11 @@ public:
|
||||
fileRefSave<Ogg::Opus::File>("correctness_gain_silent_output", ".opus");
|
||||
}
|
||||
|
||||
void testDSF()
|
||||
{
|
||||
fileRefSave<DSF::File>("empty10ms",".dsf");
|
||||
}
|
||||
|
||||
void testUnsupported()
|
||||
{
|
||||
FileRef f1(TEST_FILE_PATH_C("no-extension"));
|
||||
@ -386,6 +393,7 @@ public:
|
||||
CPPUNIT_ASSERT(extensions.contains("wv"));
|
||||
CPPUNIT_ASSERT(extensions.contains("opus"));
|
||||
CPPUNIT_ASSERT(extensions.contains("xm"));
|
||||
CPPUNIT_ASSERT(extensions.contains("dsf"));
|
||||
}
|
||||
|
||||
void testFileResolver()
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "audioproperties.h"
|
||||
#include "chapterframe.h"
|
||||
#include "commentsframe.h"
|
||||
#include "dsffile.h"
|
||||
#include "dsfproperties.h"
|
||||
#include "eventtimingcodesframe.h"
|
||||
#include "fileref.h"
|
||||
#include "flacfile.h"
|
||||
@ -159,6 +161,8 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::ByteVectorStream));
|
||||
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::DebugListener));
|
||||
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::File));
|
||||
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSF::File));
|
||||
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::DSF::Properties));
|
||||
CPPUNIT_ASSERT_EQUAL(classSize(0, true), sizeof(TagLib::FLAC::MetadataBlock));
|
||||
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::Picture));
|
||||
CPPUNIT_ASSERT_EQUAL(classSize(1, true), sizeof(TagLib::FLAC::Properties));
|
||||
|
Reference in New Issue
Block a user