]> granicus.if.org Git - taglib/commitdiff
Don't wrote the Vorbis framing bit to OggFLAC files
authorLukáš Lalinský <lalinsky@gmail.com>
Sat, 24 Oct 2009 12:01:40 +0000 (12:01 +0000)
committerLukáš Lalinský <lalinsky@gmail.com>
Sat, 24 Oct 2009 12:01:40 +0000 (12:01 +0000)
https://bugs.launchpad.net/maxosx/+bug/445970
http://www.hydrogenaudio.org/forums/index.php?showtopic=75263

CCMAIL:me@sbooth.org

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@1039704 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

taglib/ogg/flac/oggflacfile.cpp
tests/CMakeLists.txt
tests/Makefile.am
tests/data/empty_flac.oga [new file with mode: 0644]
tests/data/empty_vorbis.ogg [new file with mode: 0644]
tests/test_oggflac.cpp [new file with mode: 0644]

index 3070f3ab14501e6dbf174ff1767630c609576e15..85a593541807fd9d95ee9e4b9fade4a5de20d9c5 100644 (file)
@@ -93,7 +93,7 @@ Properties *Ogg::FLAC::File::audioProperties() const
 
 bool Ogg::FLAC::File::save()
 {
-  d->xiphCommentData = d->comment->render();
+  d->xiphCommentData = d->comment->render(false);
 
   // Create FLAC metadata-block:
 
index 2db605126a4cfcd0e6443b7124b913dbf4f9562f..403e6060eed4338372b588184727c91a0f1efcbb 100644 (file)
@@ -14,6 +14,8 @@ INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/trueaudio
   ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg
   ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/vorbis
+  ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/flac
+  ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/flac
 )
 
 SET(test_runner_SRCS
@@ -33,6 +35,7 @@ SET(test_runner_SRCS
   test_aiff.cpp
   test_riff.cpp
   test_ogg.cpp
+  test_oggflac.cpp
 )
 IF(WITH_MP4)
    SET(test_runner_SRCS ${test_runner_SRCS} test_mp4.cpp)
index f51e076521f2ddb9d947d809ce26d9c5f263a858..e51ac0dea05d32a2e0059fc557eed118845f187d 100644 (file)
@@ -7,6 +7,8 @@ INCLUDES = \
         -I$(top_srcdir)/taglib/mpeg/id3v2 \
         -I$(top_srcdir)/taglib/ogg \
         -I$(top_srcdir)/taglib/ogg/vorbis \
+        -I$(top_srcdir)/taglib/ogg/flac \
+        -I$(top_srcdir)/taglib/flac \
         -I$(top_srcdir)/taglib/riff \
         -I$(top_srcdir)/taglib/riff/aiff \
         -I$(top_srcdir)/taglib/mpeg/id3v2/frames
@@ -26,7 +28,8 @@ test_runner_SOURCES = \
        test_xiphcomment.cpp \
        test_riff.cpp \
        test_aiff.cpp \
-       test_ogg.cpp
+       test_ogg.cpp \
+       test_oggflac.cpp
 
 if build_tests
 TESTS = test_runner
diff --git a/tests/data/empty_flac.oga b/tests/data/empty_flac.oga
new file mode 100644 (file)
index 0000000..444587f
Binary files /dev/null and b/tests/data/empty_flac.oga differ
diff --git a/tests/data/empty_vorbis.ogg b/tests/data/empty_vorbis.ogg
new file mode 100644 (file)
index 0000000..aa53310
Binary files /dev/null and b/tests/data/empty_vorbis.ogg differ
diff --git a/tests/test_oggflac.cpp b/tests/test_oggflac.cpp
new file mode 100644 (file)
index 0000000..a29a27a
--- /dev/null
@@ -0,0 +1,44 @@
+#include <cppunit/extensions/HelperMacros.h>
+#include <string>
+#include <stdio.h>
+#include <tag.h>
+#include <tstringlist.h>
+#include <tbytevectorlist.h>
+#include <oggfile.h>
+#include <oggflacfile.h>
+#include "utils.h"
+
+using namespace std;
+using namespace TagLib;
+
+class TestOggFLAC : public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE(TestOggFLAC);
+  CPPUNIT_TEST(testFramingBit);
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+
+  void testFramingBit()
+  {
+    string newname = copyFile("empty_flac", ".oga");
+
+    Ogg::FLAC::File *f = new Ogg::FLAC::File(newname.c_str());
+    f->tag()->setArtist("The Artist");
+    f->save();
+    delete f;
+
+    f = new Ogg::FLAC::File(newname.c_str());
+    CPPUNIT_ASSERT_EQUAL(String("The Artist"), f->tag()->artist());
+
+    f->seek(0, File::End);
+    int size = f->tell();
+    CPPUNIT_ASSERT_EQUAL(9134, size);
+
+    delete f;
+    //deleteFile(newname);
+  }
+
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(TestOggFLAC);